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;
755 llvm::AllocaInst *SavedExnVar;
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;
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;
1966 llvm::BasicBlock *TerminateLandingPad =
nullptr;
1967 llvm::BasicBlock *TerminateHandler =
nullptr;
1971 llvm::MapVector<llvm::Value *, llvm::BasicBlock *> TerminateFunclets;
1975 unsigned LargestVectorWidth = 0;
1979 bool ShouldEmitLifetimeMarkers;
1983 void EmitKernelMetadata(
const FunctionDecl *FD, llvm::Function *Fn);
1992 if (DisableDebugInfo)
2018 if (!UnreachableBlock) {
2022 return UnreachableBlock;
2050 llvm::Value *arrayEnd,
2060 Destroyer *destroyer,
bool useEHCleanupForArray);
2063 bool useEHCleanupForArray);
2065 llvm::Value *CompletePtr,
2069 bool useEHCleanupForArray);
2072 bool useEHCleanupForArray,
2077 bool checkZeroLength,
bool useEHCleanup);
2095 llvm_unreachable(
"bad destruction kind");
2116 llvm::Constant *AtomicHelperFn);
2127 llvm::Constant *AtomicHelperFn);
2142 bool IsLambdaConversionToBlock,
2143 bool BuildGlobalBlock);
2180 bool LoadBlockVarAddr,
bool CanThrow);
2191 bool followForward =
true);
2195 const llvm::Twine &name);
2251 const ThunkInfo *Thunk,
bool IsUnprototyped);
2257 llvm::FunctionCallee Callee);
2262 bool IsUnprototyped);
2291 bool BaseIsNonVirtualPrimaryBase,
2341 llvm::Value *VTable,
2342 llvm::Type *VTableTy,
2343 uint64_t VTableByteOffset);
2434 llvm::Function *parent =
nullptr,
2435 llvm::BasicBlock *before =
nullptr) {
2436 return llvm::BasicBlock::Create(
getLLVMContext(), name, parent, before);
2456 void EmitBlock(llvm::BasicBlock *BB,
bool IsFinished=
false);
2475 return Builder.GetInsertBlock() !=
nullptr;
2570 llvm::Value *ArraySize =
nullptr);
2572 const Twine &Name =
"tmp",
2573 llvm::Value *ArraySize =
nullptr,
2576 const Twine &Name =
"tmp",
2577 llvm::Value *ArraySize =
nullptr);
2590 const Twine &Name =
"tmp");
2614 const Twine &Name =
"tmp");
2646 bool ignoreResult =
false);
2671 bool capturedByInit);
2677 const RecordDecl *RD = cast<RecordDecl>(RT->getDecl());
2720 bool isVolatile =
false);
2724 auto it = LocalDeclMap.find(VD);
2725 assert(it != LocalDeclMap.end() &&
2726 "Invalid argument to GetAddrOfLocalVar(), no decl!");
2808 assert(CXXThisValue &&
"no 'this' value for this function");
2809 return CXXThisValue;
2818 assert(CXXStructorImplicitParamValue &&
"no VTT value for this function");
2819 return CXXStructorImplicitParamValue;
2828 bool BaseIsVirtual);
2844 bool NullCheckValue);
2870 bool ForVirtualBase,
2878 bool ForVirtualBase,
Address This,
2879 bool InheritedFromVBase,
2883 bool ForVirtualBase,
bool Delegating,
2887 bool ForVirtualBase,
bool Delegating,
2907 bool NewPointerIsChecked,
2908 bool ZeroInitialization =
false);
2911 llvm::Value *NumElements,
2914 bool NewPointerIsChecked,
2915 bool ZeroInitialization =
false);
2920 bool ForVirtualBase,
bool Delegating,
Address This,
2924 llvm::Type *ElementTy,
Address NewPtr,
2925 llvm::Value *NumElements,
2926 llvm::Value *AllocSizeWithoutCookie);
2943 QualType DeleteTy, llvm::Value *NumElements =
nullptr,
2947 const CallExpr *TheCallExpr,
bool IsDelete);
3008 llvm::Value *ArraySize =
nullptr);
3014 QualType IndexType,
bool Accessed);
3017 bool isInc,
bool isPre);
3019 bool isInc,
bool isPre);
3043 bool capturedByInit);
3068 llvm::Value *NRVOFlag;
3072 bool IsEscapingByRef;
3076 bool IsConstantAggregate;
3079 llvm::Value *SizeForLifetimeMarkers;
3090 AutoVarEmission(
const VarDecl &variable)
3091 : Variable(&variable), Addr(
Address::
invalid()), NRVOFlag(nullptr),
3092 IsEscapingByRef(
false), IsConstantAggregate(
false),
3093 SizeForLifetimeMarkers(nullptr), AllocaAddr(
Address::
invalid()) {}
3095 bool wasEmittedAsGlobal()
const {
return !Addr.
isValid(); }
3101 return SizeForLifetimeMarkers !=
nullptr;
3105 return SizeForLifetimeMarkers;
3122 if (!IsEscapingByRef)
return Addr;
3140 bool EmitDebugInfo);
3143 llvm::GlobalValue::LinkageTypes
Linkage);
3147 llvm::Type *ElementType;
3149 ParamValue(llvm::Value *
V, llvm::Type *T,
unsigned A)
3150 :
Value(
V), ElementType(T), Alignment(A) {}
3194 llvm::Value *Alignment,
3195 llvm::Value *OffsetValue,
3196 llvm::Value *TheCheck,
3197 llvm::Instruction *Assumption);
3201 llvm::Value *Alignment,
3202 llvm::Value *OffsetValue =
nullptr);
3206 llvm::Value *Alignment,
3207 llvm::Value *OffsetValue =
nullptr);
3235 bool GetLast =
false,
3274 bool ignoreResult =
false);
3278 bool ignoreResult =
false);
3294 llvm::Function *FinallyFunc);
3296 const Stmt *OutlinedStmt);
3305 llvm::Value *ParentFP,
3306 llvm::Value *EntryEBP);
3327 llvm::Value *ParentFP);
3340 CGF.OMPCancelStack.enter(CGF, Kind, HasCancel);
3407 const llvm::DenseMap<const ValueDecl *, Address> &CaptureDeviceAddrMap);
3410 const llvm::DenseMap<const ValueDecl *, Address> &CaptureDeviceAddrMap);
3445 llvm::Value *IsLastIterCond =
nullptr);
3464 bool ForInscan =
false);
3591 StringRef ParentName,
3618 StringRef ParentName,
3653 const Expr *LoopCond,
const Expr *IncExpr,
3690 struct OMPLoopArguments {
3700 llvm::Value *Chunk =
nullptr;
3702 Expr *EUB =
nullptr;
3704 Expr *IncExpr =
nullptr;
3706 Expr *Init =
nullptr;
3708 Expr *Cond =
nullptr;
3710 Expr *NextLB =
nullptr;
3712 Expr *NextUB =
nullptr;
3713 OMPLoopArguments() =
default;
3715 llvm::Value *Chunk =
nullptr,
Expr *EUB =
nullptr,
3716 Expr *IncExpr =
nullptr,
Expr *Init =
nullptr,
3717 Expr *Cond =
nullptr,
Expr *NextLB =
nullptr,
3718 Expr *NextUB =
nullptr)
3719 : LB(LB), UB(UB), ST(ST), IL(IL), Chunk(Chunk), EUB(EUB),
3720 IncExpr(IncExpr), Init(Init), Cond(Cond), NextLB(NextLB),
3723 void EmitOMPOuterLoop(
bool DynamicOrOrdered,
bool IsMonotonic,
3725 const OMPLoopArguments &LoopArgs,
3730 OMPPrivateScope &LoopScope,
bool Ordered,
3731 const OMPLoopArguments &LoopArgs,
3735 OMPPrivateScope &LoopScope,
3736 const OMPLoopArguments &LoopArgs,
3803 llvm::AtomicOrdering AO,
bool IsVolatile =
false,
3809 bool IsVolatile,
bool isInit);
3813 llvm::AtomicOrdering Success =
3814 llvm::AtomicOrdering::SequentiallyConsistent,
3815 llvm::AtomicOrdering Failure =
3816 llvm::AtomicOrdering::SequentiallyConsistent,
3844 bool isNontemporal =
false) {
3852 bool isNontemporal =
false);
3866 bool isInit =
false,
bool isNontemporal =
false) {
3874 bool isInit =
false,
bool isNontemporal =
false);
3905 llvm::Value **
Result=
nullptr);
3926 bool Accessed =
false);
3929 bool IsLowerBound =
true);
3950 llvm::PointerIntPair<llvm::Constant*, 1, bool> ValueAndIsReference;
3963 return ValueAndIsReference.getOpaqueValue() !=
nullptr;
3975 return ValueAndIsReference.getPointer();
4002 unsigned CVRQualifiers);
4025 llvm::CallBase **callOrInvoke,
bool IsMustTail,
4029 llvm::CallBase **callOrInvoke =
nullptr,
4030 bool IsMustTail =
false) {
4045 const Twine &name =
"");
4048 const Twine &name =
"");
4050 const Twine &name =
"");
4053 const Twine &name =
"");
4060 const Twine &Name =
"");
4063 const Twine &name =
"");
4065 const Twine &name =
"");
4104 llvm::Value *ImplicitParam,
4108 llvm::Value *This,
QualType ThisTy,
4109 llvm::Value *ImplicitParam,
4121 llvm::Value *memberPtr,