13 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENFUNCTION_H
14 #define LLVM_CLANG_LIB_CODEGEN_CODEGENFUNCTION_H
36 #include "llvm/ADT/ArrayRef.h"
37 #include "llvm/ADT/DenseMap.h"
38 #include "llvm/ADT/MapVector.h"
39 #include "llvm/ADT/SmallVector.h"
40 #include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
41 #include "llvm/IR/ValueHandle.h"
42 #include "llvm/Support/Debug.h"
43 #include "llvm/Transforms/Utils/SanitizerStats.h"
52 class CanonicalLoopInfo;
57 class CXXDestructorDecl;
58 class CXXForRangeStmt;
63 class FunctionProtoType;
65 class ObjCContainerDecl;
66 class ObjCInterfaceDecl;
69 class ObjCImplementationDecl;
70 class ObjCPropertyImplDecl;
73 class ObjCForCollectionStmt;
75 class ObjCAtThrowStmt;
76 class ObjCAtSynchronizedStmt;
77 class ObjCAutoreleasePoolStmt;
78 class OMPUseDevicePtrClause;
79 class OMPUseDeviceAddrClause;
81 class OMPExecutableDirective;
83 namespace analyze_os_log {
84 class OSLogBufferLayout;
93 class BlockByrefHelpers;
95 class BlockFieldFlags;
96 class RegionCodeGenTy;
97 class TargetCodeGenInfo;
112 #define LIST_SANITIZER_CHECKS \
113 SANITIZER_CHECK(AddOverflow, add_overflow, 0) \
114 SANITIZER_CHECK(BuiltinUnreachable, builtin_unreachable, 0) \
115 SANITIZER_CHECK(CFICheckFail, cfi_check_fail, 0) \
116 SANITIZER_CHECK(DivremOverflow, divrem_overflow, 0) \
117 SANITIZER_CHECK(DynamicTypeCacheMiss, dynamic_type_cache_miss, 0) \
118 SANITIZER_CHECK(FloatCastOverflow, float_cast_overflow, 0) \
119 SANITIZER_CHECK(FunctionTypeMismatch, function_type_mismatch, 1) \
120 SANITIZER_CHECK(ImplicitConversion, implicit_conversion, 0) \
121 SANITIZER_CHECK(InvalidBuiltin, invalid_builtin, 0) \
122 SANITIZER_CHECK(InvalidObjCCast, invalid_objc_cast, 0) \
123 SANITIZER_CHECK(LoadInvalidValue, load_invalid_value, 0) \
124 SANITIZER_CHECK(MissingReturn, missing_return, 0) \
125 SANITIZER_CHECK(MulOverflow, mul_overflow, 0) \
126 SANITIZER_CHECK(NegateOverflow, negate_overflow, 0) \
127 SANITIZER_CHECK(NullabilityArg, nullability_arg, 0) \
128 SANITIZER_CHECK(NullabilityReturn, nullability_return, 1) \
129 SANITIZER_CHECK(NonnullArg, nonnull_arg, 0) \
130 SANITIZER_CHECK(NonnullReturn, nonnull_return, 1) \
131 SANITIZER_CHECK(OutOfBounds, out_of_bounds, 0) \
132 SANITIZER_CHECK(PointerOverflow, pointer_overflow, 0) \
133 SANITIZER_CHECK(ShiftOutOfBounds, shift_out_of_bounds, 0) \
134 SANITIZER_CHECK(SubOverflow, sub_overflow, 0) \
135 SANITIZER_CHECK(TypeMismatch, type_mismatch, 1) \
136 SANITIZER_CHECK(AlignmentAssumption, alignment_assumption, 0) \
137 SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0)
140 #define SANITIZER_CHECK(Enum, Name, Version) Enum,
142 #undef SANITIZER_CHECK
148 typedef llvm::PointerIntPair<llvm::Value*, 1, bool>
saved_type;
153 if (!isa<llvm::Instruction>(value))
return false;
156 llvm::BasicBlock *block = cast<llvm::Instruction>(value)->getParent();
157 return (block != &block->getParent()->getEntryBlock());
192 value.ElementType, value.Alignment);
200 enum Kind { ScalarLiteral, ScalarAddress, AggregateLiteral,
201 AggregateAddress, ComplexAddress };
204 llvm::Type *ElementType;
207 saved_type(llvm::Value *
v, llvm::Type *e, Kind k,
unsigned a = 0)
208 :
Value(
v), ElementType(e), K(k), Align(a) {}
219 return saved_type::needsSaving(value);
222 return saved_type::save(CGF, value);
225 return value.restore(CGF);
245 bool isValid()
const {
return Block !=
nullptr; }
246 llvm::BasicBlock *
getBlock()
const {
return Block; }
256 llvm::BasicBlock *Block;
298 const unsigned,
const bool)>
302 typedef llvm::function_ref<std::pair<LValue, LValue>(
307 typedef llvm::function_ref<std::pair<llvm::Value *, llvm::Value *>(
314 void InsertHelper(llvm::Instruction *I,
const llvm::Twine &Name,
315 llvm::BasicBlock *BB,
316 llvm::BasicBlock::iterator InsertPt)
const;
334 std::unique_ptr<CGCoroData>
Data;
370 return !LabelMap.empty();
386 llvm::AssertingVH<llvm::Instruction> PostAllocaInsertPt =
nullptr;
392 if (!PostAllocaInsertPt) {
394 "Expected static alloca insertion point at function prologue");
396 "EBB should be entry block of the current code gen function");
398 PostAllocaInsertPt->setName(
"postallocapt");
402 return PostAllocaInsertPt;
409 : Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {}
412 : Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {
415 S.getCapturedRecordDecl()->field_begin();
418 I != E; ++I, ++Field) {
419 if (I->capturesThis())
420 CXXThisFieldDecl = *Field;
421 else if (I->capturesVariable())
422 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
423 else if (I->capturesVariableByCopy())
424 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
459 return CaptureFields;
467 llvm::SmallDenseMap<const VarDecl *, FieldDecl *> CaptureFields;
471 llvm::Value *ThisValue;
495 const Decl *CalleeDecl;
502 return isa_and_nonnull<FunctionDecl>(CalleeDecl);
506 if (
const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl))
507 return FD->getNumParams();
508 return cast<ObjCMethodDecl>(CalleeDecl)->param_size();
511 if (
const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl))
512 return FD->getParamDecl(I);
513 return *(cast<ObjCMethodDecl>(CalleeDecl)->param_begin() + I);
569 CodeGenOptions::FiniteLoopsKind::Never)
588 CodeGenOptions::FiniteLoopsKind::Always)
591 CodeGenOptions::FiniteLoopsKind::Never)
617 llvm::DenseMap<const VarDecl *, llvm::Value *>
NRVOFlags;
626 bool isRedundantBeforeReturn()
override {
return true; }
633 : Addr(addr.getPointer()), Size(size) {}
721 void ConstructorHelper(
FPOptions FPFeatures);
724 llvm::fp::ExceptionBehavior OldExcept;
725 llvm::RoundingMode OldRounding;
741 llvm::FunctionCallee BeginCatchFn;
745 llvm::AllocaInst *ForEHVar;
749 llvm::AllocaInst *SavedExnVar;
753 llvm::FunctionCallee beginCatchFn,
754 llvm::FunctionCallee endCatchFn, llvm::FunctionCallee rethrowFn);
769 template <
class T,
class... As>
777 typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
787 template <
class T,
class... As>
795 "cleanup active flag should never need saving");
797 typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
801 pushCleanupAfterFullExprWithActiveFlag<CleanupType>(
Kind, ActiveFlag, Saved);
804 template <
class T,
class... As>
815 static_assert(
sizeof(Header) %
alignof(T) == 0,
816 "Cleanup will be allocated on misaligned address");
819 new (Buffer +
sizeof(Header)) T(A...);
821 new (Buffer +
sizeof(Header) +
sizeof(T))
Address(ActiveFlag);
858 llvm::Instruction *DominatingIP);
868 llvm::Instruction *DominatingIP);
874 size_t LifetimeExtendedCleanupStackSize;
875 bool OldDidCallStackSave;
892 LifetimeExtendedCleanupStackSize =
894 OldDidCallStackSave =
CGF.DidCallStackSave;
895 CGF.DidCallStackSave =
false;
917 void ForceCleanup(std::initializer_list<llvm::Value**> ValuesToReload = {}) {
919 CGF.DidCallStackSave = OldDidCallStackSave;
943 CGF.CurLexicalScope =
this;
945 DI->EmitLexicalBlockStart(
CGF.
Builder, Range.getBegin());
950 Labels.push_back(label);
957 DI->EmitLexicalBlockEnd(
CGF.
Builder, Range.getEnd());
970 CGF.CurLexicalScope = ParentScope;
978 return !Labels.empty();
984 typedef llvm::DenseMap<const Decl *, Address>
DeclMapTy;
996 assert(SavedLocals.empty() &&
"Did not restored original addresses.");
1006 if (SavedLocals.count(LocalVD))
return false;
1009 auto it = CGF.LocalDeclMap.find(LocalVD);
1010 if (it != CGF.LocalDeclMap.end())
1011 SavedLocals.try_emplace(LocalVD, it->second);
1022 SavedTempAddresses.try_emplace(LocalVD, TempAddr);
1031 copyInto(SavedTempAddresses, CGF.LocalDeclMap);
1032 SavedTempAddresses.clear();
1033 return !SavedLocals.empty();
1038 if (!SavedLocals.empty()) {
1039 copyInto(SavedLocals, CGF.LocalDeclMap);
1040 SavedLocals.clear();
1048 for (
auto &Pair : Src) {
1049 if (!Pair.second.isValid()) {
1050 Dest.erase(Pair.first);
1054 auto I = Dest.find(Pair.first);
1055 if (I != Dest.end())
1056 I->second = Pair.second;
1122 : CGF(CGF), SavedMap(CGF.LocalDeclMap) {}
1130 std::initializer_list<llvm::Value **> ValuesToReload = {});
1137 size_t OldLifetimeExtendedStackSize,
1138 std::initializer_list<llvm::Value **> ValuesToReload = {});
1180 llvm::BasicBlock *StartBB;
1184 : StartBB(CGF.
Builder.GetInsertBlock()) {}
1187 assert(CGF.OutermostConditional !=
this);
1188 if (!CGF.OutermostConditional)
1189 CGF.OutermostConditional =
this;
1193 assert(CGF.OutermostConditional !=
nullptr);
1194 if (CGF.OutermostConditional ==
this)
1195 CGF.OutermostConditional =
nullptr;
1212 auto store =
new llvm::StoreInst(value, addr.
getPointer(), &block->back());
1228 : CGF(CGF), SavedOutermostConditional(CGF.OutermostConditional) {
1229 CGF.OutermostConditional =
nullptr;
1233 CGF.OutermostConditional = SavedOutermostConditional;
1242 llvm::Instruction *Inst;
1262 : OpaqueValue(ov), BoundLValue(boundLValue) {}
1272 return expr->isGLValue() ||
1273 expr->getType()->isFunctionType() ||
1289 CGF.OpaqueLValues.insert(std::make_pair(ov, lv));
1297 CGF.OpaqueRValues.insert(std::make_pair(ov, rv));
1309 bool isValid()
const {
return OpaqueValue !=
nullptr; }
1313 assert(OpaqueValue &&
"no data to unbind!");
1316 CGF.OpaqueLValues.erase(OpaqueValue);
1318 CGF.OpaqueRValues.erase(OpaqueValue);
1341 if (isa<ConditionalOperator>(op))
1355 assert(OV->
getSourceExpr() &&
"wrong form of OpaqueValueMapping used "
1356 "for OVE with no source expression");
1386 unsigned VLAExprCounter = 0;
1387 bool DisableDebugInfo =
false;
1391 bool DidCallStackSave =
false;
1397 llvm::IndirectBrInst *IndirectBranch =
nullptr;
1405 llvm::DenseMap<const ParmVarDecl *, EHScopeStack::stable_iterator>
1406 CalleeDestructedParamCleanups;
1411 llvm::SmallDenseMap<const ParmVarDecl *, const ImplicitParamDecl *, 2>
1416 llvm::DenseMap<llvm::AllocaInst *, int> EscapedLocals;
1419 llvm::DenseMap<const LabelDecl*, JumpDest> LabelMap;
1423 struct BreakContinue {
1424 BreakContinue(JumpDest Break, JumpDest Continue)
1425 : BreakBlock(Break), ContinueBlock(Continue) {}
1427 JumpDest BreakBlock;
1428 JumpDest ContinueBlock;
1430 SmallVector<BreakContinue, 8> BreakContinueStack;
1433 class OpenMPCancelExitStack {
1437 CancelExit() =
default;
1440 :
Kind(
Kind), ExitBlock(ExitBlock), ContBlock(ContBlock) {}
1444 bool HasBeenEmitted =
false;
1449 SmallVector<CancelExit, 8> Stack;
1452 OpenMPCancelExitStack() : Stack(1) {}
1453 ~OpenMPCancelExitStack() =
default;
1455 JumpDest getExitBlock()
const {
return Stack.back().ExitBlock; }
1459 const llvm::function_ref<
void(CodeGenFunction &)> CodeGen) {
1460 if (Stack.back().Kind ==
Kind && getExitBlock().isValid()) {
1461 assert(CGF.getOMPCancelDestination(
Kind).isValid());
1462 assert(CGF.HaveInsertPoint());
1463 assert(!Stack.back().HasBeenEmitted);
1464 auto IP = CGF.Builder.saveAndClearIP();
1465 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1467 CGF.EmitBranch(Stack.back().ContBlock.getBlock());
1468 CGF.Builder.restoreIP(IP);
1469 Stack.back().HasBeenEmitted =
true;
1478 Stack.push_back({
Kind,
1479 HasCancel ? CGF.getJumpDestInCurrentScope(
"cancel.exit")
1481 HasCancel ? CGF.getJumpDestInCurrentScope(
"cancel.cont")
1486 void exit(CodeGenFunction &CGF) {
1487 if (getExitBlock().isValid()) {
1488 assert(CGF.getOMPCancelDestination(Stack.back().Kind).isValid());
1489 bool HaveIP = CGF.HaveInsertPoint();
1490 if (!Stack.back().HasBeenEmitted) {
1492 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1493 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1494 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1496 CGF.EmitBlock(Stack.back().ContBlock.getBlock());
1498 CGF.Builder.CreateUnreachable();
1499 CGF.Builder.ClearInsertionPoint();
1505 OpenMPCancelExitStack OMPCancelStack;
1508 llvm::Value *emitCondLikelihoodViaExpectIntrinsic(llvm::Value *Cond,
1514 llvm::MDNode *createProfileWeights(
uint64_t TrueCount,
1516 llvm::MDNode *createProfileWeights(ArrayRef<uint64_t> Weights)
const;
1517 llvm::MDNode *createProfileWeightsForLoop(
const Stmt *Cond,
1525 !
CurFn->hasFnAttribute(llvm::Attribute::NoProfile))
1526 PGO.emitCounterIncrement(
Builder, S, StepV);
1527 PGO.setCurrentStmt(S);
1532 return PGO.getStmtCount(S).value_or(0);
1537 PGO.setCurrentRegionCount(Count);
1543 return PGO.getCurrentRegionCount();
1550 llvm::SwitchInst *SwitchInsn =
nullptr;
1559 llvm::BasicBlock *CaseRangeBlock =
nullptr;
1563 llvm::DenseMap<const OpaqueValueExpr *, LValue> OpaqueLValues;
1564 llvm::DenseMap<const OpaqueValueExpr *, RValue> OpaqueRValues;
1572 llvm::DenseMap<const Expr*, llvm::Value*> VLASizeMap;
1576 llvm::BasicBlock *UnreachableBlock =
nullptr;
1579 unsigned NumReturnExprs = 0;
1582 unsigned NumSimpleReturnExprs = 0;
1600 : CGF(CGF), OldCXXDefaultInitExprThis(CGF.CXXDefaultInitExprThis) {
1601 CGF.CXXDefaultInitExprThis =
This;
1604 CGF.CXXDefaultInitExprThis = OldCXXDefaultInitExprThis;
1609 Address OldCXXDefaultInitExprThis;
1645 : CGF(CGF), OldArrayInitIndex(CGF.ArrayInitIndex) {
1646 CGF.ArrayInitIndex = Index;
1649 CGF.ArrayInitIndex = OldArrayInitIndex;
1654 llvm::Value *OldArrayInitIndex;
1662 OldCXXABIThisDecl(CGF.CXXABIThisDecl),
1663 OldCXXABIThisValue(CGF.CXXABIThisValue),
1664 OldCXXThisValue(CGF.CXXThisValue),
1665 OldCXXABIThisAlignment(CGF.CXXABIThisAlignment),
1666 OldCXXThisAlignment(CGF.CXXThisAlignment),
1668 OldCXXInheritedCtorInitExprArgs(
1669 std::move(CGF.CXXInheritedCtorInitExprArgs)) {
1672 cast<CXXConstructorDecl>(GD.
getDecl());
1673 CGF.CXXABIThisDecl =
nullptr;
1674 CGF.CXXABIThisValue =
nullptr;
1675 CGF.CXXThisValue =
nullptr;
1680 CGF.CXXInheritedCtorInitExprArgs.clear();
1683 CGF.CurGD = OldCurGD;
1684 CGF.CurFuncDecl = OldCurFuncDecl;
1685 CGF.CurCodeDecl = OldCurCodeDecl;
1686 CGF.CXXABIThisDecl = OldCXXABIThisDecl;
1687 CGF.CXXABIThisValue = OldCXXABIThisValue;
1688 CGF.CXXThisValue = OldCXXThisValue;
1689 CGF.CXXABIThisAlignment = OldCXXABIThisAlignment;
1690 CGF.CXXThisAlignment = OldCXXThisAlignment;
1691 CGF.ReturnValue = OldReturnValue;
1692 CGF.FnRetTy = OldFnRetTy;
1693 CGF.CXXInheritedCtorInitExprArgs =
1694 std::move(OldCXXInheritedCtorInitExprArgs);
1700 const Decl *OldCurFuncDecl;
1701 const Decl *OldCurCodeDecl;
1703 llvm::Value *OldCXXABIThisValue;
1704 llvm::Value *OldCXXThisValue;
1735 llvm::CallInst *RTLFnCI;
1739 RLFnCI->removeFromParent();
1769 StringRef FirstSeparator =
".",
1770 StringRef Separator =
".");
1775 CGBuilderTy::InsertPointGuard IPG(CGF.
Builder);
1776 assert(IP.getBlock()->end() != IP.getPoint() &&
1777 "OpenMP IR Builder should cause terminated block!");
1779 llvm::BasicBlock *IPBB = IP.getBlock();
1780 llvm::BasicBlock *DestBB = IPBB->getUniqueSuccessor();
1781 assert(DestBB &&
"Finalization block should have one successor!");
1784 IPBB->getTerminator()->eraseFromParent();
1785 CGF.
Builder.SetInsertPoint(IPBB);
1798 const Stmt *RegionBodyStmt,
1804 llvm::BasicBlock &FiniBB, llvm::Function *Fn,
1806 llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
1807 if (llvm::Instruction *CodeGenIPBBTI = CodeGenIPBB->getTerminator())
1808 CodeGenIPBBTI->eraseFromParent();
1810 CGF.
Builder.SetInsertPoint(CodeGenIPBB);
1812 if (Fn->doesNotThrow())
1817 if (CGF.
Builder.saveIP().isSet())
1818 CGF.
Builder.CreateBr(&FiniBB);
1830 const Stmt *RegionBodyStmt,
1838 llvm::AssertingVH<llvm::Instruction> OldAllocaIP;
1844 llvm::BasicBlock &RetBB)
1846 assert(AllocaIP.isSet() &&
1847 "Must specify Insertion point for allocas of outlined function");
1864 llvm::AssertingVH<llvm::Instruction> OldAllocaIP;
1869 llvm::BasicBlock &FiniBB)
1875 assert((!AllocaIP.isSet() ||
1877 "Insertion point should be in the entry block of containing "
1880 if (AllocaIP.isSet())
1899 llvm::Value *CXXABIThisValue =
nullptr;
1900 llvm::Value *CXXThisValue =
nullptr;
1910 llvm::Value *ArrayInitIndex =
nullptr;
1919 llvm::Value *CXXStructorImplicitParamValue =
nullptr;
1924 ConditionalEvaluation *OutermostConditional =
nullptr;
1927 LexicalScope *CurLexicalScope =
nullptr;
1935 llvm::DenseMap<const ValueDecl *, BlockByrefInfo> BlockByrefInfos;
1939 llvm::Value *RetValNullabilityPrecondition =
nullptr;
1943 bool requiresReturnValueNullabilityCheck()
const {
1944 return RetValNullabilityPrecondition;
1952 bool requiresReturnValueCheck()
const;
1954 llvm::BasicBlock *TerminateLandingPad =
nullptr;
1955 llvm::BasicBlock *TerminateHandler =
nullptr;
1959 llvm::MapVector<llvm::Value *, llvm::BasicBlock *> TerminateFunclets;
1963 unsigned LargestVectorWidth = 0;
1967 bool ShouldEmitLifetimeMarkers;
1972 llvm::Function *Fn);
1975 CodeGenFunction(CodeGenModule &cgm,
bool suppressNewContext=
false);
1981 if (DisableDebugInfo)
2007 if (!UnreachableBlock) {
2011 return UnreachableBlock;
2039 llvm::Value *arrayEnd,
2049 Destroyer *destroyer,
bool useEHCleanupForArray);
2052 bool useEHCleanupForArray);
2054 llvm::Value *CompletePtr,
2058 bool useEHCleanupForArray);
2061 bool useEHCleanupForArray,
2066 bool checkZeroLength,
bool useEHCleanup);
2084 llvm_unreachable(
"bad destruction kind");
2105 llvm::Constant *AtomicHelperFn);
2116 llvm::Constant *AtomicHelperFn);
2131 bool IsLambdaConversionToBlock,
2132 bool BuildGlobalBlock);
2148 class AutoVarEmission;
2169 bool LoadBlockVarAddr,
bool CanThrow);
2180 bool followForward =
true);
2184 const llvm::Twine &
name);
2240 const ThunkInfo *Thunk,
bool IsUnprototyped);
2246 llvm::FunctionCallee Callee);
2251 bool IsUnprototyped);
2280 bool BaseIsNonVirtualPrimaryBase,
2330 llvm::Value *VTable,
2331 llvm::Type *VTableTy,
2362 llvm::Constant *Addr);
2367 llvm::Value *EncodedAddr);
2428 llvm::Function *parent =
nullptr,
2429 llvm::BasicBlock *
before =
nullptr) {
2450 void EmitBlock(llvm::BasicBlock *BB,
bool IsFinished=
false);
2469 return Builder.GetInsertBlock() !=
nullptr;
2563 llvm::AllocaInst *
CreateTempAlloca(llvm::Type *Ty,
const Twine &Name =
"tmp",
2564 llvm::Value *ArraySize =
nullptr);
2566 const Twine &Name =
"tmp",
2567 llvm::Value *ArraySize =
nullptr,
2570 const Twine &Name =
"tmp",
2571 llvm::Value *ArraySize =
nullptr);
2584 const Twine &Name =
"tmp");
2608 const Twine &Name =
"tmp");
2640 bool ignoreResult =
false);
2665 bool capturedByInit);
2671 const RecordDecl *RD = cast<RecordDecl>(RT->getDecl());
2714 bool isVolatile =
false);
2718 auto it = LocalDeclMap.find(VD);
2719 assert(it != LocalDeclMap.end() &&
2720 "Invalid argument to GetAddrOfLocalVar(), no decl!");
2756 llvm::Value *
EmitVAStartEnd(llvm::Value *ArgValue,
bool IsStart);
2802 assert(CXXThisValue &&
"no 'this' value for this function");
2803 return CXXThisValue;
2812 assert(CXXStructorImplicitParamValue &&
"no VTT value for this function");
2813 return CXXStructorImplicitParamValue;
2822 bool BaseIsVirtual);
2838 bool NullCheckValue);
2864 bool ForVirtualBase,
2873 bool InheritedFromVBase,
2877 bool ForVirtualBase,
bool Delegating,
2881 bool ForVirtualBase,
bool Delegating,
2901 bool NewPointerIsChecked,
2902 bool ZeroInitialization =
false);
2905 llvm::Value *NumElements,
2908 bool NewPointerIsChecked,
2909 bool ZeroInitialization =
false);
2914 bool ForVirtualBase,
bool Delegating,
Address This,
2918 llvm::Type *ElementTy,
Address NewPtr,
2919 llvm::Value *NumElements,
2920 llvm::Value *AllocSizeWithoutCookie);
2937 QualType DeleteTy, llvm::Value *NumElements =
nullptr,
2941 const CallExpr *TheCallExpr,
bool IsDelete);
3002 llvm::Value *ArraySize =
nullptr);
3008 QualType IndexType,
bool Accessed);
3011 bool isInc,
bool isPre);
3013 bool isInc,
bool isPre);
3037 bool capturedByInit);
3062 llvm::Value *NRVOFlag;
3066 bool IsEscapingByRef;
3070 bool IsConstantAggregate;
3073 llvm::Value *SizeForLifetimeMarkers;
3084 AutoVarEmission(
const VarDecl &variable)
3085 : Variable(&variable), Addr(
Address::
invalid()), NRVOFlag(nullptr),
3086 IsEscapingByRef(
false), IsConstantAggregate(
false),
3087 SizeForLifetimeMarkers(nullptr), AllocaAddr(
Address::
invalid()) {}
3089 bool wasEmittedAsGlobal()
const {
return !Addr.
isValid(); }
3095 return SizeForLifetimeMarkers !=
nullptr;
3099 return SizeForLifetimeMarkers;
3116 if (!IsEscapingByRef)
return Addr;
3134 bool EmitDebugInfo);
3137 llvm::GlobalValue::LinkageTypes
Linkage);
3141 llvm::Type *ElementType;
3143 ParamValue(llvm::Value *
V, llvm::Type *T,
unsigned A)
3144 :
Value(
V), ElementType(T), Alignment(A) {}
3187 llvm::Value *Alignment,
3188 llvm::Value *OffsetValue,
3189 llvm::Value *TheCheck,
3190 llvm::Instruction *Assumption);
3194 llvm::Value *Alignment,
3195 llvm::Value *OffsetValue =
nullptr);
3199 llvm::Value *Alignment,
3200 llvm::Value *OffsetValue =
nullptr);
3228 bool GetLast =
false,
3267 bool ignoreResult =
false);
3271 bool ignoreResult =
false);
3287 llvm::Function *FinallyFunc);
3289 const Stmt *OutlinedStmt);
3298 llvm::Value *ParentFP,
3299 llvm::Value *EntryEBP);
3320 llvm::Value *ParentFP);
3333 CGF.OMPCancelStack.enter(CGF,
Kind, HasCancel);
3395 OMPPrivateScope &PrivateScope);
3397 OMPPrivateScope &PrivateScope);
3400 const llvm::DenseMap<const ValueDecl *, Address> &CaptureDeviceAddrMap);
3403 const llvm::DenseMap<const ValueDecl *, Address> &CaptureDeviceAddrMap);
3428 OMPPrivateScope &PrivateScope);
3438 llvm::Value *IsLastIterCond =
nullptr);
3456 OMPPrivateScope &PrivateScope,
3457 bool ForInscan =
false);
3497 OMPTargetDataInfo &InputInfo);
3578 StringRef ParentName,
3605 StringRef ParentName,
3640 const Expr *LoopCond,
const Expr *IncExpr,
3647 OMPPrivateScope &LoopScope);
3677 struct OMPLoopArguments {
3687 llvm::Value *Chunk =
nullptr;
3689 Expr *EUB =
nullptr;
3691 Expr *IncExpr =
nullptr;
3693 Expr *Init =
nullptr;
3695 Expr *Cond =
nullptr;
3697 Expr *NextLB =
nullptr;
3699 Expr *NextUB =
nullptr;
3700 OMPLoopArguments() =
default;
3702 llvm::Value *Chunk =
nullptr,
Expr *EUB =
nullptr,
3703 Expr *IncExpr =
nullptr,
Expr *Init =
nullptr,
3704 Expr *Cond =
nullptr,
Expr *NextLB =
nullptr,
3705 Expr *NextUB =
nullptr)
3706 : LB(LB), UB(UB), ST(ST), IL(IL), Chunk(Chunk), EUB(EUB),
3707 IncExpr(IncExpr), Init(Init), Cond(Cond), NextLB(NextLB),
3710 void EmitOMPOuterLoop(
bool DynamicOrOrdered,
bool IsMonotonic,
3711 const OMPLoopDirective &S, OMPPrivateScope &LoopScope,
3712 const OMPLoopArguments &LoopArgs,
3715 void EmitOMPForOuterLoop(
const OpenMPScheduleTy &ScheduleKind,
3716 bool IsMonotonic,
const OMPLoopDirective &S,
3717 OMPPrivateScope &LoopScope,
bool Ordered,
3718 const OMPLoopArguments &LoopArgs,
3721 const OMPLoopDirective &S,
3722 OMPPrivateScope &LoopScope,
3723 const OMPLoopArguments &LoopArgs,
3726 void EmitSections(
const OMPExecutableDirective &S);
3775 SourceLocation Loc);
3785 llvm::AtomicOrdering AO,
bool IsVolatile =
false,
3790 void EmitAtomicStore(RValue rvalue, LValue lvalue, llvm::AtomicOrdering AO,
3791 bool IsVolatile,
bool isInit);
3794 LValue Obj, RValue
Expected, RValue Desired, SourceLocation Loc,
3795 llvm::AtomicOrdering Success =
3796 llvm::AtomicOrdering::SequentiallyConsistent,
3797 llvm::AtomicOrdering Failure =
3798 llvm::AtomicOrdering::SequentiallyConsistent,
3802 const llvm::function_ref<RValue(RValue)> &UpdateOp,
3818 SourceLocation Loc);
3826 bool isNontemporal =
false) {
3834 bool isNontemporal =
false);
3848 bool isInit =
false,
bool isNontemporal =
false) {
3856 bool isInit =
false,
bool isNontemporal =
false);
3887 llvm::Value **Result=
nullptr);
3893 llvm::Value *&Result);
3908 bool Accessed =
false);
3911 bool IsLowerBound =
true);
3932 llvm::PointerIntPair<llvm::Constant*, 1, bool> ValueAndIsReference;
3945 return ValueAndIsReference.getOpaqueValue() !=
nullptr;
3957 return ValueAndIsReference.getPointer();
3982 unsigned CVRQualifiers);
4005 llvm::CallBase **callOrInvoke,
bool IsMustTail,
4009 llvm::CallBase **callOrInvoke =
nullptr,
4010 bool IsMustTail =
false) {
4025 const Twine &
name =
"");
4028 const Twine &
name =
"");
4030 const Twine &
name =
"");
4033 const Twine &
name =
"");
4040 const Twine &Name =
"");
4043 const Twine &
name =
"");
4045 const Twine &
name =
"");
4084 llvm::Value *ImplicitParam,
4089 llvm::Value *ImplicitParam,
4101 llvm::Value *memberPtr,
4145 const llvm::CmpInst::Predicate Fp,
4146 const llvm::CmpInst::Predicate Ip,
4147 const llvm::Twine &Name =
"");
4150 llvm::Triple::ArchType Arch);
4153 llvm::Triple::ArchType Arch);
4156 llvm::Triple::ArchType Arch);
4163 unsigned LLVMIntrinsic,
4164 unsigned AltLLVMIntrinsic,
4165 const char *NameHint,
4170 llvm::Triple::ArchType Arch);
4173 unsigned Modifier, llvm::Type *ArgTy,
4178 unsigned shift = 0,
bool rightshift =
false);
4180 const llvm::ElementCount &Count);
4183 bool negateForRightShift);
4185 llvm::Type *Ty,
bool usgn,
const char *
name);
4200 llvm::Value *
EmitSVEDupX(llvm::Value *Scalar, llvm::Type *Ty);
4204 unsigned BuiltinID);
4207 unsigned BuiltinID);
4209 llvm::ScalableVectorType *VTy);
4218 unsigned BuiltinID,
bool IsZExtReturn);
4221 unsigned BuiltinID);
4224 unsigned BuiltinID);
4237 llvm::Triple::ArchType Arch);
4252 llvm::AtomicOrdering &AO,
4291 bool resultIgnored);
4293 bool resultIgnored);
4307 llvm::Type *returnType);
4310 std::pair<LValue,llvm::Value*>
4312 std::pair<LValue,llvm::Value*>
4314 std::pair<LValue,llvm::Value*>
4318 llvm::Type *returnType);
4320 llvm::Type *returnType);
4329 bool allowUnsafeClaim);
4394 bool IgnoreReal =
false,
4395 bool IgnoreImag =
false);
4414 llvm::GlobalVariable *
4416 llvm::GlobalVariable *GV);
4427 llvm::Constant *Addr);
4430 llvm::FunctionCallee Dtor,
4431 llvm::Constant *Addr,
4432 llvm::FunctionCallee &AtExit);
4437 llvm::Constant *addr);
4457 llvm::BasicBlock *InitBlock,
4458 llvm::BasicBlock *NoInitBlock,
4472 ArrayRef<std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH,
4474 DtorsOrStermFinalizers);
4478 llvm::GlobalVariable *Addr,
4495 llvm::Value *AnnotatedVal,
4496 StringRef AnnotationStr,
4498 const AnnotateAttr *
Attr);
4529 bool AllowLabels =
false);
4535 bool AllowLabels =
false);
4546 llvm::BasicBlock *TrueBlock,
4547 llvm::BasicBlock *FalseBlock,
4550 const Expr *CntrIdx =
nullptr);
4558 llvm::BasicBlock *FalseBlock,
uint64_t TrueCount,
4579 const Twine &Name =
"");