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"
53class CanonicalLoopInfo;
58class CXXDestructorDecl;
64class FunctionProtoType;
66class ObjCContainerDecl;
67class ObjCInterfaceDecl;
70class ObjCImplementationDecl;
71class ObjCPropertyImplDecl;
74class ObjCForCollectionStmt;
77class ObjCAtSynchronizedStmt;
78class ObjCAutoreleasePoolStmt;
79class OMPUseDevicePtrClause;
80class OMPUseDeviceAddrClause;
82class OMPExecutableDirective;
84namespace analyze_os_log {
85class OSLogBufferLayout;
94class BlockByrefHelpers;
98class 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, 0) \
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);
244 :
Block(
Block), ScopeDepth(Depth), Index(Index) {}
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 *>(
316 llvm::BasicBlock *BB,
317 llvm::BasicBlock::iterator InsertPt)
const;
335 std::unique_ptr<CGCoroData>
Data;
376 return !LabelMap.empty();
392 llvm::AssertingVH<llvm::Instruction> PostAllocaInsertPt =
nullptr;
398 if (!PostAllocaInsertPt) {
400 "Expected static alloca insertion point at function prologue");
402 "EBB should be entry block of the current code gen function");
404 PostAllocaInsertPt->setName(
"postallocapt");
408 return PostAllocaInsertPt;
415 : Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {}
418 : Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {
421 S.getCapturedRecordDecl()->field_begin();
424 I != E; ++I, ++Field) {
425 if (I->capturesThis())
426 CXXThisFieldDecl = *Field;
427 else if (I->capturesVariable())
428 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
429 else if (I->capturesVariableByCopy())
430 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
465 return CaptureFields;
473 llvm::SmallDenseMap<const VarDecl *, FieldDecl *> CaptureFields;
477 llvm::Value *ThisValue;
501 const Decl *CalleeDecl;
508 return isa_and_nonnull<FunctionDecl>(CalleeDecl);
512 if (
const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl))
513 return FD->getNumParams();
514 return cast<ObjCMethodDecl>(CalleeDecl)->param_size();
517 if (
const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl))
518 return FD->getParamDecl(I);
519 return *(cast<ObjCMethodDecl>(CalleeDecl)->param_begin() + I);
623 llvm::DenseMap<const VarDecl *, llvm::Value *>
NRVOFlags;
632 bool isRedundantBeforeReturn()
override {
return true; }
639 : Addr(addr.getPointer()), Size(size) {}
727 void ConstructorHelper(
FPOptions FPFeatures);
730 llvm::fp::ExceptionBehavior OldExcept;
731 llvm::RoundingMode OldRounding;
732 std::optional<CGBuilderTy::FastMathFlagGuard> FMFGuard;
747 llvm::FunctionCallee BeginCatchFn;
751 llvm::AllocaInst *ForEHVar =
nullptr;
755 llvm::AllocaInst *SavedExnVar =
nullptr;
759 llvm::FunctionCallee beginCatchFn,
760 llvm::FunctionCallee endCatchFn, llvm::FunctionCallee rethrowFn);
775 template <
class T,
class... As>
780 return EHStack.pushCleanup<T>(kind, A...);
783 typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
793 template <
class T,
class... As>
801 "cleanup active flag should never need saving");
803 typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
807 pushCleanupAfterFullExprWithActiveFlag<CleanupType>(Kind, ActiveFlag, Saved);
810 template <
class T,
class... As>
821 static_assert(
sizeof(Header) %
alignof(T) == 0,
822 "Cleanup will be allocated on misaligned address");
825 new (Buffer +
sizeof(Header)) T(A...);
827 new (Buffer +
sizeof(Header) +
sizeof(T))
Address(ActiveFlag);
864 llvm::Instruction *DominatingIP);
874 llvm::Instruction *DominatingIP);
880 size_t LifetimeExtendedCleanupStackSize;
881 bool OldDidCallStackSave;
898 LifetimeExtendedCleanupStackSize =
900 OldDidCallStackSave =
CGF.DidCallStackSave;
901 CGF.DidCallStackSave =
false;
923 void ForceCleanup(std::initializer_list<llvm::Value**> ValuesToReload = {}) {
925 CGF.DidCallStackSave = OldDidCallStackSave;
949 CGF.CurLexicalScope =
this;
951 DI->EmitLexicalBlockStart(
CGF.
Builder, Range.getBegin());
956 Labels.push_back(label);
963 DI->EmitLexicalBlockEnd(
CGF.
Builder, Range.getEnd());
976 CGF.CurLexicalScope = ParentScope;
984 return !Labels.empty();
990 typedef llvm::DenseMap<const Decl *, Address>
DeclMapTy;
1002 assert(SavedLocals.empty() &&
"Did not restored original addresses.");
1012 if (SavedLocals.count(LocalVD))
return false;
1015 auto it = CGF.LocalDeclMap.find(LocalVD);
1016 if (it != CGF.LocalDeclMap.end())
1017 SavedLocals.try_emplace(LocalVD, it->second);
1028 SavedTempAddresses.try_emplace(LocalVD, TempAddr);
1037 copyInto(SavedTempAddresses, CGF.LocalDeclMap);
1038 SavedTempAddresses.clear();
1039 return !SavedLocals.empty();
1044 if (!SavedLocals.empty()) {
1045 copyInto(SavedLocals, CGF.LocalDeclMap);
1046 SavedLocals.clear();
1054 for (
auto &Pair : Src) {
1055 if (!Pair.second.isValid()) {
1056 Dest.erase(Pair.first);
1060 auto I = Dest.find(Pair.first);
1061 if (I != Dest.end())
1062 I->second = Pair.second;
1133 : CGF(CGF), SavedMap(CGF.LocalDeclMap) {}
1141 std::initializer_list<llvm::Value **> ValuesToReload = {});
1148 size_t OldLifetimeExtendedStackSize,
1149 std::initializer_list<llvm::Value **> ValuesToReload = {});
1191 llvm::BasicBlock *StartBB;
1195 : StartBB(CGF.
Builder.GetInsertBlock()) {}
1198 assert(CGF.OutermostConditional !=
this);
1199 if (!CGF.OutermostConditional)
1200 CGF.OutermostConditional =
this;
1204 assert(CGF.OutermostConditional !=
nullptr);
1205 if (CGF.OutermostConditional ==
this)
1206 CGF.OutermostConditional =
nullptr;
1223 auto store =
new llvm::StoreInst(value, addr.
getPointer(), &block->back());
1239 : CGF(CGF), SavedOutermostConditional(CGF.OutermostConditional) {
1240 CGF.OutermostConditional =
nullptr;
1244 CGF.OutermostConditional = SavedOutermostConditional;
1253 llvm::Instruction *Inst =
nullptr;
1273 : OpaqueValue(ov), BoundLValue(boundLValue) {}
1283 return expr->isGLValue() ||
1284 expr->getType()->isFunctionType() ||
1300 CGF.OpaqueLValues.insert(std::make_pair(ov, lv));
1308 CGF.OpaqueRValues.insert(std::make_pair(ov, rv));
1320 bool isValid()
const {
return OpaqueValue !=
nullptr; }
1324 assert(OpaqueValue &&
"no data to unbind!");
1327 CGF.OpaqueLValues.erase(OpaqueValue);
1329 CGF.OpaqueRValues.erase(OpaqueValue);
1352 if (isa<ConditionalOperator>(op))
1366 assert(OV->
getSourceExpr() &&
"wrong form of OpaqueValueMapping used "
1367 "for OVE with no source expression");
1390 if (
Data.isValid())
Data.unbind(CGF);
1397 unsigned VLAExprCounter = 0;
1398 bool DisableDebugInfo =
false;
1402 bool DidCallStackSave =
false;
1408 llvm::IndirectBrInst *IndirectBranch =
nullptr;
1416 llvm::DenseMap<const ParmVarDecl *, EHScopeStack::stable_iterator>
1417 CalleeDestructedParamCleanups;
1422 llvm::SmallDenseMap<const ParmVarDecl *, const ImplicitParamDecl *, 2>
1427 llvm::DenseMap<llvm::AllocaInst *, int> EscapedLocals;
1430 llvm::DenseMap<const LabelDecl*, JumpDest> LabelMap;
1434 struct BreakContinue {
1435 BreakContinue(JumpDest Break, JumpDest Continue)
1436 : BreakBlock(Break), ContinueBlock(Continue) {}
1438 JumpDest BreakBlock;
1439 JumpDest ContinueBlock;
1441 SmallVector<BreakContinue, 8> BreakContinueStack;
1444 class OpenMPCancelExitStack {
1448 CancelExit() =
default;
1451 : Kind(Kind), ExitBlock(ExitBlock), ContBlock(ContBlock) {}
1455 bool HasBeenEmitted =
false;
1460 SmallVector<CancelExit, 8> Stack;
1463 OpenMPCancelExitStack() : Stack(1) {}
1464 ~OpenMPCancelExitStack() =
default;
1466 JumpDest getExitBlock()
const {
return Stack.back().ExitBlock; }
1470 const llvm::function_ref<
void(CodeGenFunction &)> CodeGen) {
1471 if (Stack.back().Kind == Kind && getExitBlock().isValid()) {
1472 assert(CGF.getOMPCancelDestination(Kind).isValid());
1473 assert(CGF.HaveInsertPoint());
1474 assert(!Stack.back().HasBeenEmitted);
1475 auto IP = CGF.Builder.saveAndClearIP();
1476 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1478 CGF.EmitBranch(Stack.back().ContBlock.getBlock());
1479 CGF.Builder.restoreIP(IP);
1480 Stack.back().HasBeenEmitted =
true;
1489 Stack.push_back({
Kind,
1490 HasCancel ? CGF.getJumpDestInCurrentScope(
"cancel.exit")
1492 HasCancel ? CGF.getJumpDestInCurrentScope(
"cancel.cont")
1497 void exit(CodeGenFunction &CGF) {
1498 if (getExitBlock().isValid()) {
1499 assert(CGF.getOMPCancelDestination(Stack.back().Kind).isValid());
1500 bool HaveIP = CGF.HaveInsertPoint();
1501 if (!Stack.back().HasBeenEmitted) {
1503 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1504 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1505 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1507 CGF.EmitBlock(Stack.back().ContBlock.getBlock());
1509 CGF.Builder.CreateUnreachable();
1510 CGF.Builder.ClearInsertionPoint();
1516 OpenMPCancelExitStack OMPCancelStack;
1519 llvm::Value *emitCondLikelihoodViaExpectIntrinsic(llvm::Value *Cond,
1525 llvm::MDNode *createProfileWeights(uint64_t TrueCount,
1526 uint64_t FalseCount)
const;
1527 llvm::MDNode *createProfileWeights(ArrayRef<uint64_t> Weights)
const;
1528 llvm::MDNode *createProfileWeightsForLoop(
const Stmt *Cond,
1529 uint64_t LoopCount)
const;
1536 !
CurFn->hasFnAttribute(llvm::Attribute::NoProfile) &&
1537 !
CurFn->hasFnAttribute(llvm::Attribute::SkipProfile))
1538 PGO.emitCounterIncrement(
Builder, S, StepV);
1539 PGO.setCurrentStmt(S);
1544 return PGO.getStmtCount(S).value_or(0);
1549 PGO.setCurrentRegionCount(Count);
1555 return PGO.getCurrentRegionCount();
1562 llvm::SwitchInst *SwitchInsn =
nullptr;
1571 llvm::BasicBlock *CaseRangeBlock =
nullptr;
1575 llvm::DenseMap<const OpaqueValueExpr *, LValue> OpaqueLValues;
1576 llvm::DenseMap<const OpaqueValueExpr *, RValue> OpaqueRValues;
1584 llvm::DenseMap<const Expr*, llvm::Value*> VLASizeMap;
1588 llvm::BasicBlock *UnreachableBlock =
nullptr;
1591 unsigned NumReturnExprs = 0;
1594 unsigned NumSimpleReturnExprs = 0;
1612 : CGF(CGF), OldCXXDefaultInitExprThis(CGF.CXXDefaultInitExprThis) {
1613 CGF.CXXDefaultInitExprThis = This;
1616 CGF.CXXDefaultInitExprThis = OldCXXDefaultInitExprThis;
1621 Address OldCXXDefaultInitExprThis;
1657 : CGF(CGF), OldArrayInitIndex(CGF.ArrayInitIndex) {
1658 CGF.ArrayInitIndex = Index;
1661 CGF.ArrayInitIndex = OldArrayInitIndex;
1666 llvm::Value *OldArrayInitIndex;
1674 OldCXXABIThisDecl(CGF.CXXABIThisDecl),
1675 OldCXXABIThisValue(CGF.CXXABIThisValue),
1676 OldCXXThisValue(CGF.CXXThisValue),
1677 OldCXXABIThisAlignment(CGF.CXXABIThisAlignment),
1678 OldCXXThisAlignment(CGF.CXXThisAlignment),
1680 OldCXXInheritedCtorInitExprArgs(
1681 std::move(CGF.CXXInheritedCtorInitExprArgs)) {
1684 cast<CXXConstructorDecl>(GD.
getDecl());
1685 CGF.CXXABIThisDecl =
nullptr;
1686 CGF.CXXABIThisValue =
nullptr;
1687 CGF.CXXThisValue =
nullptr;
1692 CGF.CXXInheritedCtorInitExprArgs.clear();
1695 CGF.CurGD = OldCurGD;
1696 CGF.CurFuncDecl = OldCurFuncDecl;
1697 CGF.CurCodeDecl = OldCurCodeDecl;
1698 CGF.CXXABIThisDecl = OldCXXABIThisDecl;
1699 CGF.CXXABIThisValue = OldCXXABIThisValue;
1700 CGF.CXXThisValue = OldCXXThisValue;
1701 CGF.CXXABIThisAlignment = OldCXXABIThisAlignment;
1702 CGF.CXXThisAlignment = OldCXXThisAlignment;
1703 CGF.ReturnValue = OldReturnValue;
1704 CGF.FnRetTy = OldFnRetTy;
1705 CGF.CXXInheritedCtorInitExprArgs =
1706 std::move(OldCXXInheritedCtorInitExprArgs);
1712 const Decl *OldCurFuncDecl;
1713 const Decl *OldCurCodeDecl;
1715 llvm::Value *OldCXXABIThisValue;
1716 llvm::Value *OldCXXThisValue;
1747 llvm::CallInst *RTLFnCI;
1751 RLFnCI->removeFromParent();
1781 StringRef FirstSeparator =
".",
1782 StringRef Separator =
".");
1787 CGBuilderTy::InsertPointGuard IPG(CGF.
Builder);
1788 assert(IP.getBlock()->end() != IP.getPoint() &&
1789 "OpenMP IR Builder should cause terminated block!");
1791 llvm::BasicBlock *IPBB = IP.getBlock();
1792 llvm::BasicBlock *DestBB = IPBB->getUniqueSuccessor();
1793 assert(DestBB &&
"Finalization block should have one successor!");
1796 IPBB->getTerminator()->eraseFromParent();
1797 CGF.
Builder.SetInsertPoint(IPBB);
1810 const Stmt *RegionBodyStmt,
1816 llvm::BasicBlock &FiniBB, llvm::Function *Fn,
1818 llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
1819 if (llvm::Instruction *CodeGenIPBBTI = CodeGenIPBB->getTerminator())
1820 CodeGenIPBBTI->eraseFromParent();
1822 CGF.
Builder.SetInsertPoint(CodeGenIPBB);
1824 if (Fn->doesNotThrow())
1829 if (CGF.
Builder.saveIP().isSet())
1830 CGF.
Builder.CreateBr(&FiniBB);
1842 const Stmt *RegionBodyStmt,
1850 llvm::AssertingVH<llvm::Instruction> OldAllocaIP;
1856 llvm::BasicBlock &RetBB)
1858 assert(AllocaIP.isSet() &&
1859 "Must specify Insertion point for allocas of outlined function");
1876 llvm::AssertingVH<llvm::Instruction> OldAllocaIP;
1881 llvm::BasicBlock &FiniBB)
1887 assert((!AllocaIP.isSet() ||
1889 "Insertion point should be in the entry block of containing "
1892 if (AllocaIP.isSet())
1911 llvm::Value *CXXABIThisValue =
nullptr;
1912 llvm::Value *CXXThisValue =
nullptr;
1922 llvm::Value *ArrayInitIndex =
nullptr;
1931 llvm::Value *CXXStructorImplicitParamValue =
nullptr;
1936 ConditionalEvaluation *OutermostConditional =
nullptr;
1939 LexicalScope *CurLexicalScope =
nullptr;
1947 llvm::DenseMap<const ValueDecl *, BlockByrefInfo> BlockByrefInfos;
1951 llvm::Value *RetValNullabilityPrecondition =
nullptr;
1955 bool requiresReturnValueNullabilityCheck()
const {
1956 return RetValNullabilityPrecondition;
1964 bool requiresReturnValueCheck()
const;
1969 llvm::BasicBlock *TerminateLandingPad =
nullptr;
1970 llvm::BasicBlock *TerminateHandler =
nullptr;
1974 llvm::MapVector<llvm::Value *, llvm::BasicBlock *> TerminateFunclets;
1978 unsigned LargestVectorWidth = 0;
1982 bool ShouldEmitLifetimeMarkers;
1986 void EmitKernelMetadata(
const FunctionDecl *FD, llvm::Function *Fn);
1995 if (DisableDebugInfo)
2021 if (!UnreachableBlock) {
2025 return UnreachableBlock;
2053 llvm::Value *arrayEnd,
2063 Destroyer *destroyer,
bool useEHCleanupForArray);
2066 bool useEHCleanupForArray);
2068 llvm::Value *CompletePtr,
2072 std::pair<llvm::Value *, llvm::Value *> AddrSizePair);
2074 bool useEHCleanupForArray);
2077 bool useEHCleanupForArray,
2082 bool checkZeroLength,
bool useEHCleanup);
2100 llvm_unreachable(
"bad destruction kind");
2121 llvm::Constant *AtomicHelperFn);
2132 llvm::Constant *AtomicHelperFn);
2147 bool IsLambdaConversionToBlock,
2148 bool BuildGlobalBlock);
2185 bool LoadBlockVarAddr,
bool CanThrow);
2196 bool followForward =
true);
2200 const llvm::Twine &name);
2235 llvm::Constant *CallOpFn =
nullptr);
2242 llvm::Function **ImplFn);
2263 const ThunkInfo *Thunk,
bool IsUnprototyped);
2269 llvm::FunctionCallee Callee);
2274 bool IsUnprototyped);
2303 bool BaseIsNonVirtualPrimaryBase,
2353 llvm::Value *VTable,
2354 llvm::Type *VTableTy,
2355 uint64_t VTableByteOffset);
2446 llvm::Function *parent =
nullptr,
2447 llvm::BasicBlock *before =
nullptr) {
2448 return llvm::BasicBlock::Create(
getLLVMContext(), name, parent, before);
2468 void EmitBlock(llvm::BasicBlock *BB,
bool IsFinished=
false);
2487 return Builder.GetInsertBlock() !=
nullptr;
2582 llvm::Value *ArraySize =
nullptr);
2584 const Twine &Name =
"tmp",
2585 llvm::Value *ArraySize =
nullptr,
2588 const Twine &Name =
"tmp",
2589 llvm::Value *ArraySize =
nullptr);
2602 const Twine &Name =
"tmp");
2626 const Twine &Name =
"tmp");
2655 bool ignoreResult =
false);
2680 bool capturedByInit);
2686 const RecordDecl *RD = cast<RecordDecl>(RT->getDecl());
2729 bool isVolatile =
false);
2733 auto it = LocalDeclMap.find(VD);
2734 assert(it != LocalDeclMap.end() &&
2735 "Invalid argument to GetAddrOfLocalVar(), no decl!");
2817 assert(CXXThisValue &&
"no 'this' value for this function");
2818 return CXXThisValue;
2827 assert(CXXStructorImplicitParamValue &&
"no VTT value for this function");
2828 return CXXStructorImplicitParamValue;
2837 bool BaseIsVirtual);
2853 bool NullCheckValue);
2879 bool ForVirtualBase,
2887 bool ForVirtualBase,
Address This,
2888 bool InheritedFromVBase,
2916 bool NewPointerIsChecked,
2917 bool ZeroInitialization =
false);
2920 llvm::Value *NumElements,
2923 bool NewPointerIsChecked,
2924 bool ZeroInitialization =
false);
2933 llvm::Type *ElementTy,
Address NewPtr,
2934 llvm::Value *NumElements,
2935 llvm::Value *AllocSizeWithoutCookie);
2952 QualType DeleteTy, llvm::Value *NumElements =
nullptr,
2956 const CallExpr *TheCallExpr,
bool IsDelete);
3017 llvm::Value *ArraySize =
nullptr);
3023 QualType IndexType,
bool Accessed);
3039 bool isInc,
bool isPre);
3041 bool isInc,
bool isPre);
3065 bool capturedByInit);
3090 llvm::Value *NRVOFlag;
3094 bool IsEscapingByRef;
3098 bool IsConstantAggregate;
3101 llvm::Value *SizeForLifetimeMarkers;
3112 AutoVarEmission(
const VarDecl &variable)
3113 : Variable(&variable), Addr(
Address::
invalid()), NRVOFlag(nullptr),
3114 IsEscapingByRef(
false), IsConstantAggregate(
false),
3115 SizeForLifetimeMarkers(nullptr), AllocaAddr(
Address::
invalid()) {}
3117 bool wasEmittedAsGlobal()
const {
return !Addr.
isValid(); }
3123 return SizeForLifetimeMarkers !=
nullptr;
3127 return SizeForLifetimeMarkers;
3144 if (!IsEscapingByRef)
return Addr;
3162 bool EmitDebugInfo);
3165 llvm::GlobalValue::LinkageTypes
Linkage);
3169 llvm::Type *ElementType;
3171 ParamValue(llvm::Value *
V, llvm::Type *T,
unsigned A)
3172 :
Value(
V), ElementType(T), Alignment(A) {}
3216 llvm::Value *Alignment,
3217 llvm::Value *OffsetValue,
3218 llvm::Value *TheCheck,
3219 llvm::Instruction *Assumption);
3223 llvm::Value *Alignment,
3224 llvm::Value *OffsetValue =
nullptr);
3228 llvm::Value *Alignment,
3229 llvm::Value *OffsetValue =
nullptr);
3257 bool GetLast =
false,
3296 bool ignoreResult =
false);
3300 bool ignoreResult =
false);
3316 llvm::Function *FinallyFunc);
3318 const Stmt *OutlinedStmt);
3327 llvm::Value *ParentFP,
3328 llvm::Value *EntryEBP);
3349 llvm::Value *ParentFP);
3362 CGF.OMPCancelStack.enter(CGF, Kind, HasCancel);
3429 const llvm::DenseMap<const ValueDecl *, llvm::Value *>
3430 CaptureDeviceAddrMap);
3433 const llvm::DenseMap<const ValueDecl *, llvm::Value *>
3434 CaptureDeviceAddrMap);
3469 llvm::Value *IsLastIterCond =
nullptr);
3488 bool ForInscan =
false);
3621 StringRef ParentName,
3648 StringRef ParentName,
3693 const Expr *LoopCond,
const Expr *IncExpr,
3730 struct OMPLoopArguments {
3740 llvm::Value *Chunk =
nullptr;
3742 Expr *EUB =
nullptr;
3744 Expr *IncExpr =
nullptr;
3748 Expr *Cond =
nullptr;
3750 Expr *NextLB =
nullptr;
3752 Expr *NextUB =
nullptr;
3753 OMPLoopArguments() =
default;
3755 llvm::Value *Chunk =
nullptr,
Expr *EUB =
nullptr,
3756 Expr *IncExpr =
nullptr,
Expr *Init =
nullptr,
3757 Expr *Cond =
nullptr,
Expr *NextLB =
nullptr,
3758 Expr *NextUB =
nullptr)
3759 : LB(LB), UB(UB), ST(ST), IL(IL), Chunk(Chunk), EUB(EUB),
3760 IncExpr(IncExpr),
Init(
Init), Cond(Cond), NextLB(NextLB),
3763 void EmitOMPOuterLoop(
bool DynamicOrOrdered,
bool IsMonotonic,
3765 const OMPLoopArguments &LoopArgs,
3770 OMPPrivateScope &LoopScope,
bool Ordered,
3771 const OMPLoopArguments &LoopArgs,
3775 OMPPrivateScope &LoopScope,
3776 const OMPLoopArguments &LoopArgs,
3843 llvm::AtomicOrdering AO,
bool IsVolatile =
false,
3849 bool IsVolatile,
bool isInit);
3853 llvm::AtomicOrdering Success =
3854 llvm::AtomicOrdering::SequentiallyConsistent,
3855 llvm::AtomicOrdering Failure =
3856 llvm::AtomicOrdering::SequentiallyConsistent,
3884 bool isNontemporal =
false) {
3892 bool isNontemporal =
false);
3906 bool isInit =
false,
bool isNontemporal =
false) {
3914 bool isInit =
false,
bool isNontemporal =
false);
3945 llvm::Value **
Result=
nullptr);
3966 bool Accessed =
false);
3969 bool IsLowerBound =
true);
3990 llvm::PointerIntPair<llvm::Constant*, 1, bool> ValueAndIsReference;
4003 return ValueAndIsReference.getOpaqueValue() !=
nullptr;
4015 return ValueAndIsReference.getPointer();
4034 llvm::Value *ThisValue);
4044 unsigned CVRQualifiers);
4067 llvm::CallBase **callOrInvoke,
bool IsMustTail,
4071 llvm::CallBase **callOrInvoke =
nullptr,
4072 bool IsMustTail =
false) {
4087 const Twine &name =
"");
4090 const Twine &name =
"");
4092 const Twine &name =
"");
4095 const Twine &name =
"");
4102 const Twine &Name =
"");
4105 const Twine &name =
"");
4107 const Twine &name =
"");