13#ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENFUNCTION_H
14#define LLVM_CLANG_LIB_CODEGEN_CODEGENFUNCTION_H
37#include "llvm/ADT/ArrayRef.h"
38#include "llvm/ADT/DenseMap.h"
39#include "llvm/ADT/MapVector.h"
40#include "llvm/ADT/SmallVector.h"
41#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
42#include "llvm/IR/Instructions.h"
43#include "llvm/IR/ValueHandle.h"
44#include "llvm/Support/Debug.h"
45#include "llvm/Transforms/Utils/SanitizerStats.h"
50class ConvergenceControlInst;
56class CanonicalLoopInfo;
61class CXXDestructorDecl;
67class FunctionProtoType;
69class ObjCContainerDecl;
70class ObjCInterfaceDecl;
73class ObjCImplementationDecl;
74class ObjCPropertyImplDecl;
77class ObjCForCollectionStmt;
80class ObjCAtSynchronizedStmt;
81class ObjCAutoreleasePoolStmt;
82class OMPUseDevicePtrClause;
83class OMPUseDeviceAddrClause;
85class OMPExecutableDirective;
87namespace analyze_os_log {
88class OSLogBufferLayout;
98class BlockByrefHelpers;
100class BlockFieldFlags;
101class RegionCodeGenTy;
102class TargetCodeGenInfo;
122 typedef llvm::PointerIntPair<llvm::Value *, 1, bool>
saved_type;
130 if (!isa<llvm::Instruction>(value))
134 llvm::BasicBlock *block = cast<llvm::Instruction>(value)->getParent();
135 return (block != &block->getParent()->getEntryBlock());
198 LLVM_PREFERRED_TYPE(
Kind)
206 : Vals{Val1, Val2}, K(ComplexAddress) {}
209 : AggregateAddr(AggregateAddr), K(K) {}
221 return saved_type::save(CGF, value);
224 return value.restore(CGF);
234 uint64_t OriginalAtom = 0;
260 :
Block(
Block), ScopeDepth(Depth), Index(Index) {}
262 bool isValid()
const {
return Block !=
nullptr; }
263 llvm::BasicBlock *
getBlock()
const {
return Block; }
273 llvm::BasicBlock *Block;
321 const unsigned,
const bool)>
325 typedef llvm::function_ref<std::pair<LValue, LValue>(
330 typedef llvm::function_ref<std::pair<llvm::Value *, llvm::Value *>(
337 void InsertHelper(llvm::Instruction *I,
const llvm::Twine &Name,
338 llvm::BasicBlock::iterator InsertPt)
const;
356 std::unique_ptr<CGCoroData>
Data;
385 Twine
const &SuspendPointName,
414 return !LabelMap.empty();
430 llvm::AssertingVH<llvm::Instruction> PostAllocaInsertPt =
nullptr;
436 if (!PostAllocaInsertPt) {
438 "Expected static alloca insertion point at function prologue");
440 "EBB should be entry block of the current code gen function");
442 PostAllocaInsertPt->setName(
"postallocapt");
446 return PostAllocaInsertPt;
453 : Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {}
456 : Kind(K), ThisValue(nullptr), CXXThisFieldDecl(nullptr) {
459 S.getCapturedRecordDecl()->field_begin();
462 I !=
E; ++I, ++Field) {
463 if (I->capturesThis())
464 CXXThisFieldDecl = *Field;
465 else if (I->capturesVariable())
466 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
467 else if (I->capturesVariableByCopy())
468 CaptureFields[I->getCapturedVar()->getCanonicalDecl()] = *Field;
501 return CaptureFields;
509 llvm::SmallDenseMap<const VarDecl *, FieldDecl *> CaptureFields;
513 llvm::Value *ThisValue;
538 const Decl *CalleeDecl;
545 return isa_and_nonnull<FunctionDecl>(CalleeDecl);
549 if (
const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl))
550 return FD->getNumParams();
551 return cast<ObjCMethodDecl>(CalleeDecl)->param_size();
554 if (
const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl))
555 return FD->getParamDecl(I);
556 return *(cast<ObjCMethodDecl>(CalleeDecl)->param_begin() + I);
610 HLSLControlFlowHintAttr::SpellingNotCalculated;
647 llvm::DenseMap<const VarDecl *, llvm::Value *>
NRVOFlags;
678 assert(!
Deactivated &&
"Deactivating already deactivated scope");
682 Stack[I - 1].DominatingIP);
683 Stack[I - 1].DominatingIP->eraseFromParent();
701 bool isRedundantBeforeReturn()
override {
return true; }
735 LLVM_PREFERRED_TYPE(
bool)
736 unsigned IsConditional : 1;
738 size_t getSize()
const {
return Size; }
746 unsigned NextCleanupDestIndex = 1;
749 llvm::BasicBlock *EHResumeBlock =
nullptr;
753 llvm::Value *ExceptionSlot =
nullptr;
757 llvm::AllocaInst *EHSelectorSlot =
nullptr;
765 llvm::Value *SEHInfo =
nullptr;
768 llvm::BasicBlock *EmitLandingPad();
770 llvm::BasicBlock *getInvokeDestImpl();
774 llvm::BasicBlock *OMPBeforeScanBlock =
nullptr;
775 llvm::BasicBlock *OMPAfterScanBlock =
nullptr;
776 llvm::BasicBlock *OMPScanExitBlock =
nullptr;
777 llvm::BasicBlock *OMPScanDispatch =
nullptr;
778 bool OMPFirstScanLoop =
false;
790 ParentLoopDirectiveForScan(CGF.OMPParentLoopDirectiveForScan) {
810 void ConstructorHelper(
FPOptions FPFeatures);
813 llvm::fp::ExceptionBehavior OldExcept;
814 llvm::RoundingMode OldRounding;
815 std::optional<CGBuilderTy::FastMathFlagGuard> FMFGuard;
822 : CGM(CGM_), SavedAtomicOpts(CGM.getAtomicOpts()) {
826 : CGM(CGM_), SavedAtomicOpts(CGM.getAtomicOpts()) {
830 for (
auto Option : AA->atomicOptions()) {
832 case AtomicAttr::remote_memory:
835 case AtomicAttr::no_remote_memory:
838 case AtomicAttr::fine_grained_memory:
841 case AtomicAttr::no_fine_grained_memory:
844 case AtomicAttr::ignore_denormal_mode:
847 case AtomicAttr::no_ignore_denormal_mode:
875 llvm::FunctionCallee BeginCatchFn;
879 llvm::AllocaInst *ForEHVar =
nullptr;
883 llvm::AllocaInst *SavedExnVar =
nullptr;
887 llvm::FunctionCallee beginCatchFn,
888 llvm::FunctionCallee endCatchFn, llvm::FunctionCallee rethrowFn);
897 return CurrentFuncletPad && isa<llvm::CleanupPadInst>(CurrentFuncletPad);
903 template <
class T,
class... As>
907 if (!isInConditionalBranch())
908 return EHStack.pushCleanup<
T>(kind, A...);
911 typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
912 SavedTuple Saved{saveValueInCond(A)...};
916 initFullExprCleanup();
921 template <
class T,
class... As>
923 if (!isInConditionalBranch())
924 return pushCleanupAfterFullExprWithActiveFlag<T>(
925 Kind, RawAddress::invalid(), A...);
927 RawAddress ActiveFlag = createCleanupActiveFlag();
929 "cleanup active flag should never need saving");
931 typedef std::tuple<typename DominatingValue<As>::saved_type...> SavedTuple;
932 SavedTuple Saved{saveValueInCond(A)...};
935 pushCleanupAfterFullExprWithActiveFlag<CleanupType>(
Kind, ActiveFlag,
939 template <
class T,
class... As>
945 size_t OldSize = LifetimeExtendedCleanupStack.size();
946 LifetimeExtendedCleanupStack.resize(
947 LifetimeExtendedCleanupStack.size() +
sizeof(Header) + Header.
Size +
952 "Cleanup will be allocated on misaligned address");
953 char *Buffer = &LifetimeExtendedCleanupStack[
OldSize];
955 new (Buffer +
sizeof(Header))
T(A...);
957 new (Buffer +
sizeof(Header) +
sizeof(
T))
RawAddress(ActiveFlag);
963 template <
class T,
class... As>
966 llvm::Instruction *DominatingIP =
967 Builder.CreateFlagLoad(llvm::Constant::getNullValue(Int8PtrTy));
968 EHStack.pushCleanup<
T>(
Kind, A...);
969 DeferredDeactivationCleanupStack.push_back(
976 initFullExprCleanupWithFlag(createCleanupActiveFlag());
979 void initFullExprCleanupWithFlag(
RawAddress ActiveFlag);
996 void PopCleanupBlock(
bool FallThroughIsBranchThrough =
false,
1008 llvm::Instruction *DominatingIP);
1018 llvm::Instruction *DominatingIP);
1024 size_t LifetimeExtendedCleanupStackSize;
1026 bool OldDidCallStackSave;
1041 : DeactivateCleanups(CGF), PerformCleanup(
true), CGF(CGF) {
1043 LifetimeExtendedCleanupStackSize =
1045 OldDidCallStackSave = CGF.DidCallStackSave;
1046 CGF.DidCallStackSave =
false;
1070 assert(PerformCleanup &&
"Already forced cleanup");
1071 CGF.DidCallStackSave = OldDidCallStackSave;
1075 PerformCleanup =
false;
1082 EHScopeStack::stable_end();
1097 assert(PerformCleanup &&
"adding label to dead scope?");
1098 Labels.push_back(label);
1108 CGF.CurLexicalScope = ParentScope;
1109 RunCleanupsScope::ForceCleanup();
1111 if (!Labels.empty())
1117 void rescopeLabels();
1132 assert(SavedLocals.empty() &&
"Did not restored original addresses.");
1142 if (SavedLocals.count(LocalVD))
1146 auto it = CGF.LocalDeclMap.find(LocalVD);
1147 if (it != CGF.LocalDeclMap.end())
1148 SavedLocals.try_emplace(LocalVD, it->second);
1150 SavedLocals.try_emplace(LocalVD, Address::invalid());
1159 SavedTempAddresses.try_emplace(LocalVD, TempAddr);
1168 copyInto(SavedTempAddresses, CGF.LocalDeclMap);
1169 SavedTempAddresses.clear();
1170 return !SavedLocals.empty();
1175 if (!SavedLocals.empty()) {
1176 copyInto(SavedLocals, CGF.LocalDeclMap);
1177 SavedLocals.clear();
1185 for (
auto &[
Decl, Addr] : Src) {
1186 if (!
Addr.isValid())
1189 Dest.insert_or_assign(
Decl, Addr);
1212 assert(PerformCleanup &&
"adding private to dead scope");
1227 RunCleanupsScope::ForceCleanup();
1258 : CGF(CGF), SavedMap(CGF.LocalDeclMap) {}
1266 std::initializer_list<llvm::Value **> ValuesToReload = {});
1272 PopCleanupBlocks(EHScopeStack::stable_iterator OldCleanupStackSize,
1273 size_t OldLifetimeExtendedStackSize,
1274 std::initializer_list<llvm::Value **> ValuesToReload = {});
1276 void ResolveBranchFixups(llvm::BasicBlock *
Target);
1283 NextCleanupDestIndex++);
1290 return getJumpDestInCurrentScope(createBasicBlock(Name));
1296 void EmitBranchThroughCleanup(JumpDest Dest);
1301 bool isObviouslyBranchWithoutCleanups(JumpDest Dest)
const;
1306 void popCatchScope();
1308 llvm::BasicBlock *getEHResumeBlock(
bool isCleanup);
1315 llvm::BasicBlock *StartBB;
1319 : StartBB(CGF.Builder.GetInsertBlock()) {}
1322 assert(CGF.OutermostConditional !=
this);
1323 if (!CGF.OutermostConditional)
1324 CGF.OutermostConditional =
this;
1328 assert(CGF.OutermostConditional !=
nullptr);
1329 if (CGF.OutermostConditional ==
this)
1330 CGF.OutermostConditional =
nullptr;
1344 assert(isInConditionalBranch());
1345 llvm::BasicBlock *block = OutermostConditional->getStartingBlock();
1346 auto store =
new llvm::StoreInst(value, addr.
emitRawPointer(CGF),
1347 block->back().getIterator());
1363 : CGF(CGF), SavedOutermostConditional(CGF.OutermostConditional) {
1364 CGF.OutermostConditional =
nullptr;
1368 CGF.OutermostConditional = SavedOutermostConditional;
1377 llvm::Instruction *Inst =
nullptr;
1396 : OpaqueValue(ov), BoundLValue(boundLValue) {}
1407 return expr->isGLValue() ||
expr->getType()->isFunctionType() ||
1408 hasAggregateEvaluationKind(
expr->getType());
1413 if (shouldBindAsLValue(ov))
1420 assert(shouldBindAsLValue(ov));
1421 CGF.OpaqueLValues.insert(std::make_pair(ov, lv));
1427 assert(!shouldBindAsLValue(ov));
1428 CGF.OpaqueRValues.insert(std::make_pair(ov, rv));
1440 bool isValid()
const {
return OpaqueValue !=
nullptr; }
1444 assert(OpaqueValue &&
"no data to unbind!");
1447 CGF.OpaqueLValues.erase(OpaqueValue);
1449 CGF.OpaqueRValues.erase(OpaqueValue);
1462 return OpaqueValueMappingData::shouldBindAsLValue(
expr);
1473 if (isa<ConditionalOperator>(op))
1487 assert(OV->
getSourceExpr() &&
"wrong form of OpaqueValueMapping used "
1488 "for OVE with no source expression");
1517 unsigned VLAExprCounter = 0;
1518 bool DisableDebugInfo =
false;
1522 bool DidCallStackSave =
false;
1528 llvm::IndirectBrInst *IndirectBranch =
nullptr;
1532 DeclMapTy LocalDeclMap;
1536 llvm::DenseMap<const ParmVarDecl *, EHScopeStack::stable_iterator>
1537 CalleeDestructedParamCleanups;
1542 llvm::SmallDenseMap<const ParmVarDecl *, const ImplicitParamDecl *, 2>
1547 llvm::DenseMap<llvm::AllocaInst *, int> EscapedLocals;
1550 llvm::DenseMap<const LabelDecl *, JumpDest> LabelMap;
1554 struct BreakContinue {
1555 BreakContinue(
const Stmt &LoopOrSwitch, JumpDest Break, JumpDest Continue)
1556 : LoopOrSwitch(&LoopOrSwitch), BreakBlock(Break),
1557 ContinueBlock(Continue) {}
1559 const Stmt *LoopOrSwitch;
1560 JumpDest BreakBlock;
1561 JumpDest ContinueBlock;
1563 SmallVector<BreakContinue, 8> BreakContinueStack;
1566 class OpenMPCancelExitStack {
1570 CancelExit() =
default;
1571 CancelExit(OpenMPDirectiveKind
Kind, JumpDest ExitBlock,
1573 :
Kind(
Kind), ExitBlock(ExitBlock), ContBlock(ContBlock) {}
1577 bool HasBeenEmitted =
false;
1582 SmallVector<CancelExit, 8> Stack;
1585 OpenMPCancelExitStack() : Stack(1) {}
1586 ~OpenMPCancelExitStack() =
default;
1588 JumpDest getExitBlock()
const {
return Stack.back().ExitBlock; }
1591 void emitExit(CodeGenFunction &CGF, OpenMPDirectiveKind
Kind,
1592 const llvm::function_ref<
void(CodeGenFunction &)> CodeGen) {
1593 if (Stack.back().Kind ==
Kind && getExitBlock().isValid()) {
1594 assert(CGF.getOMPCancelDestination(
Kind).isValid());
1595 assert(CGF.HaveInsertPoint());
1596 assert(!Stack.back().HasBeenEmitted);
1597 auto IP = CGF.Builder.saveAndClearIP();
1598 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1600 CGF.EmitBranch(Stack.back().ContBlock.getBlock());
1601 CGF.Builder.restoreIP(IP);
1602 Stack.back().HasBeenEmitted =
true;
1610 void enter(CodeGenFunction &CGF, OpenMPDirectiveKind
Kind,
bool HasCancel) {
1611 Stack.push_back({
Kind,
1612 HasCancel ? CGF.getJumpDestInCurrentScope(
"cancel.exit")
1614 HasCancel ? CGF.getJumpDestInCurrentScope(
"cancel.cont")
1619 void exit(CodeGenFunction &CGF) {
1620 if (getExitBlock().isValid()) {
1621 assert(CGF.getOMPCancelDestination(Stack.back().Kind).isValid());
1622 bool HaveIP = CGF.HaveInsertPoint();
1623 if (!Stack.back().HasBeenEmitted) {
1625 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1626 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1627 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1629 CGF.EmitBlock(Stack.back().ContBlock.getBlock());
1631 CGF.Builder.CreateUnreachable();
1632 CGF.Builder.ClearInsertionPoint();
1638 OpenMPCancelExitStack OMPCancelStack;
1641 llvm::Value *emitCondLikelihoodViaExpectIntrinsic(llvm::Value *Cond,
1642 Stmt::Likelihood LH);
1644 std::unique_ptr<CodeGenPGO> PGO;
1647 Address MCDCCondBitmapAddr = Address::invalid();
1650 llvm::MDNode *createProfileWeights(uint64_t TrueCount,
1651 uint64_t FalseCount)
const;
1652 llvm::MDNode *createProfileWeights(ArrayRef<uint64_t> Weights)
const;
1653 llvm::MDNode *createProfileWeightsForLoop(
const Stmt *Cond,
1654 uint64_t LoopCount)
const;
1657 std::pair<bool, bool> getIsCounterPair(
const Stmt *S)
const;
1658 void markStmtAsUsed(
bool Skipped,
const Stmt *S);
1659 void markStmtMaybeUsed(
const Stmt *S);
1663 void incrementProfileCounter(
const Stmt *S, llvm::Value *StepV =
nullptr);
1668 !CurFn->hasFnAttribute(llvm::Attribute::NoProfile));
1673 void maybeCreateMCDCCondBitmap();
1676 const BinaryOperator *BOp = dyn_cast<BinaryOperator>(
E->IgnoreParens());
1681 void maybeResetMCDCCondBitmap(
const Expr *
E);
1685 void maybeUpdateMCDCTestVectorBitmap(
const Expr *
E);
1688 void maybeUpdateMCDCCondBitmap(
const Expr *
E, llvm::Value *Val);
1691 uint64_t getProfileCount(
const Stmt *S);
1694 void setCurrentProfileCount(uint64_t Count);
1698 uint64_t getCurrentProfileCount();
1701 void addInstToCurrentSourceAtom(llvm::Instruction *KeyInstruction,
1702 llvm::Value *Backup);
1705 void addInstToSpecificSourceAtom(llvm::Instruction *KeyInstruction,
1706 llvm::Value *Backup, uint64_t Atom);
1710 void addInstToNewSourceAtom(llvm::Instruction *KeyInstruction,
1711 llvm::Value *Backup);
1716 llvm::SwitchInst *SwitchInsn =
nullptr;
1725 llvm::BasicBlock *CaseRangeBlock =
nullptr;
1729 llvm::DenseMap<const OpaqueValueExpr *, LValue> OpaqueLValues;
1730 llvm::DenseMap<const OpaqueValueExpr *, RValue> OpaqueRValues;
1738 llvm::DenseMap<const Expr *, llvm::Value *> VLASizeMap;
1742 llvm::BasicBlock *UnreachableBlock =
nullptr;
1745 unsigned NumReturnExprs = 0;
1748 unsigned NumSimpleReturnExprs = 0;
1766 : CGF(CGF), OldCXXDefaultInitExprThis(CGF.CXXDefaultInitExprThis) {
1767 CGF.CXXDefaultInitExprThis =
This;
1770 CGF.CXXDefaultInitExprThis = OldCXXDefaultInitExprThis;
1775 Address OldCXXDefaultInitExprThis;
1783 : CGF(CGF), OldCXXThisValue(CGF.CXXThisValue),
1784 OldCXXThisAlignment(CGF.CXXThisAlignment),
1785 SourceLocScope(
E, CGF.CurSourceLocExprScope) {
1787 CGF.CXXThisAlignment = CGF.CXXDefaultInitExprThis.
getAlignment();
1790 CGF.CXXThisValue = OldCXXThisValue;
1791 CGF.CXXThisAlignment = OldCXXThisAlignment;
1811 : CGF(CGF), OldArrayInitIndex(CGF.ArrayInitIndex) {
1812 CGF.ArrayInitIndex = Index;
1818 llvm::Value *OldArrayInitIndex;
1824 : CGF(CGF), OldCurGD(CGF.CurGD), OldCurFuncDecl(CGF.CurFuncDecl),
1825 OldCurCodeDecl(CGF.CurCodeDecl),
1826 OldCXXABIThisDecl(CGF.CXXABIThisDecl),
1827 OldCXXABIThisValue(CGF.CXXABIThisValue),
1828 OldCXXThisValue(CGF.CXXThisValue),
1829 OldCXXABIThisAlignment(CGF.CXXABIThisAlignment),
1830 OldCXXThisAlignment(CGF.CXXThisAlignment),
1831 OldReturnValue(CGF.ReturnValue), OldFnRetTy(CGF.FnRetTy),
1832 OldCXXInheritedCtorInitExprArgs(
1833 std::move(CGF.CXXInheritedCtorInitExprArgs)) {
1836 cast<CXXConstructorDecl>(GD.
getDecl());
1837 CGF.CXXABIThisDecl =
nullptr;
1838 CGF.CXXABIThisValue =
nullptr;
1839 CGF.CXXThisValue =
nullptr;
1844 CGF.CXXInheritedCtorInitExprArgs.clear();
1847 CGF.CurGD = OldCurGD;
1848 CGF.CurFuncDecl = OldCurFuncDecl;
1849 CGF.CurCodeDecl = OldCurCodeDecl;
1850 CGF.CXXABIThisDecl = OldCXXABIThisDecl;
1851 CGF.CXXABIThisValue = OldCXXABIThisValue;
1852 CGF.CXXThisValue = OldCXXThisValue;
1853 CGF.CXXABIThisAlignment = OldCXXABIThisAlignment;
1854 CGF.CXXThisAlignment = OldCXXThisAlignment;
1855 CGF.ReturnValue = OldReturnValue;
1856 CGF.FnRetTy = OldFnRetTy;
1857 CGF.CXXInheritedCtorInitExprArgs =
1858 std::move(OldCXXInheritedCtorInitExprArgs);
1864 const Decl *OldCurFuncDecl;
1865 const Decl *OldCurCodeDecl;
1867 llvm::Value *OldCXXABIThisValue;
1868 llvm::Value *OldCXXThisValue;
1899 llvm::CallInst *RTLFnCI;
1903 RLFnCI->removeFromParent();
1933 StringRef FirstSeparator =
".",
1934 StringRef Separator =
".");
1939 CGBuilderTy::InsertPointGuard IPG(CGF.
Builder);
1940 assert(IP.getBlock()->end() != IP.getPoint() &&
1941 "OpenMP IR Builder should cause terminated block!");
1943 llvm::BasicBlock *IPBB = IP.getBlock();
1944 llvm::BasicBlock *DestBB = IPBB->getUniqueSuccessor();
1945 assert(DestBB &&
"Finalization block should have one successor!");
1948 IPBB->getTerminator()->eraseFromParent();
1949 CGF.
Builder.SetInsertPoint(IPBB);
1962 const Stmt *RegionBodyStmt,
1963 InsertPointTy AllocaIP,
1964 InsertPointTy CodeGenIP,
1968 llvm::BasicBlock &FiniBB, llvm::Function *Fn,
1970 llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
1971 if (llvm::Instruction *CodeGenIPBBTI = CodeGenIPBB->getTerminator())
1972 CodeGenIPBBTI->eraseFromParent();
1974 CGF.
Builder.SetInsertPoint(CodeGenIPBB);
1976 if (Fn->doesNotThrow())
1981 if (CGF.
Builder.saveIP().isSet())
1982 CGF.
Builder.CreateBr(&FiniBB);
1994 const Stmt *RegionBodyStmt,
1995 InsertPointTy AllocaIP,
1996 InsertPointTy CodeGenIP,
2002 llvm::AssertingVH<llvm::Instruction> OldAllocaIP;
2008 llvm::BasicBlock &RetBB)
2010 assert(AllocaIP.isSet() &&
2011 "Must specify Insertion point for allocas of outlined function");
2028 llvm::AssertingVH<llvm::Instruction> OldAllocaIP;
2033 llvm::BasicBlock &FiniBB)
2039 assert((!AllocaIP.isSet() ||
2041 "Insertion point should be in the entry block of containing "
2044 if (AllocaIP.isSet())
2063 llvm::Value *CXXABIThisValue =
nullptr;
2064 llvm::Value *CXXThisValue =
nullptr;
2070 Address CXXDefaultInitExprThis = Address::invalid();
2074 llvm::Value *ArrayInitIndex =
nullptr;
2083 llvm::Value *CXXStructorImplicitParamValue =
nullptr;
2088 ConditionalEvaluation *OutermostConditional =
nullptr;
2091 LexicalScope *CurLexicalScope =
nullptr;
2099 llvm::DenseMap<const ValueDecl *, BlockByrefInfo> BlockByrefInfos;
2103 llvm::Value *RetValNullabilityPrecondition =
nullptr;
2107 bool requiresReturnValueNullabilityCheck()
const {
2108 return RetValNullabilityPrecondition;
2113 Address ReturnLocation = Address::invalid();
2116 bool requiresReturnValueCheck()
const;
2121 llvm::BasicBlock *TerminateLandingPad =
nullptr;
2122 llvm::BasicBlock *TerminateHandler =
nullptr;
2126 llvm::MapVector<llvm::Value *, llvm::BasicBlock *> TerminateFunclets;
2130 unsigned LargestVectorWidth = 0;
2134 bool ShouldEmitLifetimeMarkers;
2138 void EmitKernelMetadata(
const FunctionDecl *FD, llvm::Function *Fn);
2141 CodeGenFunction(CodeGenModule &cgm,
bool suppressNewContext =
false);
2147 if (DisableDebugInfo)
2167 llvm::Value *getExceptionFromSlot();
2168 llvm::Value *getSelectorFromSlot();
2173 if (!UnreachableBlock) {
2174 UnreachableBlock = createBasicBlock(
"unreachable");
2175 new llvm::UnreachableInst(getLLVMContext(), UnreachableBlock);
2177 return UnreachableBlock;
2183 return getInvokeDestImpl();
2200 void pushIrregularPartialArrayCleanup(llvm::Value *arrayBegin,
2204 Destroyer *destroyer);
2205 void pushRegularPartialArrayCleanup(llvm::Value *arrayBegin,
2206 llvm::Value *arrayEnd,
2209 Destroyer *destroyer);
2216 Destroyer *destroyer,
bool useEHCleanupForArray);
2220 QualType type, Destroyer *destroyer,
2221 bool useEHCleanupForArray);
2223 QualType type, Destroyer *destroyer,
2224 bool useEHCleanupForArray);
2227 void pushCallObjectDeleteCleanup(
const FunctionDecl *OperatorDelete,
2228 llvm::Value *CompletePtr,
2232 std::pair<llvm::Value *, llvm::Value *> AddrSizePair);
2234 bool useEHCleanupForArray);
2236 Destroyer *destroyer,
2237 bool useEHCleanupForArray,
2239 void emitArrayDestroy(llvm::Value *begin, llvm::Value *end,
2241 Destroyer *destroyer,
bool checkZeroLength,
2250 case QualType::DK_none:
2252 case QualType::DK_cxx_destructor:
2253 case QualType::DK_objc_weak_lifetime:
2254 case QualType::DK_nontrivial_c_struct:
2255 return getLangOpts().Exceptions;
2256 case QualType::DK_objc_strong_lifetime:
2257 return getLangOpts().Exceptions &&
2260 llvm_unreachable(
"bad destruction kind");
2264 return (needsEHCleanup(kind) ? NormalAndEHCleanup : NormalCleanup);
2281 llvm::Constant *AtomicHelperFn);
2292 llvm::Constant *AtomicHelperFn);
2302 llvm::Value *EmitBlockLiteral(
const BlockExpr *);
2305 const DeclMapTy &ldm,
2306 bool IsLambdaConversionToBlock,
2307 bool BuildGlobalBlock);
2310 static bool cxxDestructorCanThrow(
QualType T);
2312 llvm::Constant *GenerateCopyHelperFunction(
const CGBlockInfo &blockInfo);
2313 llvm::Constant *GenerateDestroyHelperFunction(
const CGBlockInfo &blockInfo);
2318 llvm::Value *EmitBlockCopyAndAutorelease(llvm::Value *
Block,
QualType Ty);
2323 class AutoVarEmission;
2325 void emitByrefStructureInit(
const AutoVarEmission &emission);
2344 bool LoadBlockVarAddr,
bool CanThrow);
2355 bool followForward =
true);
2357 bool followForward,
const llvm::Twine &name);
2363 void GenerateCode(
GlobalDecl GD, llvm::Function *Fn,
2368 void markAsIgnoreThreadCheckingAtRuntime(llvm::Function *Fn);
2383 void EmitFunctionBody(
const Stmt *Body);
2384 void EmitBlockWithFallThrough(llvm::BasicBlock *BB,
const Stmt *S);
2386 void EmitForwardingCallToLambda(
const CXXMethodDecl *LambdaCallOperator,
2389 llvm::Constant *CallOpFn =
nullptr);
2390 void EmitLambdaBlockInvokeBody();
2392 void EmitLambdaDelegatingInvokeBody(
const CXXMethodDecl *MD,
2396 llvm::Function **ImplFn);
2399 EmitStoreThroughLValue(RValue::get(VLASizeMap[VAT->
getSizeExpr()]), LV);
2401 void EmitAsanPrologueOrEpilogue(
bool Prologue);
2407 llvm::DebugLoc EmitReturnBlock();
2413 void StartThunk(llvm::Function *Fn,
GlobalDecl GD,
2416 void EmitCallAndReturnForThunk(llvm::FunctionCallee Callee,
2417 const ThunkInfo *Thunk,
bool IsUnprototyped);
2422 void EmitMustTailThunk(
GlobalDecl GD, llvm::Value *AdjustedThisPtr,
2423 llvm::FunctionCallee Callee);
2426 void generateThunk(llvm::Function *Fn,
const CGFunctionInfo &FnInfo,
2428 bool IsUnprototyped);
2430 llvm::Function *GenerateVarArgsThunk(llvm::Function *Fn,
2448 void InitializeVTablePointer(
const VPtr &vptr);
2457 bool BaseIsNonVirtualPrimaryBase,
2461 void InitializeVTablePointers(
const CXXRecordDecl *ClassDecl);
2476 VTableAuthMode AuthMode = VTableAuthMode::Authenticate);
2491 void EmitVTablePtrCheckForCast(
QualType T,
Address Derived,
bool MayBeNull,
2496 void EmitVTablePtrCheckForCall(
const CXXRecordDecl *RD, llvm::Value *VTable,
2501 void EmitVTablePtrCheck(
const CXXRecordDecl *RD, llvm::Value *VTable,
2513 bool ShouldEmitVTableTypeCheckedLoad(
const CXXRecordDecl *RD);
2516 llvm::Value *EmitVTableTypeCheckedLoad(
const CXXRecordDecl *RD,
2517 llvm::Value *VTable,
2518 llvm::Type *VTableTy,
2519 uint64_t VTableByteOffset);
2529 bool ShouldInstrumentFunction();
2533 bool ShouldSkipSanitizerInstrumentation();
2537 bool ShouldXRayInstrumentFunction()
const;
2541 bool AlwaysEmitXRayCustomEvents()
const;
2545 bool AlwaysEmitXRayTypedEvents()
const;
2549 llvm::ConstantInt *getUBSanFunctionTypeHash(
QualType T)
const;
2554 void EmitFunctionProlog(
const CGFunctionInfo &FI, llvm::Function *Fn,
2561 void EmitFunctionEpilog(
const CGFunctionInfo &FI,
bool EmitRetDbgLoc,
2563 uint64_t RetKeyInstructionsSourceAtom);
2566 void EmitReturnValueCheck(llvm::Value *RV);
2569 void EmitStartEHSpec(
const Decl *
D);
2572 void EmitEndEHSpec(
const Decl *
D);
2575 llvm::BasicBlock *getTerminateLandingPad();
2579 llvm::BasicBlock *getTerminateFunclet();
2584 llvm::BasicBlock *getTerminateHandler();
2586 llvm::Type *ConvertTypeForMem(
QualType T);
2587 llvm::Type *ConvertType(
QualType T);
2588 llvm::Type *convertTypeForLoadStore(
QualType ASTTy,
2589 llvm::Type *LLVMTy =
nullptr);
2591 return ConvertType(getContext().getTypeDeclType(
T));
2596 llvm::Value *LoadObjCSelf();
2605 return getEvaluationKind(
T) == TEK_Scalar;
2609 return getEvaluationKind(
T) == TEK_Aggregate;
2614 llvm::Function *parent =
nullptr,
2615 llvm::BasicBlock *before =
nullptr) {
2616 return llvm::BasicBlock::Create(getLLVMContext(), name, parent, before);
2621 JumpDest getJumpDestForLabel(
const LabelDecl *S);
2626 void SimplifyForwardingBlocks(llvm::BasicBlock *BB);
2636 void EmitBlock(llvm::BasicBlock *BB,
bool IsFinished =
false);
2640 void EmitBlockAfterUses(llvm::BasicBlock *BB);
2650 void EmitBranch(llvm::BasicBlock *
Block);
2661 if (!HaveInsertPoint())
2662 EmitBlock(createBasicBlock());
2667 void ErrorUnsupported(
const Stmt *S,
const char *
Type);
2674 llvm::BasicBlock *LHSBlock,
2675 llvm::BasicBlock *RHSBlock,
2676 llvm::BasicBlock *MergeBlock,
2678 Builder.SetInsertPoint(MergeBlock);
2679 llvm::PHINode *PtrPhi = Builder.CreatePHI(LHS.
getType(), 2,
"cond");
2696 if (Alignment.isZero())
2699 return Address(Ptr, ConvertTypeForMem(
T), Alignment,
2712 return LValue::MakeAddr(
Addr,
T, getContext(), BaseInfo, TBAAInfo);
2717 return MakeAddrLValue(makeNaturalAddressForPointer(
V,
T, Alignment),
T,
2742 MakeNaturalAlignAddrLValue(llvm::Value *
V,
QualType T,
2747 LValue MakeNaturalAlignPointeeRawAddrLValue(llvm::Value *
V,
QualType T);
2760 return EmitLoadOfReferenceLValue(RefLVal);
2772 struct AllocaTracker {
2773 void Add(llvm::AllocaInst *I) { Allocas.push_back(I); }
2779 AllocaTracker *Allocas =
nullptr;
2782 void emitStoresForConstant(
const VarDecl &
D, Address
Loc,
bool isVolatile,
2783 llvm::Constant *constant,
bool IsAutoInit);
2785 void emitStoresForZeroInit(
const VarDecl &
D, Address
Loc,
bool isVolatile);
2787 void emitStoresForPatternInit(
const VarDecl &
D, Address
Loc,
bool isVolatile);
2789 void emitStoresForInitAfterBZero(llvm::Constant *Init, Address
Loc,
2790 bool isVolatile,
bool IsAutoInit);
2796 : CGF(CGF), OldTracker(CGF.Allocas) {
2797 CGF.Allocas = &Tracker;
2805 AllocaTracker *OldTracker;
2806 AllocaTracker Tracker;
2813 llvm::Value *ArraySize =
nullptr);
2842 llvm::AllocaInst *CreateTempAlloca(llvm::Type *Ty,
const Twine &Name =
"tmp",
2843 llvm::Value *ArraySize =
nullptr);
2849 CharUnits align,
const Twine &Name =
"tmp",
2850 llvm::Value *ArraySize =
nullptr,
2859 const Twine &Name =
"tmp",
2860 llvm::Value *ArraySize =
nullptr,
2862 return CreateTempAlloca(Ty, LangAS::Default, align, Name, ArraySize,
2867 const Twine &Name =
"tmp",
2868 llvm::Value *ArraySize =
nullptr);
2880 RawAddress CreateDefaultAlignTempAlloca(llvm::Type *Ty,
2881 const Twine &Name =
"tmp");
2899 const Twine &Name =
"tmp",
2906 const Twine &Name =
"tmp");
2912 return AggValueSlot::forAddr(
2913 CreateMemTemp(
T, Name, Alloca),
T.getQualifiers(),
2914 AggValueSlot::IsNotDestructed, AggValueSlot::DoesNotNeedGCBarriers,
2915 AggValueSlot::IsNotAliased, AggValueSlot::DoesNotOverlap);
2920 llvm::Value *EvaluateExprAsBool(
const Expr *
E);
2926 llvm::Value *EmitWithOriginalRHSBitfieldAssignment(
const BinaryOperator *
E,
2932 void EmitBitfieldConversionCheck(llvm::Value *Src,
QualType SrcType,
2933 llvm::Value *Dst,
QualType DstType,
2939 void EmitIgnoredExpr(
const Expr *
E);
2949 bool ignoreResult =
false);
2967 bool IsInitializer);
2972 void EmitInitializationToLValue(
2979 bool capturedByInit);
2985 return RD->hasVolatileMember();
2994 return AggValueSlot::DoesNotOverlap;
3009 bool IsVolatile = hasVolatileMember(EltTy);
3010 EmitAggregateCopy(Dest, Src, EltTy, AggValueSlot::MayOverlap, IsVolatile);
3015 EmitAggregateCopy(Dest, Src, Src.
getType(), MayOverlap);
3027 bool isVolatile =
false);
3031 auto it = LocalDeclMap.find(VD);
3032 assert(it != LocalDeclMap.end() &&
3033 "Invalid argument to GetAddrOfLocalVar(), no decl!");
3054 static unsigned getAccessedFieldNo(
unsigned Idx,
const llvm::Constant *Elts);
3056 llvm::BlockAddress *GetAddrOfLabel(
const LabelDecl *L);
3057 llvm::BasicBlock *GetIndirectGotoBlock();
3060 static bool IsWrappedCXXThis(
const Expr *
E);
3073 llvm::Value *EmitVAStartEnd(llvm::Value *ArgValue,
bool IsStart);
3095 void EmitVariablyModifiedType(
QualType Ty);
3107 VlaSizePair getVLAElements1D(
QualType vla);
3114 VlaSizePair getVLASize(
QualType vla);
3119 assert(CXXThisValue &&
"no 'this' value for this function");
3120 return CXXThisValue;
3129 assert(CXXStructorImplicitParamValue &&
"no VTT value for this function");
3130 return CXXStructorImplicitParamValue;
3138 bool BaseIsVirtual);
3140 static bool ShouldNullCheckClassCastValue(
const CastExpr *Cast);
3152 bool NullCheckValue);
3158 llvm::Value *GetVTTParameter(
GlobalDecl GD,
bool ForVirtualBase,
3178 bool ForVirtualBase,
3187 bool InheritedFromVBase,
3191 bool ForVirtualBase,
bool Delegating,
3195 bool ForVirtualBase,
bool Delegating,
3199 llvm::CallBase **CallOrInvoke =
nullptr);
3206 void EmitVTableAssumptionLoad(
const VPtr &vptr,
Address This);
3214 bool NewPointerIsChecked,
3215 bool ZeroInitialization =
false);
3218 llvm::Value *NumElements,
Address ArrayPtr,
3220 bool NewPointerIsChecked,
3221 bool ZeroInitialization =
false);
3226 bool ForVirtualBase,
bool Delegating,
Address This,
3230 llvm::Type *ElementTy,
Address NewPtr,
3231 llvm::Value *NumElements,
3232 llvm::Value *AllocSizeWithoutCookie);
3237 void EmitSehCppScopeBegin();
3238 void EmitSehCppScopeEnd();
3239 void EmitSehTryScopeBegin();
3240 void EmitSehTryScopeEnd();
3242 bool EmitLifetimeStart(llvm::Value *Addr);
3243 void EmitLifetimeEnd(llvm::Value *Addr);
3248 void EmitDeleteCall(
const FunctionDecl *DeleteFD, llvm::Value *Ptr,
3249 QualType DeleteTy, llvm::Value *NumElements =
nullptr,
3253 const CallExpr *TheCallExpr,
bool IsDelete);
3295 TCK_DynamicOperation
3299 static bool isNullPointerAllowed(TypeCheckKind TCK);
3302 static bool isVptrCheckRequired(TypeCheckKind TCK,
QualType Ty);
3306 bool sanitizePerformTypeCheck()
const;
3310 llvm::Value *ArraySize =
nullptr) {
3311 if (!sanitizePerformTypeCheck())
3314 SkippedChecks, ArraySize);
3320 llvm::Value *ArraySize =
nullptr) {
3321 if (!sanitizePerformTypeCheck())
3323 EmitTypeCheck(TCK,
Loc,
Addr.emitRawPointer(*
this),
Type, Alignment,
3324 SkippedChecks, ArraySize);
3333 llvm::Value *ArraySize =
nullptr);
3338 void EmitBoundsCheck(
const Expr *
E,
const Expr *
Base, llvm::Value *Index,
3339 QualType IndexType,
bool Accessed);
3340 void EmitBoundsCheckImpl(
const Expr *
E, llvm::Value *Bound,
3341 llvm::Value *Index,
QualType IndexType,
3342 QualType IndexedType,
bool Accessed);
3360 void EmitCountedByBoundsChecking(
const Expr *
E, llvm::Value *Idx,
3363 bool FlexibleArray);
3366 bool isInc,
bool isPre);
3368 bool isInc,
bool isPre);
3374 unsigned getDebugInfoFIndex(
const RecordDecl *Rec,
unsigned FieldIndex);
3383 void EmitDecl(
const Decl &
D,
bool EvaluateConditionDecl =
false);
3388 void EmitVarDecl(
const VarDecl &
D);
3391 bool capturedByInit);
3398 bool isTrivialInitializer(
const Expr *Init);
3403 void EmitAutoVarDecl(
const VarDecl &
D);
3416 llvm::Value *NRVOFlag;
3420 bool IsEscapingByRef;
3424 bool IsConstantAggregate;
3427 bool UseLifetimeMarkers;
3438 AutoVarEmission(
const VarDecl &variable)
3440 IsEscapingByRef(
false), IsConstantAggregate(
false),
3443 bool wasEmittedAsGlobal()
const {
return !
Addr.isValid(); }
3462 if (!IsEscapingByRef)
3468 AutoVarEmission EmitAutoVarAlloca(
const VarDecl &var);
3469 void EmitAutoVarInit(
const AutoVarEmission &emission);
3470 void EmitAutoVarCleanups(
const AutoVarEmission &emission);
3471 void emitAutoVarTypeCleanup(
const AutoVarEmission &emission,
3474 void MaybeEmitDeferredVarDeclInit(
const VarDecl *var);
3482 bool EmitDebugInfo);
3484 void EmitStaticVarDecl(
const VarDecl &
D,
3485 llvm::GlobalValue::LinkageTypes
Linkage);
3511 assert(!
Addr.hasOffset() &&
"unexpected offset");
3512 return Addr.getBasePointer();
3516 assert(!isIndirect());
3521 assert(isIndirect());
3527 void EmitParmDecl(
const VarDecl &
D, ParamValue Arg,
unsigned ArgNo);
3538 PeepholeProtection protectFromPeepholes(
RValue rvalue);
3539 void unprotectFromPeepholes(PeepholeProtection protection);
3541 void emitAlignmentAssumptionCheck(llvm::Value *Ptr,
QualType Ty,
3544 llvm::Value *Alignment,
3545 llvm::Value *OffsetValue,
3546 llvm::Value *TheCheck,
3547 llvm::Instruction *Assumption);
3549 void emitAlignmentAssumption(llvm::Value *PtrValue,
QualType Ty,
3551 llvm::Value *Alignment,
3552 llvm::Value *OffsetValue =
nullptr);
3554 void emitAlignmentAssumption(llvm::Value *PtrValue,
const Expr *
E,
3556 llvm::Value *Alignment,
3557 llvm::Value *OffsetValue =
nullptr);
3564 void EmitStopPoint(
const Stmt *S);
3582 Address EmitCompoundStmt(
const CompoundStmt &S,
bool GetLast =
false,
3583 AggValueSlot AVS = AggValueSlot::ignored());
3585 EmitCompoundStmtWithoutScope(
const CompoundStmt &S,
bool GetLast =
false,
3586 AggValueSlot AVS = AggValueSlot::ignored());
3594 void EmitGotoStmt(
const GotoStmt &S);
3596 void EmitIfStmt(
const IfStmt &S);
3599 void EmitDoStmt(
const DoStmt &S, ArrayRef<const Attr *> Attrs = {});
3600 void EmitForStmt(
const ForStmt &S, ArrayRef<const Attr *> Attrs = {});
3601 void EmitReturnStmt(
const ReturnStmt &S);
3602 void EmitDeclStmt(
const DeclStmt &S);
3603 void EmitBreakStmt(
const BreakStmt &S);
3604 void EmitContinueStmt(
const ContinueStmt &S);
3605 void EmitSwitchStmt(
const SwitchStmt &S);
3606 void EmitDefaultStmt(
const DefaultStmt &S, ArrayRef<const Attr *> Attrs);
3607 void EmitCaseStmt(
const CaseStmt &S, ArrayRef<const Attr *> Attrs);
3608 void EmitCaseStmtRange(
const CaseStmt &S, ArrayRef<const Attr *> Attrs);
3609 void EmitAsmStmt(
const AsmStmt &S);
3611 const BreakContinue *GetDestForLoopControlStmt(
const LoopControlStmt &S);
3613 void EmitObjCForCollectionStmt(
const ObjCForCollectionStmt &S);
3614 void EmitObjCAtTryStmt(
const ObjCAtTryStmt &S);
3615 void EmitObjCAtThrowStmt(
const ObjCAtThrowStmt &S);
3616 void EmitObjCAtSynchronizedStmt(
const ObjCAtSynchronizedStmt &S);
3617 void EmitObjCAutoreleasePoolStmt(
const ObjCAutoreleasePoolStmt &S);
3619 void EmitCoroutineBody(
const CoroutineBodyStmt &S);
3620 void EmitCoreturnStmt(
const CoreturnStmt &S);
3621 RValue EmitCoawaitExpr(
const CoawaitExpr &
E,
3622 AggValueSlot aggSlot = AggValueSlot::ignored(),
3623 bool ignoreResult =
false);
3624 LValue EmitCoawaitLValue(
const CoawaitExpr *
E);
3625 RValue EmitCoyieldExpr(
const CoyieldExpr &
E,
3626 AggValueSlot aggSlot = AggValueSlot::ignored(),
3627 bool ignoreResult =
false);
3628 LValue EmitCoyieldLValue(
const CoyieldExpr *
E);
3629 RValue EmitCoroutineIntrinsic(
const CallExpr *
E,
unsigned int IID);
3631 void EnterCXXTryStmt(
const CXXTryStmt &S,
bool IsFnTryBlock =
false);
3632 void ExitCXXTryStmt(
const CXXTryStmt &S,
bool IsFnTryBlock =
false);
3634 void EmitCXXTryStmt(
const CXXTryStmt &S);
3635 void EmitSEHTryStmt(
const SEHTryStmt &S);
3636 void EmitSEHLeaveStmt(
const SEHLeaveStmt &S);
3637 void EnterSEHTryStmt(
const SEHTryStmt &S);
3638 void ExitSEHTryStmt(
const SEHTryStmt &S);
3639 void VolatilizeTryBlocks(llvm::BasicBlock *BB,
3642 void pushSEHCleanup(CleanupKind kind, llvm::Function *FinallyFunc);
3643 void startOutlinedSEHHelper(CodeGenFunction &ParentCGF,
bool IsFilter,
3644 const Stmt *OutlinedStmt);
3646 llvm::Function *GenerateSEHFilterFunction(CodeGenFunction &ParentCGF,
3647 const SEHExceptStmt &Except);
3649 llvm::Function *GenerateSEHFinallyFunction(CodeGenFunction &ParentCGF,
3650 const SEHFinallyStmt &Finally);
3652 void EmitSEHExceptionCodeSave(CodeGenFunction &ParentCGF,
3653 llvm::Value *ParentFP, llvm::Value *EntryEBP);
3654 llvm::Value *EmitSEHExceptionCode();
3655 llvm::Value *EmitSEHExceptionInfo();
3656 llvm::Value *EmitSEHAbnormalTermination();
3659 void EmitSimpleOMPExecutableDirective(
const OMPExecutableDirective &
D);
3664 void EmitCapturedLocals(CodeGenFunction &ParentCGF,
const Stmt *OutlinedStmt,
3672 Address recoverAddrOfEscapedLocal(CodeGenFunction &ParentCGF,
3673 Address ParentVar, llvm::Value *ParentFP);
3675 void EmitCXXForRangeStmt(
const CXXForRangeStmt &S,
3676 ArrayRef<const Attr *> Attrs = {});
3686 CGF.OMPCancelStack.enter(CGF,
Kind, HasCancel);
3692 llvm::Value *getTypeSize(
QualType Ty);
3695 llvm::Function *GenerateCapturedStmtFunction(
const CapturedStmt &S);
3697 llvm::Function *GenerateOpenMPCapturedStmtFunction(
const CapturedStmt &S,
3712 void EmitOMPAggregateAssign(
3742 std::pair<bool, RValue> EmitOMPAtomicSimpleUpdateExpr(
3747 OMPPrivateScope &PrivateScope);
3749 OMPPrivateScope &PrivateScope);
3750 void EmitOMPUseDevicePtrClause(
3752 const llvm::DenseMap<const ValueDecl *, llvm::Value *>
3753 CaptureDeviceAddrMap);
3754 void EmitOMPUseDeviceAddrClause(
3756 const llvm::DenseMap<const ValueDecl *, llvm::Value *>
3757 CaptureDeviceAddrMap);
3782 OMPPrivateScope &PrivateScope);
3792 llvm::Value *IsLastIterCond =
nullptr);
3799 void EmitOMPLinearClauseFinal(
3810 OMPPrivateScope &PrivateScope,
3811 bool ForInscan =
false);
3840 unsigned NumberOfTargetItems = 0;
3844 unsigned NumberOfTargetItems)
3845 : BasePointersArray(BasePointersArray), PointersArray(PointersArray),
3846 SizesArray(SizesArray), MappersArray(MappersArray),
3847 NumberOfTargetItems(NumberOfTargetItems) {}
3851 OMPTargetDataInfo &InputInfo);
3854 OMPPrivateScope &
Scope);
3908 void EmitOMPParallelMasterTaskLoopDirective(
3910 void EmitOMPParallelMaskedTaskLoopDirective(
3912 void EmitOMPParallelMasterTaskLoopSimdDirective(
3914 void EmitOMPParallelMaskedTaskLoopSimdDirective(
3917 void EmitOMPDistributeParallelForDirective(
3919 void EmitOMPDistributeParallelForSimdDirective(
3922 void EmitOMPTargetParallelForSimdDirective(
3928 void EmitOMPTeamsDistributeParallelForSimdDirective(
3930 void EmitOMPTeamsDistributeParallelForDirective(
3933 void EmitOMPTargetTeamsDistributeDirective(
3935 void EmitOMPTargetTeamsDistributeParallelForDirective(
3937 void EmitOMPTargetTeamsDistributeParallelForSimdDirective(
3939 void EmitOMPTargetTeamsDistributeSimdDirective(
3943 void EmitOMPTargetParallelGenericLoopDirective(
3945 void EmitOMPTargetTeamsGenericLoopDirective(
3954 StringRef ParentName,
3957 EmitOMPTargetParallelDeviceFunction(
CodeGenModule &CGM, StringRef ParentName,
3960 static void EmitOMPTargetParallelForDeviceFunction(
3964 static void EmitOMPTargetParallelForSimdDeviceFunction(
3969 EmitOMPTargetTeamsDeviceFunction(
CodeGenModule &CGM, StringRef ParentName,
3972 static void EmitOMPTargetTeamsDistributeDeviceFunction(
3976 static void EmitOMPTargetTeamsDistributeSimdDeviceFunction(
3980 static void EmitOMPTargetSimdDeviceFunction(
CodeGenModule &CGM,
3981 StringRef ParentName,
3985 static void EmitOMPTargetTeamsDistributeParallelForSimdDeviceFunction(
3990 static void EmitOMPTargetTeamsGenericLoopDeviceFunction(
3995 static void EmitOMPTargetParallelGenericLoopDeviceFunction(
3999 static void EmitOMPTargetTeamsDistributeParallelForDeviceFunction(
4008 llvm::CanonicalLoopInfo *EmitOMPCollapsedCanonicalLoopNest(
const Stmt *S,
4024 void EmitOMPInnerLoop(
4026 const Expr *LoopCond,
const Expr *IncExpr,
4033 OMPPrivateScope &LoopScope);
4042 const CodeGenLoopBoundsTy &CodeGenLoopBounds,
4043 const CodeGenDispatchBoundsTy &CGDispatchBounds);
4047 const CodeGenLoopTy &CodeGenLoop,
Expr *IncExpr);
4051 void EmitOMPSimdFinal(
4060 llvm::Value *EmitBlockLiteral(
const CGBlockInfo &Info);
4063 struct OMPLoopArguments {
4065 Address LB = Address::invalid();
4067 Address UB = Address::invalid();
4069 Address ST = Address::invalid();
4071 Address IL = Address::invalid();
4073 llvm::Value *Chunk =
nullptr;
4075 Expr *EUB =
nullptr;
4077 Expr *IncExpr =
nullptr;
4079 Expr *Init =
nullptr;
4081 Expr *Cond =
nullptr;
4083 Expr *NextLB =
nullptr;
4085 Expr *NextUB =
nullptr;
4088 OMPLoopArguments() =
default;
4090 llvm::Value *Chunk =
nullptr,
Expr *EUB =
nullptr,
4091 Expr *IncExpr =
nullptr,
Expr *Init =
nullptr,
4092 Expr *Cond =
nullptr,
Expr *NextLB =
nullptr,
4093 Expr *NextUB =
nullptr)
4094 : LB(LB), UB(UB), ST(ST), IL(IL), Chunk(Chunk), EUB(EUB),
4095 IncExpr(IncExpr), Init(Init), Cond(Cond), NextLB(NextLB),
4098 void EmitOMPOuterLoop(
bool DynamicOrOrdered,
bool IsMonotonic,
4099 const OMPLoopDirective &S, OMPPrivateScope &LoopScope,
4100 const OMPLoopArguments &LoopArgs,
4101 const CodeGenLoopTy &CodeGenLoop,
4102 const CodeGenOrderedTy &CodeGenOrdered);
4103 void EmitOMPForOuterLoop(
const OpenMPScheduleTy &ScheduleKind,
4104 bool IsMonotonic,
const OMPLoopDirective &S,
4105 OMPPrivateScope &LoopScope,
bool Ordered,
4106 const OMPLoopArguments &LoopArgs,
4107 const CodeGenDispatchBoundsTy &CGDispatchBounds);
4108 void EmitOMPDistributeOuterLoop(OpenMPDistScheduleClauseKind ScheduleKind,
4109 const OMPLoopDirective &S,
4110 OMPPrivateScope &LoopScope,
4111 const OMPLoopArguments &LoopArgs,
4112 const CodeGenLoopTy &CodeGenLoopContent);
4114 void EmitSections(
const OMPExecutableDirective &S);
4124 EmitStmt(S.getStructuredBlock());
4131 EmitStmt(S.getLoop());
4138 EmitStmt(S.getLoop());
4145 EmitStmt(S.getStructuredBlock());
4162 EmitStmt(S.getStructuredBlock());
4194 EmitStmt(S.getAssociatedStmt());
4214 RValue EmitUnsupportedRValue(
const Expr *
E,
const char *Name);
4218 LValue EmitUnsupportedLValue(
const Expr *
E,
const char *Name);
4246 LValue EmitCheckedLValue(
const Expr *
E, TypeCheckKind TCK);
4252 bool LValueIsSuitableForInlineAtomic(
LValue Src);
4258 llvm::AtomicOrdering AO,
bool IsVolatile =
false,
4261 void EmitAtomicStore(
RValue rvalue,
LValue lvalue,
bool isInit);
4263 void EmitAtomicStore(
RValue rvalue,
LValue lvalue, llvm::AtomicOrdering AO,
4264 bool IsVolatile,
bool isInit);
4266 std::pair<RValue, llvm::Value *> EmitAtomicCompareExchange(
4268 llvm::AtomicOrdering Success =
4269 llvm::AtomicOrdering::SequentiallyConsistent,
4270 llvm::AtomicOrdering Failure =
4271 llvm::AtomicOrdering::SequentiallyConsistent,
4272 bool IsWeak =
false,
AggValueSlot Slot = AggValueSlot::ignored());
4276 llvm::AtomicRMWInst *emitAtomicRMWInst(
4277 llvm::AtomicRMWInst::BinOp Op,
Address Addr, llvm::Value *Val,
4278 llvm::AtomicOrdering Order = llvm::AtomicOrdering::SequentiallyConsistent,
4279 llvm::SyncScope::ID SSID = llvm::SyncScope::System,
4282 void EmitAtomicUpdate(
LValue LVal, llvm::AtomicOrdering AO,
4292 llvm::Value *EmitFromMemory(llvm::Value *
Value,
QualType Ty);
4307 bool isNontemporal =
false) {
4312 llvm::Value *EmitLoadOfScalar(
Address Addr,
bool Volatile,
QualType Ty,
4315 bool isNontemporal =
false);
4329 bool isInit =
false,
bool isNontemporal =
false) {
4334 void EmitStoreOfScalar(llvm::Value *
Value,
Address Addr,
bool Volatile,
4337 bool isNontemporal =
false);
4344 void EmitStoreOfScalar(llvm::Value *value,
LValue lvalue,
4345 bool isInit =
false);
4363 void EmitStoreThroughLValue(RValue Src, LValue Dst,
bool isInit =
false);
4364 void EmitStoreThroughExtVectorComponentLValue(RValue Src, LValue Dst);
4365 void EmitStoreThroughGlobalRegLValue(RValue Src, LValue Dst);
4373 void EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
4374 llvm::Value **Result =
nullptr);
4380 llvm::Value *&Result);
4386 LValue EmitCallExprLValue(
const CallExpr *
E,
4387 llvm::CallBase **CallOrInvoke =
nullptr);
4389 LValue EmitVAArgExprLValue(
const VAArgExpr *
E);
4396 bool Accessed =
false);
4397 llvm::Value *EmitMatrixIndexExpr(
const Expr *
E);
4400 bool IsLowerBound =
true);
4408 LValue EmitCastLValue(
const CastExpr *
E);
4413 std::pair<LValue, LValue> EmitHLSLOutArgLValues(
const HLSLOutArgExpr *
E,
4418 Address EmitExtVectorElementLValue(LValue
V);
4422 Address EmitArrayToPointerDecay(
const Expr *Array,
4423 LValueBaseInfo *BaseInfo =
nullptr,
4424 TBAAAccessInfo *TBAAInfo =
nullptr);
4427 llvm::PointerIntPair<llvm::Constant *, 1, bool> ValueAndIsReference;
4429 : ValueAndIsReference(C, isReference) {}
4441 return ValueAndIsReference.getOpaqueValue() !=
nullptr;
4446 assert(isReference());
4452 assert(!isReference());
4453 return ValueAndIsReference.getPointer();
4457 ConstantEmission tryEmitAsConstant(
const DeclRefExpr *RefExpr);
4458 ConstantEmission tryEmitAsConstant(
const MemberExpr *ME);
4459 llvm::Value *emitScalarConstant(
const ConstantEmission &Constant,
Expr *
E);
4465 void FlattenAccessAndType(
4475 bool IsInBounds =
true);
4478 llvm::Value *ThisValue);
4509 llvm::CallBase **CallOrInvoke,
bool IsMustTail,
4511 bool IsVirtualFunctionPointerThunk =
false);
4514 llvm::CallBase **CallOrInvoke =
nullptr,
4515 bool IsMustTail =
false) {
4516 return EmitCall(CallInfo, Callee, ReturnValue, Args, CallOrInvoke,
4521 llvm::CallBase **CallOrInvoke =
nullptr,
4528 llvm::CallBase **CallOrInvoke =
nullptr);
4530 llvm::CallBase **CallOrInvoke =
nullptr);
4537 const Twine &name =
"");
4540 const Twine &name =
"");
4542 const Twine &name =
"");
4545 const Twine &name =
"");
4548 const Twine &name =
"");
4551 getBundlesForFunclet(llvm::Value *Callee);
4553 llvm::CallBase *EmitCallOrInvoke(llvm::FunctionCallee Callee,
4555 const Twine &Name =
"");
4556 llvm::CallBase *EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee,
4558 const Twine &name =
"");
4559 llvm::CallBase *EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee,
4560 const Twine &name =
"");
4561 void EmitNoreturnRuntimeCallOrInvoke(llvm::FunctionCallee callee,
4571 bool isPointerKnownNonNull(
const Expr *
E);
4573 bool isUnderlyingBasePointerConstantNull(
const Expr *
E);
4576 llvm::Value *EmitPointerAuthBlendDiscriminator(llvm::Value *StorageAddress,
4577 llvm::Value *Discriminator);
4579 llvm::Value *StorageAddress,
4592 bool IsKnownNonNull);
4593 llvm::Value *emitPointerAuthResignCall(llvm::Value *
Pointer,
4597 void EmitPointerAuthOperandBundle(
4606 bool IsKnownNonNull);
4608 const Expr *PointerExpr,
4614 bool IsKnownNonNull);
4618 std::pair<llvm::Value *, CGPointerAuthInfo>
4619 EmitOrigPointerRValue(
const Expr *
E);
4621 llvm::Value *authPointerToPointerCast(llvm::Value *ResultPtr,
4629 return getAsNaturalAddressOf(
Addr, PointeeType).getBasePointer();
4634 static std::string getNonTrivialCopyConstructorStr(
QualType QT,
4640 static std::string getNonTrivialDestructorStr(
QualType QT,
4647 void defaultInitNonTrivialCStructVar(
LValue Dst);
4648 void callCStructDefaultConstructor(
LValue Dst);
4649 void callCStructDestructor(
LValue Dst);
4650 void callCStructCopyConstructor(
LValue Dst,
LValue Src);
4651 void callCStructMoveConstructor(
LValue Dst,
LValue Src);
4652 void callCStructCopyAssignmentOperator(
LValue Dst,
LValue Src);
4653 void callCStructMoveAssignmentOperator(
LValue Dst,
LValue Src);
4655 RValue EmitCXXMemberOrOperatorCall(
4659 CallArgList *RtlArgs, llvm::CallBase **CallOrInvoke);
4662 llvm::Value *ImplicitParam,
4664 llvm::CallBase **CallOrInvoke =
nullptr);
4667 llvm::CallBase **CallOrInvoke =
nullptr);
4668 RValue EmitCXXMemberOrOperatorMemberCallExpr(
4671 const Expr *
Base, llvm::CallBase **CallOrInvoke);
4673 Address EmitCXXMemberDataPointerAddress(
4679 llvm::CallBase **CallOrInvoke);
4684 llvm::CallBase **CallOrInvoke);
4689 llvm::CallBase **CallOrInvoke);
4707 llvm::Function *generateBuiltinOSLogHelperFunction(
4712 llvm::CallBase **CallOrInvoke);
4716 llvm::Value *EmitTargetBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4720 EmitAArch64CompareBuiltinExpr(llvm::Value *Op, llvm::Type *Ty,
4721 const llvm::CmpInst::Predicate Pred,
4722 const llvm::Twine &Name =
"");
4723 llvm::Value *EmitARMBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4725 llvm::Triple::ArchType
Arch);
4726 llvm::Value *EmitARMMVEBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4728 llvm::Triple::ArchType
Arch);
4729 llvm::Value *EmitARMCDEBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4731 llvm::Triple::ArchType
Arch);
4732 llvm::Value *EmitCMSEClearRecord(llvm::Value *
V, llvm::IntegerType *ITy,
4734 llvm::Value *EmitCMSEClearRecord(llvm::Value *
V, llvm::ArrayType *ATy,
4738 EmitCommonNeonBuiltinExpr(
unsigned BuiltinID,
unsigned LLVMIntrinsic,
4739 unsigned AltLLVMIntrinsic,
const char *NameHint,
4744 llvm::Function *LookupNeonLLVMIntrinsic(
unsigned IntrinsicID,
4745 unsigned Modifier, llvm::Type *ArgTy,
4747 llvm::Value *EmitNeonCall(llvm::Function *F,
4749 unsigned shift = 0,
bool rightshift =
false);
4753 llvm::Value *EmitFP8NeonCvtCall(
unsigned IID, llvm::Type *Ty0,
4754 llvm::Type *Ty1,
bool Extract,
4757 llvm::Value *EmitFP8NeonFDOTCall(
unsigned IID,
bool ExtendLaneArg,
4761 llvm::Value *EmitFP8NeonFMLACall(
unsigned IID,
bool ExtendLaneArg,
4766 const llvm::ElementCount &Count);
4768 llvm::Value *EmitNeonShiftVector(llvm::Value *
V, llvm::Type *Ty,
4769 bool negateForRightShift);
4770 llvm::Value *EmitNeonRShiftImm(llvm::Value *Vec, llvm::Value *Amt,
4771 llvm::Type *Ty,
bool usgn,
const char *name);
4772 llvm::Value *vectorWrapScalar16(llvm::Value *Op);
4776 llvm::Type *SVEBuiltinMemEltTy(
const SVETypeFlags &TypeFlags);
4779 getSVEOverloadTypes(
const SVETypeFlags &TypeFlags, llvm::Type *ReturnType,
4782 llvm::ScalableVectorType *getSVEType(
const SVETypeFlags &TypeFlags);
4783 llvm::ScalableVectorType *getSVEPredType(
const SVETypeFlags &TypeFlags);
4784 llvm::Value *EmitSVETupleSetOrGet(
const SVETypeFlags &TypeFlags,
4786 llvm::Value *EmitSVETupleCreate(
const SVETypeFlags &TypeFlags,
4787 llvm::Type *ReturnType,
4789 llvm::Value *EmitSVEAllTruePred(
const SVETypeFlags &TypeFlags);
4792 llvm::Value *EmitSVEReinterpret(llvm::Value *Val, llvm::Type *Ty);
4793 llvm::Value *EmitSVEPMull(
const SVETypeFlags &TypeFlags,
4795 unsigned BuiltinID);
4796 llvm::Value *EmitSVEMovl(
const SVETypeFlags &TypeFlags,
4798 unsigned BuiltinID);
4799 llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
4800 llvm::ScalableVectorType *VTy);
4801 llvm::Value *EmitSVEPredicateTupleCast(llvm::Value *PredTuple,
4802 llvm::StructType *Ty);
4803 llvm::Value *EmitSVEGatherLoad(
const SVETypeFlags &TypeFlags,
4806 llvm::Value *EmitSVEScatterStore(
const SVETypeFlags &TypeFlags,
4809 llvm::Value *EmitSVEMaskedLoad(
const CallExpr *, llvm::Type *ReturnTy,
4811 unsigned BuiltinID,
bool IsZExtReturn);
4812 llvm::Value *EmitSVEMaskedStore(
const CallExpr *,
4814 unsigned BuiltinID);
4815 llvm::Value *EmitSVEPrefetchLoad(
const SVETypeFlags &TypeFlags,
4817 unsigned BuiltinID);
4818 llvm::Value *EmitSVEGatherPrefetch(
const SVETypeFlags &TypeFlags,
4821 llvm::Value *EmitSVEStructLoad(
const SVETypeFlags &TypeFlags,
4824 llvm::Value *EmitSVEStructStore(
const SVETypeFlags &TypeFlags,
4827 llvm::Value *EmitAArch64SVEBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4829 llvm::Value *EmitSMELd1St1(
const SVETypeFlags &TypeFlags,
4832 llvm::Value *EmitSMEReadWrite(
const SVETypeFlags &TypeFlags,
4835 llvm::Value *EmitSMEZero(
const SVETypeFlags &TypeFlags,
4838 llvm::Value *EmitSMELdrStr(
const SVETypeFlags &TypeFlags,
4842 void GetAArch64SVEProcessedOperands(
unsigned BuiltinID,
const CallExpr *
E,
4846 llvm::Value *EmitAArch64SMEBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4848 llvm::Value *EmitAArch64BuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4849 llvm::Triple::ArchType
Arch);
4850 llvm::Value *EmitBPFBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4853 llvm::Value *EmitX86BuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4854 llvm::Value *EmitPPCBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4855 llvm::Value *EmitAMDGPUBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4856 llvm::Value *EmitHLSLBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4864 llvm::Value *EmitDirectXBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4865 llvm::Value *EmitSPIRVBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4866 llvm::Value *EmitScalarOrConstFoldImmArg(
unsigned ICEArguments,
unsigned Idx,
4868 llvm::Value *EmitSystemZBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4869 llvm::Value *EmitNVPTXBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4870 llvm::Value *EmitWebAssemblyBuiltinExpr(
unsigned BuiltinID,
4872 llvm::Value *EmitHexagonBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4873 llvm::Value *EmitRISCVBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4876 llvm::Value *EmitRISCVCpuSupports(
const CallExpr *
E);
4878 llvm::Value *EmitRISCVCpuInit();
4879 llvm::Value *EmitRISCVCpuIs(
const CallExpr *
E);
4880 llvm::Value *EmitRISCVCpuIs(StringRef CPUStr);
4882 void AddAMDGPUFenceAddressSpaceMMRA(llvm::Instruction *Inst,
4884 void ProcessOrderScopeAMDGCN(llvm::Value *Order, llvm::Value *
Scope,
4885 llvm::AtomicOrdering &AO,
4886 llvm::SyncScope::ID &SSID);
4891 llvm::Value *EmitBuiltinAvailable(
const VersionTuple &Version);
4899 EmitObjCCollectionLiteral(
const Expr *
E,
4908 return CGM.
getCodeGenOpts().ObjCAutoRefCountExceptions ? NormalAndEHCleanup
4913 void EmitARCInitWeak(
Address addr, llvm::Value *value);
4914 void EmitARCDestroyWeak(
Address addr);
4915 llvm::Value *EmitARCLoadWeak(
Address addr);
4916 llvm::Value *EmitARCLoadWeakRetained(
Address addr);
4917 llvm::Value *EmitARCStoreWeak(
Address addr, llvm::Value *value,
bool ignored);
4922 llvm::Value *EmitARCRetainAutorelease(
QualType type, llvm::Value *value);
4923 llvm::Value *EmitARCRetainAutoreleaseNonBlock(llvm::Value *value);
4924 llvm::Value *EmitARCStoreStrong(
LValue lvalue, llvm::Value *value,
4925 bool resultIgnored);
4926 llvm::Value *EmitARCStoreStrongCall(
Address addr, llvm::Value *value,
4927 bool resultIgnored);
4928 llvm::Value *EmitARCRetain(
QualType type, llvm::Value *value);
4929 llvm::Value *EmitARCRetainNonBlock(llvm::Value *value);
4930 llvm::Value *EmitARCRetainBlock(llvm::Value *value,
bool mandatory);
4933 llvm::Value *EmitARCAutorelease(llvm::Value *value);
4934 llvm::Value *EmitARCAutoreleaseReturnValue(llvm::Value *value);
4935 llvm::Value *EmitARCRetainAutoreleaseReturnValue(llvm::Value *value);
4936 llvm::Value *EmitARCRetainAutoreleasedReturnValue(llvm::Value *value);
4937 llvm::Value *EmitARCUnsafeClaimAutoreleasedReturnValue(llvm::Value *value);
4939 llvm::Value *EmitObjCAutorelease(llvm::Value *value, llvm::Type *returnType);
4940 llvm::Value *EmitObjCRetainNonBlock(llvm::Value *value,
4941 llvm::Type *returnType);
4944 std::pair<LValue, llvm::Value *>
4946 std::pair<LValue, llvm::Value *> EmitARCStoreStrong(
const BinaryOperator *e,
4948 std::pair<LValue, llvm::Value *>
4949 EmitARCStoreUnsafeUnretained(
const BinaryOperator *e,
bool ignored);
4951 llvm::Value *EmitObjCAlloc(llvm::Value *value, llvm::Type *returnType);
4952 llvm::Value *EmitObjCAllocWithZone(llvm::Value *value,
4953 llvm::Type *returnType);
4954 llvm::Value *EmitObjCAllocInit(llvm::Value *value, llvm::Type *resultType);
4956 llvm::Value *EmitObjCThrowOperand(
const Expr *expr);
4957 llvm::Value *EmitObjCConsumeObject(
QualType T, llvm::Value *Ptr);
4958 llvm::Value *EmitObjCExtendObjectLifetime(
QualType T, llvm::Value *Ptr);
4960 llvm::Value *EmitARCExtendBlockObject(
const Expr *expr);
4961 llvm::Value *EmitARCReclaimReturnedObject(
const Expr *e,
4962 bool allowUnsafeClaim);
4963 llvm::Value *EmitARCRetainScalarExpr(
const Expr *expr);
4964 llvm::Value *EmitARCRetainAutoreleaseScalarExpr(
const Expr *expr);
4965 llvm::Value *EmitARCUnsafeUnretainedScalarExpr(
const Expr *expr);
4977 void EmitObjCAutoreleasePoolPop(llvm::Value *Ptr);
4978 llvm::Value *EmitObjCAutoreleasePoolPush();
4979 llvm::Value *EmitObjCMRRAutoreleasePoolPush();
4980 void EmitObjCAutoreleasePoolCleanup(llvm::Value *Ptr);
4981 void EmitObjCMRRAutoreleasePoolPop(llvm::Value *Ptr);
4994 llvm::Value *EmitScalarExpr(
const Expr *
E,
bool IgnoreResultAssign =
false);
4998 llvm::Value *EmitScalarConversion(llvm::Value *Src,
QualType SrcTy,
5025 void CreateCoercedStore(llvm::Value *Src,
Address Dst, llvm::TypeSize DstSize,
5026 bool DstIsVolatile);
5030 void EmitExtendGCLifetime(llvm::Value *
object);
5035 bool IgnoreImag =
false);
5039 void EmitComplexExprIntoLValue(
const Expr *
E,
LValue dest,
bool isInit);
5048 llvm::Value *EmitPromotedScalarExpr(
const Expr *
E,
QualType PromotionType);
5060 llvm::GlobalVariable *AddInitializerToStaticVarDecl(
const VarDecl &
D,
5061 llvm::GlobalVariable *GV);
5064 void EmitInvariantStart(llvm::Constant *Addr,
CharUnits Size);
5068 void EmitCXXGlobalVarDeclInit(
const VarDecl &
D, llvm::GlobalVariable *GV,
5071 llvm::Constant *createAtExitStub(
const VarDecl &VD, llvm::FunctionCallee Dtor,
5072 llvm::Constant *Addr);
5074 llvm::Function *createTLSAtExitStub(
const VarDecl &VD,
5075 llvm::FunctionCallee Dtor,
5076 llvm::Constant *Addr,
5077 llvm::FunctionCallee &AtExit);
5081 void registerGlobalDtorWithAtExit(
const VarDecl &
D, llvm::FunctionCallee fn,
5082 llvm::Constant *addr);
5086 void registerGlobalDtorWithLLVM(
const VarDecl &
D, llvm::FunctionCallee fn,
5087 llvm::Constant *addr);
5090 void registerGlobalDtorWithAtExit(llvm::Constant *dtorStub);
5093 llvm::Value *unregisterGlobalDtorWithUnAtExit(llvm::Constant *dtorStub);
5100 void EmitCXXGuardedInit(
const VarDecl &
D, llvm::GlobalVariable *DeclPtr,
5106 void EmitCXXGuardedInitBranch(llvm::Value *NeedsInit,
5107 llvm::BasicBlock *InitBlock,
5108 llvm::BasicBlock *NoInitBlock, GuardKind
Kind,
5114 GenerateCXXGlobalInitFunc(llvm::Function *Fn,
5120 void GenerateCXXGlobalCleanUpFunc(
5122 ArrayRef<std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH,
5124 DtorsOrStermFinalizers);
5126 void GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn,
const VarDecl *
D,
5127 llvm::GlobalVariable *Addr,
5134 void EmitCXXThrowExpr(
const CXXThrowExpr *
E,
bool KeepInsertionPoint =
true);
5138 void EmitFakeUse(
Address Addr);
5145 llvm::Value *EmitAnnotationCall(llvm::Function *AnnotationFn,
5146 llvm::Value *AnnotatedVal,
5147 StringRef AnnotationStr,
5149 const AnnotateAttr *
Attr);
5152 void EmitVarAnnotations(
const VarDecl *
D, llvm::Value *
V);
5165 static bool ContainsLabel(
const Stmt *S,
bool IgnoreCaseStmts =
false);
5170 static bool containsBreak(
const Stmt *S);
5174 static bool mightAddDeclToScope(
const Stmt *S);
5179 bool ConstantFoldsToSimpleInteger(
const Expr *Cond,
bool &Result,
5180 bool AllowLabels =
false);
5185 bool ConstantFoldsToSimpleInteger(
const Expr *Cond, llvm::APSInt &Result,
5186 bool AllowLabels =
false);
5189 static const Expr *stripCond(
const Expr *C);
5193 static bool isInstrumentedCondition(
const Expr *C);
5200 llvm::BasicBlock *TrueBlock,
5201 llvm::BasicBlock *FalseBlock,
5202 uint64_t TrueCount = 0,
5204 const Expr *CntrIdx =
nullptr);
5211 void EmitBranchOnBoolExpr(
const Expr *Cond, llvm::BasicBlock *TrueBlock,
5212 llvm::BasicBlock *FalseBlock, uint64_t TrueCount,
5214 const Expr *ConditionalOp =
nullptr,
5215 const VarDecl *ConditionalDecl =
nullptr);
5223 enum { NotSubtraction =
false, IsSubtraction =
true };
5227 Expr *pointerOperand, llvm::Value *pointer,
5228 Expr *indexOperand, llvm::Value *index,
5229 bool isSubtraction);
5238 bool SignedIndices,
bool IsSubtraction,
5240 const Twine &Name =
"");
5243 llvm::Type *elementType,
bool SignedIndices,
5245 CharUnits Align,
const Twine &Name =
"");
5257 llvm::Value *EmitCheckedArgForBuiltin(
const Expr *
E, BuiltinCheckKind
Kind);
5261 llvm::Value *EmitCheckedArgForAssume(
const Expr *
E);
5265 llvm::Constant *EmitCheckTypeDescriptor(
QualType T);
5269 llvm::Value *EmitCheckValue(llvm::Value *
V);
5275 void EmitKCFIOperandBundle(
const CGCallee &Callee,
5282 EmitCheck(
ArrayRef<std::pair<llvm::Value *, SanitizerKind::SanitizerOrdinal>>
5291 llvm::Value *Cond, llvm::ConstantInt *TypeId,
5302 bool NoMerge =
false,
const TrapReason *TR =
nullptr);
5306 llvm::CallInst *EmitTrapCall(llvm::Intrinsic::ID IntrID);
5309 void EmitCfiCheckStub();
5312 void EmitCfiCheckFail();
5317 AbstractCallee AC,
unsigned ParmNum);
5337 void SetFPAccuracy(llvm::Value *Val,
float Accuracy);
5341 void SetSqrtFPAccuracy(llvm::Value *Val);
5345 void SetDivFPAccuracy(llvm::Value *Val);
5348 void SetFastMathFlags(
FPOptions FPFeatures);
5351 llvm::Value *emitBoolVecConversion(llvm::Value *SrcVec,
5352 unsigned NumElementsDst,
5353 const llvm::Twine &Name =
"");
5355 void maybeAttachRangeForLoad(llvm::LoadInst *Load,
QualType Ty,
5361 llvm::ConvergenceControlInst *emitConvergenceLoopToken(llvm::BasicBlock *BB);
5365 llvm::CallBase *addConvergenceControlToken(llvm::CallBase *Input);
5369 llvm::ConvergenceControlInst *
5370 getOrEmitConvergenceEntryToken(llvm::Function *F);
5373 llvm::MDNode *getRangeForLoadFromType(
QualType Ty);
5376 void deferPlaceholderReplacement(llvm::Instruction *Old, llvm::Value *
New);
5379 DeferredReplacements;
5383 assert(!LocalDeclMap.count(VD) &&
"Decl already exists in LocalDeclMap!");
5384 LocalDeclMap.insert({VD,
Addr});
5391 void ExpandTypeFromArgs(QualType Ty, LValue Dst,
5392 llvm::Function::arg_iterator &AI);
5397 void ExpandTypeToArgs(QualType Ty, CallArg Arg, llvm::FunctionType *IRFuncTy,
5398 SmallVectorImpl<llvm::Value *> &IRCallArgs,
5399 unsigned &IRCallArgPos);
5401 std::pair<llvm::Value *, llvm::Type *>
5402 EmitAsmInput(
const TargetInfo::ConstraintInfo &Info,
const Expr *InputExpr,
5403 std::string &ConstraintStr);
5405 std::pair<llvm::Value *, llvm::Type *>
5406 EmitAsmInputLValue(
const TargetInfo::ConstraintInfo &Info, LValue InputValue,
5407 QualType InputType, std::string &ConstraintStr,
5408 SourceLocation
Loc);
5415 llvm::Value *evaluateOrEmitBuiltinObjectSize(
const Expr *
E,
unsigned Type,
5416 llvm::IntegerType *ResType,
5417 llvm::Value *EmittedE,
5423 llvm::Value *emitBuiltinObjectSize(
const Expr *
E,
unsigned Type,
5424 llvm::IntegerType *ResType,
5425 llvm::Value *EmittedE,
bool IsDynamic);
5427 llvm::Value *emitCountedBySize(
const Expr *
E, llvm::Value *EmittedE,
5428 unsigned Type, llvm::IntegerType *ResType);
5430 llvm::Value *emitCountedByMemberSize(
const MemberExpr *
E,
const Expr *Idx,
5431 llvm::Value *EmittedE,
5432 QualType CastedArrayElementTy,
5434 llvm::IntegerType *ResType);
5436 llvm::Value *emitCountedByPointerSize(
const ImplicitCastExpr *
E,
5437 const Expr *Idx, llvm::Value *EmittedE,
5438 QualType CastedArrayElementTy,
5440 llvm::IntegerType *ResType);
5442 void emitZeroOrPatternForAutoVarInit(QualType type,
const VarDecl &
D,
5458 llvm::PointerUnion<const FunctionProtoType *, const ObjCMethodDecl *>
P;
5464 void EmitCallArgs(
CallArgList &Args, PrototypeWrapper Prototype,
5465 llvm::iterator_range<CallExpr::const_arg_iterator> ArgRange,
5466 AbstractCallee AC = AbstractCallee(),
5467 unsigned ParamsToSkip = 0,
5468 EvaluationOrder Order = EvaluationOrder::Default);
5495 llvm::Value *LoadPassedObjectSize(
const Expr *
E,
QualType EltTy);
5497 void EmitSanitizerStatReport(llvm::SanitizerStatKind SSK);
5505 std::optional<StringRef>
Arch = std::nullopt)
5512 void EmitMultiVersionResolver(llvm::Function *Resolver,
5514 void EmitX86MultiVersionResolver(llvm::Function *Resolver,
5516 void EmitAArch64MultiVersionResolver(llvm::Function *Resolver,
5518 void EmitRISCVMultiVersionResolver(llvm::Function *Resolver,
5524 void EmitDeclMetadata();
5527 const AutoVarEmission &emission);
5529 void AddObjCARCExceptionMetadata(llvm::Instruction *Inst);
5531 llvm::Value *GetValueForARMHint(
unsigned BuiltinID);
5532 llvm::Value *EmitX86CpuIs(
const CallExpr *
E);
5533 llvm::Value *EmitX86CpuIs(StringRef CPUStr);
5534 llvm::Value *EmitX86CpuSupports(
const CallExpr *
E);
5536 llvm::Value *EmitX86CpuSupports(std::array<uint32_t, 4> FeatureMask);
5537 llvm::Value *EmitX86CpuInit();
5538 llvm::Value *FormX86ResolverCondition(
const FMVResolverOption &RO);
5539 llvm::Value *EmitAArch64CpuInit();
5540 llvm::Value *FormAArch64ResolverCondition(
const FMVResolverOption &RO);
5541 llvm::Value *EmitAArch64CpuSupports(
const CallExpr *
E);
5547 if (!needsSaving(value))
5563 if (!value.getInt())
5564 return value.getPointer();
5567 auto alloca = cast<llvm::AllocaInst>(value.getPointer());
5569 alloca->getAlign());
5576llvm::fp::ExceptionBehavior
Enums/classes describing ABI related information about constructors, destructors and thunks.
static bool CanThrow(Expr *E, ASTContext &Ctx)
static T * buildByrefHelpers(CodeGenModule &CGM, const BlockByrefInfo &byrefInfo, T &&generator)
Lazily build the copy and dispose helpers for a __block variable with the given information.
static CGCallee BuildAppleKextVirtualCall(CodeGenFunction &CGF, GlobalDecl GD, llvm::Type *Ty, const CXXRecordDecl *RD)
static bool isInAllocaArgument(CGCXXABI &ABI, QualType type)
CodeGenFunction::ComplexPairTy ComplexPairTy
static Address EmitPointerWithAlignment(const Expr *E, LValueBaseInfo *BaseInfo, TBAAAccessInfo *TBAAInfo, KnownNonNull_t IsKnownNonNull, CodeGenFunction &CGF)
enum clang::sema::@1840::IndirectLocalPathEntry::EntryKind Kind
Defines the clang::Expr interface and subclasses for C++ expressions.
llvm::MachO::Architecture Architecture
llvm::MachO::Target Target
Defines some OpenMP-specific enums and functions.
This file defines OpenACC AST classes for statement-level contructs.
This file defines OpenMP AST classes for executable directives and clauses.
This file defines SYCL AST classes used to represent calls to SYCL kernels.
C Language Family Type Representation.
a trap message and trap category.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
AbstractConditionalOperator - An abstract base class for ConditionalOperator and BinaryConditionalOpe...
This class represents BOTH the OpenMP Array Section and OpenACC 'subarray', with a boolean differenti...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
Attr - This represents one attribute.
Represents an attribute applied to a statement.
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
A builtin binary operation expression such as "x + y" or "x <= y".
static bool isLogicalOp(Opcode Opc)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Represents a call to a CUDA kernel function.
Represents binding an expression to a temporary.
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
A default argument (C++ [dcl.fct.default]).
A use of a default initializer in a constructor or in aggregate initialization.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ destructor within a class.
A C++ dynamic_cast expression (C++ [expr.dynamic.cast]).
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a call to a member function that may be written either with member call syntax (e....
Represents a static or instance method of a struct/union/class.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
A call to an overloaded operator written using operator syntax.
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents a C++ struct/union/class.
Represents a C++ temporary.
A C++ throw-expression (C++ [except.throw]).
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Describes the capture of either a variable, or 'this', or variable-length array type.
This captures a statement into a function.
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
const CXXBaseSpecifier *const * path_const_iterator
CharUnits - This is an opaque type for sizes expressed in character units.
bool isZero() const
isZero - Test whether the quantity equals zero.
llvm::Align getAsAlign() const
getAsAlign - Returns Quantity as a valid llvm::Align, Beware llvm::Align assumes power of two 8-bit b...
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
bool hasProfileClangInstr() const
Check if Clang profile instrumenation is on.
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
llvm::Value * getBasePointer() const
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
CharUnits getAlignment() const
llvm::Type * getElementType() const
Return the type of the values stored in this address.
void setAlignment(CharUnits Value)
llvm::Value * getOffset() const
void replaceBasePointer(llvm::Value *P)
This function is used in situations where the caller is doing some sort of opaque "laundering" of the...
llvm::PointerType * getType() const
Return the type of the pointer value.
A scoped helper to set the current source atom group for CGDebugInfo::addInstToCurrentSourceAtom.
A pair of helper functions for a __block variable.
Information about the layout of a __block variable.
CGBlockInfo - Information to generate a block literal.
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
llvm::LoadInst * CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr, CharUnits Align, const llvm::Twine &Name="")
Implements C++ ABI-specific code generation functions.
All available information about a concrete callee.
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
CGFunctionInfo - Class to encapsulate the information about a function definition.
CallArgList - Type for representing both the value and type of arguments in a call.
An abstract representation of regular/ObjC call/message targets.
AbstractCallee(const ObjCMethodDecl *OMD)
const ParmVarDecl * getParamDecl(unsigned I) const
const Decl * getDecl() const
unsigned getNumParams() const
bool hasFunctionDecl() const
AbstractCallee(const FunctionDecl *FD)
The scope of an ArrayInitLoopExpr.
ArrayInitLoopExprScope(CodeGenFunction &CGF, llvm::Value *Index)
~ArrayInitLoopExprScope()
Address getAllocatedAddress() const
Returns the raw, allocated address, which is not necessarily the address of the object itself.
bool useLifetimeMarkers() const
RawAddress getOriginalAllocatedAddress() const
Returns the address for the original alloca instruction.
Address getObjectAddress(CodeGenFunction &CGF) const
Returns the address of the object within this declaration.
static AutoVarEmission invalid()
CGAtomicOptionsRAII(CodeGenModule &CGM_, AtomicOptions AO)
CGAtomicOptionsRAII(CodeGenModule &CGM_, const AtomicAttr *AA)
CGAtomicOptionsRAII(const CGAtomicOptionsRAII &)=delete
CGAtomicOptionsRAII & operator=(const CGAtomicOptionsRAII &)=delete
API for captured statement code generation.
CapturedRegionKind getKind() const
virtual llvm::Value * getContextValue() const
virtual ~CGCapturedStmtInfo()
static bool classof(const CGCapturedStmtInfo *)
virtual void setContextValue(llvm::Value *V)
bool isCXXThisExprCaptured() const
virtual FieldDecl * getThisFieldDecl() const
llvm::SmallDenseMap< const VarDecl *, FieldDecl * > getCaptureFields()
Get the CaptureFields.
CGCapturedStmtInfo(CapturedRegionKind K=CR_Default)
virtual void EmitBody(CodeGenFunction &CGF, const Stmt *S)
Emit the captured statement body.
virtual StringRef getHelperName() const
Get the name of the capture helper.
CGCapturedStmtInfo(const CapturedStmt &S, CapturedRegionKind K=CR_Default)
virtual const FieldDecl * lookup(const VarDecl *VD) const
Lookup the captured field decl for a variable.
RAII for correct setting/restoring of CapturedStmtInfo.
CGCapturedStmtRAII(CodeGenFunction &CGF, CGCapturedStmtInfo *NewCapturedStmtInfo)
The scope of a CXXDefaultInitExpr.
CharUnits OldCXXThisAlignment
~CXXDefaultInitExprScope()
SourceLocExprScopeGuard SourceLocScope
llvm::Value * OldCXXThisValue
CXXDefaultInitExprScope(CodeGenFunction &CGF, const CXXDefaultInitExpr *E)
void Emit(CodeGenFunction &CGF, Flags flags) override
Emit the cleanup.
CallLifetimeEnd(RawAddress addr)
An object to manage conditionally-evaluated expressions.
llvm::BasicBlock * getStartingBlock() const
Returns a block which will be executed prior to each evaluation of the conditional code.
void begin(CodeGenFunction &CGF)
ConditionalEvaluation(CodeGenFunction &CGF)
void end(CodeGenFunction &CGF)
static ConstantEmission forValue(llvm::Constant *C)
static ConstantEmission forReference(llvm::Constant *C)
LValue getReferenceLValue(CodeGenFunction &CGF, const Expr *RefExpr) const
llvm::Constant * getValue() const
void Emit(CodeGenFunction &CGF, Flags flags) override
Emit the cleanup.
A scope within which we are constructing the fields of an object which might use a CXXDefaultInitExpr...
FieldConstructionScope(CodeGenFunction &CGF, Address This)
~FieldConstructionScope()
A class controlling the emission of a finally block.
InlinedInheritingConstructorScope(CodeGenFunction &CGF, GlobalDecl GD)
~InlinedInheritingConstructorScope()
void addLabel(const LabelDecl *label)
void ForceCleanup()
Force the emission of cleanups now, instead of waiting until this object is destroyed.
RAII for preserving necessary info during inlined region body codegen.
InlinedRegionBodyRAII(CodeGenFunction &cgf, InsertPointTy &AllocaIP, llvm::BasicBlock &FiniBB)
Cleanup action for allocate support.
OMPAllocateCleanupTy(llvm::CallInst *RLFnCI)
void Emit(CodeGenFunction &CGF, Flags) override
Emit the cleanup.
RAII for preserving necessary info during Outlined region body codegen.
OutlinedRegionBodyRAII(CodeGenFunction &cgf, InsertPointTy &AllocaIP, llvm::BasicBlock &RetBB)
~OutlinedRegionBodyRAII()
Controls insertion of cancellation exit blocks in worksharing constructs.
OMPCancelStackRAII(CodeGenFunction &CGF, OpenMPDirectiveKind Kind, bool HasCancel)
Save/restore original map of previously emitted local vars in case when we need to duplicate emission...
OMPLocalDeclMapRAII(CodeGenFunction &CGF)
The class used to assign some variables some temporarily addresses.
bool apply(CodeGenFunction &CGF)
Applies new addresses to the list of the variables.
void restore(CodeGenFunction &CGF)
Restores original addresses of the variables.
bool setVarAddr(CodeGenFunction &CGF, const VarDecl *LocalVD, Address TempAddr)
Sets the address of the variable LocalVD to be TempAddr in function CGF.
The scope used to remap some variables as private in the OpenMP loop body (or other captured region e...
void restoreMap()
Restore all mapped variables w/o clean up.
bool Privatize()
Privatizes local variables previously registered as private.
bool isGlobalVarCaptured(const VarDecl *VD) const
Checks if the global variable is captured in current function.
OMPPrivateScope(CodeGenFunction &CGF)
Enter a new OpenMP private scope.
~OMPPrivateScope()
Exit scope - all the mapped variables are restored.
bool addPrivate(const VarDecl *LocalVD, Address Addr)
Registers LocalVD variable as a private with Addr as the address of the corresponding private variabl...
A non-RAII class containing all the information about a bound opaque value.
static OpaqueValueMappingData bind(CodeGenFunction &CGF, const OpaqueValueExpr *ov, const LValue &lv)
static OpaqueValueMappingData bind(CodeGenFunction &CGF, const OpaqueValueExpr *ov, const RValue &rv)
static bool shouldBindAsLValue(const Expr *expr)
void unbind(CodeGenFunction &CGF)
static OpaqueValueMappingData bind(CodeGenFunction &CGF, const OpaqueValueExpr *ov, const Expr *e)
An RAII object to set (and then clear) a mapping for an OpaqueValueExpr.
OpaqueValueMapping(CodeGenFunction &CGF, const OpaqueValueExpr *OV)
Build the opaque value mapping for an OpaqueValueExpr whose source expression is set to the expressio...
OpaqueValueMapping(CodeGenFunction &CGF, const AbstractConditionalOperator *op)
Build the opaque value mapping for the given conditional operator if it's the GNU ?...
static bool shouldBindAsLValue(const Expr *expr)
OpaqueValueMapping(CodeGenFunction &CGF, const OpaqueValueExpr *opaqueValue, RValue rvalue)
OpaqueValueMapping(CodeGenFunction &CGF, const OpaqueValueExpr *opaqueValue, LValue lvalue)
llvm::Value * getDirectValue() const
Address getIndirectAddress() const
static ParamValue forIndirect(Address addr)
static ParamValue forDirect(llvm::Value *value)
llvm::Value * getAnyValue() const
Manages parent directive for scan directives.
ParentLoopDirectiveForScanRegion(CodeGenFunction &CGF, const OMPExecutableDirective &ParentLoopDirectiveForScan)
~ParentLoopDirectiveForScanRegion()
An object which temporarily prevents a value from being destroyed by aggressive peephole optimization...
PeepholeProtection()=default
Enters a new scope for capturing cleanups, all of which will be executed once the scope is exited.
RunCleanupsScope(CodeGenFunction &CGF)
Enter a new cleanup scope.
~RunCleanupsScope()
Exit this cleanup scope, emitting any accumulated cleanups.
void ForceCleanup(std::initializer_list< llvm::Value ** > ValuesToReload={})
Force the emission of cleanups now, instead of waiting until this object is destroyed.
bool requiresCleanups() const
Determine whether this scope requires any cleanups.
RAII object to set/unset CodeGenFunction::IsSanitizerScope.
An RAII object to record that we're evaluating a statement expression.
StmtExprEvaluation(CodeGenFunction &CGF)
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
EHScopeStack::stable_iterator CurrentCleanupScopeDepth
GlobalDecl CurGD
CurGD - The GlobalDecl for the current function being compiled.
CurrentSourceLocExprScope CurSourceLocExprScope
Source location information about the default argument or member initializer expression we're evaluat...
static Destroyer destroyNonTrivialCStruct
bool isBinaryLogicalOp(const Expr *E) const
JumpDest getJumpDestInCurrentScope(llvm::BasicBlock *Target)
The given basic block lies in the current EH scope, but may be a target of a potentially scope-crossi...
SanitizerSet SanOpts
Sanitizers enabled for this function.
llvm::DenseMap< const VarDecl *, llvm::Value * > NRVOFlags
A mapping from NRVO variables to the flags used to indicate when the NRVO has been applied to this va...
bool IsOutlinedSEHHelper
True if the current function is an outlined SEH helper.
llvm::CallInst * EmitRuntimeCall(llvm::FunctionCallee callee, ArrayRef< llvm::Value * > args, const Twine &name="")
SmallVector< Address, 1 > SEHCodeSlotStack
A stack of exception code slots.
JumpDest getJumpDestInCurrentScope(StringRef Name=StringRef())
The given basic block lies in the current EH scope, but may be a target of a potentially scope-crossi...
LValue MakeAddrLValue(llvm::Value *V, QualType T, CharUnits Alignment, AlignmentSource Source=AlignmentSource::Type)
static bool hasScalarEvaluationKind(QualType T)
bool isCleanupPadScope() const
Returns true while emitting a cleanuppad.
llvm::Value * EmitNeonSplat(llvm::Value *V, llvm::Constant *Idx)
void EmitOpenACCExitDataConstruct(const OpenACCExitDataConstruct &S)
AwaitSuspendWrapperInfo CurAwaitSuspendWrapper
void EmitFakeUse(Address Addr)
llvm::function_ref< std::pair< llvm::Value *, llvm::Value * >(CodeGenFunction &, const OMPExecutableDirective &S, Address LB, Address UB)> CodeGenDispatchBoundsTy
static Destroyer destroyARCWeak
FieldDecl * LambdaThisCaptureField
CGCapturedStmtInfo * CapturedStmtInfo
BuiltinCheckKind
Specifies which type of sanitizer check to apply when handling a particular builtin.
PeepholeProtection protectFromPeepholes(RValue rvalue)
protectFromPeepholes - Protect a value that we're intending to store to the side, but which will prob...
bool inSuspendBlock() const
CleanupKind getARCCleanupKind()
Retrieves the default cleanup kind for an ARC cleanup.
const OMPExecutableDirective * OMPParentLoopDirectiveForScan
Parent loop-based directive for scan directive.
bool shouldUseFusedARCCalls()
void EmitOpenACCInitConstruct(const OpenACCInitConstruct &S)
bool CurFuncIsThunk
In C++, whether we are code generating a thunk.
SmallVector< llvm::ConvergenceControlInst *, 4 > ConvergenceTokenStack
Stack to track the controlled convergence tokens.
bool isSEHTryScope() const
Returns true inside SEH __try blocks.
void unprotectFromPeepholes(PeepholeProtection protection)
bool hasVolatileMember(QualType T)
hasVolatileMember - returns true if aggregate type has a volatile member.
llvm::SmallVector< DeferredDeactivateCleanup > DeferredDeactivationCleanupStack
llvm::Value * getAsNaturalPointerTo(Address Addr, QualType PointeeType)
llvm::BasicBlock * createBasicBlock(const Twine &name="", llvm::Function *parent=nullptr, llvm::BasicBlock *before=nullptr)
createBasicBlock - Create an LLVM basic block.
const LangOptions & getLangOpts() const
LValue MakeNaturalAlignAddrLValue(llvm::Value *V, QualType T, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
void EmitOpenACCShutdownConstruct(const OpenACCShutdownConstruct &S)
bool InNoConvergentAttributedStmt
True if the current statement has noconvergent attribute.
void EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, Address Addr, QualType Type, CharUnits Alignment=CharUnits::Zero(), SanitizerSet SkippedChecks=SanitizerSet(), llvm::Value *ArraySize=nullptr)
const CodeGen::CGBlockInfo * BlockInfo
void EmitAggregateCopyCtor(LValue Dest, LValue Src, AggValueSlot::Overlap_t MayOverlap)
Address makeNaturalAddressForPointer(llvm::Value *Ptr, QualType T, CharUnits Alignment=CharUnits::Zero(), bool ForPointeeType=false, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
Construct an address with the natural alignment of T.
void EmitOpenACCWaitConstruct(const OpenACCWaitConstruct &S)
static Destroyer destroyCXXObject
TypeCheckKind
Situations in which we might emit a check for the suitability of a pointer or glvalue.
@ TCK_DowncastPointer
Checking the operand of a static_cast to a derived pointer type.
@ TCK_DowncastReference
Checking the operand of a static_cast to a derived reference type.
@ TCK_MemberAccess
Checking the object expression in a non-static data member access.
@ TCK_ConstructorCall
Checking the 'this' pointer for a constructor call.
@ TCK_Store
Checking the destination of a store. Must be suitably sized and aligned.
@ TCK_NonnullAssign
Checking the value assigned to a _Nonnull pointer. Must not be null.
@ TCK_UpcastToVirtualBase
Checking the operand of a cast to a virtual base object.
@ TCK_MemberCall
Checking the 'this' pointer for a call to a non-static member function.
@ TCK_ReferenceBinding
Checking the bound value in a reference binding.
@ TCK_Load
Checking the operand of a load. Must be suitably sized and aligned.
@ TCK_Upcast
Checking the operand of a cast to a base object.
LValue MakeAddrLValue(Address Addr, QualType T, LValueBaseInfo BaseInfo, TBAAAccessInfo TBAAInfo)
void EmitBranchThroughCleanup(JumpDest Dest)
EmitBranchThroughCleanup - Emit a branch from the current insert block through the normal cleanup han...
bool InNoMergeAttributedStmt
True if the current statement has nomerge attribute.
llvm::Value * EmitNeonSplat(llvm::Value *V, llvm::Constant *Idx, const llvm::ElementCount &Count)
Address EmitCheckedInBoundsGEP(Address Addr, ArrayRef< llvm::Value * > IdxList, llvm::Type *elementType, bool SignedIndices, bool IsSubtraction, SourceLocation Loc, CharUnits Align, const Twine &Name="")
const Decl * CurCodeDecl
CurCodeDecl - This is the inner-most code context, which includes blocks.
LValue MakeAddrLValueWithoutTBAA(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
llvm::BasicBlock * getUnreachableBlock()
llvm::AssertingVH< llvm::Instruction > AllocaInsertPt
AllocaInsertPoint - This is an instruction in the entry block before which we prefer to insert alloca...
void EmitAggregateAssign(LValue Dest, LValue Src, QualType EltTy)
Emit an aggregate assignment.
bool currentFunctionUsesSEHTry() const
llvm::SmallVector< const JumpDest *, 2 > SEHTryEpilogueStack
CodeGenFunction * ParentCGF
JumpDest ReturnBlock
ReturnBlock - Unified return block.
DominatingValue< T >::saved_type saveValueInCond(T value)
const llvm::function_ref< void(CodeGenFunction &, llvm::Function *, const OMPTaskDataTy &)> TaskGenTy
llvm::Value * EmitSVEDupX(llvm::Value *Scalar)
llvm::SmallPtrSet< const CXXRecordDecl *, 4 > VisitedVirtualBasesSetTy
void pushCleanupAndDeferDeactivation(CleanupKind Kind, As... A)
llvm::DenseMap< const Decl *, Address > DeclMapTy
const TargetInfo & getTarget() const
void initFullExprCleanup()
Set up the last cleanup that was pushed as a conditional full-expression cleanup.
bool isInConditionalBranch() const
isInConditionalBranch - Return true if we're currently emitting one branch or the other of a conditio...
void PopCleanupBlocks(EHScopeStack::stable_iterator OldCleanupStackSize, std::initializer_list< llvm::Value ** > ValuesToReload={})
Takes the old cleanup stack size and emits the cleanup blocks that have been added.
const Expr * RetExpr
If a return statement is being visited, this holds the return statment's result expression.
void pushCleanupAfterFullExpr(CleanupKind Kind, As... A)
Queue a cleanup to be pushed after finishing the current full-expression, potentially with an active ...
void DeactivateCleanupBlock(EHScopeStack::stable_iterator Cleanup, llvm::Instruction *DominatingIP)
DeactivateCleanupBlock - Deactivates the given cleanup block.
void pushFullExprCleanup(CleanupKind kind, As... A)
pushFullExprCleanup - Push a cleanup to be run at the end of the current full-expression.
static Destroyer destroyARCStrongImprecise
llvm::BasicBlock * getInvokeDest()
Address mergeAddressesInConditionalExpr(Address LHS, Address RHS, llvm::BasicBlock *LHSBlock, llvm::BasicBlock *RHSBlock, llvm::BasicBlock *MergeBlock, QualType MergedType)
void EmitOpenACCCombinedConstruct(const OpenACCCombinedConstruct &S)
llvm::Value * BlockPointer
llvm::Value * EmitSVEDupX(llvm::Value *Scalar, llvm::Type *Ty)
void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name, llvm::BasicBlock::iterator InsertPt) const
CGBuilder insert helper.
SmallVector< const BinaryOperator *, 16 > MCDCLogOpStack
Stack to track the Logical Operator recursion nest for MC/DC.
AggValueSlot CreateAggTemp(QualType T, const Twine &Name="tmp", RawAddress *Alloca=nullptr)
CreateAggTemp - Create a temporary memory object for the given aggregate type.
bool checkIfLoopMustProgress(const Expr *, bool HasEmptyBody)
Returns true if a loop must make progress, which means the mustprogress attribute can be added.
RValue EmitCall(const CGFunctionInfo &CallInfo, const CGCallee &Callee, ReturnValueSlot ReturnValue, const CallArgList &Args, llvm::CallBase **CallOrInvoke=nullptr, bool IsMustTail=false)
bool isMCDCCoverageEnabled() const
bool HaveInsertPoint() const
HaveInsertPoint - True if an insertion point is defined.
CGDebugInfo * getDebugInfo()
void EmitOpenACCDataConstruct(const OpenACCDataConstruct &S)
LValue MakeRawAddrLValue(llvm::Value *V, QualType T, CharUnits Alignment, AlignmentSource Source=AlignmentSource::Type)
Same as MakeAddrLValue above except that the pointer is known to be unsigned.
Address emitBlockByrefAddress(Address baseAddr, const VarDecl *V, bool followForward=true)
BuildBlockByrefAddress - Computes the location of the data in a variable which is declared as __block...
llvm::AllocaInst * CreateTempAlloca(llvm::Type *Ty, const Twine &Name="tmp", llvm::Value *ArraySize=nullptr)
CreateTempAlloca - This creates an alloca and inserts it into the entry block if ArraySize is nullptr...
llvm::function_ref< std::pair< LValue, LValue >(CodeGenFunction &, const OMPExecutableDirective &S)> CodeGenLoopBoundsTy
llvm::Function * generateAwaitSuspendWrapper(Twine const &CoroName, Twine const &SuspendPointName, CoroutineSuspendExpr const &S)
const TargetCodeGenInfo & getTargetHooks() const
void setBeforeOutermostConditional(llvm::Value *value, Address addr, CodeGenFunction &CGF)
void EmitLifetimeEnd(llvm::Value *Addr)
void incrementProfileCounter(const Stmt *S, llvm::Value *StepV=nullptr)
Increment the profiler's counter for the given statement by StepV.
bool InNoInlineAttributedStmt
True if the current statement has noinline attribute.
bool IsInPreservedAIRegion
True if CodeGen currently emits code inside presereved access index region.
void pushCleanupAfterFullExprWithActiveFlag(CleanupKind Kind, RawAddress ActiveFlag, As... A)
int ExpectedOMPLoopDepth
Number of nested loop to be consumed by the last surrounding loop-associated directive.
llvm::CallInst * EmitNounwindRuntimeCall(llvm::FunctionCallee callee, const Twine &name="")
ASTContext & getContext() const
llvm::Value * EmitLoadOfScalar(Address Addr, bool Volatile, QualType Ty, SourceLocation Loc, AlignmentSource Source=AlignmentSource::Type, bool isNontemporal=false)
EmitLoadOfScalar - Load a scalar value from an address, taking care to appropriately convert from the...
void Destroyer(CodeGenFunction &CGF, Address addr, QualType ty)
const Decl * CurFuncDecl
CurFuncDecl - Holds the Decl for the current outermost non-closure context.
llvm::CallInst * EmitNounwindRuntimeCall(llvm::FunctionCallee callee, ArrayRef< llvm::Value * > args, const Twine &name="")
SmallVector< llvm::CanonicalLoopInfo *, 4 > OMPLoopNestStack
List of recently emitted OMPCanonicalLoops.
llvm::SmallVector< char, 256 > LifetimeExtendedCleanupStack
void EmitOpenACCAtomicConstruct(const OpenACCAtomicConstruct &S)
llvm::Value * LoadCXXVTT()
LoadCXXVTT - Load the VTT parameter to base constructors/destructors have virtual bases.
void EmitOpenACCCacheConstruct(const OpenACCCacheConstruct &S)
void EmitOpenACCLoopConstruct(const OpenACCLoopConstruct &S)
llvm::Instruction * getPostAllocaInsertPoint()
Return PostAllocaInsertPt.
Address ReturnValuePointer
ReturnValuePointer - The temporary alloca to hold a pointer to sret.
RValue EmitAnyExpr(const Expr *E, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
EmitAnyExpr - Emit code to compute the specified expression which can have any type.
bool needsEHCleanup(QualType::DestructionKind kind)
Determines whether an EH cleanup is required to destroy a type with the given destruction kind.
void EmitStmt(const Stmt *S, ArrayRef< const Attr * > Attrs={})
EmitStmt - Emit the code for the statement.
llvm::DenseMap< const ValueDecl *, FieldDecl * > LambdaCaptureFields
bool AutoreleaseResult
In ARC, whether we should autorelease the return value.
CleanupKind getCleanupKind(QualType::DestructionKind kind)
llvm::CallInst * EmitRuntimeCall(llvm::FunctionCallee callee, const Twine &name="")
void EmitOpenACCEnterDataConstruct(const OpenACCEnterDataConstruct &S)
CodeGenTypes & getTypes() const
bool IsSanitizerScope
True if CodeGen currently emits code implementing sanitizer checks.
HLSLControlFlowHintAttr::Spelling HLSLControlFlowAttr
HLSL Branch attribute.
bool InAlwaysInlineAttributedStmt
True if the current statement has always_inline attribute.
RawAddress CreateTempAlloca(llvm::Type *Ty, CharUnits align, const Twine &Name="tmp", llvm::Value *ArraySize=nullptr, RawAddress *Alloca=nullptr)
CreateTempAlloca - This creates a alloca and inserts it into the entry block.
void EmitOpenACCComputeConstruct(const OpenACCComputeConstruct &S)
void EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc, LValue LV, QualType Type, SanitizerSet SkippedChecks=SanitizerSet(), llvm::Value *ArraySize=nullptr)
llvm::SmallVector< const ParmVarDecl *, 4 > FnArgs
Save Parameter Decl for coroutine.
const TargetInfo & Target
RawAddress CreateMemTemp(QualType T, const Twine &Name="tmp", RawAddress *Alloca=nullptr)
CreateMemTemp - Create a temporary memory object of the given type, with appropriate alignmen and cas...
SmallVector< llvm::Value *, 8 > ObjCEHValueStack
ObjCEHValueStack - Stack of Objective-C exception values, used for rethrows.
AggValueSlot::Overlap_t getOverlapForReturnValue()
Determine whether a return value slot may overlap some other object.
void SpecialInitFn(CodeGenFunction &Init, const VarDecl &D, llvm::Value *Address)
llvm::Value * EmitCheckedInBoundsGEP(llvm::Type *ElemTy, llvm::Value *Ptr, ArrayRef< llvm::Value * > IdxList, bool SignedIndices, bool IsSubtraction, SourceLocation Loc, const Twine &Name="")
Same as IRBuilder::CreateInBoundsGEP, but additionally emits a check to detect undefined behavior whe...
VarBypassDetector Bypasses
void EmitOpenACCHostDataConstruct(const OpenACCHostDataConstruct &S)
EHScopeStack::stable_iterator PrologueCleanupDepth
PrologueCleanupDepth - The cleanup depth enclosing all the cleanups associated with the parameters.
void EmitOpenACCUpdateConstruct(const OpenACCUpdateConstruct &S)
static bool hasAggregateEvaluationKind(QualType T)
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
void EmitLambdaVLACapture(const VariableArrayType *VAT, LValue LV)
llvm::Value * LoadCXXThis()
LoadCXXThis - Load the value of 'this'.
llvm::function_ref< void(CodeGenFunction &, SourceLocation, const unsigned, const bool)> CodeGenOrderedTy
const CallExpr * MustTailCall
const CGFunctionInfo * CurFnInfo
Address GetAddrOfLocalVar(const VarDecl *VD)
GetAddrOfLocalVar - Return the address of a local variable.
llvm::Value * getArrayInitIndex()
Get the index of the current ArrayInitLoopExpr, if any.
void EmitOpenACCSetConstruct(const OpenACCSetConstruct &S)
std::pair< llvm::Value *, llvm::Value * > ComplexPairTy
Address ReturnValue
ReturnValue - The temporary alloca to hold the return value.
LValue EmitLValue(const Expr *E, KnownNonNull_t IsKnownNonNull=NotKnownNonNull)
EmitLValue - Emit code to compute a designator that specifies the location of the expression.
llvm::Instruction * CurrentFuncletPad
void EnsureInsertPoint()
EnsureInsertPoint - Ensure that an insertion point is defined so that emitted IR has a place to go.
llvm::LLVMContext & getLLVMContext()
bool SawAsmBlock
Whether we processed a Microsoft-style asm block during CodeGen.
static Destroyer destroyARCStrongPrecise
bool checkIfFunctionMustProgress()
Returns true if a function must make progress, which means the mustprogress attribute can be added.
llvm::SmallVector< VPtr, 4 > VPtrsVector
llvm::function_ref< void(CodeGenFunction &, const OMPLoopDirective &, JumpDest)> CodeGenLoopTy
llvm::CallInst * EmitNounwindRuntimeCall(llvm::FunctionCallee callee, ArrayRef< Address > args, const Twine &name="")
static Destroyer emitARCIntrinsicUse
void EmitStoreOfScalar(llvm::Value *Value, Address Addr, bool Volatile, QualType Ty, AlignmentSource Source=AlignmentSource::Type, bool isInit=false, bool isNontemporal=false)
EmitStoreOfScalar - Store a scalar value to an address, taking care to appropriately convert from the...
bool hasLabelBeenSeenInCurrentScope() const
Return true if a label was seen in the current scope.
LValue EmitLoadOfReferenceLValue(Address RefAddr, QualType RefTy, AlignmentSource Source=AlignmentSource::Type)
llvm::Type * ConvertType(const TypeDecl *T)
This class organizes the cross-function state that is used while generating LLVM code.
void setAtomicOpts(AtomicOptions AO)
Set the current Atomic options.
const LangOptions & getLangOpts() const
CharUnits getNaturalTypeAlignment(QualType T, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr, bool forPointeeType=false)
CodeGenTypes & getTypes()
CGPointerAuthInfo getPointerAuthInfoForPointeeType(QualType type)
const llvm::DataLayout & getDataLayout() const
TBAAAccessInfo getTBAAAccessInfo(QualType AccessType)
getTBAAAccessInfo - Get TBAA information that describes an access to an object of the given type.
ASTContext & getContext() const
const TargetCodeGenInfo & getTargetCodeGenInfo()
const CodeGenOptions & getCodeGenOpts() const
llvm::LLVMContext & getLLVMContext()
This class organizes the cross-module state that is used while lowering AST types to LLVM types.
A specialization of Address that requires the address to be an LLVM Constant.
static bool needsSaving(RValue value)
DominatingLLVMValue::saved_type first
DominatingValue< Address >::saved_type AggregateAddr
static saved_type save(CodeGenFunction &CGF, RValue value)
RValue restore(CodeGenFunction &CGF)
Information for lazily generating a cleanup.
ConditionalCleanup stores the saved form of its parameters, then restores them and performs the clean...
A saved depth on the scope stack.
A stack of scopes which respond to exceptions, including cleanups and catch blocks.
stable_iterator getInnermostNormalCleanup() const
Returns the innermost normal cleanup on the stack, or stable_end() if there are no normal cleanups.
stable_iterator stable_begin() const
Create a stable reference to the top of the EH stack.
bool requiresLandingPad() const
void pushCleanupTuple(CleanupKind Kind, std::tuple< As... > A)
Push a lazily-created cleanup on the stack. Tuple version.
FunctionArgList - Type for representing both the decl and type of parameters to a function.
LValue - This represents an lvalue references.
CharUnits getAlignment() const
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
A stack of loop information corresponding to loop nesting levels.
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
An abstract representation of an aligned address.
Class provides a way to call simple version of codegen for OpenMP region, or an advanced with possibl...
ReturnValueSlot - Contains the address where the return value of a function can be stored,...
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
The class detects jumps which bypass local variables declaration: goto L; int a; L:
CompoundAssignOperator - For compound assignments (e.g.
CompoundLiteralExpr - [C99 6.5.2.5].
CompoundStmt - This represents a group of statements like { stmt stmt }.
Represents an expression that might suspend coroutine execution; either a co_await or co_yield expres...
Represents the current source location and context used to determine the value of the source location...
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext,...
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Represents a member of a struct/union/class.
Represents a function declaration or definition.
Represents a prototype with parameter type info, e.g.
GlobalDecl - represents a global declaration.
const Decl * getDecl() const
GotoStmt - This represents a direct goto.
This class represents temporary values used to represent inout and out arguments in HLSL.
IfStmt - This represents an if/then/else.
IndirectGotoStmt - This represents an indirect goto.
Describes an C or C++ initializer list.
Represents the declaration of a label.
LabelStmt - Represents a label, which has a substatement.
FPExceptionModeKind
Possible floating point exception behavior.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Represents a point when we exit a loop.
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
A pointer to member type per C++ 8.3.3 - Pointers to members.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
This represents '#pragma omp atomic' directive.
This represents '#pragma omp barrier' directive.
This represents '#pragma omp cancel' directive.
This represents '#pragma omp cancellation point' directive.
Representation of an OpenMP canonical loop.
This represents '#pragma omp critical' directive.
This represents '#pragma omp depobj' directive.
This represents '#pragma omp distribute' directive.
This represents '#pragma omp distribute parallel for' composite directive.
This represents '#pragma omp distribute parallel for simd' composite directive.
This represents '#pragma omp distribute simd' composite directive.
This represents '#pragma omp error' directive.
This is a basic class for representing single OpenMP executable directive.
This represents '#pragma omp flush' directive.
This represents '#pragma omp for' directive.
This represents '#pragma omp for simd' directive.
This represents '#pragma omp loop' directive.
Represents the '#pragma omp interchange' loop transformation directive.
This represents '#pragma omp interop' directive.
This is a common base class for loop directives ('omp simd', 'omp for', 'omp for simd' etc....
This represents '#pragma omp masked' directive.
This represents '#pragma omp masked taskloop' directive.
This represents '#pragma omp masked taskloop simd' directive.
This represents '#pragma omp master' directive.
This represents '#pragma omp master taskloop' directive.
This represents '#pragma omp master taskloop simd' directive.
This represents '#pragma omp ordered' directive.
This represents '#pragma omp parallel' directive.
This represents '#pragma omp parallel for' directive.
This represents '#pragma omp parallel for simd' directive.
This represents '#pragma omp parallel masked' directive.
This represents '#pragma omp parallel masked taskloop' directive.
This represents '#pragma omp parallel masked taskloop simd' directive.
This represents '#pragma omp parallel master' directive.
This represents '#pragma omp parallel master taskloop' directive.
This represents '#pragma omp parallel master taskloop simd' directive.
This represents '#pragma omp parallel sections' directive.
Represents the '#pragma omp reverse' loop transformation directive.
This represents '#pragma omp scan' directive.
This represents '#pragma omp scope' directive.
This represents '#pragma omp section' directive.
This represents '#pragma omp sections' directive.
This represents '#pragma omp simd' directive.
This represents '#pragma omp single' directive.
This represents the '#pragma omp stripe' loop transformation directive.
This represents '#pragma omp target data' directive.
This represents '#pragma omp target' directive.
This represents '#pragma omp target enter data' directive.
This represents '#pragma omp target exit data' directive.
This represents '#pragma omp target parallel' directive.
This represents '#pragma omp target parallel for' directive.
This represents '#pragma omp target parallel for simd' directive.
This represents '#pragma omp target parallel loop' directive.
This represents '#pragma omp target simd' directive.
This represents '#pragma omp target teams' directive.
This represents '#pragma omp target teams distribute' combined directive.
This represents '#pragma omp target teams distribute parallel for' combined directive.
This represents '#pragma omp target teams distribute parallel for simd' combined directive.
This represents '#pragma omp target teams distribute simd' combined directive.
This represents '#pragma omp target teams loop' directive.
This represents '#pragma omp target update' directive.
This represents '#pragma omp task' directive.
This represents '#pragma omp taskloop' directive.
This represents '#pragma omp taskloop simd' directive.
This represents '#pragma omp taskgroup' directive.
This represents '#pragma omp taskwait' directive.
This represents '#pragma omp taskyield' directive.
This represents '#pragma omp teams' directive.
This represents '#pragma omp teams distribute' directive.
This represents '#pragma omp teams distribute parallel for' composite directive.
This represents '#pragma omp teams distribute parallel for simd' composite directive.
This represents '#pragma omp teams distribute simd' combined directive.
This represents '#pragma omp teams loop' directive.
This represents the '#pragma omp tile' loop transformation directive.
This represents the '#pragma omp unroll' loop transformation directive.
This represents clause 'use_device_addr' in the '#pragma omp ...' directives.
This represents clause 'use_device_ptr' in the '#pragma omp ...' directives.
ObjCArrayLiteral - used for objective-c array containers; as in: @["Hello", NSApp,...
ObjCBoxedExpr - used for generalized expression boxing.
ObjCContainerDecl - Represents a container for method declarations.
ObjCDictionaryLiteral - AST node to represent objective-c dictionary literals; as in:"name" : NSUserN...
ObjCEncodeExpr, used for @encode in Objective-C.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarRefExpr - A reference to an ObjC instance variable.
An expression that sends a message to the given Objective-C object or class.
ObjCMethodDecl - Represents an instance or class method declaration.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCProtocolExpr used for protocol expression in Objective-C.
ObjCSelectorExpr used for @selector in Objective-C.
ObjCStringLiteral, used for Objective-C string literals i.e.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
This class represents a 'loop' construct.
Represents a parameter to a function.
Pointer-authentication qualifiers.
PointerType - C99 6.7.5.1 - Pointer Declarators.
[C99 6.4.2.2] - A predefined identifier such as func.
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
A (possibly-)qualified type.
The collection of all-type qualifiers we support.
Represents a struct/union/class.
Flags to identify the types for overloaded SVE builtins.
Scope - A scope is a transient data structure that is used while parsing the program.
Encodes a location in the source.
A trivial tuple used to represent a source range.
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
Stmt - This represents one statement.
Likelihood
The likelihood of a branch being taken.
StringLiteral - This represents a string literal expression, e.g.
Exposes information about the current target.
Represents a declaration of a type.
The base class of the type hierarchy.
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool isReferenceType() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Represents a call to the builtin function __builtin_va_arg.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isLocalVarDeclOrParm() const
Similar to isLocalVarDecl but also includes parameters.
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * getSizeExpr() const
WhileStmt - This represents a 'while' stmt.
Defines the clang::TargetInfo interface.
AlignmentSource
The source of the alignment of an l-value; an expression of confidence in the alignment actually matc...
TypeEvaluationKind
The kind of evaluation to perform on values of a particular type.
ARCPreciseLifetime_t
Does an ARC strong l-value have precise lifetime?
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
std::variant< struct RequiresDecl, struct HeaderDecl, struct UmbrellaDirDecl, struct ModuleDecl, struct ExcludeDecl, struct ExportDecl, struct ExportAsDecl, struct ExternModuleDecl, struct UseDecl, struct LinkDecl, struct ConfigMacrosDecl, struct ConflictDecl > Decl
All declarations that can appear in a module declaration.
The JSON file list parser is used to communicate input to InstallAPI.
CXXCtorType
C++ constructor types.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
CapturedRegionKind
The different kinds of captured statement.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
CXXDtorType
C++ destructor types.
LangAS
Defines the address space values used by the address space qualifier of QualType.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
const FunctionProtoType * T
llvm::fp::ExceptionBehavior ToConstrainedExceptMD(LangOptions::FPExceptionModeKind Kind)
Diagnostic wrappers for TextAPI types for error reporting.
unsigned fine_grained_memory
unsigned ignore_denormal_mode
Structure with information about how a bitfield should be accessed.
llvm::SmallVector< llvm::AllocaInst * > Take()
AllocaTrackerRAII(CodeGenFunction &CGF)
std::unique_ptr< CGCoroData > Data
CXXDefaultArgExprScope(CodeGenFunction &CGF, const CXXDefaultArgExpr *E)
size_t OldDeactivateCleanupStackSize
CleanupDeactivationScope(CodeGenFunction &CGF)
~CleanupDeactivationScope()
llvm::Instruction * DominatingIP
EHScopeStack::stable_iterator Cleanup
std::optional< StringRef > Architecture
FMVResolverOption(llvm::Function *F, ArrayRef< StringRef > Feats, std::optional< StringRef > Arch=std::nullopt)
llvm::SmallVector< StringRef, 8 > Features
llvm::Function * Function
A jump destination is an abstract label, branching to which may require a jump out through normal cle...
void setScopeDepth(EHScopeStack::stable_iterator depth)
llvm::BasicBlock * getBlock() const
EHScopeStack::stable_iterator getScopeDepth() const
unsigned getDestIndex() const
JumpDest(llvm::BasicBlock *Block, EHScopeStack::stable_iterator Depth, unsigned Index)
OMPBuilderCBHelpers()=delete
llvm::OpenMPIRBuilder::InsertPointTy InsertPointTy
static void EmitCaptureStmt(CodeGenFunction &CGF, InsertPointTy CodeGenIP, llvm::BasicBlock &FiniBB, llvm::Function *Fn, ArrayRef< llvm::Value * > Args)
static void FinalizeOMPRegion(CodeGenFunction &CGF, InsertPointTy IP)
Emit the Finalization for an OMP region.
OMPBuilderCBHelpers & operator=(const OMPBuilderCBHelpers &)=delete
OMPBuilderCBHelpers(const OMPBuilderCBHelpers &)=delete
OMPTargetDataInfo(Address BasePointersArray, Address PointersArray, Address SizesArray, Address MappersArray, unsigned NumberOfTargetItems)
OMPTargetDataInfo()=default
PrototypeWrapper(const FunctionProtoType *FT)
llvm::PointerUnion< const FunctionProtoType *, const ObjCMethodDecl * > P
PrototypeWrapper(const ObjCMethodDecl *MD)
Struct with all information about dynamic [sub]class needed to set vptr.
const CXXRecordDecl * NearestVBase
const CXXRecordDecl * VTableClass
CharUnits OffsetFromNearestVBase
VlaSizePair(llvm::Value *NE, QualType T)
This structure provides a set of types that are commonly used during IR emission.
Helper class with most of the code for saving a value for a conditional expression cleanup.
llvm::PointerIntPair< llvm::Value *, 1, bool > saved_type
static llvm::Value * restore(CodeGenFunction &CGF, saved_type value)
static saved_type save(CodeGenFunction &CGF, llvm::Value *value)
static bool needsSaving(llvm::Value *value)
Answer whether the given value needs extra work to be saved.
static type restore(CodeGenFunction &CGF, saved_type value)
DominatingLLVMValue::saved_type Offset
llvm::PointerType * EffectiveType
DominatingLLVMValue::saved_type BasePtr
static type restore(CodeGenFunction &CGF, saved_type value)
static bool needsSaving(type value)
static saved_type save(CodeGenFunction &CGF, type value)
static bool needsSaving(type value)
static saved_type save(CodeGenFunction &CGF, type value)
static type restore(CodeGenFunction &CGF, saved_type value)
A metaprogramming class for ensuring that a value will dominate an arbitrary position in a function.
The this pointer adjustment as well as an optional return adjustment for a thunk.