14 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENFUNCTION_H 15 #define LLVM_CLANG_LIB_CODEGEN_CODEGENFUNCTION_H 35 #include "llvm/ADT/ArrayRef.h" 36 #include "llvm/ADT/DenseMap.h" 37 #include "llvm/ADT/MapVector.h" 38 #include "llvm/ADT/SmallVector.h" 39 #include "llvm/IR/ValueHandle.h" 40 #include "llvm/Support/Debug.h" 41 #include "llvm/Transforms/Utils/SanitizerStats.h" 57 class CXXDestructorDecl;
58 class CXXForRangeStmt;
62 class EnumConstantDecl;
64 class FunctionProtoType;
66 class ObjCContainerDecl;
67 class ObjCInterfaceDecl;
70 class ObjCImplementationDecl;
71 class ObjCPropertyImplDecl;
74 class ObjCForCollectionStmt;
76 class ObjCAtThrowStmt;
77 class ObjCAtSynchronizedStmt;
78 class ObjCAutoreleasePoolStmt;
80 namespace analyze_os_log {
81 class OSLogBufferLayout;
91 class BlockByrefHelpers;
94 class BlockFieldFlags;
95 class RegionCodeGenTy;
96 class TargetCodeGenInfo;
111 #define LIST_SANITIZER_CHECKS \ 112 SANITIZER_CHECK(AddOverflow, add_overflow, 0) \ 113 SANITIZER_CHECK(BuiltinUnreachable, builtin_unreachable, 0) \ 114 SANITIZER_CHECK(CFICheckFail, cfi_check_fail, 0) \ 115 SANITIZER_CHECK(DivremOverflow, divrem_overflow, 0) \ 116 SANITIZER_CHECK(DynamicTypeCacheMiss, dynamic_type_cache_miss, 0) \ 117 SANITIZER_CHECK(FloatCastOverflow, float_cast_overflow, 0) \ 118 SANITIZER_CHECK(FunctionTypeMismatch, function_type_mismatch, 0) \ 119 SANITIZER_CHECK(InvalidBuiltin, invalid_builtin, 0) \ 120 SANITIZER_CHECK(LoadInvalidValue, load_invalid_value, 0) \ 121 SANITIZER_CHECK(MissingReturn, missing_return, 0) \ 122 SANITIZER_CHECK(MulOverflow, mul_overflow, 0) \ 123 SANITIZER_CHECK(NegateOverflow, negate_overflow, 0) \ 124 SANITIZER_CHECK(NullabilityArg, nullability_arg, 0) \ 125 SANITIZER_CHECK(NullabilityReturn, nullability_return, 1) \ 126 SANITIZER_CHECK(NonnullArg, nonnull_arg, 0) \ 127 SANITIZER_CHECK(NonnullReturn, nonnull_return, 1) \ 128 SANITIZER_CHECK(OutOfBounds, out_of_bounds, 0) \ 129 SANITIZER_CHECK(PointerOverflow, pointer_overflow, 0) \ 130 SANITIZER_CHECK(ShiftOutOfBounds, shift_out_of_bounds, 0) \ 131 SANITIZER_CHECK(SubOverflow, sub_overflow, 0) \ 132 SANITIZER_CHECK(TypeMismatch, type_mismatch, 1) \ 133 SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0) 136 #define SANITIZER_CHECK(Enum, Name, Version) Enum, 138 #undef SANITIZER_CHECK 152 JumpDest() : Block(nullptr), ScopeDepth(), Index(0) {}
156 : Block(Block), ScopeDepth(Depth), Index(Index) {}
158 bool isValid()
const {
return Block !=
nullptr; }
159 llvm::BasicBlock *
getBlock()
const {
return Block; }
169 llvm::BasicBlock *Block;
190 const unsigned,
const bool)>
194 typedef llvm::function_ref<std::pair<LValue, LValue>(
199 typedef llvm::function_ref<std::pair<llvm::Value *, llvm::Value *>(
206 void InsertHelper(llvm::Instruction *I,
const llvm::Twine &Name,
207 llvm::BasicBlock *BB,
208 llvm::BasicBlock::iterator InsertPt)
const;
223 std::unique_ptr<CGCoroData>
Data;
230 return CurCoro.
Data !=
nullptr;
250 return CurLexicalScope->hasLabels();
251 return !LabelMap.empty();
262 :
Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {}
265 :
Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {
271 I != E; ++I, ++Field) {
272 if (I->capturesThis())
273 CXXThisFieldDecl = *Field;
274 else if (I->capturesVariable())
275 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
276 else if (I->capturesVariableByCopy())
277 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
315 llvm::SmallDenseMap<const VarDecl *, FieldDecl *> CaptureFields;
329 CodeGenFunction &CGF;
334 : CGF(CGF), PrevCapturedStmtInfo(CGF.CapturedStmtInfo) {
343 const Decl *CalleeDecl;
350 return dyn_cast_or_null<FunctionDecl>(CalleeDecl);
354 if (
const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl))
355 return FD->getNumParams();
356 return cast<ObjCMethodDecl>(CalleeDecl)->param_size();
359 if (
const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl))
360 return FD->getParamDecl(I);
361 return *(cast<ObjCMethodDecl>(CalleeDecl)->param_begin() + I);
373 CodeGenFunction *CGF;
404 llvm::DenseMap<const VarDecl *, llvm::Value *>
NRVOFlags;
410 llvm::Instruction *CurrentFuncletPad =
nullptr;
418 : Addr(addr.getPointer()), Size(size) {}
464 llvm::BasicBlock *EmitLandingPad();
466 llvm::BasicBlock *getInvokeDestImpl();
484 llvm::Constant *BeginCatchFn;
488 llvm::AllocaInst *ForEHVar;
492 llvm::AllocaInst *SavedExnVar;
495 void enter(CodeGenFunction &CGF,
const Stmt *Finally,
496 llvm::Constant *beginCatchFn, llvm::Constant *endCatchFn,
497 llvm::Constant *rethrowFn);
498 void exit(CodeGenFunction &CGF);
506 return CurrentFuncletPad && isa<llvm::CleanupPadInst>(CurrentFuncletPad);
512 template <
class T,
class... As>
516 if (!isInConditionalBranch())
517 return EHStack.pushCleanup<T>(
kind, A...);
520 typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
521 SavedTuple Saved{saveValueInCond(A)...};
525 initFullExprCleanup();
530 template <
class T,
class... As>
532 assert(!isInConditionalBranch() &&
"can't defer conditional cleanup");
536 size_t OldSize = LifetimeExtendedCleanupStack.size();
537 LifetimeExtendedCleanupStack.resize(
538 LifetimeExtendedCleanupStack.size() +
sizeof(Header) + Header.
Size);
540 static_assert(
sizeof(Header) %
alignof(T) == 0,
541 "Cleanup will be allocated on misaligned address");
542 char *Buffer = &LifetimeExtendedCleanupStack[OldSize];
544 new (Buffer +
sizeof(Header))
T(A...);
549 void initFullExprCleanup();
564 void PopCleanupBlock(
bool FallThroughIsBranchThrough =
false);
575 llvm::Instruction *DominatingIP);
585 llvm::Instruction *DominatingIP);
591 size_t LifetimeExtendedCleanupStackSize;
592 bool OldDidCallStackSave;
606 : PerformCleanup(
true), CGF(CGF)
609 LifetimeExtendedCleanupStackSize =
611 OldDidCallStackSave = CGF.DidCallStackSave;
612 CGF.DidCallStackSave =
false;
632 void ForceCleanup(std::initializer_list<llvm::Value**> ValuesToReload = {}) {
633 assert(PerformCleanup &&
"Already forced cleanup");
634 CGF.DidCallStackSave = OldDidCallStackSave;
637 PerformCleanup =
false;
653 CGF.CurLexicalScope =
this;
659 assert(PerformCleanup &&
"adding label to dead scope?");
660 Labels.push_back(label);
671 if (PerformCleanup) {
680 CGF.CurLexicalScope = ParentScope;
681 RunCleanupsScope::ForceCleanup();
688 return !Labels.empty();
691 void rescopeLabels();
694 typedef llvm::DenseMap<const Decl *, Address>
DeclMapTy;
700 DeclMapTy SavedLocals;
701 DeclMapTy SavedPrivates;
718 llvm::function_ref<
Address()> PrivateGen) {
719 assert(PerformCleanup &&
"adding private to dead scope");
723 if (SavedLocals.count(LocalVD))
return false;
726 auto it = CGF.LocalDeclMap.find(LocalVD);
727 if (it != CGF.LocalDeclMap.end()) {
728 SavedLocals.insert({LocalVD, it->second});
730 SavedLocals.insert({LocalVD, Address::invalid()});
741 SavedPrivates.insert({LocalVD, Addr});
755 copyInto(SavedPrivates, CGF.LocalDeclMap);
756 SavedPrivates.clear();
757 return !SavedLocals.empty();
761 RunCleanupsScope::ForceCleanup();
762 copyInto(SavedLocals, CGF.LocalDeclMap);
781 static void copyInto(
const DeclMapTy &src, DeclMapTy &dest) {
782 for (
auto &pair : src) {
783 if (!pair.second.isValid()) {
784 dest.erase(pair.first);
788 auto it = dest.find(pair.first);
789 if (it != dest.end()) {
790 it->second = pair.second;
802 std::initializer_list<llvm::Value **> ValuesToReload = {});
809 size_t OldLifetimeExtendedStackSize,
810 std::initializer_list<llvm::Value **> ValuesToReload = {});
812 void ResolveBranchFixups(llvm::BasicBlock *Target);
820 NextCleanupDestIndex++);
827 return getJumpDestInCurrentScope(createBasicBlock(Name));
833 void EmitBranchThroughCleanup(
JumpDest Dest);
838 bool isObviouslyBranchWithoutCleanups(
JumpDest Dest)
const;
843 void popCatchScope();
845 llvm::BasicBlock *getEHResumeBlock(
bool isCleanup);
851 llvm::BasicBlock *StartBB;
855 : StartBB(CGF.Builder.GetInsertBlock()) {}
858 assert(CGF.OutermostConditional !=
this);
859 if (!CGF.OutermostConditional)
860 CGF.OutermostConditional =
this;
863 void end(CodeGenFunction &CGF) {
864 assert(CGF.OutermostConditional !=
nullptr);
865 if (CGF.OutermostConditional ==
this)
866 CGF.OutermostConditional =
nullptr;
881 assert(isInConditionalBranch());
882 llvm::BasicBlock *block = OutermostConditional->getStartingBlock();
883 auto store =
new llvm::StoreInst(value, addr.
getPointer(), &block->back());
890 CodeGenFunction &CGF;
899 : CGF(CGF), SavedOutermostConditional(CGF.OutermostConditional) {
900 CGF.OutermostConditional =
nullptr;
904 CGF.OutermostConditional = SavedOutermostConditional;
913 llvm::Instruction *Inst;
914 friend class CodeGenFunction;
933 : OpaqueValue(ov), BoundLValue(boundLValue) {}
945 hasAggregateEvaluationKind(expr->
getType());
951 if (shouldBindAsLValue(ov))
959 assert(shouldBindAsLValue(ov));
960 CGF.OpaqueLValues.insert(std::make_pair(ov, lv));
967 assert(!shouldBindAsLValue(ov));
968 CGF.OpaqueRValues.insert(std::make_pair(ov, rv));
980 bool isValid()
const {
return OpaqueValue !=
nullptr; }
981 void clear() { OpaqueValue =
nullptr; }
984 assert(OpaqueValue &&
"no data to unbind!");
987 CGF.OpaqueLValues.erase(OpaqueValue);
989 CGF.OpaqueRValues.erase(OpaqueValue);
997 CodeGenFunction &CGF;
1002 return OpaqueValueMappingData::shouldBindAsLValue(expr);
1012 if (isa<ConditionalOperator>(op))
1026 assert(OV->
getSourceExpr() &&
"wrong form of OpaqueValueMapping used " 1027 "for OVE with no source expression");
1028 Data = OpaqueValueMappingData::bind(CGF, OV, OV->
getSourceExpr());
1056 bool DisableDebugInfo;
1060 bool DidCallStackSave;
1066 llvm::IndirectBrInst *IndirectBranch;
1070 DeclMapTy LocalDeclMap;
1075 llvm::SmallDenseMap<const ParmVarDecl *, const ImplicitParamDecl *, 2>
1080 llvm::DenseMap<llvm::AllocaInst *, int> EscapedLocals;
1083 llvm::DenseMap<const LabelDecl*, JumpDest> LabelMap;
1087 struct BreakContinue {
1089 : BreakBlock(Break), ContinueBlock(Continue) {}
1097 class OpenMPCancelExitStack {
1101 CancelExit() =
default;
1104 :
Kind(Kind), ExitBlock(ExitBlock), ContBlock(ContBlock) {}
1108 bool HasBeenEmitted =
false;
1116 OpenMPCancelExitStack() : Stack(1) {}
1117 ~OpenMPCancelExitStack() =
default;
1119 JumpDest getExitBlock()
const {
return Stack.back().ExitBlock; }
1123 const llvm::function_ref<
void(CodeGenFunction &)> &CodeGen) {
1124 if (Stack.back().Kind == Kind && getExitBlock().isValid()) {
1127 assert(!Stack.back().HasBeenEmitted);
1128 auto IP = CGF.
Builder.saveAndClearIP();
1129 CGF.
EmitBlock(Stack.back().ExitBlock.getBlock());
1131 CGF.
EmitBranch(Stack.back().ContBlock.getBlock());
1133 Stack.back().HasBeenEmitted =
true;
1142 Stack.push_back({
Kind,
1150 void exit(CodeGenFunction &CGF) {
1151 if (getExitBlock().isValid()) {
1154 if (!Stack.back().HasBeenEmitted) {
1157 CGF.
EmitBlock(Stack.back().ExitBlock.getBlock());
1160 CGF.
EmitBlock(Stack.back().ContBlock.getBlock());
1162 CGF.
Builder.CreateUnreachable();
1163 CGF.
Builder.ClearInsertionPoint();
1169 OpenMPCancelExitStack OMPCancelStack;
1174 llvm::MDNode *createProfileWeights(uint64_t TrueCount, uint64_t FalseCount);
1176 llvm::MDNode *createProfileWeightsForLoop(
const Stmt *Cond,
1177 uint64_t LoopCount);
1191 if (!Count.hasValue())
1211 llvm::SwitchInst *SwitchInsn;
1217 llvm::BasicBlock *CaseRangeBlock;
1221 llvm::DenseMap<const OpaqueValueExpr *, LValue> OpaqueLValues;
1222 llvm::DenseMap<const OpaqueValueExpr *, RValue> OpaqueRValues;
1230 llvm::DenseMap<const Expr*, llvm::Value*> VLASizeMap;
1234 llvm::BasicBlock *UnreachableBlock;
1237 unsigned NumReturnExprs;
1240 unsigned NumSimpleReturnExprs;
1252 : CGF(CGF), OldCXXDefaultInitExprThis(CGF.CXXDefaultInitExprThis) {
1253 CGF.CXXDefaultInitExprThis = This;
1256 CGF.CXXDefaultInitExprThis = OldCXXDefaultInitExprThis;
1260 CodeGenFunction &CGF;
1261 Address OldCXXDefaultInitExprThis;
1269 : CGF(CGF), OldCXXThisValue(CGF.CXXThisValue),
1270 OldCXXThisAlignment(CGF.CXXThisAlignment) {
1271 CGF.CXXThisValue = CGF.CXXDefaultInitExprThis.
getPointer();
1272 CGF.CXXThisAlignment = CGF.CXXDefaultInitExprThis.
getAlignment();
1275 CGF.CXXThisValue = OldCXXThisValue;
1276 CGF.CXXThisAlignment = OldCXXThisAlignment;
1290 : CGF(CGF), OldArrayInitIndex(CGF.ArrayInitIndex) {
1291 CGF.ArrayInitIndex = Index;
1294 CGF.ArrayInitIndex = OldArrayInitIndex;
1298 CodeGenFunction &CGF;
1305 : CGF(CGF), OldCurGD(CGF.CurGD), OldCurFuncDecl(CGF.CurFuncDecl),
1306 OldCurCodeDecl(CGF.CurCodeDecl),
1307 OldCXXABIThisDecl(CGF.CXXABIThisDecl),
1308 OldCXXABIThisValue(CGF.CXXABIThisValue),
1309 OldCXXThisValue(CGF.CXXThisValue),
1310 OldCXXABIThisAlignment(CGF.CXXABIThisAlignment),
1311 OldCXXThisAlignment(CGF.CXXThisAlignment),
1312 OldReturnValue(CGF.ReturnValue), OldFnRetTy(CGF.FnRetTy),
1313 OldCXXInheritedCtorInitExprArgs(
1314 std::move(CGF.CXXInheritedCtorInitExprArgs)) {
1317 cast<CXXConstructorDecl>(GD.
getDecl());
1318 CGF.CXXABIThisDecl =
nullptr;
1319 CGF.CXXABIThisValue =
nullptr;
1320 CGF.CXXThisValue =
nullptr;
1325 CGF.CXXInheritedCtorInitExprArgs.clear();
1328 CGF.
CurGD = OldCurGD;
1331 CGF.CXXABIThisDecl = OldCXXABIThisDecl;
1332 CGF.CXXABIThisValue = OldCXXABIThisValue;
1333 CGF.CXXThisValue = OldCXXThisValue;
1334 CGF.CXXABIThisAlignment = OldCXXABIThisAlignment;
1335 CGF.CXXThisAlignment = OldCXXThisAlignment;
1338 CGF.CXXInheritedCtorInitExprArgs =
1339 std::move(OldCXXInheritedCtorInitExprArgs);
1343 CodeGenFunction &CGF;
1345 const Decl *OldCurFuncDecl;
1346 const Decl *OldCurCodeDecl;
1368 Address CXXDefaultInitExprThis = Address::invalid();
1397 llvm::DenseMap<const ValueDecl *, BlockByrefInfo> BlockByrefInfos;
1401 llvm::Value *RetValNullabilityPrecondition =
nullptr;
1405 bool requiresReturnValueNullabilityCheck()
const {
1406 return RetValNullabilityPrecondition;
1411 Address ReturnLocation = Address::invalid();
1414 bool requiresReturnValueCheck()
const {
1415 return requiresReturnValueNullabilityCheck() ||
1416 (SanOpts.
has(SanitizerKind::ReturnsNonnullAttribute) &&
1417 CurCodeDecl && CurCodeDecl->
getAttr<ReturnsNonNullAttr>());
1420 llvm::BasicBlock *TerminateLandingPad;
1421 llvm::BasicBlock *TerminateHandler;
1422 llvm::BasicBlock *TrapBB;
1425 llvm::MapVector<llvm::Value *, llvm::BasicBlock *> TerminateFunclets;
1428 const bool ShouldEmitLifetimeMarkers;
1433 llvm::Function *Fn);
1436 CodeGenFunction(
CodeGenModule &cgm,
bool suppressNewContext=
false);
1442 if (DisableDebugInfo)
1465 Address getNormalCleanupDestSlot();
1468 if (!UnreachableBlock) {
1469 UnreachableBlock = createBasicBlock(
"unreachable");
1470 new llvm::UnreachableInst(getLLVMContext(), UnreachableBlock);
1472 return UnreachableBlock;
1477 return getInvokeDestImpl();
1494 void pushIrregularPartialArrayCleanup(
llvm::Value *arrayBegin,
1498 Destroyer *destroyer);
1499 void pushRegularPartialArrayCleanup(
llvm::Value *arrayBegin,
1503 Destroyer *destroyer);
1510 Destroyer *destroyer,
bool useEHCleanupForArray);
1513 bool useEHCleanupForArray);
1514 void pushCallObjectDeleteCleanup(
const FunctionDecl *OperatorDelete,
1519 bool useEHCleanupForArray);
1521 Destroyer *destroyer,
1522 bool useEHCleanupForArray,
1526 Destroyer *destroyer,
1527 bool checkZeroLength,
bool useEHCleanup);
1535 case QualType::DK_none:
1537 case QualType::DK_cxx_destructor:
1538 case QualType::DK_objc_weak_lifetime:
1539 return getLangOpts().Exceptions;
1540 case QualType::DK_objc_strong_lifetime:
1541 return getLangOpts().Exceptions &&
1544 llvm_unreachable(
"bad destruction kind");
1565 llvm::Constant *AtomicHelperFn);
1576 llvm::Constant *AtomicHelperFn);
1589 llvm::Function **InvokeF =
nullptr);
1592 llvm::Function *GenerateBlockFunction(
GlobalDecl GD,
1594 const DeclMapTy &ldm,
1595 bool IsLambdaConversionToBlock,
1596 bool BuildGlobalBlock);
1598 llvm::Constant *GenerateCopyHelperFunction(
const CGBlockInfo &blockInfo);
1599 llvm::Constant *GenerateDestroyHelperFunction(
const CGBlockInfo &blockInfo);
1600 llvm::Constant *GenerateObjCAtomicSetterCopyHelperFunction(
1602 llvm::Constant *GenerateObjCAtomicGetterCopyHelperFunction(
1622 bool followForward =
true);
1626 const llvm::Twine &name);
1632 void GenerateCode(
GlobalDecl GD, llvm::Function *Fn,
1651 void EmitBlockWithFallThrough(llvm::BasicBlock *BB,
const Stmt *S);
1653 void EmitForwardingCallToLambda(
const CXXMethodDecl *LambdaCallOperator,
1655 void EmitLambdaBlockInvokeBody();
1656 void EmitLambdaDelegatingInvokeBody(
const CXXMethodDecl *MD);
1658 void EmitAsanPrologueOrEpilogue(
bool Prologue);
1664 llvm::DebugLoc EmitReturnBlock();
1670 void StartThunk(llvm::Function *Fn,
GlobalDecl GD,
1673 void EmitCallAndReturnForThunk(llvm::Constant *Callee,
1683 void generateThunk(llvm::Function *Fn,
const CGFunctionInfo &FnInfo,
1686 llvm::Function *GenerateVarArgsThunk(llvm::Function *Fn,
1704 void InitializeVTablePointer(
const VPtr &vptr);
1709 VPtrsVector getVTablePointers(
const CXXRecordDecl *VTableClass);
1713 bool BaseIsNonVirtualPrimaryBase,
1715 VisitedVirtualBasesSetTy &VBases, VPtrsVector &vptrs);
1717 void InitializeVTablePointers(
const CXXRecordDecl *ClassDecl);
1758 bool ShouldEmitVTableTypeCheckedLoad(
const CXXRecordDecl *RD);
1762 uint64_t VTableByteOffset);
1772 bool ShouldInstrumentFunction();
1776 bool ShouldXRayInstrumentFunction()
const;
1780 bool AlwaysEmitXRayCustomEvents()
const;
1783 llvm::Constant *EncodeAddrForUseInPrologue(llvm::Function *F,
1784 llvm::Constant *Addr);
1800 void EmitFunctionEpilog(
const CGFunctionInfo &FI,
bool EmitRetDbgLoc,
1807 void EmitStartEHSpec(
const Decl *D);
1810 void EmitEndEHSpec(
const Decl *D);
1813 llvm::BasicBlock *getTerminateLandingPad();
1817 llvm::BasicBlock *getTerminateFunclet();
1822 llvm::BasicBlock *getTerminateHandler();
1824 llvm::Type *ConvertTypeForMem(
QualType T);
1825 llvm::Type *ConvertType(
QualType T);
1827 return ConvertType(getContext().getTypeDeclType(T));
1850 llvm::Function *parent =
nullptr,
1851 llvm::BasicBlock *before =
nullptr) {
1866 void SimplifyForwardingBlocks(llvm::BasicBlock *BB);
1876 void EmitBlock(llvm::BasicBlock *BB,
bool IsFinished=
false);
1880 void EmitBlockAfterUses(llvm::BasicBlock *BB);
1890 void EmitBranch(llvm::BasicBlock *Block);
1895 return Builder.GetInsertBlock() !=
nullptr;
1903 if (!HaveInsertPoint())
1904 EmitBlock(createBasicBlock());
1909 void ErrorUnsupported(
const Stmt *S,
const char *Type);
1917 return LValue::MakeAddr(Addr, T, getContext(),
LValueBaseInfo(Source),
1923 return LValue::MakeAddr(Addr, T, getContext(), BaseInfo, TBAAInfo);
1928 return LValue::MakeAddr(
Address(V, Alignment), T, getContext(),
1934 return LValue::MakeAddr(
Address(V, Alignment), T, getContext(),
1935 BaseInfo, TBAAInfo);
1943 bool forPointeeType =
false);
1954 AlignmentSource::Type) {
1957 return EmitLoadOfReferenceLValue(RefLVal);
1989 llvm::AllocaInst *CreateTempAlloca(llvm::Type *Ty,
const Twine &Name =
"tmp",
1992 const Twine &Name =
"tmp",
1994 bool CastToDefaultAddrSpace =
true);
2006 Address CreateDefaultAlignTempAlloca(llvm::Type *Ty,
2007 const Twine &Name =
"tmp");
2032 bool CastToDefaultAddrSpace =
true);
2034 bool CastToDefaultAddrSpace =
true);
2039 return AggValueSlot::forAddr(CreateMemTemp(T, Name),
2041 AggValueSlot::IsNotDestructed,
2042 AggValueSlot::DoesNotNeedGCBarriers,
2043 AggValueSlot::IsNotAliased);
2054 void EmitIgnoredExpr(
const Expr *E);
2064 bool ignoreResult =
false);
2081 void EmitAnyExprToMem(
const Expr *E,
Address Location,
2084 void EmitAnyExprToExn(
const Expr *E,
Address Addr);
2089 bool capturedByInit);
2095 const RecordDecl *RD = cast<RecordDecl>(RT->getDecl());
2106 bool IsVolatile = hasVolatileMember(EltTy);
2107 EmitAggregateCopy(DestPtr, SrcPtr, EltTy, IsVolatile,
true);
2112 EmitAggregateCopy(DestPtr, SrcPtr, SrcTy,
false,
2123 QualType EltTy,
bool isVolatile=
false,
2124 bool isAssignment =
false);
2128 auto it = LocalDeclMap.find(VD);
2129 assert(it != LocalDeclMap.end() &&
2130 "Invalid argument to GetAddrOfLocalVar(), no decl!");
2137 assert(OpaqueValueMapping::shouldBindAsLValue(e));
2139 llvm::DenseMap<const OpaqueValueExpr*,LValue>::iterator
2140 it = OpaqueLValues.find(e);
2141 assert(it != OpaqueLValues.end() &&
"no mapping for opaque value!");
2148 assert(!OpaqueValueMapping::shouldBindAsLValue(e));
2150 llvm::DenseMap<const OpaqueValueExpr*,RValue>::iterator
2151 it = OpaqueRValues.find(e);
2152 assert(it != OpaqueRValues.end() &&
"no mapping for opaque value!");
2161 static unsigned getAccessedFieldNo(
unsigned Idx,
const llvm::Constant *Elts);
2163 llvm::BlockAddress *GetAddrOfLabel(
const LabelDecl *L);
2164 llvm::BasicBlock *GetIndirectGotoBlock();
2167 static bool IsWrappedCXXThis(
const Expr *E);
2202 void EmitVariablyModifiedType(
QualType Ty);
2209 std::pair<llvm::Value*,QualType> getVLASize(
QualType vla);
2214 assert(CXXThisValue &&
"no 'this' value for this function");
2215 return CXXThisValue;
2224 assert(CXXStructorImplicitParamValue &&
"no VTT value for this function");
2225 return CXXStructorImplicitParamValue;
2231 GetAddressOfDirectBaseInCompleteClass(
Address Value,
2234 bool BaseIsVirtual);
2236 static bool ShouldNullCheckClassCastValue(
const CastExpr *Cast);
2250 bool NullCheckValue);
2276 bool ForVirtualBase,
2284 bool ForVirtualBase,
Address This,
2285 bool InheritedFromVBase,
2289 bool ForVirtualBase,
bool Delegating,
2293 bool ForVirtualBase,
bool Delegating,
2301 void EmitVTableAssumptionLoad(
const VPtr &vptr,
Address This);
2311 bool ZeroInitialization =
false);
2317 bool ZeroInitialization =
false);
2322 bool ForVirtualBase,
bool Delegating,
2326 llvm::Type *ElementTy,
Address NewPtr,
2344 const Expr *Arg,
bool IsDelete);
2385 TCK_DynamicOperation
2396 bool sanitizePerformTypeCheck()
const;
2408 QualType IndexType,
bool Accessed);
2411 bool isInc,
bool isPre);
2413 bool isInc,
bool isPre);
2417 Builder.CreateAlignmentAssumption(CGM.
getDataLayout(), PtrValue, Alignment,
2432 void EmitDecl(
const Decl &D);
2437 void EmitVarDecl(
const VarDecl &D);
2440 bool capturedByInit);
2447 bool isTrivialInitializer(
const Expr *Init);
2452 void EmitAutoVarDecl(
const VarDecl &D);
2455 friend class CodeGenFunction;
2470 bool IsConstantAggregate;
2479 : Variable(&variable), Addr(
Address::invalid()), NRVOFlag(nullptr),
2481 SizeForLifetimeMarkers(nullptr) {}
2483 bool wasEmittedAsGlobal()
const {
return !Addr.
isValid(); }
2489 return SizeForLifetimeMarkers !=
nullptr;
2492 assert(useLifetimeMarkers());
2493 return SizeForLifetimeMarkers;
2506 if (!IsByRef)
return Addr;
2517 void EmitStaticVarDecl(
const VarDecl &D,
2518 llvm::GlobalValue::LinkageTypes
Linkage);
2537 assert(!isIndirect());
2542 assert(isIndirect());
2543 return Address(Value, CharUnits::fromQuantity(Alignment));
2564 Builder.CreateAlignmentAssumption(CGM.
getDataLayout(), PtrValue, Alignment,
2573 void EmitStopPoint(
const Stmt *S);
2589 bool EmitSimpleStmt(
const Stmt *S);
2594 bool GetLast =
false,
2596 AggValueSlot::ignored());
2604 void EmitGotoStmt(
const GotoStmt &S);
2606 void EmitIfStmt(
const IfStmt &S);
2611 void EmitForStmt(
const ForStmt &S,
2614 void EmitDeclStmt(
const DeclStmt &S);
2619 void EmitCaseStmt(
const CaseStmt &S);
2620 void EmitCaseStmtRange(
const CaseStmt &S);
2621 void EmitAsmStmt(
const AsmStmt &S);
2633 bool ignoreResult =
false);
2637 bool ignoreResult =
false);
2639 RValue EmitCoroutineIntrinsic(
const CallExpr *E,
unsigned int IID);
2641 void EnterCXXTryStmt(
const CXXTryStmt &S,
bool IsFnTryBlock =
false);
2642 void ExitCXXTryStmt(
const CXXTryStmt &S,
bool IsFnTryBlock =
false);
2650 void startOutlinedSEHHelper(CodeGenFunction &ParentCGF,
bool IsFilter,
2651 const Stmt *OutlinedStmt);
2653 llvm::Function *GenerateSEHFilterFunction(CodeGenFunction &ParentCGF,
2656 llvm::Function *GenerateSEHFinallyFunction(CodeGenFunction &ParentCGF,
2659 void EmitSEHExceptionCodeSave(CodeGenFunction &ParentCGF,
2672 void EmitCapturedLocals(CodeGenFunction &ParentCGF,
const Stmt *OutlinedStmt,
2680 Address recoverAddrOfEscapedLocal(CodeGenFunction &ParentCGF,
2689 CodeGenFunction &CGF;
2695 CGF.OMPCancelStack.enter(CGF, Kind, HasCancel);
2704 llvm::Function *GenerateCapturedStmtFunction(
const CapturedStmt &S);
2706 llvm::Function *GenerateOpenMPCapturedStmtFunction(
const CapturedStmt &S);
2720 void EmitOMPAggregateAssign(
2734 void EmitOMPCopy(
QualType OriginalType,
2751 std::pair<bool, RValue> EmitOMPAtomicSimpleUpdateExpr(
2759 void EmitOMPUseDevicePtrClause(
2761 const llvm::DenseMap<const ValueDecl *, Address> &CaptureDeviceAddrMap);
2803 void EmitOMPLinearClauseFinal(
2805 const llvm::function_ref<
llvm::Value *(CodeGenFunction &)> &CondGen);
2830 typedef const llvm::function_ref<void(CodeGenFunction & ,
2841 unsigned NumberOfTargetItems = 0;
2844 Address SizesArray,
unsigned NumberOfTargetItems)
2845 : BasePointersArray(BasePointersArray), PointersArray(PointersArray),
2846 SizesArray(SizesArray), NumberOfTargetItems(NumberOfTargetItems) {}
2888 void EmitOMPDistributeParallelForDirective(
2890 void EmitOMPDistributeParallelForSimdDirective(
2893 void EmitOMPTargetParallelForSimdDirective(
2899 void EmitOMPTeamsDistributeParallelForSimdDirective(
2901 void EmitOMPTeamsDistributeParallelForDirective(
2904 void EmitOMPTargetTeamsDistributeDirective(
2906 void EmitOMPTargetTeamsDistributeParallelForDirective(
2908 void EmitOMPTargetTeamsDistributeParallelForSimdDirective(
2910 void EmitOMPTargetTeamsDistributeSimdDirective(
2915 StringRef ParentName,
2918 EmitOMPTargetParallelDeviceFunction(
CodeGenModule &CGM, StringRef ParentName,
2921 static void EmitOMPTargetParallelForDeviceFunction(
2925 static void EmitOMPTargetParallelForSimdDeviceFunction(
2930 EmitOMPTargetTeamsDeviceFunction(
CodeGenModule &CGM, StringRef ParentName,
2933 static void EmitOMPTargetTeamsDistributeDeviceFunction(
2937 static void EmitOMPTargetTeamsDistributeSimdDeviceFunction(
2941 static void EmitOMPTargetSimdDeviceFunction(
CodeGenModule &CGM,
2942 StringRef ParentName,
2954 void EmitOMPInnerLoop(
2955 const Stmt &S,
bool RequiresCleanup,
const Expr *LoopCond,
2956 const Expr *IncExpr,
2957 const llvm::function_ref<
void(CodeGenFunction &)> &BodyGen,
2958 const llvm::function_ref<
void(CodeGenFunction &)> &PostIncGen);
2981 void EmitOMPSimdFinal(
2983 const llvm::function_ref<
llvm::Value *(CodeGenFunction &)> &CondGen);
2993 llvm::Function **InvokeF =
nullptr);
2996 struct OMPLoopArguments {
2998 Address LB = Address::invalid();
3000 Address UB = Address::invalid();
3002 Address ST = Address::invalid();
3004 Address IL = Address::invalid();
3008 Expr *EUB =
nullptr;
3010 Expr *IncExpr =
nullptr;
3012 Expr *Init =
nullptr;
3014 Expr *Cond =
nullptr;
3016 Expr *NextLB =
nullptr;
3018 Expr *NextUB =
nullptr;
3019 OMPLoopArguments() =
default;
3022 Expr *IncExpr =
nullptr,
Expr *Init =
nullptr,
3023 Expr *Cond =
nullptr,
Expr *NextLB =
nullptr,
3024 Expr *NextUB =
nullptr)
3025 : LB(LB), UB(UB), ST(ST), IL(IL), Chunk(Chunk), EUB(EUB),
3026 IncExpr(IncExpr), Init(Init), Cond(Cond), NextLB(NextLB),
3029 void EmitOMPOuterLoop(
bool DynamicOrOrdered,
bool IsMonotonic,
3031 const OMPLoopArguments &LoopArgs,
3037 const OMPLoopArguments &LoopArgs,
3042 const OMPLoopArguments &LoopArgs,
3095 bool LValueIsSuitableForInlineAtomic(
LValue Src);
3101 llvm::AtomicOrdering AO,
bool IsVolatile =
false,
3104 void EmitAtomicStore(
RValue rvalue,
LValue lvalue,
bool isInit);
3106 void EmitAtomicStore(
RValue rvalue,
LValue lvalue, llvm::AtomicOrdering AO,
3107 bool IsVolatile,
bool isInit);
3109 std::pair<RValue, llvm::Value *> EmitAtomicCompareExchange(
3111 llvm::AtomicOrdering Success =
3112 llvm::AtomicOrdering::SequentiallyConsistent,
3113 llvm::AtomicOrdering Failure =
3114 llvm::AtomicOrdering::SequentiallyConsistent,
3115 bool IsWeak =
false,
AggValueSlot Slot = AggValueSlot::ignored());
3117 void EmitAtomicUpdate(
LValue LVal, llvm::AtomicOrdering AO,
3142 bool isNontemporal =
false) {
3143 return EmitLoadOfScalar(Addr, Volatile, Ty, Loc,
LValueBaseInfo(Source),
3150 bool isNontemporal =
false);
3164 bool isInit =
false,
bool isNontemporal =
false) {
3165 EmitStoreOfScalar(Value, Addr, Volatile, Ty,
LValueBaseInfo(Source),
3172 bool isInit =
false,
bool isNontemporal =
false);
3192 void EmitStoreThroughLValue(
RValue Src,
LValue Dst,
bool isInit =
false);
3193 void EmitStoreThroughExtVectorComponentLValue(
RValue Src,
LValue Dst);
3194 void EmitStoreThroughGlobalRegLValue(
RValue Src,
LValue Dst);
3202 void EmitStoreThroughBitfieldLValue(
RValue Src,
LValue Dst,
3224 bool Accessed =
false);
3226 bool IsLowerBound =
true);
3241 Address EmitArrayToPointerDecay(
const Expr *Array,
3246 llvm::PointerIntPair<llvm::Constant*, 1, bool> ValueAndIsReference;
3248 : ValueAndIsReference(C, isReference) {}
3259 return ValueAndIsReference.getOpaqueValue() !=
nullptr;
3264 assert(isReference());
3270 assert(!isReference());
3271 return ValueAndIsReference.getPointer();
3295 unsigned CVRQualifiers);
3322 llvm::Instruction **callOrInvoke =
nullptr) {
3323 return EmitCall(CallInfo, Callee, ReturnValue, Args, callOrInvoke,
3335 llvm::CallInst *EmitRuntimeCall(
llvm::Value *callee,
3336 const Twine &name =
"");
3337 llvm::CallInst *EmitRuntimeCall(
llvm::Value *callee,
3339 const Twine &name =
"");
3340 llvm::CallInst *EmitNounwindRuntimeCall(
llvm::Value *callee,
3341 const Twine &name =
"");
3342 llvm::CallInst *EmitNounwindRuntimeCall(
llvm::Value *callee,
3344 const Twine &name =
"");
3346 llvm::CallSite EmitCallOrInvoke(
llvm::Value *Callee,
3348 const Twine &Name =
"");
3349 llvm::CallSite EmitRuntimeCallOrInvoke(
llvm::Value *callee,
3351 const Twine &name =
"");
3352 llvm::CallSite EmitRuntimeCallOrInvoke(
llvm::Value *callee,
3353 const Twine &name =
"");
3354 void EmitNoreturnRuntimeCallOrInvoke(
llvm::Value *callee,
3384 bool IsArrow,
const Expr *Base);
3406 unsigned BuiltinID,
const CallExpr *E,
3412 llvm::Function *generateBuiltinOSLogHelperFunction(
3423 const llvm::CmpInst::Predicate Fp,
3424 const llvm::CmpInst::Predicate Ip,
3425 const llvm::Twine &Name =
"");
3427 llvm::Triple::ArchType Arch);
3429 llvm::Value *EmitCommonNeonBuiltinExpr(
unsigned BuiltinID,
3430 unsigned LLVMIntrinsic,
3431 unsigned AltLLVMIntrinsic,
3432 const char *NameHint,
3437 llvm::Triple::ArchType Arch);
3438 llvm::Function *LookupNeonLLVMIntrinsic(
unsigned IntrinsicID,
3439 unsigned Modifier, llvm::Type *ArgTy,
3444 unsigned shift = 0,
bool rightshift =
false);
3447 bool negateForRightShift);
3449 llvm::Type *Ty,
bool usgn,
const char *name);
3452 llvm::Triple::ArchType Arch);
3460 llvm::Value *EmitWebAssemblyBuiltinExpr(
unsigned BuiltinID,
3492 void EmitARCDestroyWeak(
Address addr);
3501 bool resultIgnored);
3503 bool resultIgnored);
3515 std::pair<LValue,llvm::Value*>
3517 std::pair<LValue,llvm::Value*>
3519 std::pair<LValue,llvm::Value*>
3520 EmitARCStoreUnsafeUnretained(
const BinaryOperator *e,
bool ignored);
3528 bool allowUnsafeClaim);
3540 void EmitObjCAutoreleasePoolPop(
llvm::Value *Ptr);
3543 void EmitObjCAutoreleasePoolCleanup(
llvm::Value *Ptr);
3544 void EmitObjCMRRAutoreleasePoolPop(
llvm::Value *Ptr);
3547 RValue EmitReferenceBindingToExpr(
const Expr *E);
3557 llvm::Value *EmitScalarExpr(
const Expr *E ,
bool IgnoreResultAssign =
false);
3585 ComplexPairTy EmitComplexExpr(
const Expr *E,
3586 bool IgnoreReal =
false,
3587 bool IgnoreImag =
false);
3591 void EmitComplexExprIntoLValue(
const Expr *E,
LValue dest,
bool isInit);
3594 void EmitStoreOfComplex(ComplexPairTy V,
LValue dest,
bool isInit);
3606 llvm::GlobalVariable *
3607 AddInitializerToStaticVarDecl(
const VarDecl &D,
3608 llvm::GlobalVariable *GV);
3613 void EmitCXXGlobalVarDeclInit(
const VarDecl &D, llvm::Constant *DeclPtr,
3616 llvm::Constant *createAtExitStub(
const VarDecl &VD, llvm::Constant *Dtor,
3617 llvm::Constant *Addr);
3621 void registerGlobalDtorWithAtExit(
const VarDecl &D, llvm::Constant *fn,
3622 llvm::Constant *addr);
3629 void EmitCXXGuardedInit(
const VarDecl &D, llvm::GlobalVariable *DeclPtr,
3635 void EmitCXXGuardedInitBranch(
llvm::Value *NeedsInit,
3636 llvm::BasicBlock *InitBlock,
3637 llvm::BasicBlock *NoInitBlock,
3642 void GenerateCXXGlobalInitFunc(llvm::Function *Fn,
3644 Address Guard = Address::invalid());
3648 void GenerateCXXGlobalDtorsFunc(
3650 const std::vector<std::pair<llvm::WeakTrackingVH, llvm::Constant *>>
3653 void GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn,
3655 llvm::GlobalVariable *Addr,
3664 enterNonTrivialFullExpression(E);
3668 void EmitCXXThrowExpr(
const CXXThrowExpr *E,
bool KeepInsertionPoint =
true);
3681 StringRef AnnotationStr,
3698 static bool ContainsLabel(
const Stmt *S,
bool IgnoreCaseStmts =
false);
3703 static bool containsBreak(
const Stmt *S);
3707 static bool mightAddDeclToScope(
const Stmt *S);
3712 bool ConstantFoldsToSimpleInteger(
const Expr *Cond,
bool &Result,
3713 bool AllowLabels =
false);
3718 bool ConstantFoldsToSimpleInteger(
const Expr *Cond, llvm::APSInt &Result,
3719 bool AllowLabels =
false);
3726 void EmitBranchOnBoolExpr(
const Expr *Cond, llvm::BasicBlock *TrueBlock,
3727 llvm::BasicBlock *FalseBlock, uint64_t TrueCount);
3735 enum { NotSubtraction =
false, IsSubtraction =
true };
3747 const Twine &Name =
"");
3762 llvm::Constant *EmitCheckTypeDescriptor(
QualType T);
3775 void EmitCheck(
ArrayRef<std::pair<llvm::Value *, SanitizerMask>> Checked,
3798 void EmitCfiCheckStub();
3801 void EmitCfiCheckFail();
3819 void SetFPAccuracy(
llvm::Value *Val,
float Accuracy);
3822 llvm::MDNode *getRangeForLoadFromType(
QualType Ty);
3825 void deferPlaceholderReplacement(llvm::Instruction *Old,
llvm::Value *New);
3828 DeferredReplacements;
3832 assert(!LocalDeclMap.count(VD) &&
"Decl already exists in LocalDeclMap!");
3833 LocalDeclMap.insert({VD, Addr});
3846 void ExpandTypeToArgs(
QualType Ty,
RValue RV, llvm::FunctionType *IRFuncTy,
3848 unsigned &IRCallArgPos);
3851 const Expr *InputExpr, std::string &ConstraintStr);
3855 std::string &ConstraintStr,
3863 llvm::Value *evaluateOrEmitBuiltinObjectSize(
const Expr *E,
unsigned Type,
3864 llvm::IntegerType *ResType,
3871 llvm::IntegerType *ResType,
3881 return classDecl->getTypeParamListAsWritten();
3885 return catDecl->getTypeParamList();
3891 template<
typename T>
3905 template <
typename T>
3907 llvm::iterator_range<CallExpr::const_arg_iterator> ArgRange,
3909 unsigned ParamsToSkip = 0,
3914 assert((ParamsToSkip == 0 || CallArgTypeInfo) &&
3915 "Can't skip parameters if type info is not provided");
3916 if (CallArgTypeInfo) {
3918 bool isGenericMethod = isObjCMethodWithTypeParams(CallArgTypeInfo);
3922 for (
auto I = CallArgTypeInfo->param_type_begin() + ParamsToSkip,
3923 E = CallArgTypeInfo->param_type_end();
3924 I != E; ++I, ++Arg) {
3925 assert(Arg != ArgRange.end() &&
"Running over edge of argument list!");
3926 assert((isGenericMethod ||
3927 ((*I)->isVariablyModifiedType() ||
3928 (*I).getNonReferenceType()->isObjCRetainableType() ||
3930 .getCanonicalType((*I).getNonReferenceType())
3933 .getCanonicalType((*Arg)->getType())
3935 "type mismatch in call argument!");
3936 ArgTypes.push_back(*I);
3942 assert((Arg == ArgRange.end() || !CallArgTypeInfo ||
3943 CallArgTypeInfo->isVariadic()) &&
3944 "Extra arguments in non-variadic function!");
3947 for (
auto *A : llvm::make_range(Arg, ArgRange.end()))
3948 ArgTypes.push_back(CallArgTypeInfo ? getVarArgType(A) : A->getType());
3950 EmitCallArgs(Args, ArgTypes, ArgRange, AC, ParamsToSkip, Order);
3954 llvm::iterator_range<CallExpr::const_arg_iterator> ArgRange,
3956 unsigned ParamsToSkip = 0,
3976 Address EmitPointerWithAlignment(
const Expr *Addr,
3985 void EmitSanitizerStatReport(llvm::SanitizerStatKind SSK);
3990 void EmitDeclMetadata();
3995 void AddObjCARCExceptionMetadata(llvm::Instruction *Inst);
3997 llvm::Value *GetValueForARMHint(
unsigned BuiltinID);
4013 if (!isa<llvm::Instruction>(value))
return false;
4016 llvm::BasicBlock *block = cast<llvm::Instruction>(value)->getParent();
4017 return (block != &block->getParent()->getEntryBlock());
4022 if (!needsSaving(value))
return saved_type(value,
false);
4025 auto align = CharUnits::fromQuantity(
4031 return saved_type(alloca.
getPointer(),
true);
4036 if (!value.getInt())
return value.getPointer();
4039 auto alloca = cast<llvm::AllocaInst>(value.getPointer());
4049 return static_cast<T*
>(DominatingLLVMValue::restore(CGF, value));
4063 return DominatingLLVMValue::needsSaving(value.
getPointer());
4065 static saved_type
save(CodeGenFunction &CGF, type value) {
4066 return { DominatingLLVMValue::save(CGF, value.
getPointer()),
4069 static type
restore(CodeGenFunction &CGF, saved_type value) {
4070 return Address(DominatingLLVMValue::restore(CGF, value.SavedValue),
4079 enum Kind { ScalarLiteral, ScalarAddress, AggregateLiteral,
4080 AggregateAddress, ComplexAddress };
4084 unsigned Align : 29;
4086 :
Value(v), K(k), Align(a) {}
4089 static bool needsSaving(
RValue value);
4090 static saved_type save(CodeGenFunction &CGF,
RValue value);
4091 RValue restore(CodeGenFunction &CGF);
4097 return saved_type::needsSaving(value);
4099 static saved_type
save(CodeGenFunction &CGF, type value) {
4100 return saved_type::save(CGF, value);
4102 static type
restore(CodeGenFunction &CGF, saved_type value) {
4103 return value.restore(CGF);
const llvm::DataLayout & getDataLayout() const
A call to an overloaded operator written using operator syntax.
ReturnValueSlot - Contains the address where the return value of a function can be stored...
llvm::Value * getArrayInitIndex()
Get the index of the current ArrayInitLoopExpr, if any.
Optional< uint64_t > getStmtCount(const Stmt *S)
Check if an execution count is known for a given statement.
This represents '#pragma omp distribute simd' composite directive.
Information about the layout of a __block variable.
This represents '#pragma omp master' directive.
virtual void EmitBody(CodeGenFunction &CGF, const Stmt *S)
Emit the captured statement body.
This represents '#pragma omp task' directive.
An instance of this class is created to represent a function declaration or definition.
llvm::Value * BlockPointer
void end(CodeGenFunction &CGF)
~InlinedInheritingConstructorScope()
LValue getReferenceLValue(CodeGenFunction &CGF, Expr *refExpr) const
CXXDefaultInitExprScope(CodeGenFunction &CGF)
PointerType - C99 6.7.5.1 - Pointer Declarators.
llvm::Constant * getValue() const
Scheduling data for loop-based OpenMP directives.
A (possibly-)qualified type.
CodeGenTypes & getTypes()
static CGCallee BuildAppleKextVirtualCall(CodeGenFunction &CGF, GlobalDecl GD, llvm::Type *Ty, const CXXRecordDecl *RD)
const CodeGenOptions & getCodeGenOpts() const
The class detects jumps which bypass local variables declaration: goto L; int a; L: ...
AlignmentSource
The source of the alignment of an l-value; an expression of confidence in the alignment actually matc...
bool HaveInsertPoint() const
HaveInsertPoint - True if an insertion point is defined.
bool isSEHTryScope() const
Returns true inside SEH __try blocks.
llvm::LLVMContext & getLLVMContext()
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
FieldConstructionScope(CodeGenFunction &CGF, Address This)
Represents a 'co_return' statement in the C++ Coroutines TS.
Stmt - This represents one statement.
IfStmt - This represents an if/then/else.
static T * buildByrefHelpers(CodeGenModule &CGM, const BlockByrefInfo &byrefInfo, T &&generator)
Lazily build the copy and dispose helpers for a __block variable with the given information.
bool requiresCleanups() const
Determine whether this scope requires any cleanups.
C Language Family Type Representation.
OpaqueValueMapping(CodeGenFunction &CGF, const AbstractConditionalOperator *op)
Build the opaque value mapping for the given conditional operator if it's the GNU ...
This represents '#pragma omp for simd' directive.
Checking the 'this' pointer for a constructor call.
bool hasVolatileMember() const
bool hasLabelBeenSeenInCurrentScope() const
Return true if a label was seen in the current scope.
Decl - This represents one declaration (or definition), e.g.
This represents '#pragma omp teams distribute parallel for' composite directive.
const Decl * CurCodeDecl
CurCodeDecl - This is the inner-most code context, which includes blocks.
static saved_type save(CodeGenFunction &CGF, llvm::Value *value)
Try to save the given value.
static bool classof(const CGCapturedStmtInfo *)
Represents an attribute applied to a statement.
static Destroyer destroyARCStrongPrecise
llvm::Value * LoadCXXThis()
LoadCXXThis - Load the value of 'this'.
The base class of the type hierarchy.
This represents '#pragma omp target teams distribute' combined directive.
Represents Objective-C's @throw statement.
CGCapturedStmtInfo(const CapturedStmt &S, CapturedRegionKind K=CR_Default)
const RecordDecl * getCapturedRecordDecl() const
Retrieve the record declaration for captured variables.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
void SpecialInitFn(CodeGenFunction &Init, const VarDecl &D, llvm::Value *Address)
virtual const FieldDecl * lookup(const VarDecl *VD) const
Lookup the captured field decl for a variable.
Represents a call to a C++ constructor.
bool isZero() const
isZero - Test whether the quantity equals zero.
stable_iterator stable_begin() const
Create a stable reference to the top of the EH stack.
DominatingValue< T >::saved_type saveValueInCond(T value)
CGCapturedStmtInfo(CapturedRegionKind K=CR_Default)
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const ParmVarDecl * getParamDecl(unsigned I) const
bool currentFunctionUsesSEHTry() const
This represents '#pragma omp parallel for' directive.
void emitCounterIncrement(CGBuilderTy &Builder, const Stmt *S, llvm::Value *StepV)
This represents '#pragma omp target teams distribute parallel for' combined directive.
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
static bool needsSaving(llvm::Value *value)
Answer whether the given value needs extra work to be saved.
static type restore(CodeGenFunction &CGF, saved_type value)
static OpaqueValueMappingData bind(CodeGenFunction &CGF, const OpaqueValueExpr *ov, const RValue &rv)
Represents a point when we exit a loop.
static Destroyer destroyARCWeak
const CXXBaseSpecifier *const * path_const_iterator
This represents '#pragma omp target exit data' directive.
Address GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
TypeEvaluationKind
The kind of evaluation to perform on values of a particular type.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Address getObjectAddress(CodeGenFunction &CGF) const
Returns the address of the object within this declaration.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
CompoundLiteralExpr - [C99 6.5.2.5].
RAII object to set/unset CodeGenFunction::IsSanitizerScope.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const T * getAs() const
Member-template getAs<specific type>'.
uint64_t getProfileCount(const Stmt *S)
Get the profiler's count for the given statement.
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
ObjCMethodDecl - Represents an instance or class method declaration.
void setCurrentProfileCount(uint64_t Count)
Set the profiler's current count.
llvm::Value * getPointer() const
bool shouldUseFusedARCCalls()
bool useLifetimeMarkers() const
static ConstantEmission forValue(llvm::Constant *C)
bool IsSanitizerScope
True if CodeGen currently emits code implementing sanitizer checks.
capture_iterator capture_begin()
Retrieve an iterator pointing to the first capture.
A C++ throw-expression (C++ [except.throw]).
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
ParmVarDecl - Represents a parameter to a function.
bool hasFunctionDecl() const
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Defines the clang::Expr interface and subclasses for C++ expressions.
AbstractCallee(const ObjCMethodDecl *OMD)
The collection of all-type qualifiers we support.
EHScopeStack::stable_iterator PrologueCleanupDepth
PrologueCleanupDepth - The cleanup depth enclosing all the cleanups associated with the parameters...
A jump destination is an abstract label, branching to which may require a jump out through normal cle...
~CXXDefaultInitExprScope()
LabelStmt - Represents a label, which has a substatement.
RecordDecl - Represents a struct/union/class.
llvm::DenseMap< const VarDecl *, FieldDecl * > LambdaCaptureFields
LValue MakeAddrLValue(llvm::Value *V, QualType T, CharUnits Alignment, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
const TargetInfo & getTarget() const
An object to manage conditionally-evaluated expressions.
PeepholeProtection protectFromPeepholes(RValue rvalue)
protectFromPeepholes - Protect a value that we're intending to store to the side, but which will prob...
ConditionalCleanup stores the saved form of its parameters, then restores them and performs the clean...
ArrayInitLoopExprScope(CodeGenFunction &CGF, llvm::Value *Index)
void unbind(CodeGenFunction &CGF)
CGBlockInfo * FirstBlockInfo
FirstBlockInfo - The head of a singly-linked-list of block layouts.
void setScopeDepth(EHScopeStack::stable_iterator depth)
This represents '#pragma omp parallel' directive.
CGDebugInfo * getDebugInfo()
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const CXXRecordDecl * NearestVBase
Address getIndirectAddress() const
void addLabel(const LabelDecl *label)
AbstractCallee(const FunctionDecl *FD)
llvm::SmallPtrSet< const CXXRecordDecl *, 4 > VisitedVirtualBasesSetTy
The scope used to remap some variables as private in the OpenMP loop body (or other captured region e...
SmallVector< Address, 1 > SEHCodeSlotStack
A stack of exception code slots.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
An RAII object to set (and then clear) a mapping for an OpaqueValueExpr.
bool isReferenceType() const
Helper class with most of the code for saving a value for a conditional expression cleanup...
llvm::BasicBlock * getStartingBlock() const
Returns a block which will be executed prior to each evaluation of the conditional code...
This represents '#pragma omp target simd' directive.
virtual void setContextValue(llvm::Value *V)
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Defines some OpenMP-specific enums and functions.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Address getAllocatedAddress() const
Returns the raw, allocated address, which is not necessarily the address of the object itself...
A metaprogramming class for ensuring that a value will dominate an arbitrary position in a function...
This represents '#pragma omp barrier' directive.
CleanupKind getCleanupKind(QualType::DestructionKind kind)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp, [NSNumber numberWithInt:42]];.
The this pointer adjustment as well as an optional return adjustment for a thunk. ...
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc...
This represents '#pragma omp critical' directive.
const AstTypeMatcher< ComplexType > complexType
Matches C99 complex types.
unsigned getNumParams() const
bool isCleanupPadScope() const
Returns true while emitting a cleanuppad.
void EmitStoreOfScalar(llvm::Value *Value, Address Addr, bool Volatile, QualType Ty, AlignmentSource Source=AlignmentSource::Type, bool isInit=false, bool isNontemporal=false)
EmitStoreOfScalar - Store a scalar value to an address, taking care to appropriately convert from the...
RValue EmitAnyExpr(const Expr *E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
EmitAnyExpr - Emit code to compute the specified expression which can have any type.
const RValue & getOpaqueRValueMapping(const OpaqueValueExpr *e)
getOpaqueRValueMapping - Given an opaque value expression (which must be mapped to an r-value)...
void pushFullExprCleanup(CleanupKind kind, As... A)
pushFullExprCleanup - Push a cleanup to be run at the end of the current full-expression.
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
This represents '#pragma omp distribute parallel for' composite directive.
void setCurrentRegionCount(uint64_t Count)
Set the counter value for the current region.
A class controlling the emission of a finally block.
This represents '#pragma omp teams distribute parallel for simd' composite directive.
static bool hasScalarEvaluationKind(QualType T)
ForStmt - This represents a 'for (init;cond;inc)' stmt.
InlinedInheritingConstructorScope(CodeGenFunction &CGF, GlobalDecl GD)
ObjCContainerDecl - Represents a container for method declarations.
CharUnits - This is an opaque type for sizes expressed in character units.
llvm::function_ref< std::pair< LValue, LValue > CodeGenFunction &, const OMPExecutableDirective &S)> CodeGenLoopBoundsTy
bool requiresLandingPad() const
CGCapturedStmtRAII(CodeGenFunction &CGF, CGCapturedStmtInfo *NewCapturedStmtInfo)
LexicalScope(CodeGenFunction &CGF, SourceRange Range)
Enter a new cleanup scope.
RAII for correct setting/restoring of CapturedStmtInfo.
TBAAAccessInfo getTBAAAccessInfo(QualType AccessType)
getTBAAAccessInfo - Get TBAA information that describes an access to an object of the given type...
CharUnits getAlignment() const
Return the alignment of this pointer.
TypeDecl - Represents a declaration of a type.
A builtin binary operation expression such as "x + y" or "x <= y".
bool needsEHCleanup(QualType::DestructionKind kind)
Determines whether an EH cleanup is required to destroy a type with the given destruction kind...
static OpaqueValueMappingData bind(CodeGenFunction &CGF, const OpaqueValueExpr *ov, const LValue &lv)
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
bool IsOutlinedSEHHelper
True if the current function is an outlined SEH helper.
bool isCXXThisExprCaptured() const
#define LIST_SANITIZER_CHECKS
This represents '#pragma omp cancellation point' directive.
void EmitAggregateAssign(Address DestPtr, Address SrcPtr, QualType EltTy)
EmitAggregateCopy - Emit an aggregate assignment.
ObjCStringLiteral, used for Objective-C string literals i.e.
field_iterator field_begin() const
A stack of scopes which respond to exceptions, including cleanups and catch blocks.
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
This represents '#pragma omp teams' directive.
Denotes a cleanup that should run when a scope is exited using normal control flow (falling off the e...
Enums/classes describing ABI related information about constructors, destructors and thunks...
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
This represents '#pragma omp teams distribute simd' combined directive.
void ForceCleanup(std::initializer_list< llvm::Value **> ValuesToReload={})
Force the emission of cleanups now, instead of waiting until this object is destroyed.
Represents binding an expression to a temporary.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
GlobalDecl CurGD
CurGD - The GlobalDecl for the current function being compiled.
Controls insertion of cancellation exit blocks in worksharing constructs.
void incrementProfileCounter(const Stmt *S, llvm::Value *StepV=nullptr)
Increment the profiler's counter for the given statement by StepV.
uint64_t getCurrentProfileCount()
Get the profiler's current count.
CallLifetimeEnd(Address addr, llvm::Value *size)
llvm::function_ref< std::pair< llvm::Value *, llvm::Value * > CodeGenFunction &, const OMPExecutableDirective &S, Address LB, Address UB)> CodeGenDispatchBoundsTy
llvm::AllocaInst * CreateTempAlloca(llvm::Type *Ty, const Twine &Name="tmp", llvm::Value *ArraySize=nullptr)
CreateTempAlloca - This creates an alloca and inserts it into the entry block if ArraySize is nullptr...
Represents an ObjC class declaration.
Checking the operand of a cast to a virtual base object.
JumpDest getJumpDestInCurrentScope(StringRef Name=StringRef())
The given basic block lies in the current EH scope, but may be a target of a potentially scope-crossi...
llvm::AllocaInst * EHSelectorSlot
The selector slot.
const Decl * getDecl() const
Checking the operand of a load. Must be suitably sized and aligned.
void begin(CodeGenFunction &CGF)
~LexicalScope()
Exit this cleanup scope, emitting any accumulated cleanups.
Checking the 'this' pointer for a call to a non-static member function.
llvm::Value * EmitLoadOfScalar(Address Addr, bool Volatile, QualType Ty, SourceLocation Loc, AlignmentSource Source=AlignmentSource::Type, bool isNontemporal=false)
EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the...
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
This represents '#pragma omp target parallel for simd' directive.
OpenMP 4.0 [2.4, Array Sections].
Const iterator for iterating over Stmt * arrays that contain only Expr *.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
CompoundStmt - This represents a group of statements like { stmt stmt }.
std::pair< llvm::Value *, llvm::Value * > ComplexPairTy
ASTContext & getContext() const
Represents a prototype with parameter type info, e.g.
Describes the capture of either a variable, or 'this', or variable-length array type.
void EmitAlignmentAssumption(llvm::Value *PtrValue, llvm::Value *Alignment, llvm::Value *OffsetValue=nullptr)
const CodeGen::CGBlockInfo * BlockInfo
This represents '#pragma omp taskgroup' directive.
const TargetCodeGenInfo & getTargetCodeGenInfo()
CGBlockInfo - Information to generate a block literal.
RValue - This trivial value class is used to represent the result of an expression that is evaluated...
bool addPrivate(const VarDecl *LocalVD, llvm::function_ref< Address()> PrivateGen)
Registers LocalVD variable as a private and apply PrivateGen function for it to generate correspondin...
CleanupKind getARCCleanupKind()
Retrieves the default cleanup kind for an ARC cleanup.
static AutoVarEmission invalid()
bool isGlobalVarCaptured(const VarDecl *VD) const
Checks if the global variable is captured in current function.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Represents a call to the builtin function __builtin_va_arg.
llvm::Value * ExceptionSlot
The exception slot.
void pushCleanupAfterFullExpr(CleanupKind Kind, As... A)
Queue a cleanup to be pushed after finishing the current full-expression.
LValue MakeAddrLValue(Address Addr, QualType T, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
This represents '#pragma omp distribute' directive.
Exposes information about the current target.
CXXDtorType
C++ destructor types.
llvm::BasicBlock * EHResumeBlock
EHResumeBlock - Unified block containing a call to llvm.eh.resume.
EHScopeStack::stable_iterator getScopeDepth() const
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
stable_iterator getInnermostNormalCleanup() const
Returns the innermost normal cleanup on the stack, or stable_end() if there are no normal cleanups...
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited...
const FunctionProtoType * T
llvm::function_ref< void(CodeGenFunction &, SourceLocation, const unsigned, const bool)> CodeGenOrderedTy
static ParamValue forIndirect(Address addr)
OpaqueValueMapping(CodeGenFunction &CGF, const OpaqueValueExpr *opaqueValue, RValue rvalue)
void EmitCallArgs(CallArgList &Args, const T *CallArgTypeInfo, llvm::iterator_range< CallExpr::const_arg_iterator > ArgRange, AbstractCallee AC=AbstractCallee(), unsigned ParamsToSkip=0, EvaluationOrder Order=EvaluationOrder::Default)
EmitCallArgs - Emit call arguments for a function.
llvm::BasicBlock * getBlock() const
void ForceCleanup()
Force the emission of cleanups now, instead of waiting until this object is destroyed.
static bool isObjCMethodWithTypeParams(const ObjCMethodDecl *method)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Represents a C++ destructor within a class.
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
static saved_type save(CodeGenFunction &CGF, type value)
AggValueSlot CreateAggTemp(QualType T, const Twine &Name="tmp")
CreateAggTemp - Create a temporary memory object for the given aggregate type.
llvm::AllocaInst * NormalCleanupDest
i32s containing the indexes of the cleanup destinations.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
DeclContext * getDeclContext()
static bool needsSaving(type value)
Represents Objective-C's @synchronized statement.
ObjCSelectorExpr used for @selector in Objective-C.
CXXTryStmt - A C++ try block, including all handlers.
~OMPPrivateScope()
Exit scope - all the mapped variables are restored.
This represents '#pragma omp target teams distribute simd' combined directive.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
llvm::LLVMContext & getLLVMContext()
llvm::Value * OldCXXThisValue
Checking the value assigned to a _Nonnull pointer. Must not be null.
An RAII object to record that we're evaluating a statement expression.
This represents '#pragma omp for' directive.
~ArrayInitLoopExprScope()
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
This represents '#pragma omp target teams' directive.
LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T)
An expression that sends a message to the given Objective-C object or class.
JumpDest(llvm::BasicBlock *Block, EHScopeStack::stable_iterator Depth, unsigned Index)
void EmitAggregateCopyCtor(Address DestPtr, Address SrcPtr, QualType DestTy, QualType SrcTy)
SourceLocation getEnd() const
An object which temporarily prevents a value from being destroyed by aggressive peephole optimization...
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
The scope of a CXXDefaultInitExpr.
OMPTargetDataInfo(Address BasePointersArray, Address PointersArray, Address SizesArray, unsigned NumberOfTargetItems)
This represents '#pragma omp cancel' directive.
RunCleanupsScope(CodeGenFunction &CGF)
Enter a new cleanup scope.
const LangOptions & getLangOpts() const
ASTContext & getContext() const
static bool shouldBindAsLValue(const Expr *expr)
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
GlobalDecl - represents a global declaration.
This represents '#pragma omp flush' directive.
This represents '#pragma omp parallel for simd' directive.
DoStmt - This represents a 'do/while' stmt.
AsmStmt is the base class for GCCAsmStmt and MSAsmStmt.
VarBypassDetector Bypasses
void EmitAlignmentAssumption(llvm::Value *PtrValue, unsigned Alignment, llvm::Value *OffsetValue=nullptr)
void PopCleanupBlocks(EHScopeStack::stable_iterator OldCleanupStackSize, std::initializer_list< llvm::Value **> ValuesToReload={})
Takes the old cleanup stack size and emits the cleanup blocks that have been added.
llvm::function_ref< void(CodeGenFunction &, const OMPLoopDirective &, JumpDest)> CodeGenLoopTy
This represents '#pragma omp target enter data' directive.
OMPPrivateScope(CodeGenFunction &CGF)
Enter a new OpenMP private scope.
The scope of an ArrayInitLoopExpr.
virtual llvm::Value * getContextValue() const
static bool needsSaving(type value)
llvm::SmallVector< VPtr, 4 > VPtrsVector
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
bool SawAsmBlock
Whether we processed a Microsoft-style asm block during CodeGen.
This captures a statement into a function.
Represents a call to an inherited base class constructor from an inheriting constructor.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
~FieldConstructionScope()
This represents '#pragma omp single' directive.
Encodes a location in the source.
void EnsureInsertPoint()
EnsureInsertPoint - Ensure that an insertion point is defined so that emitted IR has a place to go...
A saved depth on the scope stack.
std::unique_ptr< CGCoroData > Data
Represents a C++ temporary.
~RunCleanupsScope()
Exit this cleanup scope, emitting any accumulated cleanups.
llvm::BasicBlock * getUnreachableBlock()
void setBeforeOutermostConditional(llvm::Value *value, Address addr)
This is a basic class for representing single OpenMP executable directive.
SmallVector< llvm::Value *, 8 > ObjCEHValueStack
ObjCEHValueStack - Stack of Objective-C exception values, used for rethrows.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Represents a call to a member function that may be written either with member call syntax (e...
const Decl * getDecl() const
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Checking the operand of a cast to a base object.
OpenMPDirectiveKind
OpenMP directives.
LabelDecl - Represents the declaration of a label.
CharUnits OldCXXThisAlignment
A scoped helper to set the current debug location to the specified location or preferred location of ...
Represents a static or instance method of a struct/union/class.
void EmitStmt(const Stmt *S, ArrayRef< const Attr *> Attrs=None)
EmitStmt - Emit the code for the statement.
static type restore(CodeGenFunction &CGF, saved_type value)
unsigned getDestIndex() const
OpenMPLinearClauseKind Modifier
Modifier of 'linear' clause.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
This represents '#pragma omp taskwait' directive.
SanitizerSet SanOpts
Sanitizers enabled for this function.
ObjCCategoryDecl - Represents a category declaration.
This is a basic class for representing single OpenMP clause.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
ObjCProtocolExpr used for protocol expression in Objective-C.
TypeCheckKind
Situations in which we might emit a check for the suitability of a pointer or glvalue.
This represents '#pragma omp target' directive.
static Destroyer emitARCIntrinsicUse
All available information about a concrete callee.
LValue MakeAddrLValue(llvm::Value *V, QualType T, CharUnits Alignment, AlignmentSource Source=AlignmentSource::Type)
JumpDest getJumpDestInCurrentScope(llvm::BasicBlock *Target)
The given basic block lies in the current EH scope, but may be a target of a potentially scope-crossi...
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues, like target-specific attributes, builtins and so on.
Checking the object expression in a non-static data member access.
This represents '#pragma omp ordered' directive.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
static ParamValue forDirect(llvm::Value *value)
static llvm::Value * restore(CodeGenFunction &CGF, saved_type value)
This represents '#pragma omp target update' directive.
ObjCBoxedExpr - used for generalized expression boxing.
uint64_t getCurrentRegionCount() const
Return the counter value of the current region.
virtual FieldDecl * getThisFieldDecl() const
llvm::Value * getDirectValue() const
const CGFunctionInfo * CurFnInfo
void Emit(CodeGenFunction &CGF, Flags flags) override
Emit the cleanup.
static ConstantEmission forReference(llvm::Constant *C)
void enterFullExpression(const ExprWithCleanups *E)
const TargetCodeGenInfo & getTargetHooks() const
static Destroyer destroyARCStrongImprecise
CXXCtorType
C++ constructor types.
CompoundAssignOperator - For compound assignments (e.g.
JumpDest getOMPCancelDestination(OpenMPDirectiveKind Kind)
FunctionArgList - Type for representing both the decl and type of parameters to a function...
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
CGFunctionInfo - Class to encapsulate the information about a function definition.
This class organizes the cross-function state that is used while generating LLVM code.
Dataflow Directional Tag Classes.
Class provides a way to call simple version of codegen for OpenMP region, or an advanced with possibl...
[C99 6.4.2.2] - A predefined identifier such as func.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
static bool shouldBindAsLValue(const Expr *expr)
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
This represents '#pragma omp section' directive.
This represents '#pragma omp teams distribute' directive.
A scope within which we are constructing the fields of an object which might use a CXXDefaultInitExpr...
llvm::LoadInst * CreateAlignedLoad(llvm::Value *Addr, CharUnits Align, const llvm::Twine &Name="")
Checking the bound value in a reference binding.
bool isInConditionalBranch() const
isInConditionalBranch - Return true if we're currently emitting one branch or the other of a conditio...
This represents '#pragma omp simd' directive.
Represents a 'co_yield' expression.
llvm::Value * getAnyValue() const
StmtExprEvaluation(CodeGenFunction &CGF)
Checking the destination of a store. Must be suitably sized and aligned.
A pointer to member type per C++ 8.3.3 - Pointers to members.
llvm::SmallVector< char, 256 > LifetimeExtendedCleanupStack
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
This represents '#pragma omp atomic' directive.
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
bool hasProfileClangInstr() const
Check if Clang profile instrumenation is on.
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
Represents a __leave statement.
JumpDest ReturnBlock
ReturnBlock - Unified return block.
llvm::DenseMap< const Decl *, Address > DeclMapTy
Checking the operand of a static_cast to a derived reference type.
virtual StringRef getHelperName() const
Get the name of the capture helper.
static bool hasAggregateEvaluationKind(QualType T)
SwitchStmt - This represents a 'switch' stmt.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
API for captured statement code generation.
static saved_type save(CodeGenFunction &CGF, type value)
static bool isObjCMethodWithTypeParams(const T *)
Represents the body of a coroutine.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
llvm::Type * ConvertType(const TypeDecl *T)
const LValue & getOpaqueLValueMapping(const OpaqueValueExpr *e)
getOpaqueLValueMapping - Given an opaque value expression (which must be mapped to an l-value)...
Checking the operand of a static_cast to a derived pointer type.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
CharUnits OffsetFromNearestVBase
Represents Objective-C's collection statement.
CodeGenTypes & getTypes() const
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
Implements C++ ABI-specific code generation functions.
unsigned getNumObjects() const
ObjCEncodeExpr, used for @encode in Objective-C.
A stack of loop information corresponding to loop nesting levels.
This class organizes the cross-module state that is used while lowering AST types to LLVM types...
Represents a call to a CUDA kernel function.
bool isFunctionType() const
Represents a 'co_await' expression.
const TargetInfo & Target
llvm::AssertingVH< llvm::Instruction > AllocaInsertPt
AllocaInsertPoint - This is an instruction in the entry block before which we prefer to insert alloca...
void pushCleanupTuple(CleanupKind Kind, std::tuple< As... > A)
Push a lazily-created cleanup on the stack. Tuple version.
void EmitBlock(llvm::BasicBlock *BB, bool IsFinished=false)
EmitBlock - Emit the given block.
FieldDecl * LambdaThisCaptureField
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
llvm::Value * LoadCXXVTT()
LoadCXXVTT - Load the VTT parameter to base constructors/destructors have virtual bases...
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
ObjCIvarRefExpr - A reference to an ObjC instance variable.
const Decl * CurFuncDecl
CurFuncDecl - Holds the Decl for the current outermost non-closure context.
A pair of helper functions for a __block variable.
GotoStmt - This represents a direct goto.
DominatingLLVMValue::saved_type SavedValue
static OpaqueValueMappingData bind(CodeGenFunction &CGF, const OpaqueValueExpr *ov, const Expr *e)
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
unsigned NextCleanupDestIndex
void setCurrentStmt(const Stmt *S)
If the execution count for the current statement is known, record that as the current count...
llvm::DenseMap< const VarDecl *, llvm::Value * > NRVOFlags
A mapping from NRVO variables to the flags used to indicate when the NRVO has been applied to this va...
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
void unprotectFromPeepholes(PeepholeProtection protection)
A non-RAII class containing all the information about a bound opaque value.
This represents '#pragma omp target parallel' directive.
Represents a C++ struct/union/class.
ContinueStmt - This represents a continue.
void EmitBranch(llvm::BasicBlock *Block)
EmitBranch - Emit a branch to the specified basic block from the current insert block, taking care to avoid creation of branches from dummy blocks.
llvm::PointerIntPair< llvm::Value *, 1, bool > saved_type
llvm::BasicBlock * getInvokeDest()
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
static Destroyer destroyCXXObject
LValue EmitLoadOfReferenceLValue(Address RefAddr, QualType RefTy, AlignmentSource Source=AlignmentSource::Type)
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
ObjCIvarDecl - Represents an ObjC instance variable.
static type restore(CodeGenFunction &CGF, saved_type value)
BuiltinCheckKind
Specifies which type of sanitizer check to apply when handling a particular builtin.
WhileStmt - This represents a 'while' stmt.
LValue EmitLValue(const Expr *E)
EmitLValue - Emit code to compute a designator that specifies the location of the expression...
Address ReturnValue
ReturnValue - The temporary alloca to hold the return value.
OMPCancelStackRAII(CodeGenFunction &CGF, OpenMPDirectiveKind Kind, bool HasCancel)
unsigned kind
All of the diagnostics that can be emitted by the frontend.
Represents Objective-C's @try ... @catch ... @finally statement.
capture_iterator capture_end() const
Retrieve an iterator pointing past the end of the sequence of captures.
bool AutoreleaseResult
In ARC, whether we should autorelease the return value.
bool has(SanitizerMask K) const
Check if a certain (single) sanitizer is enabled.
This represents '#pragma omp taskloop simd' directive.
StringLiteral - This represents a string literal expression, e.g.
Defines the clang::TargetInfo interface.
CapturedRegionKind getKind() const
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
CGCapturedStmtInfo * CapturedStmtInfo
llvm::Value * getSizeForLifetimeMarkers() const
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, llvm::Instruction **callOrInvoke=nullptr)
const llvm::function_ref< void(CodeGenFunction &, llvm::Value *, const OMPTaskDataTy &)> TaskGenTy
This represents '#pragma omp sections' directive.
Struct with all informations about dynamic [sub]class needed to set vptr.
bool hasVolatileMember(QualType T)
hasVolatileMember - returns true if aggregate type has a volatile member.
This represents '#pragma omp target data' directive.
A reference to a declared variable, function, enum, etc.
ConditionalEvaluation(CodeGenFunction &CGF)
This structure provides a set of types that are commonly used during IR emission. ...
BreakStmt - This represents a break.
void EmitLifetimeEnd(llvm::Value *Size, llvm::Value *Addr)
CapturedRegionKind
The different kinds of captured statement.
void EmitBranchThroughCleanup(JumpDest Dest)
EmitBranchThroughCleanup - Emit a branch from the current insert block through the normal cleanup han...
const CXXRecordDecl * VTableClass
A trivial tuple used to represent a source range.
LValue - This represents an lvalue references.
An abstract representation of regular/ObjC call/message targets.
This represents '#pragma omp taskyield' directive.
Information for lazily generating a cleanup.
This represents '#pragma omp distribute parallel for simd' composite directive.
Represents a C array with a specified size that is not an integer-constant-expression.
This represents '#pragma omp parallel sections' directive.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
bool CurFuncIsThunk
In C++, whether we are code generating a thunk.
const LangOptions & getLangOpts() const
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
SourceLocation getBegin() const
CallArgList - Type for representing both the value and type of arguments in a call.
OpaqueValueMapping(CodeGenFunction &CGF, const OpaqueValueExpr *opaqueValue, LValue lvalue)
Address CreateMemTemp(QualType T, const Twine &Name="tmp", bool CastToDefaultAddrSpace=true)
CreateMemTemp - Create a temporary memory object of the given type, with appropriate alignment...
Represents Objective-C's @autoreleasepool Statement.
OpaqueValueMapping(CodeGenFunction &CGF, const OpaqueValueExpr *OV)
Build the opaque value mapping for an OpaqueValueExpr whose source expression is set to the expressio...
Address emitBlockByrefAddress(Address baseAddr, const VarDecl *V, bool followForward=true)
BuildBlockByrefAddress - Computes the location of the data in a variable which is declared as __block...
bool isLocalVarDeclOrParm() const
Similar to isLocalVarDecl but also includes parameters.
This represents '#pragma omp target parallel for' directive.
llvm::SmallVector< const JumpDest *, 2 > SEHTryEpilogueStack
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
bool Privatize()
Privatizes local variables previously registered as private.
void Destroyer(CodeGenFunction &CGF, Address addr, QualType ty)
This represents '#pragma omp taskloop' directive.