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"
53 class CanonicalLoopInfo;
58 class CXXDestructorDecl;
59 class CXXForRangeStmt;
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;
79 class OMPUseDevicePtrClause;
80 class OMPUseDeviceAddrClause;
82 class OMPExecutableDirective;
84 namespace analyze_os_log {
85 class OSLogBufferLayout;
94 class BlockByrefHelpers;
96 class BlockFieldFlags;
97 class RegionCodeGenTy;
98 class TargetCodeGenInfo;
113 #define LIST_SANITIZER_CHECKS \
114 SANITIZER_CHECK(AddOverflow, add_overflow, 0) \
115 SANITIZER_CHECK(BuiltinUnreachable, builtin_unreachable, 0) \
116 SANITIZER_CHECK(CFICheckFail, cfi_check_fail, 0) \
117 SANITIZER_CHECK(DivremOverflow, divrem_overflow, 0) \
118 SANITIZER_CHECK(DynamicTypeCacheMiss, dynamic_type_cache_miss, 0) \
119 SANITIZER_CHECK(FloatCastOverflow, float_cast_overflow, 0) \
120 SANITIZER_CHECK(FunctionTypeMismatch, function_type_mismatch, 1) \
121 SANITIZER_CHECK(ImplicitConversion, implicit_conversion, 0) \
122 SANITIZER_CHECK(InvalidBuiltin, invalid_builtin, 0) \
123 SANITIZER_CHECK(InvalidObjCCast, invalid_objc_cast, 0) \
124 SANITIZER_CHECK(LoadInvalidValue, load_invalid_value, 0) \
125 SANITIZER_CHECK(MissingReturn, missing_return, 0) \
126 SANITIZER_CHECK(MulOverflow, mul_overflow, 0) \
127 SANITIZER_CHECK(NegateOverflow, negate_overflow, 0) \
128 SANITIZER_CHECK(NullabilityArg, nullability_arg, 0) \
129 SANITIZER_CHECK(NullabilityReturn, nullability_return, 1) \
130 SANITIZER_CHECK(NonnullArg, nonnull_arg, 0) \
131 SANITIZER_CHECK(NonnullReturn, nonnull_return, 1) \
132 SANITIZER_CHECK(OutOfBounds, out_of_bounds, 0) \
133 SANITIZER_CHECK(PointerOverflow, pointer_overflow, 0) \
134 SANITIZER_CHECK(ShiftOutOfBounds, shift_out_of_bounds, 0) \
135 SANITIZER_CHECK(SubOverflow, sub_overflow, 0) \
136 SANITIZER_CHECK(TypeMismatch, type_mismatch, 1) \
137 SANITIZER_CHECK(AlignmentAssumption, alignment_assumption, 0) \
138 SANITIZER_CHECK(VLABoundNotPositive, vla_bound_not_positive, 0)
141 #define SANITIZER_CHECK(Enum, Name, Version) Enum,
143 #undef SANITIZER_CHECK
149 typedef llvm::PointerIntPair<llvm::Value*, 1, bool>
saved_type;
154 if (!isa<llvm::Instruction>(value))
return false;
157 llvm::BasicBlock *block = cast<llvm::Instruction>(value)->getParent();
158 return (block != &block->getParent()->getEntryBlock());
193 value.ElementType, value.Alignment);
201 enum Kind { ScalarLiteral, ScalarAddress, AggregateLiteral,
202 AggregateAddress, ComplexAddress };
205 llvm::Type *ElementType;
208 saved_type(llvm::Value *
v, llvm::Type *e, Kind k,
unsigned a = 0)
209 :
Value(
v), ElementType(e), K(k), Align(a) {}
220 return saved_type::needsSaving(value);
223 return saved_type::save(CGF, value);
226 return value.restore(CGF);
246 bool isValid()
const {
return Block !=
nullptr; }
247 llvm::BasicBlock *
getBlock()
const {
return Block; }
257 llvm::BasicBlock *Block;
299 const unsigned,
const bool)>
303 typedef llvm::function_ref<std::pair<LValue, LValue>(
308 typedef llvm::function_ref<std::pair<llvm::Value *, llvm::Value *>(
315 void InsertHelper(llvm::Instruction *I,
const llvm::Twine &Name,
316 llvm::BasicBlock *BB,
317 llvm::BasicBlock::iterator InsertPt)
const;
335 std::unique_ptr<CGCoroData>
Data;
371 return !LabelMap.empty();
387 llvm::AssertingVH<llvm::Instruction> PostAllocaInsertPt =
nullptr;
393 if (!PostAllocaInsertPt) {
395 "Expected static alloca insertion point at function prologue");
397 "EBB should be entry block of the current code gen function");
399 PostAllocaInsertPt->setName(
"postallocapt");
403 return PostAllocaInsertPt;
410 : Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {}
413 : Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {
416 S.getCapturedRecordDecl()->field_begin();
419 I != E; ++I, ++Field) {
420 if (I->capturesThis())
421 CXXThisFieldDecl = *Field;
422 else if (I->capturesVariable())
423 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
424 else if (I->capturesVariableByCopy())
425 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
460 return CaptureFields;
468 llvm::SmallDenseMap<const VarDecl *, FieldDecl *> CaptureFields;
472 llvm::Value *ThisValue;
496 const Decl *CalleeDecl;
503 return isa_and_nonnull<FunctionDecl>(CalleeDecl);
507 if (
const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl))
508 return FD->getNumParams();
509 return cast<ObjCMethodDecl>(CalleeDecl)->param_size();
512 if (
const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl))
513 return FD->getParamDecl(I);
514 return *(cast<ObjCMethodDecl>(CalleeDecl)->param_begin() + I);
570 CodeGenOptions::FiniteLoopsKind::Never)
589 CodeGenOptions::FiniteLoopsKind::Always)
592 CodeGenOptions::FiniteLoopsKind::Never)
618 llvm::DenseMap<const VarDecl *, llvm::Value *>
NRVOFlags;
627 bool isRedundantBeforeReturn()
override {
return true; }
634 : Addr(addr.getPointer()), Size(size) {}
722 void ConstructorHelper(
FPOptions FPFeatures);
725 llvm::fp::ExceptionBehavior OldExcept;
726 llvm::RoundingMode OldRounding;
727 std::optional<CGBuilderTy::FastMathFlagGuard> FMFGuard;
742 llvm::FunctionCallee BeginCatchFn;
746 llvm::AllocaInst *ForEHVar;
750 llvm::AllocaInst *SavedExnVar;
754 llvm::FunctionCallee beginCatchFn,
755 llvm::FunctionCallee endCatchFn, llvm::FunctionCallee rethrowFn);
770 template <
class T,
class... As>
778 typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
788 template <
class T,
class... As>
796 "cleanup active flag should never need saving");
798 typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
802 pushCleanupAfterFullExprWithActiveFlag<CleanupType>(
Kind, ActiveFlag, Saved);
805 template <
class T,
class... As>
816 static_assert(
sizeof(Header) %
alignof(T) == 0,
817 "Cleanup will be allocated on misaligned address");
820 new (Buffer +
sizeof(Header)) T(A...);
822 new (Buffer +
sizeof(Header) +
sizeof(T))
Address(ActiveFlag);
859 llvm::Instruction *DominatingIP);
869 llvm::Instruction *DominatingIP);
875 size_t LifetimeExtendedCleanupStackSize;
876 bool OldDidCallStackSave;
893 LifetimeExtendedCleanupStackSize =
895 OldDidCallStackSave =
CGF.DidCallStackSave;
896 CGF.DidCallStackSave =
false;
918 void ForceCleanup(std::initializer_list<llvm::Value**> ValuesToReload = {}) {
920 CGF.DidCallStackSave = OldDidCallStackSave;
944 CGF.CurLexicalScope =
this;
946 DI->EmitLexicalBlockStart(
CGF.
Builder, Range.getBegin());
951 Labels.push_back(label);
958 DI->EmitLexicalBlockEnd(
CGF.
Builder, Range.getEnd());
971 CGF.CurLexicalScope = ParentScope;
979 return !Labels.empty();
985 typedef llvm::DenseMap<const Decl *, Address>
DeclMapTy;
997 assert(SavedLocals.empty() &&
"Did not restored original addresses.");
1007 if (SavedLocals.count(LocalVD))
return false;
1010 auto it = CGF.LocalDeclMap.find(LocalVD);
1011 if (it != CGF.LocalDeclMap.end())
1012 SavedLocals.try_emplace(LocalVD, it->second);
1023 SavedTempAddresses.try_emplace(LocalVD, TempAddr);
1032 copyInto(SavedTempAddresses, CGF.LocalDeclMap);
1033 SavedTempAddresses.clear();
1034 return !SavedLocals.empty();
1039 if (!SavedLocals.empty()) {
1040 copyInto(SavedLocals, CGF.LocalDeclMap);
1041 SavedLocals.clear();
1049 for (
auto &Pair : Src) {
1050 if (!Pair.second.isValid()) {
1051 Dest.erase(Pair.first);
1055 auto I = Dest.find(Pair.first);
1056 if (I != Dest.end())
1057 I->second = Pair.second;
1128 : CGF(CGF), SavedMap(CGF.LocalDeclMap) {}
1136 std::initializer_list<llvm::Value **> ValuesToReload = {});
1143 size_t OldLifetimeExtendedStackSize,
1144 std::initializer_list<llvm::Value **> ValuesToReload = {});
1186 llvm::BasicBlock *StartBB;
1190 : StartBB(CGF.
Builder.GetInsertBlock()) {}
1193 assert(CGF.OutermostConditional !=
this);
1194 if (!CGF.OutermostConditional)
1195 CGF.OutermostConditional =
this;
1199 assert(CGF.OutermostConditional !=
nullptr);
1200 if (CGF.OutermostConditional ==
this)
1201 CGF.OutermostConditional =
nullptr;
1218 auto store =
new llvm::StoreInst(value, addr.
getPointer(), &block->back());
1234 : CGF(CGF), SavedOutermostConditional(CGF.OutermostConditional) {
1235 CGF.OutermostConditional =
nullptr;
1239 CGF.OutermostConditional = SavedOutermostConditional;
1248 llvm::Instruction *Inst;
1268 : OpaqueValue(ov), BoundLValue(boundLValue) {}
1278 return expr->isGLValue() ||
1279 expr->getType()->isFunctionType() ||
1295 CGF.OpaqueLValues.insert(std::make_pair(ov, lv));
1303 CGF.OpaqueRValues.insert(std::make_pair(ov, rv));
1315 bool isValid()
const {
return OpaqueValue !=
nullptr; }
1319 assert(OpaqueValue &&
"no data to unbind!");
1322 CGF.OpaqueLValues.erase(OpaqueValue);
1324 CGF.OpaqueRValues.erase(OpaqueValue);
1347 if (isa<ConditionalOperator>(op))
1361 assert(OV->
getSourceExpr() &&
"wrong form of OpaqueValueMapping used "
1362 "for OVE with no source expression");
1392 unsigned VLAExprCounter = 0;
1393 bool DisableDebugInfo =
false;
1397 bool DidCallStackSave =
false;
1403 llvm::IndirectBrInst *IndirectBranch =
nullptr;
1411 llvm::DenseMap<const ParmVarDecl *, EHScopeStack::stable_iterator>
1412 CalleeDestructedParamCleanups;
1417 llvm::SmallDenseMap<const ParmVarDecl *, const ImplicitParamDecl *, 2>
1422 llvm::DenseMap<llvm::AllocaInst *, int> EscapedLocals;
1425 llvm::DenseMap<const LabelDecl*, JumpDest> LabelMap;
1429 struct BreakContinue {
1430 BreakContinue(JumpDest Break, JumpDest Continue)
1431 : BreakBlock(Break), ContinueBlock(Continue) {}
1433 JumpDest BreakBlock;
1434 JumpDest ContinueBlock;
1436 SmallVector<BreakContinue, 8> BreakContinueStack;
1439 class OpenMPCancelExitStack {
1443 CancelExit() =
default;
1446 :
Kind(
Kind), ExitBlock(ExitBlock), ContBlock(ContBlock) {}
1450 bool HasBeenEmitted =
false;
1455 SmallVector<CancelExit, 8> Stack;
1458 OpenMPCancelExitStack() : Stack(1) {}
1459 ~OpenMPCancelExitStack() =
default;
1461 JumpDest getExitBlock()
const {
return Stack.back().ExitBlock; }
1465 const llvm::function_ref<
void(CodeGenFunction &)> CodeGen) {
1466 if (Stack.back().Kind ==
Kind && getExitBlock().isValid()) {
1467 assert(CGF.getOMPCancelDestination(
Kind).isValid());
1468 assert(CGF.HaveInsertPoint());
1469 assert(!Stack.back().HasBeenEmitted);
1470 auto IP = CGF.Builder.saveAndClearIP();
1471 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1473 CGF.EmitBranch(Stack.back().ContBlock.getBlock());
1474 CGF.Builder.restoreIP(IP);
1475 Stack.back().HasBeenEmitted =
true;
1484 Stack.push_back({
Kind,
1485 HasCancel ? CGF.getJumpDestInCurrentScope(
"cancel.exit")
1487 HasCancel ? CGF.getJumpDestInCurrentScope(
"cancel.cont")
1492 void exit(CodeGenFunction &CGF) {
1493 if (getExitBlock().isValid()) {
1494 assert(CGF.getOMPCancelDestination(Stack.back().Kind).isValid());
1495 bool HaveIP = CGF.HaveInsertPoint();
1496 if (!Stack.back().HasBeenEmitted) {
1498 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1499 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1500 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1502 CGF.EmitBlock(Stack.back().ContBlock.getBlock());
1504 CGF.Builder.CreateUnreachable();
1505 CGF.Builder.ClearInsertionPoint();
1511 OpenMPCancelExitStack OMPCancelStack;
1514 llvm::Value *emitCondLikelihoodViaExpectIntrinsic(llvm::Value *Cond,
1520 llvm::MDNode *createProfileWeights(
uint64_t TrueCount,
1522 llvm::MDNode *createProfileWeights(ArrayRef<uint64_t> Weights)
const;
1523 llvm::MDNode *createProfileWeightsForLoop(
const Stmt *Cond,
1531 !
CurFn->hasFnAttribute(llvm::Attribute::NoProfile) &&
1532 !
CurFn->hasFnAttribute(llvm::Attribute::SkipProfile))
1533 PGO.emitCounterIncrement(
Builder, S, StepV);
1534 PGO.setCurrentStmt(S);
1539 return PGO.getStmtCount(S).value_or(0);
1544 PGO.setCurrentRegionCount(Count);
1550 return PGO.getCurrentRegionCount();
1557 llvm::SwitchInst *SwitchInsn =
nullptr;
1566 llvm::BasicBlock *CaseRangeBlock =
nullptr;
1570 llvm::DenseMap<const OpaqueValueExpr *, LValue> OpaqueLValues;
1571 llvm::DenseMap<const OpaqueValueExpr *, RValue> OpaqueRValues;
1579 llvm::DenseMap<const Expr*, llvm::Value*> VLASizeMap;
1583 llvm::BasicBlock *UnreachableBlock =
nullptr;
1586 unsigned NumReturnExprs = 0;
1589 unsigned NumSimpleReturnExprs = 0;
1607 : CGF(CGF), OldCXXDefaultInitExprThis(CGF.CXXDefaultInitExprThis) {
1608 CGF.CXXDefaultInitExprThis =
This;
1611 CGF.CXXDefaultInitExprThis = OldCXXDefaultInitExprThis;
1616 Address OldCXXDefaultInitExprThis;
1652 : CGF(CGF), OldArrayInitIndex(CGF.ArrayInitIndex) {
1653 CGF.ArrayInitIndex = Index;
1656 CGF.ArrayInitIndex = OldArrayInitIndex;
1661 llvm::Value *OldArrayInitIndex;
1669 OldCXXABIThisDecl(CGF.CXXABIThisDecl),
1670 OldCXXABIThisValue(CGF.CXXABIThisValue),
1671 OldCXXThisValue(CGF.CXXThisValue),
1672 OldCXXABIThisAlignment(CGF.CXXABIThisAlignment),
1673 OldCXXThisAlignment(CGF.CXXThisAlignment),
1675 OldCXXInheritedCtorInitExprArgs(
1676 std::move(CGF.CXXInheritedCtorInitExprArgs)) {
1679 cast<CXXConstructorDecl>(GD.
getDecl());
1680 CGF.CXXABIThisDecl =
nullptr;
1681 CGF.CXXABIThisValue =
nullptr;
1682 CGF.CXXThisValue =
nullptr;
1687 CGF.CXXInheritedCtorInitExprArgs.clear();
1690 CGF.CurGD = OldCurGD;
1691 CGF.CurFuncDecl = OldCurFuncDecl;
1692 CGF.CurCodeDecl = OldCurCodeDecl;
1693 CGF.CXXABIThisDecl = OldCXXABIThisDecl;
1694 CGF.CXXABIThisValue = OldCXXABIThisValue;
1695 CGF.CXXThisValue = OldCXXThisValue;
1696 CGF.CXXABIThisAlignment = OldCXXABIThisAlignment;
1697 CGF.CXXThisAlignment = OldCXXThisAlignment;
1698 CGF.ReturnValue = OldReturnValue;
1699 CGF.FnRetTy = OldFnRetTy;
1700 CGF.CXXInheritedCtorInitExprArgs =
1701 std::move(OldCXXInheritedCtorInitExprArgs);
1707 const Decl *OldCurFuncDecl;
1708 const Decl *OldCurCodeDecl;
1710 llvm::Value *OldCXXABIThisValue;
1711 llvm::Value *OldCXXThisValue;
1742 llvm::CallInst *RTLFnCI;
1746 RLFnCI->removeFromParent();
1776 StringRef FirstSeparator =
".",
1777 StringRef Separator =
".");
1782 CGBuilderTy::InsertPointGuard IPG(CGF.
Builder);
1783 assert(IP.getBlock()->end() != IP.getPoint() &&
1784 "OpenMP IR Builder should cause terminated block!");
1786 llvm::BasicBlock *IPBB = IP.getBlock();
1787 llvm::BasicBlock *DestBB = IPBB->getUniqueSuccessor();
1788 assert(DestBB &&
"Finalization block should have one successor!");
1791 IPBB->getTerminator()->eraseFromParent();
1792 CGF.
Builder.SetInsertPoint(IPBB);
1805 const Stmt *RegionBodyStmt,
1811 llvm::BasicBlock &FiniBB, llvm::Function *Fn,
1813 llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
1814 if (llvm::Instruction *CodeGenIPBBTI = CodeGenIPBB->getTerminator())
1815 CodeGenIPBBTI->eraseFromParent();
1817 CGF.
Builder.SetInsertPoint(CodeGenIPBB);
1819 if (Fn->doesNotThrow())
1824 if (CGF.
Builder.saveIP().isSet())
1825 CGF.
Builder.CreateBr(&FiniBB);
1837 const Stmt *RegionBodyStmt,
1845 llvm::AssertingVH<llvm::Instruction> OldAllocaIP;
1851 llvm::BasicBlock &RetBB)
1853 assert(AllocaIP.isSet() &&
1854 "Must specify Insertion point for allocas of outlined function");
1871 llvm::AssertingVH<llvm::Instruction> OldAllocaIP;
1876 llvm::BasicBlock &FiniBB)
1882 assert((!AllocaIP.isSet() ||
1884 "Insertion point should be in the entry block of containing "
1887 if (AllocaIP.isSet())
1906 llvm::Value *CXXABIThisValue =
nullptr;
1907 llvm::Value *CXXThisValue =
nullptr;
1917 llvm::Value *ArrayInitIndex =
nullptr;
1926 llvm::Value *CXXStructorImplicitParamValue =
nullptr;
1931 ConditionalEvaluation *OutermostConditional =
nullptr;
1934 LexicalScope *CurLexicalScope =
nullptr;
1942 llvm::DenseMap<const ValueDecl *, BlockByrefInfo> BlockByrefInfos;
1946 llvm::Value *RetValNullabilityPrecondition =
nullptr;
1950 bool requiresReturnValueNullabilityCheck()
const {
1951 return RetValNullabilityPrecondition;
1959 bool requiresReturnValueCheck()
const;
1961 llvm::BasicBlock *TerminateLandingPad =
nullptr;
1962 llvm::BasicBlock *TerminateHandler =
nullptr;
1966 llvm::MapVector<llvm::Value *, llvm::BasicBlock *> TerminateFunclets;
1970 unsigned LargestVectorWidth = 0;
1974 bool ShouldEmitLifetimeMarkers;
1978 void EmitKernelMetadata(
const FunctionDecl *FD, llvm::Function *Fn);
1981 CodeGenFunction(CodeGenModule &cgm,
bool suppressNewContext=
false);
1987 if (DisableDebugInfo)
2013 if (!UnreachableBlock) {
2017 return UnreachableBlock;
2045 llvm::Value *arrayEnd,
2055 Destroyer *destroyer,
bool useEHCleanupForArray);
2058 bool useEHCleanupForArray);
2060 llvm::Value *CompletePtr,
2064 bool useEHCleanupForArray);
2067 bool useEHCleanupForArray,
2072 bool checkZeroLength,
bool useEHCleanup);
2090 llvm_unreachable(
"bad destruction kind");
2111 llvm::Constant *AtomicHelperFn);
2122 llvm::Constant *AtomicHelperFn);
2137 bool IsLambdaConversionToBlock,
2138 bool BuildGlobalBlock);
2154 class AutoVarEmission;
2175 bool LoadBlockVarAddr,
bool CanThrow);
2186 bool followForward =
true);
2190 const llvm::Twine &
name);
2246 const ThunkInfo *Thunk,
bool IsUnprototyped);
2252 llvm::FunctionCallee Callee);
2257 bool IsUnprototyped);
2286 bool BaseIsNonVirtualPrimaryBase,
2336 llvm::Value *VTable,
2337 llvm::Type *VTableTy,
2369 llvm::Value *EncodedAddr);
2430 llvm::Function *parent =
nullptr,
2431 llvm::BasicBlock *
before =
nullptr) {
2452 void EmitBlock(llvm::BasicBlock *BB,
bool IsFinished=
false);
2471 return Builder.GetInsertBlock() !=
nullptr;
2565 llvm::AllocaInst *
CreateTempAlloca(llvm::Type *Ty,
const Twine &Name =
"tmp",
2566 llvm::Value *ArraySize =
nullptr);
2568 const Twine &Name =
"tmp",
2569 llvm::Value *ArraySize =
nullptr,
2572 const Twine &Name =
"tmp",
2573 llvm::Value *ArraySize =
nullptr);
2586 const Twine &Name =
"tmp");
2610 const Twine &Name =
"tmp");
2642 bool ignoreResult =
false);
2667 bool capturedByInit);
2673 const RecordDecl *RD = cast<RecordDecl>(RT->getDecl());
2716 bool isVolatile =
false);
2720 auto it = LocalDeclMap.find(VD);
2721 assert(it != LocalDeclMap.end() &&
2722 "Invalid argument to GetAddrOfLocalVar(), no decl!");
2758 llvm::Value *
EmitVAStartEnd(llvm::Value *ArgValue,
bool IsStart);
2804 assert(CXXThisValue &&
"no 'this' value for this function");
2805 return CXXThisValue;
2814 assert(CXXStructorImplicitParamValue &&
"no VTT value for this function");
2815 return CXXStructorImplicitParamValue;
2824 bool BaseIsVirtual);
2840 bool NullCheckValue);
2866 bool ForVirtualBase,
2875 bool InheritedFromVBase,
2879 bool ForVirtualBase,
bool Delegating,
2883 bool ForVirtualBase,
bool Delegating,
2903 bool NewPointerIsChecked,
2904 bool ZeroInitialization =
false);
2907 llvm::Value *NumElements,
2910 bool NewPointerIsChecked,
2911 bool ZeroInitialization =
false);
2916 bool ForVirtualBase,
bool Delegating,
Address This,
2920 llvm::Type *ElementTy,
Address NewPtr,
2921 llvm::Value *NumElements,
2922 llvm::Value *AllocSizeWithoutCookie);
2939 QualType DeleteTy, llvm::Value *NumElements =
nullptr,
2943 const CallExpr *TheCallExpr,
bool IsDelete);
3004 llvm::Value *ArraySize =
nullptr);
3010 QualType IndexType,
bool Accessed);
3013 bool isInc,
bool isPre);
3015 bool isInc,
bool isPre);
3039 bool capturedByInit);
3064 llvm::Value *NRVOFlag;
3068 bool IsEscapingByRef;
3072 bool IsConstantAggregate;
3075 llvm::Value *SizeForLifetimeMarkers;
3086 AutoVarEmission(
const VarDecl &variable)
3087 : Variable(&variable), Addr(
Address::
invalid()), NRVOFlag(nullptr),
3088 IsEscapingByRef(
false), IsConstantAggregate(
false),
3089 SizeForLifetimeMarkers(nullptr), AllocaAddr(
Address::
invalid()) {}
3091 bool wasEmittedAsGlobal()
const {
return !Addr.
isValid(); }
3097 return SizeForLifetimeMarkers !=
nullptr;
3101 return SizeForLifetimeMarkers;
3118 if (!IsEscapingByRef)
return Addr;
3136 bool EmitDebugInfo);
3139 llvm::GlobalValue::LinkageTypes
Linkage);
3143 llvm::Type *ElementType;
3145 ParamValue(llvm::Value *
V, llvm::Type *T,
unsigned A)
3146 :
Value(
V), ElementType(T), Alignment(A) {}
3189 llvm::Value *Alignment,
3190 llvm::Value *OffsetValue,
3191 llvm::Value *TheCheck,
3192 llvm::Instruction *Assumption);
3196 llvm::Value *Alignment,
3197 llvm::Value *OffsetValue =
nullptr);
3201 llvm::Value *Alignment,
3202 llvm::Value *OffsetValue =
nullptr);
3230 bool GetLast =
false,
3269 bool ignoreResult =
false);
3273 bool ignoreResult =
false);
3289 llvm::Function *FinallyFunc);
3291 const Stmt *OutlinedStmt);
3300 llvm::Value *ParentFP,
3301 llvm::Value *EntryEBP);
3322 llvm::Value *ParentFP);
3335 CGF.OMPCancelStack.enter(CGF,
Kind, HasCancel);
3397 OMPPrivateScope &PrivateScope);
3399 OMPPrivateScope &PrivateScope);
3402 const llvm::DenseMap<const ValueDecl *, Address> &CaptureDeviceAddrMap);
3405 const llvm::DenseMap<const ValueDecl *, Address> &CaptureDeviceAddrMap);
3430 OMPPrivateScope &PrivateScope);
3440 llvm::Value *IsLastIterCond =
nullptr);
3458 OMPPrivateScope &PrivateScope,
3459 bool ForInscan =
false);
3499 OMPTargetDataInfo &InputInfo);
3504 OMPPrivateScope &
Scope);
3585 StringRef ParentName,
3612 StringRef ParentName,
3647 const Expr *LoopCond,
const Expr *IncExpr,
3654 OMPPrivateScope &LoopScope);
3684 struct OMPLoopArguments {
3694 llvm::Value *Chunk =
nullptr;
3696 Expr *EUB =
nullptr;
3698 Expr *IncExpr =
nullptr;
3700 Expr *Init =
nullptr;
3702 Expr *Cond =
nullptr;
3704 Expr *NextLB =
nullptr;
3706 Expr *NextUB =
nullptr;
3707 OMPLoopArguments() =
default;
3709 llvm::Value *Chunk =
nullptr,
Expr *EUB =
nullptr,
3710 Expr *IncExpr =
nullptr,
Expr *Init =
nullptr,
3711 Expr *Cond =
nullptr,
Expr *NextLB =
nullptr,
3712 Expr *NextUB =
nullptr)
3713 : LB(LB), UB(UB), ST(ST), IL(IL), Chunk(Chunk), EUB(EUB),
3714 IncExpr(IncExpr), Init(Init), Cond(Cond), NextLB(NextLB),
3717 void EmitOMPOuterLoop(
bool DynamicOrOrdered,
bool IsMonotonic,
3718 const OMPLoopDirective &S, OMPPrivateScope &LoopScope,
3719 const OMPLoopArguments &LoopArgs,
3722 void EmitOMPForOuterLoop(
const OpenMPScheduleTy &ScheduleKind,
3723 bool IsMonotonic,
const OMPLoopDirective &S,
3724 OMPPrivateScope &LoopScope,
bool Ordered,
3725 const OMPLoopArguments &LoopArgs,
3728 const OMPLoopDirective &S,
3729 OMPPrivateScope &LoopScope,
3730 const OMPLoopArguments &LoopArgs,
3733 void EmitSections(
const OMPExecutableDirective &S);
3782 SourceLocation Loc);
3792 llvm::AtomicOrdering AO,
bool IsVolatile =
false,
3797 void EmitAtomicStore(RValue rvalue, LValue lvalue, llvm::AtomicOrdering AO,
3798 bool IsVolatile,
bool isInit);
3801 LValue Obj, RValue
Expected, RValue Desired, SourceLocation Loc,
3802 llvm::AtomicOrdering Success =
3803 llvm::AtomicOrdering::SequentiallyConsistent,
3804 llvm::AtomicOrdering Failure =
3805 llvm::AtomicOrdering::SequentiallyConsistent,
3809 const llvm::function_ref<RValue(RValue)> &UpdateOp,
3825 SourceLocation Loc);
3833 bool isNontemporal =
false) {
3841 bool isNontemporal =
false);
3855 bool isInit =
false,
bool isNontemporal =
false) {
3863 bool isInit =
false,
bool isNontemporal =
false);
3894 llvm::Value **Result=
nullptr);
3900 llvm::Value *&Result);
3915 bool Accessed =
false);
3918 bool IsLowerBound =
true);
3939 llvm::PointerIntPair<llvm::Constant*, 1, bool> ValueAndIsReference;
3952 return ValueAndIsReference.getOpaqueValue() !=
nullptr;
3964 return ValueAndIsReference.getPointer();
3991 unsigned CVRQualifiers);
4014 llvm::CallBase **callOrInvoke,
bool IsMustTail,
4018 llvm::CallBase **callOrInvoke =
nullptr,
4019 bool IsMustTail =
false) {
4034 const Twine &
name =
"");
4037 const Twine &
name =
"");
4039 const Twine &
name =
"");
4042 const Twine &
name =
"");
4049 const Twine &Name =
"");
4052 const Twine &
name =
"");
4054 const Twine &
name =
"");
4093 llvm::Value *ImplicitParam,
4098 llvm::Value *ImplicitParam,
4110 llvm::Value *memberPtr,
4154 const llvm::CmpInst::Predicate Fp,
4155 const llvm::CmpInst::Predicate Ip,
4156 const llvm::Twine &Name =
"");
4159 llvm::Triple::ArchType Arch);
4162 llvm::Triple::ArchType Arch);
4165 llvm::Triple::ArchType Arch);
4172 unsigned LLVMIntrinsic,
4173 unsigned AltLLVMIntrinsic,
4174 const char *NameHint,
4179 llvm::Triple::ArchType Arch);
4182 unsigned Modifier, llvm::Type *ArgTy,
4187 unsigned shift = 0,
bool rightshift =
false);
4189 const llvm::ElementCount &Count);
4192 bool negateForRightShift);
4194 llvm::Type *Ty,
bool usgn,
const char *
name);
4208 llvm::Type *ReturnType,
4211 llvm::Type *ReturnType,
4215 llvm::Value *
EmitSVEDupX(llvm::Value *Scalar, llvm::Type *Ty);
4219 unsigned BuiltinID);
4222 unsigned BuiltinID);
4224 llvm::ScalableVectorType *VTy);
4233 unsigned BuiltinID,
bool IsZExtReturn);
4236 unsigned BuiltinID);
4239 unsigned BuiltinID);
4252 llvm::Triple::ArchType Arch);
4268 llvm::AtomicOrdering &AO,
4307 bool resultIgnored);
4309 bool resultIgnored);
4323 llvm::Type *returnType);
4326 std::pair<LValue,llvm::Value*>
4328 std::pair<LValue,llvm::Value*>
4330 std::pair<LValue,llvm::Value*>
4334 llvm::Type *returnType);
4336 llvm::Type *returnType);
4345 bool allowUnsafeClaim);
4410 bool IgnoreReal =
false,
4411 bool IgnoreImag =
false);
4435 llvm::GlobalVariable *
4437 llvm::GlobalVariable *GV);
4448 llvm::Constant *Addr);
4451 llvm::FunctionCallee Dtor,
4452 llvm::Constant *Addr,
4453 llvm::FunctionCallee &AtExit);
4458 llvm::Constant *addr);
4478 llvm::BasicBlock *InitBlock,
4479 llvm::BasicBlock *NoInitBlock,
4493 ArrayRef<std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH,
4495 DtorsOrStermFinalizers);
4499 llvm::GlobalVariable *Addr,
4516 llvm::Value *AnnotatedVal,
4517 StringRef AnnotationStr,
4519 const AnnotateAttr *
Attr);
4550 bool AllowLabels =
false);
4556 bool AllowLabels =
false);
4567 llvm::BasicBlock *TrueBlock,
4568 llvm::BasicBlock *FalseBlock,
4571 const Expr *CntrIdx =
nullptr);