13#ifndef CLANG_LIB_CIR_CODEGEN_CIRGENFUNCTION_H
14#define CLANG_LIB_CIR_CODEGEN_CIRGENFUNCTION_H
42#include "llvm/ADT/ScopedHashTable.h"
43#include "llvm/IR/Instructions.h"
44#include "llvm/IR/Intrinsics.h"
53class OutlinedFunctionDecl;
54class SYCLKernelCallStmt;
81 struct ConstrainedFPRAII {
83 bool savedIsFPConstrained;
85 llvm::RoundingMode savedRounding;
86 cir::FastMathFlags savedFastMathFlags;
89 : builder(builder), savedIsFPConstrained(builder.getIsFPConstrained()),
90 savedExcept(builder.getDefaultConstrainedExcept()),
91 savedRounding(builder.getDefaultConstrainedRounding()),
92 savedFastMathFlags(builder.getFastMathFlags()) {}
93 ~ConstrainedFPRAII() {
94 builder.setIsFPConstrained(savedIsFPConstrained);
95 builder.setDefaultConstrainedExcept(savedExcept);
96 builder.setDefaultConstrainedRounding(savedRounding);
97 builder.setFastMathFlags(savedFastMathFlags);
99 } constrainedFPState{builder};
115 std::unique_ptr<CGCoroData>
data;
245 assert(!
deactivated &&
"Deactivating already deactivated scope");
246 auto &stack =
cgf.deferredDeactivationCleanupStack;
248 cgf.deactivateCleanupBlock(stack[i - 1].cleanup,
249 stack[i - 1].dominatingIP);
250 stack[i - 1].dominatingIP->erase();
266 llvm::SmallDenseMap<const ParmVarDecl *, const ImplicitParamDecl *>
273 llvm::DenseMap<const clang::ValueDecl *, clang::FieldDecl *>
317 using DeclMapTy = llvm::DenseMap<const clang::Decl *, Address>;
334 auto fn = mlir::cast<cir::FuncOp>(
curFn);
335 return &fn.getRegion().front();
352 llvm::RoundingMode oldRounding;
353 std::optional<cir::FastMathFlags> oldFastMathFlags;
370 using SymTableTy = llvm::ScopedHashTable<const clang::Decl *, mlir::Value>;
394 auto constOp = val.getDefiningOp<cir::ConstantOp>();
395 assert(constOp &&
"getSExtIntValueFromConstOp call with non ConstantOp");
396 return constOp.getIntValue().getSExtValue();
402 auto constOp = val.getDefiningOp<cir::ConstantOp>();
403 assert(constOp &&
"getZExtIntValueFromConstOp call with non ConstantOp");
404 return constOp.getIntValue().getZExtValue();
419 bool suppressNewContext =
false);
428 return cgm.getTargetCIRGenInfo();
454 class OpaqueValueMappingData {
459 : opaqueValue(ov), boundLValue(boundLValue) {}
470 return expr->isGLValue() ||
expr->getType()->isFunctionType() ||
493 OpaqueValueMappingData data(ov,
false);
502 bool isValid()
const {
return opaqueValue !=
nullptr; }
503 void clear() { opaqueValue =
nullptr; }
506 assert(opaqueValue &&
"no data to unbind!");
535 if (mlir::isa<ConditionalOperator>(op))
540 mlir::cast<BinaryConditionalOperator>(op);
550 assert(ov->
getSourceExpr() &&
"wrong form of OpaqueValueMapping used "
551 "for OVE with no source expression");
582 bool isParam =
false);
592 class VarDeclContext {
599 oldVal = p.currVarDecl;
600 p.currVarDecl = value;
605 void restore() { p.currVarDecl = oldVal; }
606 ~VarDeclContext() { restore(); }
616 std::optional<SourceRange> oldLoc;
621 oldLoc = cgf.currSrcLoc;
622 cgf.currSrcLoc = value;
632 llvm::ScopedHashTableScope<const clang::Decl *, mlir::Value>;
643 mlir::Location
getLoc(mlir::Location lhs, mlir::Location rhs);
648 if (
cgm.getCodeGenOpts().getFiniteLoops() ==
678 controllingExpression, hasEmptyBody, [
this] {
679 curFn->removeAttr(cir::CIRDialect::getMustProgressAttrName());
689 return builder.getInsertionBlock() !=
nullptr;
697 mlir::Block *block = builder.getInsertionBlock();
698 return block && (block->isEntryBlock() || !block->hasNoPredecessors());
719 bool isVolatile =
false,
732 return llvm::isa_and_nonnull<clang::FunctionDecl>(calleeDecl);
738 if (
const auto *fd = llvm::dyn_cast<clang::FunctionDecl>(calleeDecl))
739 return fd->getNumParams();
740 return llvm::cast<clang::ObjCMethodDecl>(calleeDecl)->param_size();
744 if (
const auto *fd = llvm::dyn_cast<clang::FunctionDecl>(calleeDecl))
745 return fd->getParamDecl(I);
746 return *(llvm::cast<clang::ObjCMethodDecl>(calleeDecl)->param_begin() +
795 bool allowLabels =
false);
797 llvm::APSInt &resultInt,
798 bool allowLabels =
false);
807 class ConstantEmission {
809 llvm::PointerIntPair<mlir::Attribute, 1, bool> valueAndIsReference;
818 static ConstantEmission
forValue(mlir::TypedAttr c) {
822 explicit operator bool()
const {
823 return valueAndIsReference.getOpaqueValue() !=
nullptr;
831 mlir::cast<mlir::TypedAttr>(valueAndIsReference.getPointer()));
837 return mlir::cast<mlir::TypedAttr>(valueAndIsReference.getPointer());
909 cir::GetGlobalOp gvAddr);
933 cgm.getCodeGenOpts().ObjCAutoRefCountExceptions;
935 llvm_unreachable(
"bad destruction kind");
946 assert(!
localDeclMap.count(vd) &&
"Decl already exists in LocalDeclMap!");
968 bool shouldDelete =
false;
974 auto mapItr = cgf.localDeclMap.find(vd);
976 if (mapItr != cgf.localDeclMap.end())
977 oldAddr = mapItr->second;
984 cgf.localDeclMap.erase(vd);
986 cgf.localDeclMap.insert_or_assign(vd, oldAddr);
1013 bool baseIsNonVirtualPrimaryBase,
1038 cgf.cxxDefaultInitExprThis = thisAddr;
1041 cgf.cxxDefaultInitExprThis = oldCXXDefaultInitExprThis;
1046 Address oldCXXDefaultInitExprThis;
1057 cgf.cxxThisValue =
cgf.cxxDefaultInitExprThis.getPointer();
1058 cgf.cxxThisAlignment =
cgf.cxxDefaultInitExprThis.getAlignment();
1085 oldArrayInitIndex(setIdx
1089 cgf.arrayInitIndex =
index;
1092 if (oldArrayInitIndex.has_value())
1093 cgf.arrayInitIndex = *oldArrayInitIndex;
1098 std::optional<mlir::Value> oldArrayInitIndex;
1113 bool forPointeeType =
false,
1116 alignment =
cgm.getNaturalTypeAlignment(t, baseInfo);
1122 llvm::iterator_range<CastExpr::path_const_iterator> path,
1127 llvm::iterator_range<CastExpr::path_const_iterator> path,
1128 bool nullCheckValue);
1156 "Invalid argument to getAddrOfLocalVar(), no decl!");
1161 mlir::Type fieldType,
unsigned index);
1175 assert(
cxxThisValue &&
"no 'this' value for this function");
1193 bool baseIsVirtual);
1216 cir::FuncType funcType);
1231 cir::FuncOp fn, cir::FuncType funcType,
1247 return rd->hasVolatileMember();
1267 mlir::isa<cir::CatchAllAttr>(
ehSpecTryOp.getHandlerTypes()[0]);
1280 size_t oldLifetimeExtendedSize,
1289 mlir::Location loc);
1297 mlir::Location loc);
1309 mlir::Operation *dominatingIP);
1329 template <
class T,
class... As>
1345 template <
class T,
class... As>
1347 mlir::Location loc = builder.getUnknownLoc();
1348 mlir::Operation *dominatingIP = builder.getBool(
false, loc).getOperation();
1351 {
ehStack.stable_begin(), dominatingIP});
1358 bool useEHCleanupForArray);
1370 class RunCleanupsScope {
1372 size_t lifetimeExtendedCleanupStackSize;
1374 bool deferLifetimeExtended =
false;
1376 size_t oldLifetimeExtendedSize()
const {
1377 return deferLifetimeExtended ?
cgf.lifetimeExtendedCleanupStack.size()
1378 : lifetimeExtendedCleanupStackSize;
1386 RunCleanupsScope(
const RunCleanupsScope &) =
delete;
1387 void operator=(
const RunCleanupsScope &) =
delete;
1396 cleanupStackDepth =
cgf.ehStack.stable_begin();
1397 lifetimeExtendedCleanupStackSize =
1398 cgf.lifetimeExtendedCleanupStack.size();
1400 cgf.didCallStackSave =
false;
1401 oldCleanupStackDepth =
cgf.currentCleanupStackDepth;
1402 cgf.currentCleanupStackDepth = cleanupStackDepth;
1429 const bool hasPendingDeactivations =
1434 bool didSpillAny =
false;
1435 if (hasPendingDeactivations) {
1436 tempAllocas.reserve(valuesToReload.size());
1437 for (mlir::Value *valPtr : valuesToReload) {
1438 mlir::Value val = *valPtr;
1439 if (!val || !val.getDefiningOp() ||
1440 !val.getDefiningOp()->getParentOfType<cir::CleanupScopeOp>()) {
1445 val.getType(), val.getLoc(),
"tmp.exprcleanup");
1446 tempAllocas.push_back(temp);
1465 for (
auto [addr, valPtr] : llvm::zip(tempAllocas, valuesToReload)) {
1466 if (!addr.isValid())
1471 cgf.popCleanupBlocks(cleanupStackDepth, oldLifetimeExtendedSize(),
1476 cgf.currentCleanupStackDepth = oldCleanupStackDepth;
1486 deactivateCleanups.forceDeactivate();
1487 cgf.popCleanupBlocks(cleanupStackDepth);
1495 assert(deactivateCleanups.deactivated &&
1496 "forceCleanupExceptLifetimeExtended() must be called first");
1497 cgf.popCleanupBlocks(cleanupStackDepth, oldLifetimeExtendedSize());
1499 cgf.currentCleanupStackDepth = oldCleanupStackDepth;
1505 return cgf.ehStack.stable_begin() != cleanupStackDepth;
1525 cir::CleanupScopeOp scope;
1526 cir::CleanupScopeOp oldFullExprCleanupScope;
1529 size_t deferredCleanupStackSize;
1530 size_t conditionalScopeDepth;
1531 bool exited =
false;
1541 cleanups.deferLifetimeExtendedCleanups();
1573 : cgf(cgf), depth(cgf.
ehStack.stable_begin()), active(active) {}
1584 : ehStack(scope.cgf.ehStack) {
1587 assert(!ehStack.isCapturingCleanups() &&
1588 "cleanup capturing should not nest");
1590 ehStack.setCapturingCleanups(
true);
1602 cgf.emitCapturedCleanups(depth, loc);
1610 cgf.emitCapturedCleanupsAsScopes(depth, loc);
1627 mlir::Block *entryBlock;
1632 cir::TryOp tryOp =
nullptr;
1638 bool hasCoreturnSinceLastLabel =
false;
1649 Kind scopeKind = Kind::Regular;
1652 mlir::Value retVal =
nullptr;
1654 mlir::Location beginLoc;
1655 mlir::Location endLoc;
1662 beginLoc(loc), endLoc(loc) {
1664 assert(entryBlock &&
"LexicalScope requires an entry block");
1665 cgf.curLexScope =
this;
1669 if (
const auto fusedLoc = mlir::dyn_cast<mlir::FusedLoc>(loc)) {
1670 assert(fusedLoc.getLocations().size() == 2 &&
"too many locations");
1671 beginLoc = fusedLoc.getLocations()[0];
1672 endLoc = fusedLoc.getLocations()[1];
1698 s->hasCoreturnSinceLastLabel =
false;
1708 bool isTry() {
return scopeKind == Kind::Try; }
1714 scopeKind = Kind::Try;
1734 llvm::DenseMap<mlir::Block *, mlir::Location> retLocs;
1735 llvm::DenseMap<cir::CaseOp, unsigned> retBlockInCaseIndex;
1736 std::optional<unsigned> normalRetBlockIndex;
1742 assert((isa_and_nonnull<cir::CaseOp>(
1743 cgf.builder.getBlock()->getParentOp()) ||
1744 retBlocks.size() == 0) &&
1745 "only switches can hold more than one ret block");
1748 mlir::OpBuilder::InsertionGuard guard(
cgf.builder);
1749 auto *b =
cgf.builder.createBlock(
cgf.builder.getBlock()->getParent());
1750 retBlocks.push_back(b);
1755 cir::ReturnOp emitReturn(mlir::Location loc);
1756 void emitImplicitReturn();
1760 mlir::Location
getRetLoc(mlir::Block *b) {
return retLocs.at(b); }
1762 retLocs.insert_or_assign(b, loc);
1767 if (
auto caseOp = mlir::dyn_cast_if_present<cir::CaseOp>(
1768 cgf.builder.getBlock()->getParentOp())) {
1769 auto iter = retBlockInCaseIndex.find(caseOp);
1770 if (iter != retBlockInCaseIndex.end()) {
1772 mlir::Block *ret = retBlocks[iter->second];
1777 mlir::Block *ret = createRetBlock(
cgf, loc);
1778 retBlockInCaseIndex[caseOp] = retBlocks.size() - 1;
1782 if (normalRetBlockIndex) {
1783 mlir::Block *ret = retBlocks[*normalRetBlockIndex];
1788 mlir::Block *ret = createRetBlock(
cgf, loc);
1789 normalRetBlockIndex = retBlocks.size() - 1;
1811 bool useEHCleanupForArray,
1832 const ThunkInfo &thunk,
bool isUnprototyped);
1842 mlir::Location loc);
1843 std::optional<mlir::Value>
1846 llvm::Triple::ArchType arch);
1857 mlir::Value offsetValue =
nullptr);
1862 mlir::Value offsetValue =
nullptr);
1875 llvm::StringRef fieldName,
1876 unsigned fieldIndex);
1880 bool insertIntoFnEntryBlock,
1881 mlir::Value arraySize =
nullptr);
1884 mlir::OpBuilder::InsertPoint ip,
1885 mlir::Value arraySize =
nullptr);
1904 bool isVolatile =
false);
1912 bool ignoreResult =
false);
1917 bool isInitializer);
1941 std::pair<mlir::Value, mlir::Type>
1943 QualType inputType, std::string &constraintString,
1945 std::pair<mlir::Value, mlir::Type>
1947 std::string &constraintString);
1954 bool isVolatile,
bool isInit);
1959 std::optional<Expr::EvalResult>
eval;
1966 eval.emplace(std::move(evalResult));
1971 const EmittedOrderOrScope &order,
bool isStore,
bool isLoad,
bool isFence,
1975 llvm::function_ref<
void(cir::SyncScopeKind)>
emitAtomicOp);
1979 mlir::Type *originalArgType =
nullptr,
1980 mlir::Value *emittedArgValue =
nullptr,
1981 cir::MemOrder ordering = cir::MemOrder::SequentiallyConsistent);
1987 cir::MemOrder successOrder = cir::MemOrder::SequentiallyConsistent,
1988 cir::MemOrder failureOrder = cir::MemOrder::SequentiallyConsistent,
1989 cir::SyncScopeKind scope = cir::SyncScopeKind::System);
1994 mlir::OpBuilder::InsertPoint ip = {});
2013 CapturedCleanups &condCleanup,
2032 bool guardDestruction =
false,
2047 CXXCtorInitializer *baseInit);
2069 cir::IntType resType, mlir::Value emittedE,
2074 cir::IntType resType,
2075 mlir::Value emittedE,
2092 template <
unsigned N>
2093 [[maybe_unused]] RValue
2095 llvm::StringRef intrinName,
2096 mlir::Type resultType = {}) {
2097 static_assert(N,
"expect non-empty argument");
2101 for (
unsigned i = 0; i < N; ++i)
2103 const auto call = cir::LLVMIntrinsicCallOp::create(
2109 RValue
emitCall(
const CIRGenFunctionInfo &funcInfo,
2110 const CIRGenCallee &callee, ReturnValueSlot
returnValue,
2111 const CallArgList &args, cir::CIRCallOpInterface *callOp,
2116 cir::CIRCallOpInterface *callOrTryCall =
nullptr) {
2117 assert(
currSrcLoc &&
"source location must have been set");
2127 const ThunkInfo *thunk,
bool isUnprototyped);
2133 llvm::iterator_range<clang::CallExpr::const_arg_iterator> argRange,
2134 AbstractCallee callee = AbstractCallee(),
unsigned paramsToSkip = 0,
2144 template <
typename T>
2146 mlir::ArrayAttr value,
2147 cir::CaseOpKind
kind,
2148 bool buildingTopLevelCase);
2153 mlir::Type condType,
2154 bool buildingTopLevelCase);
2203 bool newPointerIsChecked,
2204 bool zeroInitialize =
false);
2206 mlir::Value numElements,
Address arrayBase,
2208 bool newPointerIsChecked,
bool zeroInitialize,
2217 bool delegating,
Address thisAddr,
2221 bool forVirtualBase,
Address thisAddr,
2222 bool inheritedFromVBase,
2227 bool forVirtualBase,
bool delegating,
CallArgList &args);
2232 bool forVirtualBase,
bool delegating,
2236 mlir::Value thisVal,
QualType thisTy,
2237 mlir::Value implicitParam,
2247 const Expr *e,
Address base, mlir::Value memberPtr,
2268 mlir::Type elementTy,
Address beginPtr,
2269 mlir::Value numElements,
2270 mlir::Value allocSizeWithoutCookie);
2304 bool isFnTryBlock =
false);
2337 LValue lvalue,
bool capturedByInit =
false);
2362 mlir::NamedAttrList attrs = {});
2368 bool ignoreResultAssign =
false);
2381 bool useCurrentScope);
2383 mlir::LogicalResult
emitForStmt(
const clang::ForStmt &s,
2384 llvm::ArrayRef<const Attr *> attrs = {});
2387 CallArgList &callArgs);
2391 bool ignoreResult =
false);
2396 bool ignoreResult =
false);
2409 mlir::Value &result);
2417 Address *lastValue =
nullptr,
2420 void emitDecl(
const clang::Decl &d,
bool evaluateConditionDecl =
false);
2421 mlir::LogicalResult
emitDeclStmt(
const clang::DeclStmt &s);
2425 mlir::Type condType,
2426 bool buildingTopLevelCase);
2430 const FunctionArgList &args,
2431 clang::SourceLocation loc);
2437 clang::SourceLocation loc);
2446 const clang::Stmt *thenS,
2447 const clang::Stmt *elseS);
2450 mlir::Location thenLoc,
2452 std::optional<mlir::Location> elseLoc = {});
2457 mlir::Location thenLoc,
2459 std::optional<mlir::Location> elseLoc = {});
2465 mlir::LogicalResult
emitLabel(
const clang::LabelDecl &d);
2466 mlir::LogicalResult
emitLabelStmt(
const clang::LabelStmt &s);
2471 mlir::LogicalResult
emitIfStmt(
const clang::IfStmt &s);
2490 LValueBaseInfo *pointeeBaseInfo);
2500 SourceLocation loc, LValueBaseInfo baseInfo,
2501 bool isNontemporal =
false);
2518 mlir::Value thisValue);
2530 llvm::StringRef fieldName);
2539 cir::FuncOp callee);
2589 bool capturedByInit =
false);
2592 const Expr *argExpr);
2605 bool isInit =
false,
bool isNontemporal =
false);
2618 llvm::StringRef name =
".str");
2622 bool buildingTopLevelCase);
2628 cir::FuncOp funcOp, cir::FuncType funcType,
2634 std::optional<mlir::Value>
2663 void emitTrap(mlir::Location loc,
bool createNewBlock);
2698 mlir::Value
emitX86CpuIs(mlir::Location loc, StringRef cpuStr);
2703 std::array<uint32_t, 4> FeatureMask);
2724 mlir::Block *anchorBlock;
2725 mlir::Operation *anchorAfter =
nullptr;
2736 if (cgf.currentFullExprCleanupScope && !cgf.isInConditionalBranch()) {
2737 cir::CleanupKind cleanupKind = cgf.getLangOpts().Exceptions
2738 ? cir::CleanupKind::All
2739 : cir::CleanupKind::Normal;
2740 cir::CleanupScopeOp scope = cir::CleanupScopeOp::create(
2741 cgf.builder, loc, cleanupKind,
2742 [](mlir::OpBuilder &, mlir::Location) {},
2743 [](mlir::OpBuilder &, mlir::Location) {});
2744 cgf.conditionalCleanupScopes.push_back(
2745 {scope, cgf.deferredConditionalCleanupStack.size()});
2746 cgf.builder.setInsertionPointToEnd(&scope.getBodyRegion().front());
2749 anchorBlock = cgf.builder.getInsertionBlock();
2750 assert(anchorBlock &&
"conditional evaluation needs an insertion point");
2751 mlir::Block::iterator ip = cgf.builder.getInsertionPoint();
2752 if (ip != anchorBlock->begin())
2753 anchorAfter = &*std::prev(ip);
2757 assert(cgf.outermostConditional !=
this);
2758 if (!cgf.outermostConditional)
2759 cgf.outermostConditional =
this;
2763 assert(cgf.outermostConditional !=
nullptr);
2764 if (cgf.outermostConditional ==
this)
2765 cgf.outermostConditional =
nullptr;
2778 return mlir::OpBuilder::InsertPoint(anchorBlock, anchorBlock->begin());
2779 return mlir::OpBuilder::InsertPoint(
2780 anchorAfter->getBlock(), std::next(anchorAfter->getIterator()));
2785 std::optional<LValue>
lhs{}, rhs{};
2796 mlir::OpBuilder::InsertionGuard guard(builder);
2798 cir::StoreOp store = builder.createStore(
2799 value.getLoc(), value, addr,
false,
2801 mlir::IntegerAttr::get(
2802 mlir::IntegerType::get(value.getContext(), 64),
2834 cgf.outermostConditional =
nullptr;
2835 cgf.hiddenOutermostConditional =
nullptr;
2839 cgf.outermostConditional = savedOutermostConditional;
2840 cgf.hiddenOutermostConditional = savedHiddenOutermostConditional;
2844 template <
typename FuncTy>
2846 const FuncTy &branchGenFunc);
2856 void emitVAStart(mlir::Value vaList);
2862 void emitVAEnd(mlir::Value vaList);
2879 cir::AllocaOp createTempAlloca(mlir::Type ty, mlir::Location loc,
2880 const Twine &name =
"tmp",
2881 mlir::Value arraySize =
nullptr,
2882 bool insertIntoFnEntryBlock =
false);
2883 cir::AllocaOp createTempAlloca(mlir::Type ty, mlir::Location loc,
2884 const Twine &name =
"tmp",
2885 mlir::OpBuilder::InsertPoint ip = {},
2886 mlir::Value arraySize =
nullptr);
2887 Address createTempAlloca(mlir::Type ty,
CharUnits align, mlir::Location loc,
2888 const Twine &name =
"tmp",
2889 mlir::Value arraySize =
nullptr,
2890 Address *alloca =
nullptr,
2891 mlir::OpBuilder::InsertPoint ip = {});
2892 Address createTempAlloca(mlir::Type ty,
2893 mlir::ptr::MemorySpaceAttrInterface destAddrSpace,
2894 CharUnits align, mlir::Location loc,
2895 const Twine &name =
"tmp",
2896 mlir::Value arraySize =
nullptr,
2897 Address *alloca =
nullptr,
2898 mlir::OpBuilder::InsertPoint ip = {});
2899 Address createTempAllocaWithoutCast(mlir::Type ty, CharUnits align,
2901 const Twine &name =
"tmp",
2902 mlir::Value arraySize =
nullptr,
2903 mlir::OpBuilder::InsertPoint ip = {});
2905 maybeCastStackAddressSpace(
Address alloca,
2906 mlir::ptr::MemorySpaceAttrInterface destAddrSpace,
2907 mlir::Value arraySize =
nullptr);
2908 Address createDefaultAlignTempAlloca(mlir::Type ty, mlir::Location loc,
2914 Address createMemTemp(QualType t, mlir::Location loc,
2915 const Twine &name =
"tmp",
Address *alloca =
nullptr,
2916 mlir::OpBuilder::InsertPoint ip = {});
2917 Address createMemTemp(QualType t, CharUnits align, mlir::Location loc,
2918 const Twine &name =
"tmp",
Address *alloca =
nullptr,
2919 mlir::OpBuilder::InsertPoint ip = {});
2920 Address createMemTempWithoutCast(QualType t, mlir::Location loc,
2921 const Twine &name =
"tmp");
2924 if (cir::GlobalOp globalOp = v.getDefiningOp<cir::GlobalOp>())
2925 cgm.errorNYI(
"Global op addrspace cast");
2926 return builder.createAddrSpaceCast(v, destTy);
2938 void emitOMPNoLifetimeVarDecl(
const VarDecl &d);
2942 mlir::LogicalResult emitOMPParallelDirective(
const OMPParallelDirective &s);
2947 mlir::LogicalResult emitOMPCanonicalLoop(
const OMPCanonicalLoop &s);
3007 mlir::LogicalResult emitOMPParallelMaskedTaskLoopDirective(
3009 mlir::LogicalResult emitOMPParallelMaskedTaskLoopSimdDirective(
3011 mlir::LogicalResult emitOMPParallelMasterTaskLoopDirective(
3013 mlir::LogicalResult emitOMPParallelMasterTaskLoopSimdDirective(
3017 mlir::LogicalResult emitOMPDistributeParallelForDirective(
3019 mlir::LogicalResult emitOMPDistributeParallelForSimdDirective(
3023 mlir::LogicalResult emitOMPTargetParallelGenericLoopDirective(
3027 mlir::LogicalResult emitOMPTargetParallelForSimdDirective(
3031 mlir::LogicalResult emitOMPTargetTeamsGenericLoopDirective(
3039 mlir::LogicalResult emitOMPTeamsDistributeParallelForSimdDirective(
3041 mlir::LogicalResult emitOMPTeamsDistributeParallelForDirective(
3047 mlir::LogicalResult emitOMPTargetTeamsDistributeDirective(
3049 mlir::LogicalResult emitOMPTargetTeamsDistributeParallelForDirective(
3051 mlir::LogicalResult emitOMPTargetTeamsDistributeParallelForSimdDirective(
3053 mlir::LogicalResult emitOMPTargetTeamsDistributeSimdDirective(
3080 template <
typename Op>
3085 template <
typename Op,
typename TermOp>
3087 emitOpenACCOpAssociatedStmt(mlir::Location start, mlir::Location end,
3090 const Stmt *associatedStmt);
3092 template <
typename Op,
typename TermOp>
3093 mlir::LogicalResult emitOpenACCOpCombinedConstruct(
3097 template <
typename Op>
3106 template <
typename ComputeOp,
typename LoopOp>
3107 void emitOpenACCClauses(ComputeOp &op, LoopOp &loopOp,
3114 void updateLoopOpParallelism(mlir::acc::LoopOp &op,
bool isOrphan,
3119 mlir::acc::LoopOp *activeLoopOp =
nullptr;
3121 struct ActiveOpenACCLoopRAII {
3123 mlir::acc::LoopOp *oldLoopOp;
3125 ActiveOpenACCLoopRAII(
CIRGenFunction &cgf, mlir::acc::LoopOp *newOp)
3126 : cgf(cgf), oldLoopOp(cgf.activeLoopOp) {
3127 cgf.activeLoopOp = newOp;
3129 ~ActiveOpenACCLoopRAII() { cgf.activeLoopOp = oldLoopOp; }
3134 mlir::OpBuilder::InsertPoint lastRecipeLocation;
3193 const Twine &name =
"tmp",
3205 bool shouldEmitLifetimeMarkers =
false;
3208 bool fnHasBypassStmt =
false;
3210 bool shouldEmitLifetimeMarkersForAutoVar()
const {
3211 return shouldEmitLifetimeMarkers && !fnHasBypassStmt;
3214 class InlinedInheritingConstructorScope {
3216 InlinedInheritingConstructorScope(CIRGenFunction &cgf,
GlobalDecl gd)
3217 : cgf(cgf), oldCurGD(cgf.curGD), oldCurFuncDecl(cgf.curFuncDecl),
3218 oldCurCodeDecl(cgf.curCodeDecl),
3219 oldCxxabiThisDecl(cgf.cxxabiThisDecl),
3220 oldCxxThisValue(cgf.cxxThisValue),
3221 oldCxxabiThisAlignment(cgf.cxxabiThisAlignment),
3222 oldCxxThisAlignment(cgf.cxxThisAlignment),
3223 oldReturnValue(cgf.returnValue), oldFnRetTy(cgf.fnRetTy),
3224 oldCxxInheritedCtorInitExprArgs(
3225 std::move(cgf.cxxInheritedCtorInitExprArgs)) {
3228 cgf.curCodeDecl = cgf.curFuncDecl;
3229 cgf.cxxabiThisDecl =
nullptr;
3230 cgf.cxxabiThisValue =
nullptr;
3231 cgf.cxxThisValue =
nullptr;
3234 cgf.returnValue = Address::invalid();
3236 cgf.cxxInheritedCtorInitExprArgs.clear();
3240 ~InlinedInheritingConstructorScope() {
3241 cgf.curGD = oldCurGD;
3242 cgf.curFuncDecl = oldCurFuncDecl;
3243 cgf.curCodeDecl = oldCurCodeDecl;
3244 cgf.cxxabiThisDecl = oldCxxabiThisDecl;
3245 cgf.cxxabiThisValue = oldCxxabiThisValue;
3246 cgf.cxxThisValue = oldCxxThisValue;
3247 cgf.cxxThisAlignment = oldCxxThisAlignment;
3248 cgf.cxxabiThisAlignment = oldCxxabiThisAlignment;
3249 cgf.returnValue = oldReturnValue;
3250 cgf.fnRetTy = oldFnRetTy;
3251 cgf.cxxInheritedCtorInitExprArgs =
3252 std::move(oldCxxInheritedCtorInitExprArgs);
3256 CIRGenFunction &cgf;
3257 GlobalDecl oldCurGD;
3258 const Decl *oldCurFuncDecl;
3259 const Decl *oldCurCodeDecl;
3260 ImplicitParamDecl *oldCxxabiThisDecl;
3261 mlir::Value oldCxxabiThisValue;
3262 mlir::Value oldCxxThisValue;
3263 clang::CharUnits oldCxxabiThisAlignment;
3264 clang::CharUnits oldCxxThisAlignment;
3266 QualType oldFnRetTy;
3267 CallArgList oldCxxInheritedCtorInitExprArgs;
Defines the clang::ASTContext interface.
static void emitOMPDistributeDirective(const OMPLoopDirective &S, CodeGenFunction &CGF, CodeGenModule &CGM)
static void emitOMPForDirective(const OMPLoopDirective &S, CodeGenFunction &CGF, CodeGenModule &CGM, bool HasCancel)
static void emitOMPSimdDirective(const OMPLoopDirective &S, CodeGenFunction &CGF, CodeGenModule &CGM)
llvm::function_ref< void(mlir::OpBuilder &, mlir::Location)> BuilderCallbackRef
static void emitAtomicOp(CIRGenFunction &cgf, AtomicExpr *expr, Address dest, Address ptr, Address val1, Address val2, Address expectedResult, Expr *isWeakExpr, Expr *failureOrderExpr, int64_t size, cir::MemOrder order, cir::SyncScopeKind scope)
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines some OpenACC-specific enums and functions.
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
Defines an enumeration for C++ overloaded operators.
Enumerates target-specific builtins in their own namespaces within namespace clang.
C Language Family Type Representation.
This represents 'pragma omp atomic' directive.
This represents 'pragma omp barrier' directive.
This represents 'pragma omp cancel' directive.
This represents 'pragma omp cancellation point' directive.
This represents 'pragma omp critical' directive.
This represents 'pragma omp depobj' directive.
This represents 'pragma omp dispatch' directive.
This represents 'pragma omp distribute' directive.
This represents 'pragma omp distribute parallel for' composite directive.
This represents 'pragma omp distribute parallel for simd' composite directive.
This represents 'pragma omp distribute simd' composite directive.
This represents 'pragma omp error' directive.
Represents the 'pragma omp flatten' loop transformation directive.
This represents 'pragma omp flush' directive.
This represents 'pragma omp for' directive.
This represents 'pragma omp for simd' directive.
Represents the 'pragma omp fuse' loop transformation directive.
This represents 'pragma omp loop' directive.
Represents the 'pragma omp interchange' loop transformation directive.
This represents 'pragma omp interop' directive.
This represents 'pragma omp masked' directive.
This represents 'pragma omp masked taskloop' directive.
This represents 'pragma omp masked taskloop simd' directive.
This represents 'pragma omp master' directive.
This represents 'pragma omp master taskloop' directive.
This represents 'pragma omp master taskloop simd' directive.
This represents block-associated 'pragma omp ordered' directive.
This represents standalone 'pragma omp ordered' directive.
This represents 'pragma omp parallel for' directive.
This represents 'pragma omp parallel for simd' directive.
This represents 'pragma omp parallel loop' directive.
This represents 'pragma omp parallel masked' directive.
This represents 'pragma omp parallel masked taskloop' directive.
This represents 'pragma omp parallel masked taskloop simd' directive.
This represents 'pragma omp parallel master' directive.
This represents 'pragma omp parallel master taskloop' directive.
This represents 'pragma omp parallel master taskloop simd' directive.
This represents 'pragma omp parallel sections' directive.
Represents the 'pragma omp reverse' loop transformation directive.
This represents 'pragma omp scan' directive.
This represents 'pragma omp scope' directive.
This represents 'pragma omp section' directive.
This represents 'pragma omp sections' directive.
This represents 'pragma omp simd' directive.
This represents 'pragma omp single' directive.
Represents the 'pragma omp split' loop transformation directive.
This represents the 'pragma omp stripe' loop transformation directive.
This represents 'pragma omp target data' directive.
This represents 'pragma omp target' directive.
This represents 'pragma omp target enter data' directive.
This represents 'pragma omp target exit data' directive.
This represents 'pragma omp target loop' directive.
This represents 'pragma omp target parallel' directive.
This represents 'pragma omp target parallel for' directive.
This represents 'pragma omp target parallel for simd' directive.
This represents 'pragma omp target parallel loop' directive.
This represents 'pragma omp target simd' directive.
This represents 'pragma omp target teams' directive.
This represents 'pragma omp target teams distribute' combined directive.
This represents 'pragma omp target teams distribute parallel for' combined directive.
This represents 'pragma omp target teams distribute parallel for simd' combined directive.
This represents 'pragma omp target teams distribute simd' combined directive.
This represents 'pragma omp target teams loop' directive.
This represents 'pragma omp target update' directive.
This represents 'pragma omp task' directive.
This represents 'pragma omp taskloop' directive.
This represents 'pragma omp taskloop simd' directive.
This represents 'pragma omp taskgroup' directive.
This represents 'pragma omp taskwait' directive.
This represents 'pragma omp taskyield' directive.
This represents 'pragma omp teams' directive.
This represents 'pragma omp teams distribute' directive.
This represents 'pragma omp teams distribute parallel for' composite directive.
This represents 'pragma omp teams distribute parallel for simd' composite directive.
This represents 'pragma omp teams distribute simd' combined directive.
This represents 'pragma omp teams loop' directive.
This represents the 'pragma omp tile' loop transformation directive.
This represents the 'pragma omp unroll' loop transformation directive.
This class represents a 'loop' construct. The 'loop' construct applies to a 'for' loop (or range-for ...
cir::ConstantOp getConstant(mlir::Location loc, mlir::TypedAttr attr)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Defines the interface for sync scope model.
Represents an attribute applied to a statement.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
BreakStmt - This represents a break.
mlir::Value getPointer() const
clang::CharUnits getAlignment() const
mlir::Value getBasePointer() const
static AggValueSlot forAddr(Address addr, clang::Qualifiers quals, IsDestructed_t isDestructed, IsAliased_t isAliased, Overlap_t mayOverlap, IsZeroed_t isZeroed=IsNotZeroed)
static AggValueSlot ignored()
Returns an aggregate value slot indicating that the aggregate value is being ignored.
cir::LoadOp createLoad(mlir::Location loc, Address addr, bool isVolatile=false, bool isNontemporal=false)
cir::StoreOp createStore(mlir::Location loc, mlir::Value val, Address dst, bool isVolatile=false, bool isNontemporal=false, mlir::IntegerAttr align={}, cir::SyncScopeKindAttr scope={}, cir::MemOrderAttr order={})
An abstract representation of regular/ObjC call/message targets.
bool hasFunctionDecl() const
unsigned getNumParams() const
const clang::Decl * getDecl() const
AbstractCallee(const clang::FunctionDecl *fd)
const clang::ParmVarDecl * getParamDecl(unsigned I) const
ArrayInitLoopExprScope(CIRGenFunction &cgf, bool setIdx, mlir::Value index)
~ArrayInitLoopExprScope()
CIRGenFPOptionsRAII(CIRGenFunction &cgf, FPOptions FPFeatures)
SourceLocExprScopeGuard sourceLocScope
CXXDefaultInitExprScope(CIRGenFunction &cgf, const CXXDefaultInitExpr *e)
clang::CharUnits oldCXXThisAlignment
mlir::Value oldCXXThisValue
~CXXDefaultInitExprScope()
CaptureScope(const CaptureScope &)=delete
CaptureScope(CapturedCleanups &scope)
void operator=(const CaptureScope &)=delete
Captures cleanups for variables whose lifetime ends in a region owned by an enclosing op rather than ...
CapturedCleanups(CIRGenFunction &cgf, bool active)
void emitAsNestedScopes(mlir::Location loc)
Emit the captured cleanups at the current insertion point as nested cir.cleanup.scope operations,...
void emitIntoCleanupRegion(mlir::Location loc)
Emit the captured cleanups into the current insertion point, which must be inside the owning op's cle...
An object to manage conditionally-evaluated expressions.
void advanceInsertPoint(mlir::Operation *op)
Records op as the last operation emitted at the pre-conditional insertion point, so that a later emis...
mlir::OpBuilder::InsertPoint getInsertPoint() const
Returns the insertion point which will be executed prior to each evaluation of the conditional code.
ConditionalEvaluation(CIRGenFunction &cgf, mlir::Location loc)
loc is the location of the conditional expression.
static ConstantEmission forReference(mlir::TypedAttr c)
static ConstantEmission forValue(mlir::TypedAttr c)
LValue getReferenceLValue(CIRGenFunction &cgf, const Expr *refExpr) const
mlir::TypedAttr getValue() const
DeclMapRevertingRAII(CIRGenFunction &cgf, const VarDecl *vd)
~FieldConstructionScope()
FieldConstructionScope(CIRGenFunction &cgf, Address thisAddr)
void deferLifetimeExtendedCleanups()
FullExprCleanupScope(CIRGenFunction &cgf, const Stmt *s)
s is the AST root for one cleanup boundary: a full-expression, an asm statement, or the construction ...
void exit(ArrayRef< mlir::Value * > valuesToReload={})
A non-RAII class containing all the information about a bound opaque value.
static OpaqueValueMappingData bind(CIRGenFunction &cgf, const OpaqueValueExpr *ov, const LValue &lv)
static OpaqueValueMappingData bind(CIRGenFunction &cgf, const OpaqueValueExpr *ov, const RValue &rv)
static bool shouldBindAsLValue(const Expr *expr)
static OpaqueValueMappingData bind(CIRGenFunction &cgf, const OpaqueValueExpr *ov, const Expr *e)
void unbind(CIRGenFunction &cgf)
OpaqueValueMapping(CIRGenFunction &cgf, const OpaqueValueExpr *opaqueValue, RValue rvalue)
OpaqueValueMapping(CIRGenFunction &cgf, const OpaqueValueExpr *opaqueValue, LValue lvalue)
OpaqueValueMapping(CIRGenFunction &cgf, const AbstractConditionalOperator *op)
Build the opaque value mapping for the given conditional operator if it's the GNU ?
OpaqueValueMapping(CIRGenFunction &cgf, const OpaqueValueExpr *ov)
Build the opaque value mapping for an OpaqueValueExpr whose source expression is set to the expressio...
static bool shouldBindAsLValue(const Expr *expr)
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited.
RunCleanupsScope(CIRGenFunction &cgf)
Enter a new cleanup scope.
void deferLifetimeExtendedCleanups()
Leave the cleanups of lifetime-extended temporaries created in this scope to the enclosing scope inst...
void forceLifetimeExtendedCleanups()
Promote any pending lifetime-extended cleanup entries onto the EH scope stack at the current insertio...
void forceCleanup(ArrayRef< mlir::Value * > valuesToReload={})
Force the emission of cleanups now, instead of waiting until this object is destroyed.
void forceCleanupExceptLifetimeExtended()
Force the emission of EH cleanups now, but defer promoting any lifetime-extended cleanup entries onto...
bool hasPendingCleanups() const
Whether there are any pending cleanups that have been pushed since this scope was entered.
~RunCleanupsScope()
Exit this cleanup scope, emitting any accumulated cleanups.
void restore()
Can be used to restore the state early, before the dtor is run.
SourceLocRAIIObject(CIRGenFunction &cgf, SourceRange value)
StmtExprEvaluation(CIRGenFunction &cgf)
static bool isConstructorDelegationValid(const clang::CXXConstructorDecl *ctor)
Checks whether the given constructor is a valid subject for the complete-to-base constructor delegati...
static bool hasScalarEvaluationKind(clang::QualType type)
void emitFunctionProlog(const FunctionArgList &args, mlir::Block *entryBB, const FunctionDecl *fd, SourceLocation bodyBeginLoc)
Emit the function prologue: initialize the return value of an implicit-return-zero function and decla...
void emitOpenACCRoutine(const OpenACCRoutineDecl &d)
void emitLambdaDelegatingInvokeBody(const CXXMethodDecl *md)
mlir::Value emitComplexToScalarConversion(mlir::Value src, QualType srcTy, QualType dstTy, SourceLocation loc)
Emit a conversion from the specified complex type to the specified destination type,...
mlir::Type convertType(clang::QualType t)
cir::GlobalOp addInitializerToStaticVarDecl(const VarDecl &d, cir::GlobalOp gv, cir::GetGlobalOp gvAddr)
Add the initializer for 'd' to the global variable that has already been created for it.
LValue emitCXXBindTemporaryLValue(const CXXBindTemporaryExpr *e)
mlir::Value emitCheckedArgForAssume(const Expr *e)
Emits an argument for a call to a __builtin_assume.
LValue emitOpaqueValueLValue(const OpaqueValueExpr *e)
static cir::TypeEvaluationKind getEvaluationKind(clang::QualType type)
Return the cir::TypeEvaluationKind of QualType type.
clang::GlobalDecl curGD
The GlobalDecl for the current function being compiled or the global variable currently being initial...
clang::CurrentSourceLocExprScope::SourceLocExprScopeGuard SourceLocExprScopeGuard
RValue convertTempToRValue(Address addr, clang::QualType type, clang::SourceLocation loc)
Given the address of a temporary variable, produce an r-value of its type.
mlir::LogicalResult emitCoreturnStmt(const CoreturnStmt &s)
mlir::LogicalResult emitOpenACCDataConstruct(const OpenACCDataConstruct &s)
AutoVarEmission emitAutoVarAlloca(const clang::VarDecl &d, mlir::OpBuilder::InsertPoint ip={})
mlir::Value emitPromotedValue(mlir::Value result, QualType promotionType)
void emitAutoVarTypeCleanup(const AutoVarEmission &emission, clang::QualType::DestructionKind dtorKind)
Enter a destroy cleanup for the given local variable.
ImplicitParamDecl * cxxabiThisDecl
CXXThisDecl - When generating code for a C++ member function, this will hold the implicit 'this' decl...
EHScopeStack::stable_iterator prologueCleanupDepth
The cleanup depth enclosing all the cleanups associated with the parameters.
mlir::LogicalResult emitOpenACCCombinedConstruct(const OpenACCCombinedConstruct &s)
Address emitCXXMemberDataPointerAddress(const Expr *e, Address base, mlir::Value memberPtr, const MemberPointerType *memberPtrType, LValueBaseInfo *baseInfo)
bool curFuncIsThunk
In C++, whether we are code generating a thunk.
mlir::LogicalResult emitOpenACCWaitConstruct(const OpenACCWaitConstruct &s)
cir::FuncOp generateCode(clang::GlobalDecl gd, cir::FuncOp fn, cir::FuncType funcType)
llvm::SmallVector< PendingCleanupEntry > lifetimeExtendedCleanupStack
ConditionalEvaluation * hiddenOutermostConditional
Address emitFieldAnnotations(const clang::FieldDecl *field, Address addr)
Annotate the address of field; accesses must use the result.
CIRGenTypes & getTypes() const
Address emitPointerWithAlignment(const clang::Expr *expr, LValueBaseInfo *baseInfo=nullptr)
Given an expression with a pointer type, emit the value and compute our best estimate of the alignmen...
llvm::ScopedHashTable< const clang::Decl *, mlir::Value > SymTableTy
The symbol table maps a variable name to a value in the current scope.
void initFullExprCleanup()
Set up the last cleanup that was pushed as a conditional full-expression cleanup.
void emitInvariantStart(CharUnits size, mlir::Value addr, mlir::Location loc)
void emitVariablyModifiedType(QualType ty)
RValue emitLoadOfLValue(LValue lv, SourceLocation loc)
Given an expression that represents a value lvalue, this method emits the address of the lvalue,...
const clang::LangOptions & getLangOpts() const
mlir::Value cxxStructorImplicitParamValue
void emitCapturedCleanups(EHScopeStack::stable_iterator depth, mlir::Location loc)
Emit the captured cleanups (those pushed above depth while EHScopeStack was capturing cleanups) at th...
void emitTrap(mlir::Location loc, bool createNewBlock)
Emit a trap instruction, which is used to abort the program in an abnormal way, usually for debugging...
void emitForwardingCallToLambda(const CXXMethodDecl *lambdaCallOperator, CallArgList &callArgs)
mlir::Block * getCurFunctionEntryBlock()
RValue emitCXXMemberCallExpr(const clang::CXXMemberCallExpr *e, ReturnValueSlot returnValue)
mlir::LogicalResult emitOpenACCUpdateConstruct(const OpenACCUpdateConstruct &s)
RValue emitCXXMemberPointerCallExpr(const CXXMemberCallExpr *ce, ReturnValueSlot returnValue)
bool isInConditionalBranch() const
mlir::Value emitX86CpuIs(const CallExpr *expr)
LValue emitLValueForBitField(LValue base, const FieldDecl *field)
mlir::LogicalResult emitIfOnBoolExpr(const clang::Expr *cond, const clang::Stmt *thenS, const clang::Stmt *elseS)
Emit an if on a boolean condition to the specified blocks.
VlaSizePair getVLASize(const VariableArrayType *type)
Returns an MLIR::Value+QualType pair that corresponds to the size, in non-variably-sized elements,...
LValue emitScalarCompoundAssignWithComplex(const CompoundAssignOperator *e, mlir::Value &result)
cir::CoroAllocOp emitCoroAllocBuiltinCall(const CallExpr *e)
Address cxxDefaultInitExprThis
The value of 'this' to sue when evaluating CXXDefaultInitExprs within this expression.
cir::IfOp emitIfOnBoolValue(mlir::Value condV, mlir::Location loc, BuilderCallbackRef thenBuilder, mlir::Location thenLoc, BuilderCallbackRef elseBuilder, std::optional< mlir::Location > elseLoc={})
Build the cir.if for an already-emitted condition value.
void emitStaticVarDecl(const VarDecl &d, cir::GlobalLinkageKind linkage)
mlir::Value emitComplexExpr(const Expr *e)
Emit the computation of the specified expression of complex type, returning the result.
void setBeforeOutermostConditional(mlir::Value value, Address addr)
mlir::LogicalResult emitOpenACCCacheConstruct(const OpenACCCacheConstruct &s)
mlir::Value loadCXXThis()
Load the value for 'this'.
LValue makeNaturalAlignPointeeAddrLValue(mlir::Value v, clang::QualType t)
Given a value of type T* that may not be to a complete object, construct an l-vlaue withi the natural...
RValue emitCallExpr(const clang::CallExpr *e, ReturnValueSlot returnValue=ReturnValueSlot())
void emitDeleteCall(const FunctionDecl *deleteFD, mlir::Value ptr, QualType deleteTy)
LValue emitMemberExpr(const MemberExpr *e)
clang::CharUnits cxxThisAlignment
const TargetInfo & getTarget() const
void replaceAddrOfLocalVar(const clang::VarDecl *vd, Address addr)
llvm::DenseMap< const clang::Decl *, Address > DeclMapTy
LValue emitConditionalOperatorLValue(const AbstractConditionalOperator *expr)
LValue emitLValue(const clang::Expr *e)
Emit code to compute a designator that specifies the location of the expression.
void addCatchHandlerAttr(const CXXCatchStmt *catchStmt, SmallVector< mlir::Attribute > &handlerAttrs)
Address makeNaturalAddressForPointer(mlir::Value ptr, QualType t, CharUnits alignment, bool forPointeeType=false, LValueBaseInfo *baseInfo=nullptr)
Construct an address with the natural alignment of T.
const clang::Decl * curFuncDecl
mlir::LogicalResult emitCXXForRangeStmt(const CXXForRangeStmt &s, llvm::ArrayRef< const Attr * > attrs)
clang::FPOptions curFPFeatures
cir::CoroNoopOp emitCoroNoopBuiltinCall(const CallExpr *e)
bool insertionPointIsReachable() const
True if code emitted at the builder's insertion point can be reached.
Address loadCXXThisAddress()
LValue emitLValueForLambdaField(const FieldDecl *field)
mlir::Value evaluateExprAsBool(const clang::Expr *e)
Perform the usual unary conversions on the specified expression and compare the result against zero,...
bool isTrivialInitializer(const Expr *init)
Determine whether the given initializer is trivial in the sense that it requires no code to be genera...
void emitOpenACCDeclare(const OpenACCDeclareDecl &d)
void emitInlinedInheritingCXXConstructorCall(SourceLocation loc, const CXXConstructorDecl *d, CXXCtorType ctorType, bool forVirtualBase, bool delegating, CallArgList &args)
Address getAddrOfLocalVar(const clang::VarDecl *vd)
Return the address of a local variable.
void emitAnyExprToExn(const Expr *e, Address addr)
void emitAggregateCopy(LValue dest, LValue src, QualType eltTy, AggValueSlot::Overlap_t mayOverlap, bool isVolatile=false)
Emit an aggregate copy.
cir::CoroSuspendOp emitCoroSuspendBuiltinCall(const CallExpr *e)
std::string getCounterRefTmpAsString()
void emitCapturedCleanupsAsScopes(EHScopeStack::stable_iterator depth, mlir::Location loc)
Like emitCapturedCleanups, but push the captured cleanups again as ordinary cleanups,...
LValue makeNaturalAlignAddrLValue(mlir::Value val, QualType ty)
llvm::DenseMap< const Expr *, mlir::Value > vlaSizeMap
bool constantFoldsToSimpleInteger(const clang::Expr *cond, llvm::APSInt &resultInt, bool allowLabels=false)
If the specified expression does not fold to a constant, or if it does fold but contains a label,...
void emitMustTailThunk(GlobalDecl gd, mlir::Value adjustedThisPtr, cir::FuncOp callee)
Emit a musttail call for a thunk with a potentially different ABI.
mlir::LogicalResult emitForStmt(const clang::ForStmt &s, llvm::ArrayRef< const Attr * > attrs={})
void pushIrregularPartialArrayCleanup(mlir::Value arrayBegin, Address arrayEndPointer, QualType elementType, CharUnits elementAlign, Destroyer *destroyer)
Push an EH cleanup to destroy already-constructed elements of the given array.
void emitLifetimeEndOp(mlir::Location loc, mlir::Value addr)
Address getAsNaturalAddressOf(Address addr, QualType pointeeTy)
void pushCleanupAndDeferDeactivation(CleanupKind kind, As... a)
Push a cleanup and record it for deferred deactivation.
cir::TryOp ehSpecTryOp
The cir.try wrapping a function whose exception specification has to be enforced.
LValue emitComplexCompoundAssignmentLValue(const CompoundAssignOperator *e)
bool checkIfFunctionMustProgress()
void emitBeginCatch(const CXXCatchStmt *catchStmt, mlir::Value ehToken)
Begins a catch statement by initializing the catch variable and calling __cxa_begin_catch.
mlir::Value getVTTParameter(GlobalDecl gd, bool forVirtualBase, bool delegating)
Return the VTT parameter that should be passed to a base constructor/destructor with virtual bases.
mlir::Location getLoc(clang::SourceLocation srcLoc)
Helpers to convert Clang's SourceLocation to a MLIR Location.
void initializeVTablePointers(mlir::Location loc, const clang::CXXRecordDecl *rd)
mlir::Type convertType(const TypeDecl *t)
bool constantFoldsToBool(const clang::Expr *cond, bool &resultBool, bool allowLabels=false)
If the specified expression does not fold to a constant, or if it does but contains a label,...
void emitVarAnnotations(const clang::VarDecl *d, mlir::Value addr)
Annotate the storage of d at addr.
mlir::Value emitOpOnBoolExpr(mlir::Location loc, const clang::Expr *cond)
TODO(cir): see EmitBranchOnBoolExpr for extra ideas).
void emitStoreThroughExtVectorComponentLValue(RValue src, LValue dst)
CodeGenUtils::EvaluationOrder EvaluationOrder
void initializeVTablePointer(mlir::Location loc, const VPtr &vptr)
void emitCallArgs(CallArgList &args, PrototypeWrapper prototype, llvm::iterator_range< clang::CallExpr::const_arg_iterator > argRange, AbstractCallee callee=AbstractCallee(), unsigned paramsToSkip=0, EvaluationOrder order=EvaluationOrder::Default)
Address getAddressOfBaseClass(Address value, const CXXRecordDecl *derived, llvm::iterator_range< CastExpr::path_const_iterator > path, bool nullCheckValue, SourceLocation loc)
void emitAggregateStore(mlir::Value value, Address dest)
mlir::LogicalResult emitDoStmt(const clang::DoStmt &s, llvm::ArrayRef< const Attr * > attrs={})
mlir::LogicalResult emitReturnStmt(const clang::ReturnStmt &s)
LValue emitLoadOfReferenceLValue(Address refAddr, mlir::Location loc, QualType refTy, AlignmentSource source)
cir::CoroBeginOp emitCoroBeginBuiltinCall(const CallExpr *e)
void emitDelegateCXXConstructorCall(const clang::CXXConstructorDecl *ctor, clang::CXXCtorType ctorType, const FunctionArgList &args, clang::SourceLocation loc)
VlaSizePair getVLAElements1D(const VariableArrayType *vla)
Return the number of elements for a single dimension for the given array type.
ConditionalEvaluation * outermostConditional
mlir::LogicalResult emitOpenACCInitConstruct(const OpenACCInitConstruct &s)
void emitAnyExprToMem(const Expr *e, Address location, Qualifiers quals, bool isInitializer)
Emits the code necessary to evaluate an arbitrary expression into the given memory location.
RValue emitCXXMemberOrOperatorCall(const clang::CXXMethodDecl *md, const CIRGenCallee &callee, ReturnValueSlot returnValue, mlir::Value thisPtr, mlir::Value implicitParam, clang::QualType implicitParamTy, const clang::CallExpr *ce, CallArgList *rtlArgs)
LValue getOrCreateOpaqueLValueMapping(const OpaqueValueExpr *e)
Given an opaque value expression, return its LValue mapping if it exists, otherwise create one.
void emitBaseInitializer(mlir::Location loc, const CXXRecordDecl *classDecl, CXXCtorInitializer *baseInit)
RValue emitAtomicExpr(AtomicExpr *e)
void emitExprAsInit(const clang::Expr *init, const clang::ValueDecl *d, LValue lvalue, bool capturedByInit=false)
Emit an expression as an initializer for an object (variable, field, etc.) at the given location.
void emitCXXGuardedInit(const VarDecl &varDecl, cir::GlobalOp globalOp, bool performInit)
Emit a guarded initializer for a static local variable.
void emitLoopConditionVariable(const clang::VarDecl &d, CapturedCleanups &condCleanup, llvm::ArrayRef< QualType > extendedTemporaries)
Emit a loop's condition-variable declaration.
static bool resumeExprDefersCleanups(const CoroutineSuspendExpr &s)
Whether the resume expression of s contains a construct that defers cleanups to the end of the enclos...
mlir::Value emitArrayLength(const clang::ArrayType *arrayType, QualType &baseType, Address &addr)
Computes the length of an array in elements, as well as the base element type and a properly-typed fi...
void emitNullInitialization(mlir::Location loc, Address destPtr, QualType ty)
mlir::LogicalResult emitOpenACCSetConstruct(const OpenACCSetConstruct &s)
mlir::Value performAddrSpaceCast(mlir::Value v, mlir::Type destTy) const
RValue emitReferenceBindingToExpr(const Expr *e)
Emits a reference binding to the passed in expression.
llvm::SmallVector< DeferredDeactivateCleanup > deferredDeactivationCleanupStack
VPtrsVector getVTablePointers(const clang::CXXRecordDecl *vtableClass)
const TargetCIRGenInfo & getTargetHooks() const
mlir::LogicalResult emitSwitchStmt(const clang::SwitchStmt &s)
RValue emitCoyieldExpr(const CoyieldExpr &e, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
cir::CoroFreeOp emitCoroFreeBuiltin(const CallExpr *e)
mlir::Value evaluateOrEmitBuiltinObjectSize(const clang::Expr *e, unsigned type, cir::IntType resType, mlir::Value emittedE, bool isDynamic)
void emitLambdaVLACapture(const VariableArrayType *vat, LValue lv)
mlir::Value emitX86CpuInit(mlir::Location loc)
std::optional< mlir::Value > emitRISCVBuiltinExpr(unsigned builtinID, const CallExpr *expr)
void pushDestroyAndDeferDeactivation(QualType::DestructionKind dtorKind, Address addr, QualType type)
mlir::LogicalResult emitWhileStmt(const clang::WhileStmt &s, llvm::ArrayRef< const Attr * > attrs={})
mlir::LogicalResult emitCaseStmt(const clang::CaseStmt &s, mlir::Type condType, bool buildingTopLevelCase)
LValue emitArraySubscriptExpr(const clang::ArraySubscriptExpr *e)
void emitScalarInit(const clang::Expr *init, LValue lvalue, bool capturedByInit=false)
llvm::ScopedHashTableScope< const clang::Decl *, mlir::Value > SymTableScopeTy
OpenACCDataOperandInfo getOpenACCDataOperandInfo(const Expr *e)
CleanupKind getCleanupKind(QualType::DestructionKind kind)
clang::CharUnits cxxabiThisAlignment
void checkTargetFeatures(const clang::CallExpr *e, const clang::FunctionDecl *targetDecl)
Emit a diagnostic if the target features required by targetDecl are not available in the calling func...
mlir::Value emitX86CpuSupports(const CallExpr *expr)
mlir::Value emitBuiltinObjectSize(const clang::Expr *e, unsigned type, cir::IntType resType, mlir::Value emittedE, bool isDynamic)
Returns a Value corresponding to the size of the given expression by emitting a cir....
LValue emitCoawaitLValue(const CoawaitExpr *e)
mlir::Value makeBinaryAtomicValue(cir::AtomicFetchKind kind, const clang::CallExpr *expr, mlir::Type *originalArgType=nullptr, mlir::Value *emittedArgValue=nullptr, cir::MemOrder ordering=cir::MemOrder::SequentiallyConsistent)
Utility to insert an atomic instruction based on Intrinsic::ID and the expression node.
RValue emitCUDAKernelCallExpr(const CUDAKernelCallExpr *expr, ReturnValueSlot returnValue)
AggValueSlot::Overlap_t getOverlapForFieldInit(const FieldDecl *fd)
mlir::LogicalResult emitSimpleStmt(const clang::Stmt *s, bool useCurrentScope)
mlir::Operation * curFn
The current function or global initializer that is generated code for.
mlir::LogicalResult emitAsmStmt(const clang::AsmStmt &s)
std::pair< mlir::Value, mlir::Type > emitAsmInputLValue(const TargetInfo::ConstraintInfo &info, LValue inputValue, QualType inputType, std::string &constraintString, SourceLocation loc)
Address emitExtVectorElementLValue(LValue lv, mlir::Location loc)
Generates lvalue for partial ext_vector access.
mlir::Value emitScalarConversion(mlir::Value src, clang::QualType srcType, clang::QualType dstType, clang::SourceLocation loc)
Emit a conversion from the specified type to the specified destination type, both of which are CIR sc...
Address getAddressOfDerivedClass(mlir::Location loc, Address baseAddr, const CXXRecordDecl *derived, llvm::iterator_range< CastExpr::path_const_iterator > path, bool nullCheckValue)
std::optional< mlir::Value > emitTargetBuiltinExpr(unsigned builtinID, const clang::CallExpr *e, ReturnValueSlot &returnValue)
CallArgList cxxInheritedCtorInitExprArgs
The values of function arguments to use when evaluating CXXInheritedCtorInitExprs within this context...
mlir::Value emitPromotedComplexExpr(const Expr *e, QualType promotionType)
ImplicitParamDecl * cxxStructorImplicitParamDecl
When generating code for a constructor or destructor, this will hold the implicit argument (e....
mlir::LogicalResult emitOpenACCComputeConstruct(const OpenACCComputeConstruct &s)
EHScopeStack ehStack
Tracks function scope overall cleanup handling.
void enterDtorCleanups(const CXXDestructorDecl *dtor, CXXDtorType type)
Enter the cleanups necessary to complete the given phase of destruction for a destructor.
llvm::SmallVector< const ParmVarDecl * > fnArgs
Save Parameter Decl for coroutine.
mlir::Value emitUnPromotedValue(mlir::Value result, QualType unPromotionType)
mlir::LogicalResult emitSwitchBody(const clang::Stmt *s)
void startThunk(cir::FuncOp fn, GlobalDecl gd, const CIRGenFunctionInfo &fnInfo, bool isUnprototyped)
Start generating a thunk function.
RValue emitAtomicLoad(LValue lvalue, SourceLocation loc, AggValueSlot slot=AggValueSlot::ignored())
AggValueSlot createAggTemp(QualType ty, mlir::Location loc, const Twine &name="tmp", Address *alloca=nullptr)
Create a temporary memory object for the given aggregate type.
mlir::Value emitDevicePrintfCallExpr(const CallExpr *expr)
Emit a device-side printf call for GPU targets.
llvm::SmallVector< PendingCleanupEntry > deferredConditionalCleanupStack
Cleanups for temporaries constructed inside a conditional.
llvm::SmallVector< ConditionalCleanupScope > conditionalCleanupScopes
void emitNewArrayInitializer(const CXXNewExpr *e, QualType elementType, mlir::Type elementTy, Address beginPtr, mlir::Value numElements, mlir::Value allocSizeWithoutCookie)
std::optional< mlir::Value > fnRetAlloca
The compiler-generated variable that holds the return value.
unsigned nextCleanupDestIndex
void emitImplicitAssignmentOperatorBody(FunctionArgList &args)
clang::SanitizerSet sanOpts
Sanitizers enabled for this function.
static int64_t getZExtIntValueFromConstOp(mlir::Value val)
Get zero-extended integer from a mlir::Value that is an int constant or a constant op.
cir::FastMathFlagsAttr getFastMathFlagsAttr(cir::FastMathFlags fastMathFlags)
Create a CIR fast-math attribute from the specified flags.
RValue emitLoadOfExtVectorElementLValue(LValue lv)
mlir::Value emitCXXTypeidExpr(const CXXTypeidExpr *e)
mlir::Type convertTypeForMem(QualType t)
clang::QualType buildFunctionArgList(clang::GlobalDecl gd, FunctionArgList &args)
RValue emitCoroutineFrame()
void emitCtorPrologue(const clang::CXXConstructorDecl *ctor, clang::CXXCtorType ctorType, FunctionArgList &args)
This routine generates necessary code to initialize base classes and non-static data members belongin...
mlir::Value emitAlloca(llvm::StringRef name, mlir::Type ty, mlir::Location loc, clang::CharUnits alignment, bool insertIntoFnEntryBlock, mlir::Value arraySize=nullptr)
mlir::Value emitComplexPrePostIncDec(const UnaryOperator *e, LValue lv)
void emitUnreachable(clang::SourceLocation loc, bool createNewBlock)
Emit a reached-unreachable diagnostic if loc is valid and runtime checking is enabled.
mlir::LogicalResult emitCXXTryStmt(const clang::CXXTryStmt &s, cxxTryBodyEmitter &bodyCallback, bool isFnTryBlock=false)
mlir::Value createDummyValue(mlir::Location loc, clang::QualType qt)
mlir::LogicalResult emitAttributedStmt(const AttributedStmt &s)
cir::FastMathFlags getCurrentFastMathFlags() const
Convert the active Clang floating-point options to CIR fast-math flags.
void emitCXXConstructExpr(const clang::CXXConstructExpr *e, AggValueSlot dest)
mlir::Value emitLoadOfComplex(LValue src, SourceLocation loc)
Load a complex number from the specified l-value.
cir::CoroPromiseOp emitCoroPromiseBuiltinCall(const CallExpr *e)
CodeGenUtils::MSVCIntrin MSVCIntrin
LValue emitAggExprToLValue(const Expr *e)
void emitStoreOfScalar(mlir::Value value, Address addr, bool isVolatile, clang::QualType ty, LValueBaseInfo baseInfo, bool isInit=false, bool isNontemporal=false)
void pushDestroy(QualType::DestructionKind dtorKind, Address addr, QualType type)
Push the standard destructor for the given type as at least a normal cleanup.
clang::CurrentSourceLocExprScope curSourceLocExprScope
Source location information about the default argument or member initializer expression we're evaluat...
mlir::Value loadCXXVTT()
Load the VTT parameter to base constructors/destructors have virtual bases.
void emitVarDecl(const clang::VarDecl &d)
This method handles emission of any variable declaration inside a function, including static vars etc...
static Destroyer destroyCXXObject
LValue emitCompoundAssignmentLValue(const clang::CompoundAssignOperator *e)
mlir::Value emitSVEPredicateCast(mlir::Value pred, unsigned minNumElts, mlir::Location loc)
mlir::Value emitCXXNewExpr(const CXXNewExpr *e)
RValue getUndefRValue(clang::QualType ty)
Get an appropriate 'undef' rvalue for the given type.
bool getAArch64SVEProcessedOperands(unsigned builtinID, const CallExpr *expr, SmallVectorImpl< mlir::Value > &ops, clang::SVETypeFlags typeFlags)
Address returnValue
The temporary alloca to hold the return value.
LValue makeAddrLValue(Address addr, QualType ty, LValueBaseInfo baseInfo)
static int64_t getSExtIntValueFromConstOp(mlir::Value val)
Get integer from a mlir::Value that is an int constant or a constant op.
mlir::Value getArrayInitIndex()
Get the index of the current ArrayInitLoopExpr, if any.
std::optional< mlir::Value > emitX86BuiltinExpr(unsigned builtinID, const CallExpr *expr)
mlir::LogicalResult emitLabel(const clang::LabelDecl &d)
void emitCXXConstructorCall(const clang::CXXConstructorDecl *d, clang::CXXCtorType type, bool forVirtualBase, bool delegating, AggValueSlot thisAVS, const clang::CXXConstructExpr *e)
static bool hasAggregateEvaluationKind(clang::QualType type)
mlir::Value getVTablePtr(mlir::Location loc, Address thisAddr, const clang::CXXRecordDecl *vtableClass)
Return the Value of the vtable pointer member pointed to by thisAddr.
void emitArrayDestroy(mlir::Value begin, mlir::Value numElements, QualType elementType, CharUnits elementAlign, Destroyer *destroyer)
Destroys all the elements of the given array, beginning from last to first.
LValue emitPointerToDataMemberBinaryExpr(const BinaryOperator *e)
RValue emitAnyExprToTemp(const clang::Expr *e)
Similarly to emitAnyExpr(), however, the result will always be accessible even if no aggregate locati...
void finishFunction(SourceLocation endLoc)
mlir::LogicalResult emitOpenACCShutdownConstruct(const OpenACCShutdownConstruct &s)
mlir::LogicalResult emitFunctionBody(const clang::Stmt *body)
mlir::LogicalResult emitBreakStmt(const clang::BreakStmt &s)
void emitAutoVarDeclWithCapturedCleanups(const clang::VarDecl &d, CapturedCleanups &cleanups, bool guardDestruction=false, llvm::ArrayRef< QualType > extendedTemporaries={})
Emit d with captured cleanups.
void initFullExprCleanupWithFlag(Address activeFlag)
cir::CoroDestroyOp emitCoroDestroyBuiltinCall(const CallExpr *e)
mlir::LogicalResult emitIndirectGotoStmt(const IndirectGotoStmt &s)
const CallExpr * mustTailCall
void emitCallAndReturnForThunk(cir::FuncOp callee, SourceRange fnLoc, const ThunkInfo *thunk, bool isUnprototyped)
Emit the call and return for a thunk function.
void emitStoreOfComplex(mlir::Location loc, mlir::Value v, LValue dest, bool isInit)
EmitStoreOfComplex - Store a complex number into the specified l-value.
llvm::SmallPtrSet< const clang::CXXRecordDecl *, 4 > VisitedVirtualBasesSetTy
static bool destructorMayThrow(QualType type)
Whether destroying an object of type type, or its elements if it is an array, may throw an exception.
std::string getCounterAggTmpAsString()
LValue emitUnaryOpLValue(const clang::UnaryOperator *e)
void emitReturnOfRValue(mlir::Location loc, RValue rv, QualType ty)
LValue emitMatrixSubscriptExpr(const MatrixSubscriptExpr *e)
Address createCleanupActiveFlag()
Create an active flag variable for use with conditional cleanups.
bool shouldEmitVTableTypeCheckedLoad(const CXXRecordDecl *rd)
Returns whether we should perform a type checked load when loading a virtual function for virtual cal...
bool hasVolatileMember(QualType t)
returns true if aggregate type has a volatile member.
RValue emitLoadOfBitfieldLValue(LValue lv, SourceLocation loc)
LValue emitComplexAssignmentLValue(const BinaryOperator *e)
void emitCallArg(CallArgList &args, const clang::Expr *e, clang::QualType argType)
bool checkIfLoopMustProgress(const clang::Expr *controllingExpression, bool hasEmptyBody)
cir::CoroEndOp emitCoroEndBuiltinCall(const CallExpr *e)
clang::FieldDecl * lambdaThisCaptureField
void deactivateCleanupBlock(EHScopeStack::stable_iterator cleanup, mlir::Operation *dominatingIP)
Deactivates the given cleanup block.
cir::LoopHintAttr getLoopHints(llvm::ArrayRef< const Attr * > attrs, bool mustProgress)
Build the hints that get attached to a loop, or a null attribute if there is nothing to say about it.
mlir::LogicalResult emitContinueStmt(const clang::ContinueStmt &s)
const clang::Decl * curCodeDecl
This is the inner-most code context, which includes blocks.
mlir::Value emitX86MSVCIntrin(MSVCIntrin builtinID, const CallExpr *E)
void emitConstructorBody(FunctionArgList &args)
LValue emitLValueForFieldInitialization(LValue base, const clang::FieldDecl *field, llvm::StringRef fieldName)
Like emitLValueForField, excpet that if the Field is a reference, this will return the address of the...
mlir::Value getAsNaturalPointerTo(Address addr, QualType pointeeType)
LValue emitCallExprLValue(const clang::CallExpr *e)
bool haveInsertPoint() const
True if an insertion point is defined.
llvm::SmallVector< mlir::Type, 2 > condTypeStack
The type of the condition for the emitting switch statement.
RValue emitBuiltinWithOneOverloadedType(const CallExpr *e, llvm::StringRef intrinName, mlir::Type resultType={})
Emit a simple LLVM intrinsic that takes N scalar arguments.
void emitAutoVarInit(const AutoVarEmission &emission)
Emit the initializer for an allocated variable.
void emitInitializerForField(clang::FieldDecl *field, LValue lhs, clang::Expr *init)
void emitStopPoint(const Stmt *s)
Build a debug stoppoint if we are emitting debug info.
void emitAtomicExprWithSyncScope(const AtomicScopeModel *scopeModel, const EmittedOrderOrScope &scope, llvm::function_ref< void(cir::SyncScopeKind)> emitAtomicOp)
std::optional< mlir::Value > emitAMDGPUBuiltinExpr(unsigned builtinID, const CallExpr *expr)
Emit a call to an AMDGPU builtin function.
std::optional< mlir::Value > emitAArch64BuiltinExpr(unsigned builtinID, const CallExpr *expr, ReturnValueSlot returnValue, llvm::Triple::ArchType arch)
void emitCXXTemporary(const CXXTemporary *temporary, QualType tempType, Address ptr)
Emits all the code to cause the given temporary to be cleaned up.
LValue emitStringLiteralLValue(const StringLiteral *e, llvm::StringRef name=".str")
void maybeEmitDeferredVarDeclInit(const VarDecl *vd)
mlir::Value getUndefConstant(mlir::Location loc, mlir::Type cirTy)
Return a CIR constant for an undefined value of cirTy.
LValue emitCoyieldLValue(const CoyieldExpr *e)
llvm::SmallDenseMap< const ParmVarDecl *, const ImplicitParamDecl * > sizeArguments
If a ParmVarDecl had the pass_object_size attribute, this will contain a mapping from said ParmVarDec...
mlir::Value loadThisForDtorDelete(const CXXDestructorDecl *dd)
Return the pointer to pass to the operator delete of the given destructor, converted to the type of i...
mlir::Value emitToMemory(mlir::Value value, clang::QualType ty)
Given a value and its clang type, returns the value casted to its memory representation.
mlir::LogicalResult emitOpenACCHostDataConstruct(const OpenACCHostDataConstruct &s)
std::optional< mlir::Value > emitAArch64SMEBuiltinExpr(unsigned builtinID, const CallExpr *expr)
LValue emitLValueForField(LValue base, const clang::FieldDecl *field)
const LifetimeExtensionCapture * lifetimeExtensionCapture
mlir::Value emitScalarExpr(const clang::Expr *e, bool ignoreResultAssign=false)
Emit the computation of the specified expression of scalar type.
void emitAtomicExprWithMemOrder(const EmittedOrderOrScope &order, bool isStore, bool isLoad, bool isFence, llvm::function_ref< void(cir::MemOrder)> emitAtomicOp)
void pushStackRestore(CleanupKind kind, Address spMem)
LValue emitPseudoObjectLValue(const PseudoObjectExpr *E)
mlir::LogicalResult emitIfStmt(const clang::IfStmt &s)
void emitAutoVarDecl(const clang::VarDecl &d)
Emit code and set up symbol table for a variable declaration with auto, register, or no storage class...
cir::GetGlobalOp createGetCpuModel(mlir::Location loc)
void pushLifetimeExtendedDestroy(CleanupKind kind, Address addr, QualType type, Destroyer *destroyer, bool useEHCleanupForArray, const clang::ValueDecl *extendingDecl)
void popCleanupBlocks(EHScopeStack::stable_iterator oldCleanupStackDepth, ArrayRef< mlir::Value * > valuesToReload={})
Takes the old cleanup stack size and emits the cleanup blocks that have been added.
mlir::Value emitPromotedScalarExpr(const Expr *e, QualType promotionType)
AggValueSlot::Overlap_t getOverlapForReturnValue()
Determine whether a return value slot may overlap some other object.
bool needsEHCleanup(QualType::DestructionKind kind)
Determines whether an EH cleanup is required to destroy a type with the given destruction kind.
mlir::LogicalResult emitSwitchCase(const clang::SwitchCase &s, bool buildingTopLevelCase)
Address emitLoadOfReference(LValue refLVal, mlir::Location loc, LValueBaseInfo *pointeeBaseInfo)
Address getAddressOfDirectBaseInCompleteClass(mlir::Location loc, Address value, const CXXRecordDecl *derived, const CXXRecordDecl *base, bool baseIsVirtual)
Convert the given pointer to a complete class to the given direct base.
bool shouldNullCheckClassCastValue(const CastExpr *ce)
mlir::Value emitAtomicCmpXchg(const clang::CallExpr *expr, bool returnBool, cir::MemOrder successOrder=cir::MemOrder::SequentiallyConsistent, cir::MemOrder failureOrder=cir::MemOrder::SequentiallyConsistent, cir::SyncScopeKind scope=cir::SyncScopeKind::System)
Emit cir.atomic.cmpxchg.
CIRGenBuilderTy & getBuilder()
cir::VectorType getSVEType(const SVETypeFlags &typeFlags)
bool didCallStackSave
Whether a cir.stacksave operation has been added.
void emitDecl(const clang::Decl &d, bool evaluateConditionDecl=false)
LValue emitBinaryOperatorLValue(const BinaryOperator *e)
mlir::Value emitOpenACCIntExpr(const Expr *intExpr)
Address getAddrOfBitFieldStorage(LValue base, const clang::FieldDecl *field, mlir::Type fieldType, unsigned index)
AggValueSlot::Overlap_t getOverlapForBaseInit(const CXXRecordDecl *rd, const CXXRecordDecl *baseRD, bool isVirtual)
Determine whether a base class initialization may overlap some other object.
cir::FuncType getIntrinsicType(llvm::Intrinsic::ID id, llvm::ArrayRef< mlir::Type > overloadTys={})
Return the CIR signature of the LLVM intrinsic id, resolving its overloaded types to overloadTys.
void emitDestroy(Address addr, QualType type, Destroyer *destroyer)
Immediately perform the destruction of the given object.
void emitNonNullArgCheck(RValue rv, QualType argType, SourceLocation argLoc, AbstractCallee ac, unsigned paramNum)
Create a check for a function parameter that may potentially be declared as non-null.
void pushPendingCleanupToEHStack(const PendingCleanupEntry &entry)
Promote a single pending cleanup entry onto the EH scope stack.
const CIRGenModule & getCIRGenModule() const
void startFunction(clang::GlobalDecl gd, clang::QualType returnType, cir::FuncOp fn, cir::FuncType funcType, FunctionArgList args, clang::SourceLocation loc, clang::SourceLocation startLoc)
Emit code for the start of a function.
llvm::DenseMap< const VarDecl *, mlir::Value > nrvoFlags
A mapping from NRVO variables to the flags used to indicate when the NRVO has been applied to this va...
CIRGenModule & getCIRGenModule()
unsigned counterRefTmp
Hold counters for incrementally naming temporaries.
mlir::MLIRContext & getMLIRContext()
mlir::LogicalResult emitOpenACCEnterDataConstruct(const OpenACCEnterDataConstruct &s)
RValue emitCall(const CIRGenFunctionInfo &funcInfo, const CIRGenCallee &callee, ReturnValueSlot returnValue, const CallArgList &args, bool isMustTail, cir::CIRCallOpInterface *callOrTryCall=nullptr)
Destroyer * getDestroyer(clang::QualType::DestructionKind kind)
mlir::Value emitRuntimeCall(mlir::Location loc, cir::FuncOp callee, llvm::ArrayRef< mlir::Value > args={}, mlir::NamedAttrList attrs={})
void Destroyer(CIRGenFunction &cgf, Address addr, QualType ty)
void emitDestructorBody(FunctionArgList &args)
Emits the body of the current destructor.
LValue emitInitListLValue(const InitListExpr *e)
mlir::Value arrayInitIndex
The current array initialization index when evaluating an ArrayInitIndexExpr within an ArrayInitLoopE...
void emitAtomicInit(Expr *init, LValue dest)
void popCleanupBlock(bool forDeactivation=false)
Pop a cleanup block from the stack.
std::optional< SourceRange > currSrcLoc
Use to track source locations across nested visitor traversals.
LValue emitCastLValue(const CastExpr *e)
Casts are never lvalues unless that cast is to a reference type.
LValue emitCXXTypeidLValue(const CXXTypeidExpr *e)
mlir::Value emitLoadOfScalar(LValue lvalue, SourceLocation loc)
EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the...
mlir::Value emitScalarPrePostIncDec(const UnaryOperator *e, LValue lv)
bool containsLabel(const clang::Stmt *s, bool ignoreCaseStmts=false)
Return true if the statement contains a label in it.
DeclMapTy localDeclMap
This keeps track of the CIR allocas or globals for local C declarations.
mlir::Value createOpenACCConstantInt(mlir::Location loc, unsigned width, int64_t value)
RValue emitPseudoObjectRValue(const PseudoObjectExpr *e, AggValueSlot slot=AggValueSlot::ignored())
LValue emitDeclRefLValue(const clang::DeclRefExpr *e)
void emitComplexExprIntoLValue(const Expr *e, LValue dest, bool isInit)
void pushEHDestroyIfNeeded(QualType::DestructionKind dtorKind, Address addr, QualType type)
pushEHDestroyIfNeeded - Push the standard destructor for the given type as an EH-only cleanup.
std::optional< mlir::Value > emitNVPTXBuiltinExpr(unsigned builtinID, const CallExpr *expr)
Emit a call to an NVPTX builtin function.
static void eraseEmptyAndUnusedBlocks(cir::FuncOp func)
Remove leftover empty and unreachable blocks from an emitted function.
llvm::DenseMap< const clang::ValueDecl *, clang::FieldDecl * > lambdaCaptureFields
RValue emitCoawaitExpr(const CoawaitExpr &e, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
ConstantEmission tryEmitAsConstant(const DeclRefExpr *refExpr)
Try to emit a reference to the given value without producing it as an l-value.
bool emitLifetimeStartOp(mlir::Location loc, mlir::Value addr)
RValue emitCall(const CIRGenFunctionInfo &funcInfo, const CIRGenCallee &callee, ReturnValueSlot returnValue, const CallArgList &args, cir::CIRCallOpInterface *callOp, bool isMustTail, SourceRange clangLoc)
mlir::Value emitAlignmentAssumption(mlir::Value ptrValue, QualType ty, SourceLocation loc, SourceLocation assumptionLoc, int64_t alignment, mlir::Value offsetValue=nullptr)
std::optional< mlir::Value > emitSPIRVBuiltinExpr(unsigned builtinID, const CallExpr *expr)
Emit a call to a SPIR-V builtin function.
mlir::LogicalResult emitCaseDefaultCascade(const T *stmt, mlir::Type condType, mlir::ArrayAttr value, cir::CaseOpKind kind, bool buildingTopLevelCase)
void emitCXXThrowExpr(const CXXThrowExpr *e)
void setFastMathFlags(FPOptions fpFeatures)
LValue makeAddrLValue(Address addr, QualType ty, AlignmentSource source=AlignmentSource::Type)
LValue emitMatrixElementExpr(const MatrixElementExpr *e)
int64_t getAccessedFieldNo(unsigned idx, mlir::ArrayAttr elts)
LValue emitPredefinedLValue(const PredefinedExpr *e)
bool isCatchOrCleanupRequired()
RValue emitAnyExpr(const clang::Expr *e, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
Emit code to compute the specified expression which can have any type.
void emitCXXDestructorCall(const CXXDestructorDecl *dd, CXXDtorType type, bool forVirtualBase, bool delegating, Address thisAddr, QualType thisTy)
llvm::SmallVector< VPtr, 4 > VPtrsVector
cir::CoroSizeOp emitCoroSizeBuiltinCall(const CallExpr *e)
void emitLambdaStaticInvokeBody(const CXXMethodDecl *md)
bool sawAsmBlock
Whether or not a Microsoft-style asm block has been processed within this fuction.
void emitEndEHSpec(const clang::Decl *d)
Close the cir.try opened by emitStartEHSpec.
mlir::LogicalResult emitDeclStmt(const clang::DeclStmt &s)
cir::GetGlobalOp createGetCpuFeatures2(mlir::Location loc)
cir::CleanupScopeOp currentFullExprCleanupScope
The cir.cleanup.scope of the innermost FullExprCleanupScope that materialized one,...
llvm::DenseMap< const OpaqueValueExpr *, RValue > opaqueRValues
RValue emitNewOrDeleteBuiltinCall(const FunctionProtoType *type, const CallExpr *callExpr, OverloadedOperatorKind op)
mlir::LogicalResult emitDefaultStmt(const clang::DefaultStmt &s, mlir::Type condType, bool buildingTopLevelCase)
cir::CoroDoneOp emitCoroDoneBuiltinCall(const CallExpr *e)
cir::CoroResumeOp emitCoroResumeBuiltinCall(const CallExpr *e)
mlir::LogicalResult emitLabelStmt(const clang::LabelStmt &s)
Address emitArrayToPointerDecay(const Expr *e, LValueBaseInfo *baseInfo=nullptr)
std::pair< mlir::Value, mlir::Type > emitAsmInput(const TargetInfo::ConstraintInfo &info, const Expr *inputExpr, std::string &constraintString)
EHScopeStack::stable_iterator currentCleanupStackDepth
void emitCXXAggrConstructorCall(const CXXConstructorDecl *ctor, const clang::ArrayType *arrayType, Address arrayBegin, const CXXConstructExpr *e, bool newPointerIsChecked, bool zeroInitialize=false)
Emit a loop to call a particular constructor for each of several members of an array.
cir::CoroAlignOp emitCoroAlignBuiltinCall(const CallExpr *e)
void pushFullExprCleanup(CleanupKind kind, As... a)
Push a cleanup to be run at the end of the current full-expression.
void emitDelegateCallArg(CallArgList &args, const clang::VarDecl *param, clang::SourceLocation loc)
We are performing a delegate call; that is, the current function is delegating to another one.
LexicalScope * curLexScope
void emitAtomicStore(RValue rvalue, LValue dest, bool isInit)
mlir::Value emitStoreThroughBitfieldLValue(RValue src, LValue dstresult)
llvm::DenseMap< const OpaqueValueExpr *, LValue > opaqueLValues
Keeps track of the current set of opaque value expressions.
const CIRGenFunctionInfo * curFnInfo
CIRGenFunction(CIRGenModule &cgm, CIRGenBuilderTy &builder, bool suppressNewContext=false)
cir::CoroIdOp emitCoroIDBuiltinCall(const CallExpr *e)
void terminateStructuredRegionBody(mlir::Region &r, mlir::Location loc)
LValue emitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *e)
LValue emitExtVectorElementExpr(const ExtVectorElementExpr *e)
bool inEHSpecTerminateScope()
Whether the wrapper opened by emitStartEHSpec is a terminate scope, whose handler calls std::terminat...
clang::ASTContext & getContext() const
RValue emitCXXMemberOrOperatorMemberCallExpr(const clang::CallExpr *ce, const clang::CXXMethodDecl *md, ReturnValueSlot returnValue, bool hasQualifier, clang::NestedNameSpecifier qualifier, bool isArrow, const clang::Expr *base)
void setAddrOfLocalVar(const clang::VarDecl *vd, Address addr)
Set the address of a local variable.
mlir::Value emitScalarConstant(const ConstantEmission &constant, Expr *e)
RValue emitBuiltinExpr(const clang::GlobalDecl &gd, unsigned builtinID, const clang::CallExpr *e, ReturnValueSlot returnValue)
void emitSYCLKernelCaller(const clang::OutlinedFunctionDecl *outlinedFnDecl, cir::FuncOp funcOp, cir::FuncType funcType, FunctionArgList &args)
void emitStartEHSpec(const clang::Decl *d)
Wrap the function body in a cir.try that enforces the exception specification of d: a filter handler ...
void emitInheritedCXXConstructorCall(const CXXConstructorDecl *d, bool forVirtualBase, Address thisAddr, bool inheritedFromVBase, const CXXInheritedCtorInitExpr *e)
void emitCXXDeleteExpr(const CXXDeleteExpr *e)
mlir::LogicalResult emitCoroutineBody(const CoroutineBodyStmt &s)
void pushCleanupAfterFullExpr(CleanupKind kind, Address addr, QualType type, Destroyer *destroyer)
Queue a cleanup to be pushed after finishing the current full-expression.
RValue emitCXXOperatorMemberCallExpr(const CXXOperatorCallExpr *e, const CXXMethodDecl *md, ReturnValueSlot returnValue)
mlir::LogicalResult emitCompoundStmt(const clang::CompoundStmt &s, Address *lastValue=nullptr, AggValueSlot slot=AggValueSlot::ignored())
void emitNullabilityCheck(LValue lhs, mlir::Value rhs, clang::SourceLocation loc)
Given an assignment *lhs = rhs, emit a test that checks if rhs is nonnull, if 1LHS is marked _Nonnull...
mlir::LogicalResult emitGotoStmt(const clang::GotoStmt &s)
std::optional< mlir::Value > emitAArch64SVEBuiltinExpr(unsigned builtinID, const CallExpr *expr)
bool inAlwaysInlineAttributedStmt
True if the current statement has always_inline attribute.
bool inNoInlineAttributedStmt
True if the current statement has noinline attribute.
void emitStoreThroughLValue(RValue src, LValue dst, bool isInit=false)
Store the specified rvalue into the specified lvalue, where both are guaranteed to the have the same ...
mlir::Value cxxabiThisValue
bool isLValueSuitableForInlineAtomic(LValue lv)
An LValue is a candidate for having its loads and stores be made atomic if we are operating under /vo...
static llvm::SmallVector< QualType, 2 > getLifetimeExtendedTemporariesWithDestructor(const clang::VarDecl &d)
The types of the temporaries with a destructor that the initializer of the variable d,...
mlir::LogicalResult emitStmt(const clang::Stmt *s, bool useCurrentScope, llvm::ArrayRef< const Attr * > attrs={})
RValue getOrCreateOpaqueRValueMapping(const OpaqueValueExpr *e)
Given an opaque value expression, return its RValue mapping if it exists, otherwise create one.
mlir::Value emitFromMemory(mlir::Value value, clang::QualType ty)
EmitFromMemory - Change a scalar value from its memory representation to its value representation.
mlir::LogicalResult emitCompoundStmtWithoutScope(const clang::CompoundStmt &s, Address *lastValue=nullptr, AggValueSlot slot=AggValueSlot::ignored())
mlir::LogicalResult emitOpenACCExitDataConstruct(const OpenACCExitDataConstruct &s)
void generateThunk(cir::FuncOp fn, SourceRange fnLoc, const CIRGenFunctionInfo &fnInfo, GlobalDecl gd, const ThunkInfo &thunk, bool isUnprototyped)
Generate code for a thunk function.
mlir::LogicalResult emitSYCLKernelCallStmt(const SYCLKernelCallStmt &s)
void emitIgnoredExpr(const clang::Expr *e)
Emit code to compute the specified expression, ignoring the result.
Address createMemTemp(QualType t, mlir::Location loc, const Twine &name="tmp", Address *alloca=nullptr, mlir::OpBuilder::InsertPoint ip={})
Create a temporary memory object of the given type, with appropriate alignmen and cast it to the defa...
void emitDelegatingCXXConstructorCall(const CXXConstructorDecl *ctor, const FunctionArgList &args)
mlir::Value emitDynamicCast(Address thisAddr, const CXXDynamicCastExpr *dce)
void emitAggExpr(const clang::Expr *e, AggValueSlot slot)
mlir::Value emitScalarOrConstFoldImmArg(unsigned iceArguments, unsigned idx, const Expr *argExpr)
Address createDefaultAlignTempAlloca(mlir::Type ty, mlir::Location loc, const Twine &name)
CreateDefaultAlignTempAlloca - This creates an alloca with the default alignment of the corresponding...
mlir::Value emitAlloca(llvm::StringRef name, mlir::Type ty, mlir::Location loc, clang::CharUnits alignment, mlir::OpBuilder::InsertPoint ip, mlir::Value arraySize=nullptr)
mlir::LogicalResult emitOpenACCAtomicConstruct(const OpenACCAtomicConstruct &s)
LValue emitCXXConstructLValue(const CXXConstructExpr *e)
void finishThunk()
Finish generating a thunk function.
RValue emitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *expr)
LValue emitCompoundLiteralLValue(const CompoundLiteralExpr *e)
void emitAutoVarCleanups(const AutoVarEmission &emission)
RValue emitRotate(const CallExpr *e, bool isRotateLeft)
mlir::LogicalResult emitOpenACCLoopConstruct(const OpenACCLoopConstruct &s)
CIRGenCallee emitCallee(const clang::Expr *e)
Address emitAddrOfFieldStorage(Address base, const FieldDecl *field, llvm::StringRef fieldName, unsigned fieldIndex)
This class organizes the cross-function state that is used while generating CIR code.
This class organizes the cross-module state that is used while lowering AST types to CIR types.
A saved depth on the scope stack.
A stack of scopes which respond to exceptions, including cleanups and catch blocks.
Type for representing both the decl and type of parameters to a function.
static LValue makeAddr(Address address, clang::QualType t, LValueBaseInfo baseInfo)
This trivial value class is used to represent the result of an expression that is evaluated.
static RValue get(mlir::Value v)
Contains the address where the return value of a function can be stored, and whether the address is v...
Represents a call to a CUDA kernel function.
Represents binding an expression to a temporary.
CXXCatchStmt - This represents a C++ catch block.
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
A call to an overloaded operator written using operator syntax.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
Represents a C++ temporary.
A C++ throw-expression (C++ [except.throw]).
CXXTryStmt - A C++ try block, including all handlers.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
CaseStmt - Represent a case statement.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
This is an opaque type for sizes expressed in character units.
bool isZero() const
Test whether the quantity equals zero.
llvm::Align getAsAlign() const
Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit bytes.
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
ContinueStmt - This represents a continue.
Represents a 'co_return' statement in the C++ Coroutines TS.
Represents the body of a coroutine.
Represents an expression that might suspend coroutine execution; either a co_await or co_yield expres...
SourceLocExprScopeGuard(const Expr *DefaultExpr, CurrentSourceLocExprScope &Current)
Represents the current source location and context used to determine the value of the source location...
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
DoStmt - This represents a 'do/while' stmt.
This represents one expression.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents a member of a struct/union/class.
Represents a function declaration or definition.
Represents a prototype with parameter type info, e.g.
GlobalDecl - represents a global declaration.
const Decl * getDecl() const
GotoStmt - This represents a direct goto.
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
FPExceptionModeKind
Possible floating point exception behavior.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
This represents 'pragma omp allocate ...' directive.
Pseudo declaration for capturing expressions.
This represents 'pragma omp declare mapper ...' directive.
This represents 'pragma omp declare reduction ...' directive.
This represents 'pragma omp groupprivate ...' directive.
This represents 'pragma omp requires...' directive.
This represents 'pragma omp threadprivate ...' directive.
ObjCMethodDecl - Represents an instance or class method declaration.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Represents a partial function definition.
Represents a parameter to a function.
[C99 6.4.2.2] - A predefined identifier such as func.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
@ DK_objc_strong_lifetime
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
The collection of all-type qualifiers we support.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;.
Flags to identify the types for overloaded SVE builtins.
SYCLKernelCallStmt represents the transformation that is applied to the body of a function declared w...
Encodes a location in the source.
A trivial tuple used to represent a source range.
Stmt - This represents one statement.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
StringLiteral - This represents a string literal expression, e.g.
SwitchStmt - This represents a 'switch' stmt.
Exposes information about the current target.
Represents a declaration of a type.
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * getSizeExpr() const
WhileStmt - This represents a 'while' stmt.
AlignmentSource
The source of the alignment of an l-value; an expression of confidence in the alignment actually matc...
@ Type
The l-value was considered opaque, so the alignment was determined from a type.
@ NormalCleanup
Denotes a cleanup that should run when a scope is exited using normal control flow (falling off the e...
bool checkIfLoopMustProgress(const LangOptions &LangOpts, const CodeGenOptions &CGOpts, ASTContext &Ctx, const Expr *ControllingExpression, bool HasEmptyBody, llvm::function_ref< void()> RemoveMustProgress)
Returns true if a loop must make progress, which means the mustprogress attribute can be added to it.
EvaluationOrder
The order in which the arguments of a call must be evaluated.
const internal::VariadicDynCastAllOfMatcher< Decl, VarDecl > varDecl
Matches variable declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, CallExpr > callExpr
Matches call expressions.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
@ Address
A pointer to a ValueDecl.
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
Top level wrappers for InstallAPI frontend operations.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
CXXCtorType
C++ constructor types.
QualType pointeeType(QualType T)
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start, SourceLocation DirectiveLoc, SourceLocation End, ArrayRef< const OpenACCClause * > Clauses, Stmt *StructuredBlock)
const FunctionProtoType * T
CXXDtorType
C++ destructor types.
U cast(CodeGen::Address addr)
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t int64_t
__builtin_elementwise_add_sat __builtin_elementwise_sub_sat uint32_t uint64_t __builtin_riscv_ssha_i32 __builtin_riscv_sshl_u32 uint64_t
static bool aggValueSlot()
static bool peepholeProtection()
static bool opAllocaEscapeByReference()
static bool generateDebugInfo()
bool wasEmittedAsGlobal() const
AutoVarEmission(const clang::VarDecl &variable)
bool isEscapingByRef
True if the variable is a __block variable that is captured by an escaping block.
Address addr
The address of the alloca for languages with explicit address space (e.g.
bool useLifetimeMarkers
True if lifetime op should be used.
bool emittedAsOffload
True if the variable was emitted as an offload recipe, and thus doesn't have the same sort of alloca ...
const clang::VarDecl * variable
bool isConstantAggregate
True if the variable is of aggregate type and has a constant initializer.
Address getAllocatedAddress() const
Returns the raw, allocated address, which is not necessarily the address of the object itself.
bool wasEmittedAsOffloadClause() const
void setAllocatedAddress(Address a)
Address getObjectAddress(CIRGenFunction &cgf) const
Returns the address of the object within this declaration.
static AutoVarEmission invalid()
std::unique_ptr< CGCoroData > data
CXXDefaultArgExprScope(CIRGenFunction &cfg, const CXXDefaultArgExpr *e)
Scope that deactivates all enclosed deferred cleanups on exit.
size_t oldDeactivateCleanupStackSize
~CleanupDeactivationScope()
CleanupDeactivationScope(CIRGenFunction &cgf)
One record per cir.cleanup.scope opened by a ConditionalEvaluation, as described above.
size_t deferredCleanupStackSize
The size of deferredConditionalCleanupStack when this scope was opened.
cir::CleanupScopeOp scope
std::optional< LValue > lhs
A cleanup that was pushed to the EH stack but whose deactivation is deferred until the enclosing Clea...
EHScopeStack::stable_iterator cleanup
mlir::Operation * dominatingIP
EmittedOrderOrScope(CIRGenFunction &cgf, const Expr *expr)
EmittedOrderOrScope()=default
std::optional< Expr::EvalResult > eval
Represents a scope, including function bodies, compound statements, and the substatements of if/while...
llvm::ArrayRef< mlir::Block * > getRetBlocks()
mlir::Block * getOrCreateRetBlock(CIRGenFunction &cgf, mlir::Location loc)
LexicalScope(CIRGenFunction &cgf, mlir::Location loc, mlir::Block *eb)
void markCoreturnEmitted()
void setAsTry(cir::TryOp op)
void clearCoreturnInEnclosingScopes()
mlir::Block * getEntryBlock()
void updateRetLoc(mlir::Block *b, mlir::Location loc)
cir::TryOp getClosestTryParent()
void setRetVal(mlir::Value v)
mlir::Location getRetLoc(mlir::Block *b)
Set by emitAutoVarDeclWithCapturedCleanups while it emits the initializer of a variable,...
const clang::ValueDecl * extendingDecl
CapturedCleanups * cleanups
llvm::SmallVector< mlir::Value > bounds
llvm::SmallVector< QualType > boundTypes
A cleanup whose destructor call is not emitted where the cleanup is registered.
CapturedCleanups * capturedBy
If set, the cleanup is captured by this owner instead of opening a cir.cleanup.scope when it is pushe...
llvm::PointerUnion< const clang::FunctionProtoType *, const clang::ObjCMethodDecl * > p
PrototypeWrapper(const clang::ObjCMethodDecl *md)
PrototypeWrapper(const clang::FunctionProtoType *ft)
const clang::CXXRecordDecl * vtableClass
clang::CharUnits offsetFromNearestVBase
const clang::CXXRecordDecl * nearestVBase
clang::BaseSubobject base
VlaSizePair(mlir::Value num, QualType ty)
virtual mlir::LogicalResult operator()(CIRGenFunction &cgf)=0
virtual ~cxxTryBodyEmitter()=default
EvalResult is a struct with detailed info about an evaluated expression.
The this pointer adjustment as well as an optional return adjustment for a thunk.