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(JumpDest Break, JumpDest Continue)
1556 : BreakBlock(Break), ContinueBlock(Continue) {}
1558 JumpDest BreakBlock;
1559 JumpDest ContinueBlock;
1561 SmallVector<BreakContinue, 8> BreakContinueStack;
1564 class OpenMPCancelExitStack {
1568 CancelExit() =
default;
1569 CancelExit(OpenMPDirectiveKind
Kind, JumpDest ExitBlock,
1571 :
Kind(
Kind), ExitBlock(ExitBlock), ContBlock(ContBlock) {}
1575 bool HasBeenEmitted =
false;
1580 SmallVector<CancelExit, 8> Stack;
1583 OpenMPCancelExitStack() : Stack(1) {}
1584 ~OpenMPCancelExitStack() =
default;
1586 JumpDest getExitBlock()
const {
return Stack.back().ExitBlock; }
1589 void emitExit(CodeGenFunction &CGF, OpenMPDirectiveKind
Kind,
1590 const llvm::function_ref<
void(CodeGenFunction &)> CodeGen) {
1591 if (Stack.back().Kind ==
Kind && getExitBlock().isValid()) {
1592 assert(CGF.getOMPCancelDestination(
Kind).isValid());
1593 assert(CGF.HaveInsertPoint());
1594 assert(!Stack.back().HasBeenEmitted);
1595 auto IP = CGF.Builder.saveAndClearIP();
1596 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1598 CGF.EmitBranch(Stack.back().ContBlock.getBlock());
1599 CGF.Builder.restoreIP(IP);
1600 Stack.back().HasBeenEmitted =
true;
1608 void enter(CodeGenFunction &CGF, OpenMPDirectiveKind
Kind,
bool HasCancel) {
1609 Stack.push_back({
Kind,
1610 HasCancel ? CGF.getJumpDestInCurrentScope(
"cancel.exit")
1612 HasCancel ? CGF.getJumpDestInCurrentScope(
"cancel.cont")
1617 void exit(CodeGenFunction &CGF) {
1618 if (getExitBlock().isValid()) {
1619 assert(CGF.getOMPCancelDestination(Stack.back().Kind).isValid());
1620 bool HaveIP = CGF.HaveInsertPoint();
1621 if (!Stack.back().HasBeenEmitted) {
1623 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1624 CGF.EmitBlock(Stack.back().ExitBlock.getBlock());
1625 CGF.EmitBranchThroughCleanup(Stack.back().ContBlock);
1627 CGF.EmitBlock(Stack.back().ContBlock.getBlock());
1629 CGF.Builder.CreateUnreachable();
1630 CGF.Builder.ClearInsertionPoint();
1636 OpenMPCancelExitStack OMPCancelStack;
1639 llvm::Value *emitCondLikelihoodViaExpectIntrinsic(llvm::Value *Cond,
1640 Stmt::Likelihood LH);
1642 std::unique_ptr<CodeGenPGO> PGO;
1645 Address MCDCCondBitmapAddr = Address::invalid();
1648 llvm::MDNode *createProfileWeights(uint64_t TrueCount,
1649 uint64_t FalseCount)
const;
1650 llvm::MDNode *createProfileWeights(ArrayRef<uint64_t> Weights)
const;
1651 llvm::MDNode *createProfileWeightsForLoop(
const Stmt *Cond,
1652 uint64_t LoopCount)
const;
1655 std::pair<bool, bool> getIsCounterPair(
const Stmt *S)
const;
1656 void markStmtAsUsed(
bool Skipped,
const Stmt *S);
1657 void markStmtMaybeUsed(
const Stmt *S);
1661 void incrementProfileCounter(
const Stmt *S, llvm::Value *StepV =
nullptr);
1666 !CurFn->hasFnAttribute(llvm::Attribute::NoProfile));
1671 void maybeCreateMCDCCondBitmap();
1674 const BinaryOperator *BOp = dyn_cast<BinaryOperator>(
E->IgnoreParens());
1679 void maybeResetMCDCCondBitmap(
const Expr *
E);
1683 void maybeUpdateMCDCTestVectorBitmap(
const Expr *
E);
1686 void maybeUpdateMCDCCondBitmap(
const Expr *
E, llvm::Value *Val);
1689 uint64_t getProfileCount(
const Stmt *S);
1692 void setCurrentProfileCount(uint64_t Count);
1696 uint64_t getCurrentProfileCount();
1699 void addInstToCurrentSourceAtom(llvm::Instruction *KeyInstruction,
1700 llvm::Value *Backup);
1703 void addInstToSpecificSourceAtom(llvm::Instruction *KeyInstruction,
1704 llvm::Value *Backup, uint64_t Atom);
1708 void addInstToNewSourceAtom(llvm::Instruction *KeyInstruction,
1709 llvm::Value *Backup);
1714 llvm::SwitchInst *SwitchInsn =
nullptr;
1723 llvm::BasicBlock *CaseRangeBlock =
nullptr;
1727 llvm::DenseMap<const OpaqueValueExpr *, LValue> OpaqueLValues;
1728 llvm::DenseMap<const OpaqueValueExpr *, RValue> OpaqueRValues;
1736 llvm::DenseMap<const Expr *, llvm::Value *> VLASizeMap;
1740 llvm::BasicBlock *UnreachableBlock =
nullptr;
1743 unsigned NumReturnExprs = 0;
1746 unsigned NumSimpleReturnExprs = 0;
1764 : CGF(CGF), OldCXXDefaultInitExprThis(CGF.CXXDefaultInitExprThis) {
1765 CGF.CXXDefaultInitExprThis =
This;
1768 CGF.CXXDefaultInitExprThis = OldCXXDefaultInitExprThis;
1773 Address OldCXXDefaultInitExprThis;
1781 : CGF(CGF), OldCXXThisValue(CGF.CXXThisValue),
1782 OldCXXThisAlignment(CGF.CXXThisAlignment),
1783 SourceLocScope(
E, CGF.CurSourceLocExprScope) {
1785 CGF.CXXThisAlignment = CGF.CXXDefaultInitExprThis.
getAlignment();
1788 CGF.CXXThisValue = OldCXXThisValue;
1789 CGF.CXXThisAlignment = OldCXXThisAlignment;
1809 : CGF(CGF), OldArrayInitIndex(CGF.ArrayInitIndex) {
1810 CGF.ArrayInitIndex = Index;
1816 llvm::Value *OldArrayInitIndex;
1822 : CGF(CGF), OldCurGD(CGF.CurGD), OldCurFuncDecl(CGF.CurFuncDecl),
1823 OldCurCodeDecl(CGF.CurCodeDecl),
1824 OldCXXABIThisDecl(CGF.CXXABIThisDecl),
1825 OldCXXABIThisValue(CGF.CXXABIThisValue),
1826 OldCXXThisValue(CGF.CXXThisValue),
1827 OldCXXABIThisAlignment(CGF.CXXABIThisAlignment),
1828 OldCXXThisAlignment(CGF.CXXThisAlignment),
1829 OldReturnValue(CGF.ReturnValue), OldFnRetTy(CGF.FnRetTy),
1830 OldCXXInheritedCtorInitExprArgs(
1831 std::move(CGF.CXXInheritedCtorInitExprArgs)) {
1834 cast<CXXConstructorDecl>(GD.
getDecl());
1835 CGF.CXXABIThisDecl =
nullptr;
1836 CGF.CXXABIThisValue =
nullptr;
1837 CGF.CXXThisValue =
nullptr;
1842 CGF.CXXInheritedCtorInitExprArgs.clear();
1845 CGF.CurGD = OldCurGD;
1846 CGF.CurFuncDecl = OldCurFuncDecl;
1847 CGF.CurCodeDecl = OldCurCodeDecl;
1848 CGF.CXXABIThisDecl = OldCXXABIThisDecl;
1849 CGF.CXXABIThisValue = OldCXXABIThisValue;
1850 CGF.CXXThisValue = OldCXXThisValue;
1851 CGF.CXXABIThisAlignment = OldCXXABIThisAlignment;
1852 CGF.CXXThisAlignment = OldCXXThisAlignment;
1853 CGF.ReturnValue = OldReturnValue;
1854 CGF.FnRetTy = OldFnRetTy;
1855 CGF.CXXInheritedCtorInitExprArgs =
1856 std::move(OldCXXInheritedCtorInitExprArgs);
1862 const Decl *OldCurFuncDecl;
1863 const Decl *OldCurCodeDecl;
1865 llvm::Value *OldCXXABIThisValue;
1866 llvm::Value *OldCXXThisValue;
1897 llvm::CallInst *RTLFnCI;
1901 RLFnCI->removeFromParent();
1931 StringRef FirstSeparator =
".",
1932 StringRef Separator =
".");
1937 CGBuilderTy::InsertPointGuard IPG(CGF.
Builder);
1938 assert(IP.getBlock()->end() != IP.getPoint() &&
1939 "OpenMP IR Builder should cause terminated block!");
1941 llvm::BasicBlock *IPBB = IP.getBlock();
1942 llvm::BasicBlock *DestBB = IPBB->getUniqueSuccessor();
1943 assert(DestBB &&
"Finalization block should have one successor!");
1946 IPBB->getTerminator()->eraseFromParent();
1947 CGF.
Builder.SetInsertPoint(IPBB);
1960 const Stmt *RegionBodyStmt,
1961 InsertPointTy AllocaIP,
1962 InsertPointTy CodeGenIP,
1966 llvm::BasicBlock &FiniBB, llvm::Function *Fn,
1968 llvm::BasicBlock *CodeGenIPBB = CodeGenIP.getBlock();
1969 if (llvm::Instruction *CodeGenIPBBTI = CodeGenIPBB->getTerminator())
1970 CodeGenIPBBTI->eraseFromParent();
1972 CGF.
Builder.SetInsertPoint(CodeGenIPBB);
1974 if (Fn->doesNotThrow())
1979 if (CGF.
Builder.saveIP().isSet())
1980 CGF.
Builder.CreateBr(&FiniBB);
1992 const Stmt *RegionBodyStmt,
1993 InsertPointTy AllocaIP,
1994 InsertPointTy CodeGenIP,
2000 llvm::AssertingVH<llvm::Instruction> OldAllocaIP;
2006 llvm::BasicBlock &RetBB)
2008 assert(AllocaIP.isSet() &&
2009 "Must specify Insertion point for allocas of outlined function");
2026 llvm::AssertingVH<llvm::Instruction> OldAllocaIP;
2031 llvm::BasicBlock &FiniBB)
2037 assert((!AllocaIP.isSet() ||
2039 "Insertion point should be in the entry block of containing "
2042 if (AllocaIP.isSet())
2061 llvm::Value *CXXABIThisValue =
nullptr;
2062 llvm::Value *CXXThisValue =
nullptr;
2068 Address CXXDefaultInitExprThis = Address::invalid();
2072 llvm::Value *ArrayInitIndex =
nullptr;
2081 llvm::Value *CXXStructorImplicitParamValue =
nullptr;
2086 ConditionalEvaluation *OutermostConditional =
nullptr;
2089 LexicalScope *CurLexicalScope =
nullptr;
2097 llvm::DenseMap<const ValueDecl *, BlockByrefInfo> BlockByrefInfos;
2101 llvm::Value *RetValNullabilityPrecondition =
nullptr;
2105 bool requiresReturnValueNullabilityCheck()
const {
2106 return RetValNullabilityPrecondition;
2111 Address ReturnLocation = Address::invalid();
2114 bool requiresReturnValueCheck()
const;
2119 llvm::BasicBlock *TerminateLandingPad =
nullptr;
2120 llvm::BasicBlock *TerminateHandler =
nullptr;
2124 llvm::MapVector<llvm::Value *, llvm::BasicBlock *> TerminateFunclets;
2128 unsigned LargestVectorWidth = 0;
2132 bool ShouldEmitLifetimeMarkers;
2136 void EmitKernelMetadata(
const FunctionDecl *FD, llvm::Function *Fn);
2139 CodeGenFunction(CodeGenModule &cgm,
bool suppressNewContext =
false);
2145 if (DisableDebugInfo)
2165 llvm::Value *getExceptionFromSlot();
2166 llvm::Value *getSelectorFromSlot();
2171 if (!UnreachableBlock) {
2172 UnreachableBlock = createBasicBlock(
"unreachable");
2173 new llvm::UnreachableInst(getLLVMContext(), UnreachableBlock);
2175 return UnreachableBlock;
2181 return getInvokeDestImpl();
2198 void pushIrregularPartialArrayCleanup(llvm::Value *arrayBegin,
2202 Destroyer *destroyer);
2203 void pushRegularPartialArrayCleanup(llvm::Value *arrayBegin,
2204 llvm::Value *arrayEnd,
2207 Destroyer *destroyer);
2214 Destroyer *destroyer,
bool useEHCleanupForArray);
2218 QualType type, Destroyer *destroyer,
2219 bool useEHCleanupForArray);
2221 QualType type, Destroyer *destroyer,
2222 bool useEHCleanupForArray);
2225 void pushCallObjectDeleteCleanup(
const FunctionDecl *OperatorDelete,
2226 llvm::Value *CompletePtr,
2230 std::pair<llvm::Value *, llvm::Value *> AddrSizePair);
2232 bool useEHCleanupForArray);
2234 Destroyer *destroyer,
2235 bool useEHCleanupForArray,
2237 void emitArrayDestroy(llvm::Value *begin, llvm::Value *end,
2239 Destroyer *destroyer,
bool checkZeroLength,
2248 case QualType::DK_none:
2250 case QualType::DK_cxx_destructor:
2251 case QualType::DK_objc_weak_lifetime:
2252 case QualType::DK_nontrivial_c_struct:
2253 return getLangOpts().Exceptions;
2254 case QualType::DK_objc_strong_lifetime:
2255 return getLangOpts().Exceptions &&
2258 llvm_unreachable(
"bad destruction kind");
2262 return (needsEHCleanup(kind) ? NormalAndEHCleanup : NormalCleanup);
2279 llvm::Constant *AtomicHelperFn);
2290 llvm::Constant *AtomicHelperFn);
2300 llvm::Value *EmitBlockLiteral(
const BlockExpr *);
2303 const DeclMapTy &ldm,
2304 bool IsLambdaConversionToBlock,
2305 bool BuildGlobalBlock);
2308 static bool cxxDestructorCanThrow(
QualType T);
2310 llvm::Constant *GenerateCopyHelperFunction(
const CGBlockInfo &blockInfo);
2311 llvm::Constant *GenerateDestroyHelperFunction(
const CGBlockInfo &blockInfo);
2316 llvm::Value *EmitBlockCopyAndAutorelease(llvm::Value *
Block,
QualType Ty);
2321 class AutoVarEmission;
2323 void emitByrefStructureInit(
const AutoVarEmission &emission);
2342 bool LoadBlockVarAddr,
bool CanThrow);
2353 bool followForward =
true);
2355 bool followForward,
const llvm::Twine &name);
2361 void GenerateCode(
GlobalDecl GD, llvm::Function *Fn,
2366 void markAsIgnoreThreadCheckingAtRuntime(llvm::Function *Fn);
2381 void EmitFunctionBody(
const Stmt *Body);
2382 void EmitBlockWithFallThrough(llvm::BasicBlock *BB,
const Stmt *S);
2384 void EmitForwardingCallToLambda(
const CXXMethodDecl *LambdaCallOperator,
2387 llvm::Constant *CallOpFn =
nullptr);
2388 void EmitLambdaBlockInvokeBody();
2390 void EmitLambdaDelegatingInvokeBody(
const CXXMethodDecl *MD,
2394 llvm::Function **ImplFn);
2397 EmitStoreThroughLValue(RValue::get(VLASizeMap[VAT->
getSizeExpr()]), LV);
2399 void EmitAsanPrologueOrEpilogue(
bool Prologue);
2405 llvm::DebugLoc EmitReturnBlock();
2411 void StartThunk(llvm::Function *Fn,
GlobalDecl GD,
2414 void EmitCallAndReturnForThunk(llvm::FunctionCallee Callee,
2415 const ThunkInfo *Thunk,
bool IsUnprototyped);
2420 void EmitMustTailThunk(
GlobalDecl GD, llvm::Value *AdjustedThisPtr,
2421 llvm::FunctionCallee Callee);
2424 void generateThunk(llvm::Function *Fn,
const CGFunctionInfo &FnInfo,
2426 bool IsUnprototyped);
2428 llvm::Function *GenerateVarArgsThunk(llvm::Function *Fn,
2446 void InitializeVTablePointer(
const VPtr &vptr);
2455 bool BaseIsNonVirtualPrimaryBase,
2459 void InitializeVTablePointers(
const CXXRecordDecl *ClassDecl);
2474 VTableAuthMode AuthMode = VTableAuthMode::Authenticate);
2489 void EmitVTablePtrCheckForCast(
QualType T,
Address Derived,
bool MayBeNull,
2494 void EmitVTablePtrCheckForCall(
const CXXRecordDecl *RD, llvm::Value *VTable,
2499 void EmitVTablePtrCheck(
const CXXRecordDecl *RD, llvm::Value *VTable,
2511 bool ShouldEmitVTableTypeCheckedLoad(
const CXXRecordDecl *RD);
2514 llvm::Value *EmitVTableTypeCheckedLoad(
const CXXRecordDecl *RD,
2515 llvm::Value *VTable,
2516 llvm::Type *VTableTy,
2517 uint64_t VTableByteOffset);
2527 bool ShouldInstrumentFunction();
2531 bool ShouldSkipSanitizerInstrumentation();
2535 bool ShouldXRayInstrumentFunction()
const;
2539 bool AlwaysEmitXRayCustomEvents()
const;
2543 bool AlwaysEmitXRayTypedEvents()
const;
2547 llvm::ConstantInt *getUBSanFunctionTypeHash(
QualType T)
const;
2552 void EmitFunctionProlog(
const CGFunctionInfo &FI, llvm::Function *Fn,
2559 void EmitFunctionEpilog(
const CGFunctionInfo &FI,
bool EmitRetDbgLoc,
2561 uint64_t RetKeyInstructionsSourceAtom);
2564 void EmitReturnValueCheck(llvm::Value *RV);
2567 void EmitStartEHSpec(
const Decl *
D);
2570 void EmitEndEHSpec(
const Decl *
D);
2573 llvm::BasicBlock *getTerminateLandingPad();
2577 llvm::BasicBlock *getTerminateFunclet();
2582 llvm::BasicBlock *getTerminateHandler();
2584 llvm::Type *ConvertTypeForMem(
QualType T);
2585 llvm::Type *ConvertType(
QualType T);
2586 llvm::Type *convertTypeForLoadStore(
QualType ASTTy,
2587 llvm::Type *LLVMTy =
nullptr);
2589 return ConvertType(getContext().getTypeDeclType(
T));
2594 llvm::Value *LoadObjCSelf();
2603 return getEvaluationKind(
T) == TEK_Scalar;
2607 return getEvaluationKind(
T) == TEK_Aggregate;
2612 llvm::Function *parent =
nullptr,
2613 llvm::BasicBlock *before =
nullptr) {
2614 return llvm::BasicBlock::Create(getLLVMContext(), name, parent, before);
2619 JumpDest getJumpDestForLabel(
const LabelDecl *S);
2624 void SimplifyForwardingBlocks(llvm::BasicBlock *BB);
2634 void EmitBlock(llvm::BasicBlock *BB,
bool IsFinished =
false);
2638 void EmitBlockAfterUses(llvm::BasicBlock *BB);
2648 void EmitBranch(llvm::BasicBlock *
Block);
2659 if (!HaveInsertPoint())
2660 EmitBlock(createBasicBlock());
2665 void ErrorUnsupported(
const Stmt *S,
const char *
Type);
2672 llvm::BasicBlock *LHSBlock,
2673 llvm::BasicBlock *RHSBlock,
2674 llvm::BasicBlock *MergeBlock,
2676 Builder.SetInsertPoint(MergeBlock);
2677 llvm::PHINode *PtrPhi = Builder.CreatePHI(LHS.
getType(), 2,
"cond");
2694 if (Alignment.isZero())
2697 return Address(Ptr, ConvertTypeForMem(
T), Alignment,
2710 return LValue::MakeAddr(
Addr,
T, getContext(), BaseInfo, TBAAInfo);
2715 return MakeAddrLValue(makeNaturalAddressForPointer(
V,
T, Alignment),
T,
2740 MakeNaturalAlignAddrLValue(llvm::Value *
V,
QualType T,
2745 LValue MakeNaturalAlignPointeeRawAddrLValue(llvm::Value *
V,
QualType T);
2758 return EmitLoadOfReferenceLValue(RefLVal);
2770 struct AllocaTracker {
2771 void Add(llvm::AllocaInst *I) { Allocas.push_back(I); }
2777 AllocaTracker *Allocas =
nullptr;
2780 void emitStoresForConstant(
const VarDecl &
D, Address
Loc,
bool isVolatile,
2781 llvm::Constant *constant,
bool IsAutoInit);
2783 void emitStoresForZeroInit(
const VarDecl &
D, Address
Loc,
bool isVolatile);
2785 void emitStoresForPatternInit(
const VarDecl &
D, Address
Loc,
bool isVolatile);
2787 void emitStoresForInitAfterBZero(llvm::Constant *Init, Address
Loc,
2788 bool isVolatile,
bool IsAutoInit);
2794 : CGF(CGF), OldTracker(CGF.Allocas) {
2795 CGF.Allocas = &Tracker;
2803 AllocaTracker *OldTracker;
2804 AllocaTracker Tracker;
2811 llvm::Value *ArraySize =
nullptr);
2840 llvm::AllocaInst *CreateTempAlloca(llvm::Type *Ty,
const Twine &Name =
"tmp",
2841 llvm::Value *ArraySize =
nullptr);
2847 CharUnits align,
const Twine &Name =
"tmp",
2848 llvm::Value *ArraySize =
nullptr,
2857 const Twine &Name =
"tmp",
2858 llvm::Value *ArraySize =
nullptr,
2860 return CreateTempAlloca(Ty, LangAS::Default, align, Name, ArraySize,
2865 const Twine &Name =
"tmp",
2866 llvm::Value *ArraySize =
nullptr);
2878 RawAddress CreateDefaultAlignTempAlloca(llvm::Type *Ty,
2879 const Twine &Name =
"tmp");
2897 const Twine &Name =
"tmp",
2904 const Twine &Name =
"tmp");
2910 return AggValueSlot::forAddr(
2911 CreateMemTemp(
T, Name, Alloca),
T.getQualifiers(),
2912 AggValueSlot::IsNotDestructed, AggValueSlot::DoesNotNeedGCBarriers,
2913 AggValueSlot::IsNotAliased, AggValueSlot::DoesNotOverlap);
2918 llvm::Value *EvaluateExprAsBool(
const Expr *
E);
2924 llvm::Value *EmitWithOriginalRHSBitfieldAssignment(
const BinaryOperator *
E,
2930 void EmitBitfieldConversionCheck(llvm::Value *Src,
QualType SrcType,
2931 llvm::Value *Dst,
QualType DstType,
2937 void EmitIgnoredExpr(
const Expr *
E);
2947 bool ignoreResult =
false);
2965 bool IsInitializer);
2970 void EmitInitializationToLValue(
2977 bool capturedByInit);
2983 return RD->hasVolatileMember();
2992 return AggValueSlot::DoesNotOverlap;
3007 bool IsVolatile = hasVolatileMember(EltTy);
3008 EmitAggregateCopy(Dest, Src, EltTy, AggValueSlot::MayOverlap, IsVolatile);
3013 EmitAggregateCopy(Dest, Src, Src.
getType(), MayOverlap);
3025 bool isVolatile =
false);
3029 auto it = LocalDeclMap.find(VD);
3030 assert(it != LocalDeclMap.end() &&
3031 "Invalid argument to GetAddrOfLocalVar(), no decl!");
3052 static unsigned getAccessedFieldNo(
unsigned Idx,
const llvm::Constant *Elts);
3054 llvm::BlockAddress *GetAddrOfLabel(
const LabelDecl *L);
3055 llvm::BasicBlock *GetIndirectGotoBlock();
3058 static bool IsWrappedCXXThis(
const Expr *
E);
3071 llvm::Value *EmitVAStartEnd(llvm::Value *ArgValue,
bool IsStart);
3093 void EmitVariablyModifiedType(
QualType Ty);
3105 VlaSizePair getVLAElements1D(
QualType vla);
3112 VlaSizePair getVLASize(
QualType vla);
3117 assert(CXXThisValue &&
"no 'this' value for this function");
3118 return CXXThisValue;
3127 assert(CXXStructorImplicitParamValue &&
"no VTT value for this function");
3128 return CXXStructorImplicitParamValue;
3136 bool BaseIsVirtual);
3138 static bool ShouldNullCheckClassCastValue(
const CastExpr *Cast);
3150 bool NullCheckValue);
3156 llvm::Value *GetVTTParameter(
GlobalDecl GD,
bool ForVirtualBase,
3176 bool ForVirtualBase,
3185 bool InheritedFromVBase,
3189 bool ForVirtualBase,
bool Delegating,
3193 bool ForVirtualBase,
bool Delegating,
3197 llvm::CallBase **CallOrInvoke =
nullptr);
3204 void EmitVTableAssumptionLoad(
const VPtr &vptr,
Address This);
3212 bool NewPointerIsChecked,
3213 bool ZeroInitialization =
false);
3216 llvm::Value *NumElements,
Address ArrayPtr,
3218 bool NewPointerIsChecked,
3219 bool ZeroInitialization =
false);
3224 bool ForVirtualBase,
bool Delegating,
Address This,
3228 llvm::Type *ElementTy,
Address NewPtr,
3229 llvm::Value *NumElements,
3230 llvm::Value *AllocSizeWithoutCookie);
3235 void EmitSehCppScopeBegin();
3236 void EmitSehCppScopeEnd();
3237 void EmitSehTryScopeBegin();
3238 void EmitSehTryScopeEnd();
3240 bool EmitLifetimeStart(llvm::Value *Addr);
3241 void EmitLifetimeEnd(llvm::Value *Addr);
3246 void EmitDeleteCall(
const FunctionDecl *DeleteFD, llvm::Value *Ptr,
3247 QualType DeleteTy, llvm::Value *NumElements =
nullptr,
3251 const CallExpr *TheCallExpr,
bool IsDelete);
3293 TCK_DynamicOperation
3297 static bool isNullPointerAllowed(TypeCheckKind TCK);
3300 static bool isVptrCheckRequired(TypeCheckKind TCK,
QualType Ty);
3304 bool sanitizePerformTypeCheck()
const;
3308 llvm::Value *ArraySize =
nullptr) {
3309 if (!sanitizePerformTypeCheck())
3312 SkippedChecks, ArraySize);
3318 llvm::Value *ArraySize =
nullptr) {
3319 if (!sanitizePerformTypeCheck())
3321 EmitTypeCheck(TCK,
Loc,
Addr.emitRawPointer(*
this),
Type, Alignment,
3322 SkippedChecks, ArraySize);
3331 llvm::Value *ArraySize =
nullptr);
3336 void EmitBoundsCheck(
const Expr *
E,
const Expr *
Base, llvm::Value *Index,
3337 QualType IndexType,
bool Accessed);
3338 void EmitBoundsCheckImpl(
const Expr *
E, llvm::Value *Bound,
3339 llvm::Value *Index,
QualType IndexType,
3340 QualType IndexedType,
bool Accessed);
3358 void EmitCountedByBoundsChecking(
const Expr *
E, llvm::Value *Idx,
3361 bool FlexibleArray);
3364 bool isInc,
bool isPre);
3366 bool isInc,
bool isPre);
3372 unsigned getDebugInfoFIndex(
const RecordDecl *Rec,
unsigned FieldIndex);
3381 void EmitDecl(
const Decl &
D,
bool EvaluateConditionDecl =
false);
3386 void EmitVarDecl(
const VarDecl &
D);
3389 bool capturedByInit);
3396 bool isTrivialInitializer(
const Expr *Init);
3401 void EmitAutoVarDecl(
const VarDecl &
D);
3414 llvm::Value *NRVOFlag;
3418 bool IsEscapingByRef;
3422 bool IsConstantAggregate;
3425 bool UseLifetimeMarkers;
3436 AutoVarEmission(
const VarDecl &variable)
3438 IsEscapingByRef(
false), IsConstantAggregate(
false),
3441 bool wasEmittedAsGlobal()
const {
return !
Addr.isValid(); }
3460 if (!IsEscapingByRef)
3466 AutoVarEmission EmitAutoVarAlloca(
const VarDecl &var);
3467 void EmitAutoVarInit(
const AutoVarEmission &emission);
3468 void EmitAutoVarCleanups(
const AutoVarEmission &emission);
3469 void emitAutoVarTypeCleanup(
const AutoVarEmission &emission,
3472 void MaybeEmitDeferredVarDeclInit(
const VarDecl *var);
3480 bool EmitDebugInfo);
3482 void EmitStaticVarDecl(
const VarDecl &
D,
3483 llvm::GlobalValue::LinkageTypes
Linkage);
3509 assert(!
Addr.hasOffset() &&
"unexpected offset");
3510 return Addr.getBasePointer();
3514 assert(!isIndirect());
3519 assert(isIndirect());
3525 void EmitParmDecl(
const VarDecl &
D, ParamValue Arg,
unsigned ArgNo);
3536 PeepholeProtection protectFromPeepholes(
RValue rvalue);
3537 void unprotectFromPeepholes(PeepholeProtection protection);
3539 void emitAlignmentAssumptionCheck(llvm::Value *Ptr,
QualType Ty,
3542 llvm::Value *Alignment,
3543 llvm::Value *OffsetValue,
3544 llvm::Value *TheCheck,
3545 llvm::Instruction *Assumption);
3547 void emitAlignmentAssumption(llvm::Value *PtrValue,
QualType Ty,
3549 llvm::Value *Alignment,
3550 llvm::Value *OffsetValue =
nullptr);
3552 void emitAlignmentAssumption(llvm::Value *PtrValue,
const Expr *
E,
3554 llvm::Value *Alignment,
3555 llvm::Value *OffsetValue =
nullptr);
3562 void EmitStopPoint(
const Stmt *S);
3580 Address EmitCompoundStmt(
const CompoundStmt &S,
bool GetLast =
false,
3581 AggValueSlot AVS = AggValueSlot::ignored());
3583 EmitCompoundStmtWithoutScope(
const CompoundStmt &S,
bool GetLast =
false,
3584 AggValueSlot AVS = AggValueSlot::ignored());
3592 void EmitGotoStmt(
const GotoStmt &S);
3594 void EmitIfStmt(
const IfStmt &S);
3597 void EmitDoStmt(
const DoStmt &S, ArrayRef<const Attr *> Attrs = {});
3598 void EmitForStmt(
const ForStmt &S, ArrayRef<const Attr *> Attrs = {});
3599 void EmitReturnStmt(
const ReturnStmt &S);
3600 void EmitDeclStmt(
const DeclStmt &S);
3601 void EmitBreakStmt(
const BreakStmt &S);
3602 void EmitContinueStmt(
const ContinueStmt &S);
3603 void EmitSwitchStmt(
const SwitchStmt &S);
3604 void EmitDefaultStmt(
const DefaultStmt &S, ArrayRef<const Attr *> Attrs);
3605 void EmitCaseStmt(
const CaseStmt &S, ArrayRef<const Attr *> Attrs);
3606 void EmitCaseStmtRange(
const CaseStmt &S, ArrayRef<const Attr *> Attrs);
3607 void EmitAsmStmt(
const AsmStmt &S);
3609 void EmitObjCForCollectionStmt(
const ObjCForCollectionStmt &S);
3610 void EmitObjCAtTryStmt(
const ObjCAtTryStmt &S);
3611 void EmitObjCAtThrowStmt(
const ObjCAtThrowStmt &S);
3612 void EmitObjCAtSynchronizedStmt(
const ObjCAtSynchronizedStmt &S);
3613 void EmitObjCAutoreleasePoolStmt(
const ObjCAutoreleasePoolStmt &S);
3615 void EmitCoroutineBody(
const CoroutineBodyStmt &S);
3616 void EmitCoreturnStmt(
const CoreturnStmt &S);
3617 RValue EmitCoawaitExpr(
const CoawaitExpr &
E,
3618 AggValueSlot aggSlot = AggValueSlot::ignored(),
3619 bool ignoreResult =
false);
3620 LValue EmitCoawaitLValue(
const CoawaitExpr *
E);
3621 RValue EmitCoyieldExpr(
const CoyieldExpr &
E,
3622 AggValueSlot aggSlot = AggValueSlot::ignored(),
3623 bool ignoreResult =
false);
3624 LValue EmitCoyieldLValue(
const CoyieldExpr *
E);
3625 RValue EmitCoroutineIntrinsic(
const CallExpr *
E,
unsigned int IID);
3627 void EnterCXXTryStmt(
const CXXTryStmt &S,
bool IsFnTryBlock =
false);
3628 void ExitCXXTryStmt(
const CXXTryStmt &S,
bool IsFnTryBlock =
false);
3630 void EmitCXXTryStmt(
const CXXTryStmt &S);
3631 void EmitSEHTryStmt(
const SEHTryStmt &S);
3632 void EmitSEHLeaveStmt(
const SEHLeaveStmt &S);
3633 void EnterSEHTryStmt(
const SEHTryStmt &S);
3634 void ExitSEHTryStmt(
const SEHTryStmt &S);
3635 void VolatilizeTryBlocks(llvm::BasicBlock *BB,
3638 void pushSEHCleanup(CleanupKind kind, llvm::Function *FinallyFunc);
3639 void startOutlinedSEHHelper(CodeGenFunction &ParentCGF,
bool IsFilter,
3640 const Stmt *OutlinedStmt);
3642 llvm::Function *GenerateSEHFilterFunction(CodeGenFunction &ParentCGF,
3643 const SEHExceptStmt &Except);
3645 llvm::Function *GenerateSEHFinallyFunction(CodeGenFunction &ParentCGF,
3646 const SEHFinallyStmt &Finally);
3648 void EmitSEHExceptionCodeSave(CodeGenFunction &ParentCGF,
3649 llvm::Value *ParentFP, llvm::Value *EntryEBP);
3650 llvm::Value *EmitSEHExceptionCode();
3651 llvm::Value *EmitSEHExceptionInfo();
3652 llvm::Value *EmitSEHAbnormalTermination();
3655 void EmitSimpleOMPExecutableDirective(
const OMPExecutableDirective &
D);
3660 void EmitCapturedLocals(CodeGenFunction &ParentCGF,
const Stmt *OutlinedStmt,
3668 Address recoverAddrOfEscapedLocal(CodeGenFunction &ParentCGF,
3669 Address ParentVar, llvm::Value *ParentFP);
3671 void EmitCXXForRangeStmt(
const CXXForRangeStmt &S,
3672 ArrayRef<const Attr *> Attrs = {});
3682 CGF.OMPCancelStack.enter(CGF,
Kind, HasCancel);
3688 llvm::Value *getTypeSize(
QualType Ty);
3691 llvm::Function *GenerateCapturedStmtFunction(
const CapturedStmt &S);
3693 llvm::Function *GenerateOpenMPCapturedStmtFunction(
const CapturedStmt &S,
3708 void EmitOMPAggregateAssign(
3738 std::pair<bool, RValue> EmitOMPAtomicSimpleUpdateExpr(
3743 OMPPrivateScope &PrivateScope);
3745 OMPPrivateScope &PrivateScope);
3746 void EmitOMPUseDevicePtrClause(
3748 const llvm::DenseMap<const ValueDecl *, llvm::Value *>
3749 CaptureDeviceAddrMap);
3750 void EmitOMPUseDeviceAddrClause(
3752 const llvm::DenseMap<const ValueDecl *, llvm::Value *>
3753 CaptureDeviceAddrMap);
3778 OMPPrivateScope &PrivateScope);
3788 llvm::Value *IsLastIterCond =
nullptr);
3795 void EmitOMPLinearClauseFinal(
3806 OMPPrivateScope &PrivateScope,
3807 bool ForInscan =
false);
3836 unsigned NumberOfTargetItems = 0;
3840 unsigned NumberOfTargetItems)
3841 : BasePointersArray(BasePointersArray), PointersArray(PointersArray),
3842 SizesArray(SizesArray), MappersArray(MappersArray),
3843 NumberOfTargetItems(NumberOfTargetItems) {}
3847 OMPTargetDataInfo &InputInfo);
3850 OMPPrivateScope &
Scope);
3904 void EmitOMPParallelMasterTaskLoopDirective(
3906 void EmitOMPParallelMaskedTaskLoopDirective(
3908 void EmitOMPParallelMasterTaskLoopSimdDirective(
3910 void EmitOMPParallelMaskedTaskLoopSimdDirective(
3913 void EmitOMPDistributeParallelForDirective(
3915 void EmitOMPDistributeParallelForSimdDirective(
3918 void EmitOMPTargetParallelForSimdDirective(
3924 void EmitOMPTeamsDistributeParallelForSimdDirective(
3926 void EmitOMPTeamsDistributeParallelForDirective(
3929 void EmitOMPTargetTeamsDistributeDirective(
3931 void EmitOMPTargetTeamsDistributeParallelForDirective(
3933 void EmitOMPTargetTeamsDistributeParallelForSimdDirective(
3935 void EmitOMPTargetTeamsDistributeSimdDirective(
3939 void EmitOMPTargetParallelGenericLoopDirective(
3941 void EmitOMPTargetTeamsGenericLoopDirective(
3950 StringRef ParentName,
3953 EmitOMPTargetParallelDeviceFunction(
CodeGenModule &CGM, StringRef ParentName,
3956 static void EmitOMPTargetParallelForDeviceFunction(
3960 static void EmitOMPTargetParallelForSimdDeviceFunction(
3965 EmitOMPTargetTeamsDeviceFunction(
CodeGenModule &CGM, StringRef ParentName,
3968 static void EmitOMPTargetTeamsDistributeDeviceFunction(
3972 static void EmitOMPTargetTeamsDistributeSimdDeviceFunction(
3976 static void EmitOMPTargetSimdDeviceFunction(
CodeGenModule &CGM,
3977 StringRef ParentName,
3981 static void EmitOMPTargetTeamsDistributeParallelForSimdDeviceFunction(
3986 static void EmitOMPTargetTeamsGenericLoopDeviceFunction(
3991 static void EmitOMPTargetParallelGenericLoopDeviceFunction(
3995 static void EmitOMPTargetTeamsDistributeParallelForDeviceFunction(
4004 llvm::CanonicalLoopInfo *EmitOMPCollapsedCanonicalLoopNest(
const Stmt *S,
4020 void EmitOMPInnerLoop(
4022 const Expr *LoopCond,
const Expr *IncExpr,
4029 OMPPrivateScope &LoopScope);
4038 const CodeGenLoopBoundsTy &CodeGenLoopBounds,
4039 const CodeGenDispatchBoundsTy &CGDispatchBounds);
4043 const CodeGenLoopTy &CodeGenLoop,
Expr *IncExpr);
4047 void EmitOMPSimdFinal(
4056 llvm::Value *EmitBlockLiteral(
const CGBlockInfo &Info);
4059 struct OMPLoopArguments {
4061 Address LB = Address::invalid();
4063 Address UB = Address::invalid();
4065 Address ST = Address::invalid();
4067 Address IL = Address::invalid();
4069 llvm::Value *Chunk =
nullptr;
4071 Expr *EUB =
nullptr;
4073 Expr *IncExpr =
nullptr;
4075 Expr *Init =
nullptr;
4077 Expr *Cond =
nullptr;
4079 Expr *NextLB =
nullptr;
4081 Expr *NextUB =
nullptr;
4084 OMPLoopArguments() =
default;
4086 llvm::Value *Chunk =
nullptr,
Expr *EUB =
nullptr,
4087 Expr *IncExpr =
nullptr,
Expr *Init =
nullptr,
4088 Expr *Cond =
nullptr,
Expr *NextLB =
nullptr,
4089 Expr *NextUB =
nullptr)
4090 : LB(LB), UB(UB), ST(ST), IL(IL), Chunk(Chunk), EUB(EUB),
4091 IncExpr(IncExpr), Init(Init), Cond(Cond), NextLB(NextLB),
4094 void EmitOMPOuterLoop(
bool DynamicOrOrdered,
bool IsMonotonic,
4095 const OMPLoopDirective &S, OMPPrivateScope &LoopScope,
4096 const OMPLoopArguments &LoopArgs,
4097 const CodeGenLoopTy &CodeGenLoop,
4098 const CodeGenOrderedTy &CodeGenOrdered);
4099 void EmitOMPForOuterLoop(
const OpenMPScheduleTy &ScheduleKind,
4100 bool IsMonotonic,
const OMPLoopDirective &S,
4101 OMPPrivateScope &LoopScope,
bool Ordered,
4102 const OMPLoopArguments &LoopArgs,
4103 const CodeGenDispatchBoundsTy &CGDispatchBounds);
4104 void EmitOMPDistributeOuterLoop(OpenMPDistScheduleClauseKind ScheduleKind,
4105 const OMPLoopDirective &S,
4106 OMPPrivateScope &LoopScope,
4107 const OMPLoopArguments &LoopArgs,
4108 const CodeGenLoopTy &CodeGenLoopContent);
4110 void EmitSections(
const OMPExecutableDirective &S);
4120 EmitStmt(S.getStructuredBlock());
4127 EmitStmt(S.getLoop());
4134 EmitStmt(S.getLoop());
4141 EmitStmt(S.getStructuredBlock());
4158 EmitStmt(S.getStructuredBlock());
4190 EmitStmt(S.getAssociatedStmt());
4210 RValue EmitUnsupportedRValue(
const Expr *
E,
const char *Name);
4214 LValue EmitUnsupportedLValue(
const Expr *
E,
const char *Name);
4242 LValue EmitCheckedLValue(
const Expr *
E, TypeCheckKind TCK);
4248 bool LValueIsSuitableForInlineAtomic(
LValue Src);
4254 llvm::AtomicOrdering AO,
bool IsVolatile =
false,
4257 void EmitAtomicStore(
RValue rvalue,
LValue lvalue,
bool isInit);
4259 void EmitAtomicStore(
RValue rvalue,
LValue lvalue, llvm::AtomicOrdering AO,
4260 bool IsVolatile,
bool isInit);
4262 std::pair<RValue, llvm::Value *> EmitAtomicCompareExchange(
4264 llvm::AtomicOrdering Success =
4265 llvm::AtomicOrdering::SequentiallyConsistent,
4266 llvm::AtomicOrdering Failure =
4267 llvm::AtomicOrdering::SequentiallyConsistent,
4268 bool IsWeak =
false,
AggValueSlot Slot = AggValueSlot::ignored());
4272 llvm::AtomicRMWInst *emitAtomicRMWInst(
4273 llvm::AtomicRMWInst::BinOp Op,
Address Addr, llvm::Value *Val,
4274 llvm::AtomicOrdering Order = llvm::AtomicOrdering::SequentiallyConsistent,
4275 llvm::SyncScope::ID SSID = llvm::SyncScope::System,
4278 void EmitAtomicUpdate(
LValue LVal, llvm::AtomicOrdering AO,
4288 llvm::Value *EmitFromMemory(llvm::Value *
Value,
QualType Ty);
4303 bool isNontemporal =
false) {
4308 llvm::Value *EmitLoadOfScalar(
Address Addr,
bool Volatile,
QualType Ty,
4311 bool isNontemporal =
false);
4325 bool isInit =
false,
bool isNontemporal =
false) {
4330 void EmitStoreOfScalar(llvm::Value *
Value,
Address Addr,
bool Volatile,
4333 bool isNontemporal =
false);
4340 void EmitStoreOfScalar(llvm::Value *value,
LValue lvalue,
4341 bool isInit =
false);
4359 void EmitStoreThroughLValue(RValue Src, LValue Dst,
bool isInit =
false);
4360 void EmitStoreThroughExtVectorComponentLValue(RValue Src, LValue Dst);
4361 void EmitStoreThroughGlobalRegLValue(RValue Src, LValue Dst);
4369 void EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
4370 llvm::Value **Result =
nullptr);
4376 llvm::Value *&Result);
4382 LValue EmitCallExprLValue(
const CallExpr *
E,
4383 llvm::CallBase **CallOrInvoke =
nullptr);
4385 LValue EmitVAArgExprLValue(
const VAArgExpr *
E);
4392 bool Accessed =
false);
4393 llvm::Value *EmitMatrixIndexExpr(
const Expr *
E);
4396 bool IsLowerBound =
true);
4404 LValue EmitCastLValue(
const CastExpr *
E);
4409 std::pair<LValue, LValue> EmitHLSLOutArgLValues(
const HLSLOutArgExpr *
E,
4414 Address EmitExtVectorElementLValue(LValue
V);
4418 Address EmitArrayToPointerDecay(
const Expr *Array,
4419 LValueBaseInfo *BaseInfo =
nullptr,
4420 TBAAAccessInfo *TBAAInfo =
nullptr);
4423 llvm::PointerIntPair<llvm::Constant *, 1, bool> ValueAndIsReference;
4425 : ValueAndIsReference(C, isReference) {}
4437 return ValueAndIsReference.getOpaqueValue() !=
nullptr;
4442 assert(isReference());
4448 assert(!isReference());
4449 return ValueAndIsReference.getPointer();
4453 ConstantEmission tryEmitAsConstant(
const DeclRefExpr *RefExpr);
4454 ConstantEmission tryEmitAsConstant(
const MemberExpr *ME);
4455 llvm::Value *emitScalarConstant(
const ConstantEmission &Constant,
Expr *
E);
4461 void FlattenAccessAndType(
4471 bool IsInBounds =
true);
4474 llvm::Value *ThisValue);
4505 llvm::CallBase **CallOrInvoke,
bool IsMustTail,
4507 bool IsVirtualFunctionPointerThunk =
false);
4510 llvm::CallBase **CallOrInvoke =
nullptr,
4511 bool IsMustTail =
false) {
4512 return EmitCall(CallInfo, Callee, ReturnValue, Args, CallOrInvoke,
4517 llvm::CallBase **CallOrInvoke =
nullptr,
4524 llvm::CallBase **CallOrInvoke =
nullptr);
4526 llvm::CallBase **CallOrInvoke =
nullptr);
4533 const Twine &name =
"");
4536 const Twine &name =
"");
4538 const Twine &name =
"");
4541 const Twine &name =
"");
4544 const Twine &name =
"");
4547 getBundlesForFunclet(llvm::Value *Callee);
4549 llvm::CallBase *EmitCallOrInvoke(llvm::FunctionCallee Callee,
4551 const Twine &Name =
"");
4552 llvm::CallBase *EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee,
4554 const Twine &name =
"");
4555 llvm::CallBase *EmitRuntimeCallOrInvoke(llvm::FunctionCallee callee,
4556 const Twine &name =
"");
4557 void EmitNoreturnRuntimeCallOrInvoke(llvm::FunctionCallee callee,
4567 bool isPointerKnownNonNull(
const Expr *
E);
4569 bool isUnderlyingBasePointerConstantNull(
const Expr *
E);
4572 llvm::Value *EmitPointerAuthBlendDiscriminator(llvm::Value *StorageAddress,
4573 llvm::Value *Discriminator);
4575 llvm::Value *StorageAddress,
4588 bool IsKnownNonNull);
4589 llvm::Value *emitPointerAuthResignCall(llvm::Value *
Pointer,
4593 void EmitPointerAuthOperandBundle(
4602 bool IsKnownNonNull);
4604 const Expr *PointerExpr,
4610 bool IsKnownNonNull);
4614 std::pair<llvm::Value *, CGPointerAuthInfo>
4615 EmitOrigPointerRValue(
const Expr *
E);
4617 llvm::Value *authPointerToPointerCast(llvm::Value *ResultPtr,
4625 return getAsNaturalAddressOf(
Addr, PointeeType).getBasePointer();
4630 static std::string getNonTrivialCopyConstructorStr(
QualType QT,
4636 static std::string getNonTrivialDestructorStr(
QualType QT,
4643 void defaultInitNonTrivialCStructVar(
LValue Dst);
4644 void callCStructDefaultConstructor(
LValue Dst);
4645 void callCStructDestructor(
LValue Dst);
4646 void callCStructCopyConstructor(
LValue Dst,
LValue Src);
4647 void callCStructMoveConstructor(
LValue Dst,
LValue Src);
4648 void callCStructCopyAssignmentOperator(
LValue Dst,
LValue Src);
4649 void callCStructMoveAssignmentOperator(
LValue Dst,
LValue Src);
4651 RValue EmitCXXMemberOrOperatorCall(
4655 CallArgList *RtlArgs, llvm::CallBase **CallOrInvoke);
4658 llvm::Value *ImplicitParam,
4660 llvm::CallBase **CallOrInvoke =
nullptr);
4663 llvm::CallBase **CallOrInvoke =
nullptr);
4664 RValue EmitCXXMemberOrOperatorMemberCallExpr(
4667 const Expr *
Base, llvm::CallBase **CallOrInvoke);
4669 Address EmitCXXMemberDataPointerAddress(
4675 llvm::CallBase **CallOrInvoke);
4680 llvm::CallBase **CallOrInvoke);
4685 llvm::CallBase **CallOrInvoke);
4703 llvm::Function *generateBuiltinOSLogHelperFunction(
4708 llvm::CallBase **CallOrInvoke);
4712 llvm::Value *EmitTargetBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4716 EmitAArch64CompareBuiltinExpr(llvm::Value *Op, llvm::Type *Ty,
4717 const llvm::CmpInst::Predicate Pred,
4718 const llvm::Twine &Name =
"");
4719 llvm::Value *EmitARMBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4721 llvm::Triple::ArchType
Arch);
4722 llvm::Value *EmitARMMVEBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4724 llvm::Triple::ArchType
Arch);
4725 llvm::Value *EmitARMCDEBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4727 llvm::Triple::ArchType
Arch);
4728 llvm::Value *EmitCMSEClearRecord(llvm::Value *
V, llvm::IntegerType *ITy,
4730 llvm::Value *EmitCMSEClearRecord(llvm::Value *
V, llvm::ArrayType *ATy,
4734 EmitCommonNeonBuiltinExpr(
unsigned BuiltinID,
unsigned LLVMIntrinsic,
4735 unsigned AltLLVMIntrinsic,
const char *NameHint,
4740 llvm::Function *LookupNeonLLVMIntrinsic(
unsigned IntrinsicID,
4741 unsigned Modifier, llvm::Type *ArgTy,
4743 llvm::Value *EmitNeonCall(llvm::Function *F,
4745 unsigned shift = 0,
bool rightshift =
false);
4749 llvm::Value *EmitFP8NeonCvtCall(
unsigned IID, llvm::Type *Ty0,
4750 llvm::Type *Ty1,
bool Extract,
4753 llvm::Value *EmitFP8NeonFDOTCall(
unsigned IID,
bool ExtendLaneArg,
4757 llvm::Value *EmitFP8NeonFMLACall(
unsigned IID,
bool ExtendLaneArg,
4762 const llvm::ElementCount &Count);
4764 llvm::Value *EmitNeonShiftVector(llvm::Value *
V, llvm::Type *Ty,
4765 bool negateForRightShift);
4766 llvm::Value *EmitNeonRShiftImm(llvm::Value *Vec, llvm::Value *Amt,
4767 llvm::Type *Ty,
bool usgn,
const char *name);
4768 llvm::Value *vectorWrapScalar16(llvm::Value *Op);
4772 llvm::Type *SVEBuiltinMemEltTy(
const SVETypeFlags &TypeFlags);
4775 getSVEOverloadTypes(
const SVETypeFlags &TypeFlags, llvm::Type *ReturnType,
4778 llvm::ScalableVectorType *getSVEType(
const SVETypeFlags &TypeFlags);
4779 llvm::ScalableVectorType *getSVEPredType(
const SVETypeFlags &TypeFlags);
4780 llvm::Value *EmitSVETupleSetOrGet(
const SVETypeFlags &TypeFlags,
4782 llvm::Value *EmitSVETupleCreate(
const SVETypeFlags &TypeFlags,
4783 llvm::Type *ReturnType,
4785 llvm::Value *EmitSVEAllTruePred(
const SVETypeFlags &TypeFlags);
4788 llvm::Value *EmitSVEReinterpret(llvm::Value *Val, llvm::Type *Ty);
4789 llvm::Value *EmitSVEPMull(
const SVETypeFlags &TypeFlags,
4791 unsigned BuiltinID);
4792 llvm::Value *EmitSVEMovl(
const SVETypeFlags &TypeFlags,
4794 unsigned BuiltinID);
4795 llvm::Value *EmitSVEPredicateCast(llvm::Value *Pred,
4796 llvm::ScalableVectorType *VTy);
4797 llvm::Value *EmitSVEPredicateTupleCast(llvm::Value *PredTuple,
4798 llvm::StructType *Ty);
4799 llvm::Value *EmitSVEGatherLoad(
const SVETypeFlags &TypeFlags,
4802 llvm::Value *EmitSVEScatterStore(
const SVETypeFlags &TypeFlags,
4805 llvm::Value *EmitSVEMaskedLoad(
const CallExpr *, llvm::Type *ReturnTy,
4807 unsigned BuiltinID,
bool IsZExtReturn);
4808 llvm::Value *EmitSVEMaskedStore(
const CallExpr *,
4810 unsigned BuiltinID);
4811 llvm::Value *EmitSVEPrefetchLoad(
const SVETypeFlags &TypeFlags,
4813 unsigned BuiltinID);
4814 llvm::Value *EmitSVEGatherPrefetch(
const SVETypeFlags &TypeFlags,
4817 llvm::Value *EmitSVEStructLoad(
const SVETypeFlags &TypeFlags,
4820 llvm::Value *EmitSVEStructStore(
const SVETypeFlags &TypeFlags,
4823 llvm::Value *EmitAArch64SVEBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4825 llvm::Value *EmitSMELd1St1(
const SVETypeFlags &TypeFlags,
4828 llvm::Value *EmitSMEReadWrite(
const SVETypeFlags &TypeFlags,
4831 llvm::Value *EmitSMEZero(
const SVETypeFlags &TypeFlags,
4834 llvm::Value *EmitSMELdrStr(
const SVETypeFlags &TypeFlags,
4838 void GetAArch64SVEProcessedOperands(
unsigned BuiltinID,
const CallExpr *
E,
4842 llvm::Value *EmitAArch64SMEBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4844 llvm::Value *EmitAArch64BuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4845 llvm::Triple::ArchType
Arch);
4846 llvm::Value *EmitBPFBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4849 llvm::Value *EmitX86BuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4850 llvm::Value *EmitPPCBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4851 llvm::Value *EmitAMDGPUBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4852 llvm::Value *EmitHLSLBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4860 llvm::Value *EmitDirectXBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4861 llvm::Value *EmitSPIRVBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4862 llvm::Value *EmitScalarOrConstFoldImmArg(
unsigned ICEArguments,
unsigned Idx,
4864 llvm::Value *EmitSystemZBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4865 llvm::Value *EmitNVPTXBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4866 llvm::Value *EmitWebAssemblyBuiltinExpr(
unsigned BuiltinID,
4868 llvm::Value *EmitHexagonBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E);
4869 llvm::Value *EmitRISCVBuiltinExpr(
unsigned BuiltinID,
const CallExpr *
E,
4872 llvm::Value *EmitRISCVCpuSupports(
const CallExpr *
E);
4874 llvm::Value *EmitRISCVCpuInit();
4875 llvm::Value *EmitRISCVCpuIs(
const CallExpr *
E);
4876 llvm::Value *EmitRISCVCpuIs(StringRef CPUStr);
4878 void AddAMDGPUFenceAddressSpaceMMRA(llvm::Instruction *Inst,
4880 void ProcessOrderScopeAMDGCN(llvm::Value *Order, llvm::Value *
Scope,
4881 llvm::AtomicOrdering &AO,
4882 llvm::SyncScope::ID &SSID);
4887 llvm::Value *EmitBuiltinAvailable(
const VersionTuple &Version);
4895 EmitObjCCollectionLiteral(
const Expr *
E,
4904 return CGM.
getCodeGenOpts().ObjCAutoRefCountExceptions ? NormalAndEHCleanup
4909 void EmitARCInitWeak(
Address addr, llvm::Value *value);
4910 void EmitARCDestroyWeak(
Address addr);
4911 llvm::Value *EmitARCLoadWeak(
Address addr);
4912 llvm::Value *EmitARCLoadWeakRetained(
Address addr);
4913 llvm::Value *EmitARCStoreWeak(
Address addr, llvm::Value *value,
bool ignored);
4918 llvm::Value *EmitARCRetainAutorelease(
QualType type, llvm::Value *value);
4919 llvm::Value *EmitARCRetainAutoreleaseNonBlock(llvm::Value *value);
4920 llvm::Value *EmitARCStoreStrong(
LValue lvalue, llvm::Value *value,
4921 bool resultIgnored);
4922 llvm::Value *EmitARCStoreStrongCall(
Address addr, llvm::Value *value,
4923 bool resultIgnored);
4924 llvm::Value *EmitARCRetain(
QualType type, llvm::Value *value);
4925 llvm::Value *EmitARCRetainNonBlock(llvm::Value *value);
4926 llvm::Value *EmitARCRetainBlock(llvm::Value *value,
bool mandatory);
4929 llvm::Value *EmitARCAutorelease(llvm::Value *value);
4930 llvm::Value *EmitARCAutoreleaseReturnValue(llvm::Value *value);
4931 llvm::Value *EmitARCRetainAutoreleaseReturnValue(llvm::Value *value);
4932 llvm::Value *EmitARCRetainAutoreleasedReturnValue(llvm::Value *value);
4933 llvm::Value *EmitARCUnsafeClaimAutoreleasedReturnValue(llvm::Value *value);
4935 llvm::Value *EmitObjCAutorelease(llvm::Value *value, llvm::Type *returnType);
4936 llvm::Value *EmitObjCRetainNonBlock(llvm::Value *value,
4937 llvm::Type *returnType);
4940 std::pair<LValue, llvm::Value *>
4942 std::pair<LValue, llvm::Value *> EmitARCStoreStrong(
const BinaryOperator *e,
4944 std::pair<LValue, llvm::Value *>
4945 EmitARCStoreUnsafeUnretained(
const BinaryOperator *e,
bool ignored);
4947 llvm::Value *EmitObjCAlloc(llvm::Value *value, llvm::Type *returnType);
4948 llvm::Value *EmitObjCAllocWithZone(llvm::Value *value,
4949 llvm::Type *returnType);
4950 llvm::Value *EmitObjCAllocInit(llvm::Value *value, llvm::Type *resultType);
4952 llvm::Value *EmitObjCThrowOperand(
const Expr *expr);
4953 llvm::Value *EmitObjCConsumeObject(
QualType T, llvm::Value *Ptr);
4954 llvm::Value *EmitObjCExtendObjectLifetime(
QualType T, llvm::Value *Ptr);
4956 llvm::Value *EmitARCExtendBlockObject(
const Expr *expr);
4957 llvm::Value *EmitARCReclaimReturnedObject(
const Expr *e,
4958 bool allowUnsafeClaim);
4959 llvm::Value *EmitARCRetainScalarExpr(
const Expr *expr);
4960 llvm::Value *EmitARCRetainAutoreleaseScalarExpr(
const Expr *expr);
4961 llvm::Value *EmitARCUnsafeUnretainedScalarExpr(
const Expr *expr);
4973 void EmitObjCAutoreleasePoolPop(llvm::Value *Ptr);
4974 llvm::Value *EmitObjCAutoreleasePoolPush();
4975 llvm::Value *EmitObjCMRRAutoreleasePoolPush();
4976 void EmitObjCAutoreleasePoolCleanup(llvm::Value *Ptr);
4977 void EmitObjCMRRAutoreleasePoolPop(llvm::Value *Ptr);
4990 llvm::Value *EmitScalarExpr(
const Expr *
E,
bool IgnoreResultAssign =
false);
4994 llvm::Value *EmitScalarConversion(llvm::Value *Src,
QualType SrcTy,
5021 void CreateCoercedStore(llvm::Value *Src,
Address Dst, llvm::TypeSize DstSize,
5022 bool DstIsVolatile);
5026 void EmitExtendGCLifetime(llvm::Value *
object);
5031 bool IgnoreImag =
false);
5035 void EmitComplexExprIntoLValue(
const Expr *
E,
LValue dest,
bool isInit);
5044 llvm::Value *EmitPromotedScalarExpr(
const Expr *
E,
QualType PromotionType);
5056 llvm::GlobalVariable *AddInitializerToStaticVarDecl(
const VarDecl &
D,
5057 llvm::GlobalVariable *GV);
5060 void EmitInvariantStart(llvm::Constant *Addr,
CharUnits Size);
5064 void EmitCXXGlobalVarDeclInit(
const VarDecl &
D, llvm::GlobalVariable *GV,
5067 llvm::Constant *createAtExitStub(
const VarDecl &VD, llvm::FunctionCallee Dtor,
5068 llvm::Constant *Addr);
5070 llvm::Function *createTLSAtExitStub(
const VarDecl &VD,
5071 llvm::FunctionCallee Dtor,
5072 llvm::Constant *Addr,
5073 llvm::FunctionCallee &AtExit);
5077 void registerGlobalDtorWithAtExit(
const VarDecl &
D, llvm::FunctionCallee fn,
5078 llvm::Constant *addr);
5082 void registerGlobalDtorWithLLVM(
const VarDecl &
D, llvm::FunctionCallee fn,
5083 llvm::Constant *addr);
5086 void registerGlobalDtorWithAtExit(llvm::Constant *dtorStub);
5089 llvm::Value *unregisterGlobalDtorWithUnAtExit(llvm::Constant *dtorStub);
5096 void EmitCXXGuardedInit(
const VarDecl &
D, llvm::GlobalVariable *DeclPtr,
5102 void EmitCXXGuardedInitBranch(llvm::Value *NeedsInit,
5103 llvm::BasicBlock *InitBlock,
5104 llvm::BasicBlock *NoInitBlock, GuardKind
Kind,
5110 GenerateCXXGlobalInitFunc(llvm::Function *Fn,
5116 void GenerateCXXGlobalCleanUpFunc(
5118 ArrayRef<std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH,
5120 DtorsOrStermFinalizers);
5122 void GenerateCXXGlobalVarDeclInitFunc(llvm::Function *Fn,
const VarDecl *
D,
5123 llvm::GlobalVariable *Addr,
5130 void EmitCXXThrowExpr(
const CXXThrowExpr *
E,
bool KeepInsertionPoint =
true);
5134 void EmitFakeUse(
Address Addr);
5141 llvm::Value *EmitAnnotationCall(llvm::Function *AnnotationFn,
5142 llvm::Value *AnnotatedVal,
5143 StringRef AnnotationStr,
5145 const AnnotateAttr *
Attr);
5148 void EmitVarAnnotations(
const VarDecl *
D, llvm::Value *
V);
5161 static bool ContainsLabel(
const Stmt *S,
bool IgnoreCaseStmts =
false);
5166 static bool containsBreak(
const Stmt *S);
5170 static bool mightAddDeclToScope(
const Stmt *S);
5175 bool ConstantFoldsToSimpleInteger(
const Expr *Cond,
bool &Result,
5176 bool AllowLabels =
false);
5181 bool ConstantFoldsToSimpleInteger(
const Expr *Cond, llvm::APSInt &Result,
5182 bool AllowLabels =
false);
5185 static const Expr *stripCond(
const Expr *C);
5189 static bool isInstrumentedCondition(
const Expr *C);
5196 llvm::BasicBlock *TrueBlock,
5197 llvm::BasicBlock *FalseBlock,
5198 uint64_t TrueCount = 0,
5200 const Expr *CntrIdx =
nullptr);
5207 void EmitBranchOnBoolExpr(
const Expr *Cond, llvm::BasicBlock *TrueBlock,
5208 llvm::BasicBlock *FalseBlock, uint64_t TrueCount,
5210 const Expr *ConditionalOp =
nullptr,
5211 const VarDecl *ConditionalDecl =
nullptr);
5219 enum { NotSubtraction =
false, IsSubtraction =
true };
5223 Expr *pointerOperand, llvm::Value *pointer,
5224 Expr *indexOperand, llvm::Value *index,
5225 bool isSubtraction);
5234 bool SignedIndices,
bool IsSubtraction,
5236 const Twine &Name =
"");
5239 llvm::Type *elementType,
bool SignedIndices,
5241 CharUnits Align,
const Twine &Name =
"");
5253 llvm::Value *EmitCheckedArgForBuiltin(
const Expr *
E, BuiltinCheckKind
Kind);
5257 llvm::Value *EmitCheckedArgForAssume(
const Expr *
E);
5261 llvm::Constant *EmitCheckTypeDescriptor(
QualType T);
5265 llvm::Value *EmitCheckValue(llvm::Value *
V);
5271 void EmitKCFIOperandBundle(
const CGCallee &Callee,
5278 EmitCheck(
ArrayRef<std::pair<llvm::Value *, SanitizerKind::SanitizerOrdinal>>
5287 llvm::Value *Cond, llvm::ConstantInt *TypeId,
5298 bool NoMerge =
false,
const TrapReason *TR =
nullptr);
5302 llvm::CallInst *EmitTrapCall(llvm::Intrinsic::ID IntrID);
5305 void EmitCfiCheckStub();
5308 void EmitCfiCheckFail();
5313 AbstractCallee AC,
unsigned ParmNum);
5333 void SetFPAccuracy(llvm::Value *Val,
float Accuracy);
5337 void SetSqrtFPAccuracy(llvm::Value *Val);
5341 void SetDivFPAccuracy(llvm::Value *Val);
5344 void SetFastMathFlags(
FPOptions FPFeatures);
5347 llvm::Value *emitBoolVecConversion(llvm::Value *SrcVec,
5348 unsigned NumElementsDst,
5349 const llvm::Twine &Name =
"");
5351 void maybeAttachRangeForLoad(llvm::LoadInst *Load,
QualType Ty,
5357 llvm::ConvergenceControlInst *emitConvergenceLoopToken(llvm::BasicBlock *BB);
5361 llvm::CallBase *addConvergenceControlToken(llvm::CallBase *Input);
5365 llvm::ConvergenceControlInst *
5366 getOrEmitConvergenceEntryToken(llvm::Function *F);
5369 llvm::MDNode *getRangeForLoadFromType(
QualType Ty);
5372 void deferPlaceholderReplacement(llvm::Instruction *Old, llvm::Value *
New);
5375 DeferredReplacements;
5379 assert(!LocalDeclMap.count(VD) &&
"Decl already exists in LocalDeclMap!");
5380 LocalDeclMap.insert({VD,
Addr});
5387 void ExpandTypeFromArgs(QualType Ty, LValue Dst,
5388 llvm::Function::arg_iterator &AI);
5393 void ExpandTypeToArgs(QualType Ty, CallArg Arg, llvm::FunctionType *IRFuncTy,
5394 SmallVectorImpl<llvm::Value *> &IRCallArgs,
5395 unsigned &IRCallArgPos);
5397 std::pair<llvm::Value *, llvm::Type *>
5398 EmitAsmInput(
const TargetInfo::ConstraintInfo &Info,
const Expr *InputExpr,
5399 std::string &ConstraintStr);
5401 std::pair<llvm::Value *, llvm::Type *>
5402 EmitAsmInputLValue(
const TargetInfo::ConstraintInfo &Info, LValue InputValue,
5403 QualType InputType, std::string &ConstraintStr,
5404 SourceLocation
Loc);
5411 llvm::Value *evaluateOrEmitBuiltinObjectSize(
const Expr *
E,
unsigned Type,
5412 llvm::IntegerType *ResType,
5413 llvm::Value *EmittedE,
5419 llvm::Value *emitBuiltinObjectSize(
const Expr *
E,
unsigned Type,
5420 llvm::IntegerType *ResType,
5421 llvm::Value *EmittedE,
bool IsDynamic);
5423 llvm::Value *emitCountedBySize(
const Expr *
E, llvm::Value *EmittedE,
5424 unsigned Type, llvm::IntegerType *ResType);
5426 llvm::Value *emitCountedByMemberSize(
const MemberExpr *
E,
const Expr *Idx,
5427 llvm::Value *EmittedE,
5428 QualType CastedArrayElementTy,
5430 llvm::IntegerType *ResType);
5432 llvm::Value *emitCountedByPointerSize(
const ImplicitCastExpr *
E,
5433 const Expr *Idx, llvm::Value *EmittedE,
5434 QualType CastedArrayElementTy,
5436 llvm::IntegerType *ResType);
5438 void emitZeroOrPatternForAutoVarInit(QualType type,
const VarDecl &
D,
5454 llvm::PointerUnion<const FunctionProtoType *, const ObjCMethodDecl *>
P;
5460 void EmitCallArgs(
CallArgList &Args, PrototypeWrapper Prototype,
5461 llvm::iterator_range<CallExpr::const_arg_iterator> ArgRange,
5462 AbstractCallee AC = AbstractCallee(),
5463 unsigned ParamsToSkip = 0,
5464 EvaluationOrder Order = EvaluationOrder::Default);
5491 llvm::Value *LoadPassedObjectSize(
const Expr *
E,
QualType EltTy);
5493 void EmitSanitizerStatReport(llvm::SanitizerStatKind SSK);
5501 std::optional<StringRef>
Arch = std::nullopt)
5508 void EmitMultiVersionResolver(llvm::Function *Resolver,
5510 void EmitX86MultiVersionResolver(llvm::Function *Resolver,
5512 void EmitAArch64MultiVersionResolver(llvm::Function *Resolver,
5514 void EmitRISCVMultiVersionResolver(llvm::Function *Resolver,
5520 void EmitDeclMetadata();
5523 const AutoVarEmission &emission);
5525 void AddObjCARCExceptionMetadata(llvm::Instruction *Inst);
5527 llvm::Value *GetValueForARMHint(
unsigned BuiltinID);
5528 llvm::Value *EmitX86CpuIs(
const CallExpr *
E);
5529 llvm::Value *EmitX86CpuIs(StringRef CPUStr);
5530 llvm::Value *EmitX86CpuSupports(
const CallExpr *
E);
5532 llvm::Value *EmitX86CpuSupports(std::array<uint32_t, 4> FeatureMask);
5533 llvm::Value *EmitX86CpuInit();
5534 llvm::Value *FormX86ResolverCondition(
const FMVResolverOption &RO);
5535 llvm::Value *EmitAArch64CpuInit();
5536 llvm::Value *FormAArch64ResolverCondition(
const FMVResolverOption &RO);
5537 llvm::Value *EmitAArch64CpuSupports(
const CallExpr *
E);
5543 if (!needsSaving(value))
5559 if (!value.getInt())
5560 return value.getPointer();
5563 auto alloca = cast<llvm::AllocaInst>(value.getPointer());
5565 alloca->getAlign());
5572llvm::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.