Go to the documentation of this file.
13 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
14 #define LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
32 #include "llvm/ADT/DenseMap.h"
33 #include "llvm/ADT/SetVector.h"
34 #include "llvm/ADT/SmallPtrSet.h"
35 #include "llvm/ADT/StringMap.h"
36 #include "llvm/IR/Module.h"
37 #include "llvm/IR/ValueHandle.h"
38 #include "llvm/Transforms/Utils/SanitizerStats.h"
50 class IndexedInstrProfReader;
62 class ObjCImplementationDecl;
75 class HeaderSearchOptions;
76 class DiagnosticsEngine;
78 class CXXDestructorDecl;
80 class CoverageSourceInfo;
85 class CodeGenFunction;
90 class CGOpenCLRuntime;
91 class CGOpenMPRuntime;
94 class CoverageMappingModuleGen;
95 class TargetCodeGenInfo;
216 uint32_t VisitedInMainFile;
217 uint32_t MissingInMainFile;
224 : VisitedInMainFile(0), MissingInMainFile(0), Visited(0), Missing(0),
265 void Profile(llvm::FoldingSetNodeID &
id)
const {
269 virtual void profileImpl(llvm::FoldingSetNodeID &
id)
const = 0;
308 unsigned NumAutoVarInit = 0;
309 llvm::Module &TheModule;
312 std::unique_ptr<CGCXXABI> ABI;
313 llvm::LLVMContext &VMContext;
315 bool CXX20ModuleInits =
false;
316 std::unique_ptr<CodeGenTBAA> TBAA;
318 mutable std::unique_ptr<TargetCodeGenInfo> TheTargetCodeGenInfo;
329 std::unique_ptr<CGOpenCLRuntime> OpenCLRuntime;
330 std::unique_ptr<CGOpenMPRuntime> OpenMPRuntime;
331 std::unique_ptr<CGCUDARuntime> CUDARuntime;
332 std::unique_ptr<CGHLSLRuntime> HLSLRuntime;
333 std::unique_ptr<CGDebugInfo> DebugInfo;
334 std::unique_ptr<ObjCEntrypoints> ObjCData;
335 llvm::MDNode *NoObjCARCExceptionsMetadata =
nullptr;
336 std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader;
338 std::unique_ptr<llvm::SanitizerStatReport> SanStats;
349 llvm::DenseMap<StringRef, GlobalDecl> DeferredDecls;
353 std::vector<GlobalDecl> DeferredDeclsToEmit;
355 DeferredDeclsToEmit.emplace_back(GD);
356 addEmittedDeferredDecl(GD);
360 llvm::DenseMap<llvm::StringRef, GlobalDecl> EmittedDeferredDecls;
363 if (!llvm::isa<FunctionDecl>(GD.
getDecl()))
366 if (llvm::GlobalValue::isLinkOnceLinkage(L) ||
367 llvm::GlobalValue::isWeakLinkage(L)) {
374 std::vector<GlobalDecl> Aliases;
379 std::vector<GlobalDecl> MultiVersionFuncs;
381 typedef llvm::StringMap<llvm::TrackingVH<llvm::Constant> > ReplacementsTy;
382 ReplacementsTy Replacements;
388 GlobalValReplacements;
392 llvm::DenseMap<const VarDecl*, llvm::GlobalVariable*> InitializerConstants;
400 std::vector<const CXXRecordDecl*> DeferredVTables;
403 std::vector<const CXXRecordDecl *> OpportunisticVTables;
408 std::vector<llvm::WeakTrackingVH> LLVMUsed;
409 std::vector<llvm::WeakTrackingVH> LLVMCompilerUsed;
420 llvm::MapVector<GlobalDecl, StringRef> MangledDeclNames;
421 llvm::StringMap<GlobalDecl, llvm::BumpPtrAllocator> Manglings;
424 std::vector<llvm::Constant*> Annotations;
427 llvm::StringMap<llvm::Constant*> AnnotationStrings;
430 llvm::DenseMap<unsigned, llvm::Constant *> AnnotationArgs;
432 llvm::StringMap<llvm::GlobalVariable *> CFConstantStringMap;
434 llvm::DenseMap<llvm::Constant *, llvm::GlobalVariable *> ConstantStringMap;
435 llvm::DenseMap<const UnnamedGlobalConstantDecl *, llvm::GlobalVariable *>
436 UnnamedGlobalConstantDeclMap;
437 llvm::DenseMap<const Decl*, llvm::Constant *> StaticLocalDeclMap;
438 llvm::DenseMap<const Decl*, llvm::GlobalVariable*> StaticLocalDeclGuardMap;
439 llvm::DenseMap<const Expr*, llvm::Constant *> MaterializedGlobalTemporaryMap;
441 llvm::DenseMap<QualType, llvm::Constant *> AtomicSetterHelperFnMap;
442 llvm::DenseMap<QualType, llvm::Constant *> AtomicGetterHelperFnMap;
445 llvm::DenseMap<QualType, llvm::Constant *> TypeDescriptorMap;
449 typedef llvm::MapVector<IdentifierInfo *,
450 llvm::GlobalValue *> StaticExternCMap;
451 StaticExternCMap StaticExternCValues;
454 std::vector<const VarDecl *> CXXThreadLocals;
458 std::vector<llvm::Function *> CXXThreadLocalInits;
459 std::vector<const VarDecl *> CXXThreadLocalInitVars;
462 std::vector<llvm::Function *> CXXGlobalInits;
469 llvm::DenseMap<const Decl*, unsigned> DelayedCXXInitPosition;
471 typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>
474 struct GlobalInitPriorityCmp {
475 bool operator()(
const GlobalInitData &LHS,
476 const GlobalInitData &RHS)
const {
477 return LHS.first.priority < RHS.first.priority;
483 SmallVector<GlobalInitData, 8> PrioritizedCXXGlobalInits;
488 typedef std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH,
490 CXXGlobalDtorsOrStermFinalizer_t;
491 SmallVector<CXXGlobalDtorsOrStermFinalizer_t, 8>
492 CXXGlobalDtorsOrStermFinalizers;
494 typedef std::pair<OrderGlobalInitsOrStermFinalizers, llvm::Function *>
497 struct StermFinalizerPriorityCmp {
498 bool operator()(
const StermFinalizerData &LHS,
499 const StermFinalizerData &RHS)
const {
500 return LHS.first.priority < RHS.first.priority;
506 SmallVector<StermFinalizerData, 8> PrioritizedCXXStermFinalizers;
509 llvm::SetVector<clang::Module *> ImportedModules;
516 SmallVector<llvm::MDNode *, 16> LinkerOptionsMetadata;
519 SmallVector<llvm::MDNode *, 16> ELFDependentLibraries;
526 llvm::WeakTrackingVH CFConstantStringClassRef;
530 QualType ObjCFastEnumerationStateType;
535 void createObjCRuntime();
537 void createOpenCLRuntime();
538 void createOpenMPRuntime();
539 void createCUDARuntime();
540 void createHLSLRuntime();
542 bool isTriviallyRecursive(
const FunctionDecl *F);
543 bool shouldEmitFunction(GlobalDecl GD);
544 bool shouldOpportunisticallyEmitVTables();
546 llvm::DenseMap<const CompoundLiteralExpr *, llvm::GlobalVariable *>
547 EmittedCompoundLiterals;
551 llvm::DenseMap<const BlockExpr *, llvm::Constant *> EmittedGlobalBlocks;
556 llvm::Constant *NSConcreteGlobalBlock =
nullptr;
557 llvm::Constant *NSConcreteStackBlock =
nullptr;
559 llvm::FunctionCallee BlockObjectAssign =
nullptr;
560 llvm::FunctionCallee BlockObjectDispose =
nullptr;
562 llvm::Type *BlockDescriptorType =
nullptr;
563 llvm::Type *GenericBlockLiteralType =
nullptr;
574 llvm::Function *LifetimeStartFn =
nullptr;
577 llvm::Function *LifetimeEndFn =
nullptr;
579 std::unique_ptr<SanitizerMetadata> SanitizerMD;
581 llvm::MapVector<const Decl *, bool> DeferredEmptyCoverageMappingDecls;
583 std::unique_ptr<CoverageMappingModuleGen> CoverageMapping;
588 typedef llvm::DenseMap<QualType, llvm::Metadata *> MetadataTypeMap;
589 MetadataTypeMap MetadataIdMap;
590 MetadataTypeMap VirtualMetadataIdMap;
591 MetadataTypeMap GeneralizedMetadataIdMap;
593 llvm::DenseMap<const llvm::Constant *, llvm::GlobalVariable *> RTTIProxyMap;
598 GlobalTopLevelStmtBlockInFlight;
631 assert(OpenCLRuntime !=
nullptr);
632 return *OpenCLRuntime;
637 assert(OpenMPRuntime !=
nullptr);
638 return *OpenMPRuntime;
643 assert(CUDARuntime !=
nullptr);
649 assert(HLSLRuntime !=
nullptr);
654 assert(ObjCData !=
nullptr);
665 llvm::IndexedInstrProfReader *
getPGOReader()
const {
return PGOReader.get(); }
668 return CoverageMapping.get();
672 return StaticLocalDeclMap[D];
676 StaticLocalDeclMap[D] = C;
681 llvm::GlobalValue::LinkageTypes
Linkage);
684 return StaticLocalDeclGuardMap[D];
687 llvm::GlobalVariable *C) {
688 StaticLocalDeclGuardMap[D] = C;
698 return AtomicSetterHelperFnMap[Ty];
701 llvm::Constant *Fn) {
702 AtomicSetterHelperFnMap[Ty] = Fn;
706 return AtomicGetterHelperFnMap[Ty];
709 llvm::Constant *Fn) {
710 AtomicGetterHelperFnMap[Ty] = Fn;
714 return TypeDescriptorMap[Ty];
717 TypeDescriptorMap[Ty] = C;
723 if (!NoObjCARCExceptionsMetadata)
724 NoObjCARCExceptionsMetadata =
726 return NoObjCARCExceptionsMetadata;
735 const {
return HeaderSearchOpts; }
737 const {
return PreprocessorOpts; }
742 return TheModule.getDataLayout();
814 if (
Base.getTBAAInfo().isMayAlias())
870 llvm_unreachable(
"unknown visibility!");
881 llvm::GlobalVariable *
883 llvm::GlobalValue::LinkageTypes
Linkage,
884 llvm::Align Alignment);
889 llvm::GlobalVariable::LinkageTypes
Linkage =
916 llvm::Type *Ty =
nullptr,
923 bool ForVTable =
false,
924 bool DontDefer =
false,
1007 return EmittedGlobalBlocks.lookup(BE);
1028 StringRef Name =
".str");
1041 const char *GlobalName =
nullptr);
1049 llvm::GlobalVariable *
1055 llvm::GlobalVariable *GV);
1074 llvm::FunctionType *FnType =
nullptr,
1075 bool DontDefer =
false,
1085 llvm::FunctionType *FnType =
nullptr,
bool DontDefer =
false,
1091 unsigned BuiltinID);
1120 template<
typename SomeDecl>
1134 CXXGlobalDtorsOrStermFinalizers.emplace_back(DtorFn.getFunctionType(),
1135 DtorFn.getCallee(), Object);
1140 CXXGlobalDtorsOrStermFinalizers.emplace_back(DtorFn.getFunctionType(),
1141 DtorFn.getCallee(),
nullptr);
1147 AddGlobalDtor(StermFinalizer,
Priority);
1153 PrioritizedCXXStermFinalizers.size());
1154 PrioritizedCXXStermFinalizers.push_back(
1155 std::make_pair(Key, StermFinalizer));
1161 llvm::FunctionCallee
1163 llvm::AttributeList ExtraAttrs = llvm::AttributeList(),
1164 bool Local =
false,
bool AssumeConvergent =
false);
1219 llvm::Function *F,
bool IsThunk);
1254 llvm::AttributeList &Attrs,
unsigned &
CallingConv,
1255 bool AttrOnCallSite,
bool IsThunk);
1316 llvm::GlobalValue::LinkageTypes
1318 bool IsConstantVariable);
1321 llvm::GlobalValue::LinkageTypes
1347 const AnnotateAttr *AA,
1359 StringRef Category = StringRef())
const;
1365 StringRef Category = StringRef())
const;
1379 return SanitizerMD.get();
1383 DeferredVTables.push_back(RD);
1443 llvm::GlobalObject::VCallVisibility
1449 llvm::GlobalVariable *VTable,
1501 std::vector<const CXXRecordDecl *>
1504 llvm::GlobalVariable *
1537 bool forPointeeType =
false);
1549 const Decl *D)
const;
1557 llvm::Constant *GetOrCreateLLVMFunction(
1558 StringRef MangledName, llvm::Type *Ty,
GlobalDecl D,
bool ForVTable,
1559 bool DontDefer =
false,
bool IsThunk =
false,
1560 llvm::AttributeList ExtraAttrs = llvm::AttributeList(),
1568 llvm::Constant *GetOrCreateMultiVersionResolver(
GlobalDecl GD);
1576 StringRef &CurName);
1579 GetOrCreateLLVMGlobal(StringRef MangledName, llvm::Type *Ty,
LangAS AddrSpace,
1583 bool GetCPUAndFeaturesAttributes(
GlobalDecl GD,
1584 llvm::AttrBuilder &AttrBuilder);
1585 void setNonAliasAttributes(
GlobalDecl GD, llvm::GlobalObject *GO);
1588 void SetFunctionAttributes(
GlobalDecl GD, llvm::Function *F,
1589 bool IsIncompleteFunction,
bool IsThunk);
1591 void EmitGlobalDefinition(
GlobalDecl D, llvm::GlobalValue *GV =
nullptr);
1593 void EmitGlobalFunctionDefinition(
GlobalDecl GD, llvm::GlobalValue *GV);
1594 void EmitMultiVersionFunctionDefinition(
GlobalDecl GD, llvm::GlobalValue *GV);
1596 void EmitGlobalVarDefinition(
const VarDecl *D,
bool IsTentative =
false);
1597 void EmitExternalVarDeclaration(
const VarDecl *D);
1600 void emitCPUDispatchDefinition(
GlobalDecl GD);
1611 void EmitCXXThreadLocalInitFunc();
1617 void EmitCXXGlobalInitFunc();
1620 void EmitCXXGlobalCleanUpFunc();
1624 void EmitCXXGlobalVarDeclInitFunc(
const VarDecl *D,
1625 llvm::GlobalVariable *Addr,
1628 void EmitPointerToInitFunc(
const VarDecl *VD, llvm::GlobalVariable *Addr,
1629 llvm::Function *InitFunc, InitSegAttr *ISA);
1632 void AddGlobalCtor(llvm::Function *Ctor,
int Priority = 65535,
1633 unsigned LexOrder = ~0
U,
1634 llvm::Constant *AssociatedData =
nullptr);
1635 void AddGlobalDtor(llvm::Function *Dtor,
int Priority = 65535,
1636 bool IsDtorAttrFunc =
false);
1641 void EmitCtorList(
CtorList &Fns,
const char *GlobalName);
1644 void EmitDeferred();
1650 void EmitVTablesOpportunistically();
1653 void applyReplacements();
1656 void applyGlobalValReplacements();
1658 void checkAliases();
1660 std::map<int, llvm::TinyPtrVector<llvm::Function *>> DtorsUsingAtExit;
1664 void registerGlobalDtorsWithAtExit();
1669 void unregisterGlobalDtorsWithUnAtExit();
1672 void emitMultiVersionFunctions();
1675 void EmitDeferredVTables();
1679 void emitAtAvailableLinkGuard();
1682 void emitLLVMUsed();
1688 void EmitModuleLinkOptions();
1697 bool CheckAndReplaceExternCIFuncs(llvm::GlobalValue *Elem,
1698 llvm::GlobalValue *CppFunc);
1702 void EmitStaticExternCAliases();
1704 void EmitDeclMetadata();
1707 void EmitVersionIdentMetadata();
1710 void EmitCommandLineMetadata();
1714 void EmitBackendOptionsMetadata(
const CodeGenOptions CodeGenOpts);
1717 void EmitOpenCLMetadata();
1721 void EmitCoverageFile();
1731 bool MayBeEmittedEagerly(
const ValueDecl *D);
1735 void SimplifyPersonality();
1740 void getDefaultFunctionAttributes(StringRef Name,
bool HasOptnone,
1741 bool AttrOnCallSite,
1742 llvm::AttrBuilder &FuncAttrs);
1744 llvm::Metadata *CreateMetadataIdentifierImpl(
QualType T, MetadataTypeMap &Map,
1751 #endif // LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
ProfileList::ExclusionType isFunctionBlockedByProfileList(llvm::Function *Fn, SourceLocation Loc) const
bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor)
isTypeConstant - Determine whether an object of this type can be emitted as a constant.
@ InternalLinkage
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
llvm::FunctionCallee objc_autoreleasePoolPop
void objc_autoreleasePoolPop(void*);
virtual ~BlockByrefHelpers()
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
llvm::Value * createOpenCLIntToSamplerConversion(const Expr *E, CodeGenFunction &CGF)
This represents '#pragma omp allocate ...' directive.
void addUsedOrCompilerUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.compiler.used metadata.
bool isExplicitDefaultVisibilityExportMapping() const
void MaybeHandleStaticInExternC(const SomeDecl *D, llvm::GlobalValue *GV)
If the declaration has internal linkage but is inside an extern "C" linkage specification,...
llvm::FunctionCallee objc_allocWithZone
void objc_allocWithZone(id);
llvm::GlobalVariable * getStaticLocalDeclGuardAddress(const VarDecl *D)
@ HiddenVisibility
Objects with "hidden" visibility are not seen by the dynamic linker.
llvm::Constant * GetAddrOfGlobalVar(const VarDecl *D, llvm::Type *Ty=nullptr, ForDefinition_t IsForDefinition=NotForDefinition)
Return the llvm::Constant for the address of the given global variable.
YAML serialization mapping.
A specialization of Address that requires the address to be an LLVM Constant.
void addDeferredVTable(const CXXRecordDecl *RD)
bool lookupRepresentativeDecl(StringRef MangledName, GlobalDecl &Result) const
llvm::Function * objc_retainAutoreleasedReturnValue
id objc_retainAutoreleasedReturnValue(id);
llvm::Constant * EmitNullConstant(QualType T)
Return the result of value-initializing the given type, i.e.
llvm::FunctionCallee CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeList ExtraAttrs=llvm::AttributeList(), bool Local=false, bool AssumeConvergent=false)
Create or return a runtime function declaration with the specified type and name.
void setAddrOfGlobalBlock(const BlockExpr *BE, llvm::Constant *Addr)
Notes that BE's global block is available via Addr.
void ClearUnusedCoverageMapping(const Decl *D)
Remove the deferred empty coverage mapping as this declaration is actually instrumented.
BlockByrefHelpers(CharUnits alignment)
ItaniumVTableContext & getItaniumVTableContext()
Represents a linkage specification.
llvm::Metadata * CreateMetadataIdentifierGeneralized(QualType T)
Create a metadata identifier for the generalization of the given type.
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool hasDiagnostics()
Whether or not the stats we've gathered indicate any potential problems.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
void addUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.used metadata.
CGOpenCLRuntime & getOpenCLRuntime()
Return a reference to the configured OpenCL runtime.
This class records statistics on instrumentation based profiling.
llvm::Function * clang_arc_noop_use
void clang.arc.noop.use(...);
llvm::Function * codegenCXXStructor(GlobalDecl GD)
CharUnits getDynamicOffsetAlignment(CharUnits ActualAlign, const CXXRecordDecl *Class, CharUnits ExpectedTargetAlign)
Given a class pointer with an actual known alignment, and the expected alignment of an object at a dy...
llvm::Constant * GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty=nullptr, bool ForVTable=false, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)
Return the address of the given function.
llvm::MDNode * getTBAAAccessTagInfo(TBAAAccessInfo Info)
getTBAAAccessTagInfo - Get TBAA tag for a given memory access.
llvm::Function * objc_retainAutoreleaseReturnValue
id objc_retainAutoreleaseReturnValue(id);
void setAtomicSetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
Encodes a location in the source.
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
TBAAAccessInfo mergeTBAAInfoForCast(TBAAAccessInfo SourceInfo, TBAAAccessInfo TargetInfo)
mergeTBAAInfoForCast - Get merged TBAA information for the purposes of type casts.
This represents '#pragma omp threadprivate ...' directive.
void SetInternalFunctionAttributes(GlobalDecl GD, llvm::Function *F, const CGFunctionInfo &FI)
Set the attributes on the LLVM function for the given decl and function info.
bool HasHiddenLTOVisibility(const CXXRecordDecl *RD)
Returns whether the given record has hidden LTO visibility and therefore may participate in (single-m...
This represents a decl that may have a name.
CtorList & getGlobalDtors()
llvm::ConstantInt * getSize(CharUnits numChars)
Emit the given number of characters as a value of type size_t.
llvm::Function * objc_autoreleaseReturnValue
id objc_autoreleaseReturnValue(id);
A (possibly-)qualified type.
void setAtomicGetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
GVALinkage
A more specific kind of linkage than enum Linkage.
ASTContext & getContext() const
bool AlwaysHasLTOVisibilityPublic(const CXXRecordDecl *RD)
Returns whether the given record has public LTO visibility (regardless of -lto-whole-program-visibili...
Concrete class used by the front-end to report problems and issues.
llvm::Constant * DisposeHelper
llvm::GlobalValue::LinkageTypes getLLVMLinkageForDeclarator(const DeclaratorDecl *D, GVALinkage Linkage, bool IsConstantVariable)
Returns LLVM linkage for a declarator.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
void AddCXXStermFinalizerToGlobalDtor(llvm::Function *StermFinalizer, int Priority)
Add an sterm finalizer to its own llvm.global_dtors entry.
Exposes information about the current target.
void Release()
Finalize LLVM code generation.
CharUnits getMinimumClassObjectSize(const CXXRecordDecl *CD)
Returns the minimum object size for an object of the given class type (or a class derived from it).
TBAAAccessInfo getTBAAInfoForSubobject(LValue Base, QualType AccessType)
getTBAAInfoForSubobject - Get TBAA information for an access with a given base lvalue.
bool operator<(const OrderGlobalInitsOrStermFinalizers &RHS) const
LinkageInfo getLinkageAndVisibility() const
Determines the linkage and visibility of this entity.
OrderGlobalInitsOrStermFinalizers(unsigned int p, unsigned int l)
LangAS GetGlobalVarAddressSpace(const VarDecl *D)
Return the AST address space of the underlying global variable for D, as determined by its declaratio...
ExclusionType
Represents if an how something should be excluded from profiling.
void AddCXXStermFinalizerEntry(llvm::FunctionCallee DtorFn)
Add an sterm finalizer to the C++ global cleanup function.
llvm::Type * getGenericBlockLiteralType()
The type of a generic block literal.
bool ReturnTypeUsesFPRet(QualType ResultType)
Return true iff the given type uses 'fpret' when used as a return type.
CGHLSLRuntime & getHLSLRuntime()
Return a reference to the configured HLSL runtime.
virtual void emitCopy(CodeGenFunction &CGF, Address dest, Address src)=0
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
void SetLLVMFunctionAttributes(GlobalDecl GD, const CGFunctionInfo &Info, llvm::Function *F, bool IsThunk)
Set the LLVM function attributes (sext, zext, etc).
const LangOptions & getLangOpts() const
bool isVisibilityExplicit() const
llvm::Constant * getAtomicGetterHelperFnMap(QualType Ty)
llvm::Function * CreateGlobalInitOrCleanUpFunction(llvm::FunctionType *ty, const Twine &name, const CGFunctionInfo &FI, SourceLocation Loc=SourceLocation(), bool TLS=false, llvm::GlobalVariable::LinkageTypes Linkage=llvm::GlobalVariable::InternalLinkage)
void EmitMainVoidAlias()
Emit an alias for "main" if it has no arguments (needed for wasm).
const TargetCodeGenInfo & getTargetCodeGenInfo()
bool ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI)
Return true iff the given type uses an argument slot when 'sret' is used as a return type.
Stores additional source code information like skipped ranges which is required by the coverage mappi...
llvm::Function * objc_autoreleasePoolPush
void *objc_autoreleasePoolPush(void);
CharUnits computeNonVirtualBaseClassOffset(const CXXRecordDecl *DerivedClass, CastExpr::path_const_iterator Start, CastExpr::path_const_iterator End)
void addMismatched(bool MainFile)
Record that a function we've visited has mismatched profile data.
@ ProtectedVisibility
Objects with "protected" visibility are seen by the dynamic linker but always dynamically resolve to ...
llvm::Constant * EmitAnnotationUnit(SourceLocation Loc)
Emit the annotation's translation unit.
llvm::IndexedInstrProfReader * getPGOReader() const
StringRef getMangledName(GlobalDecl GD)
void ConstructAttributeList(StringRef Name, const CGFunctionInfo &Info, CGCalleeInfo CalleeInfo, llvm::AttributeList &Attrs, unsigned &CallingConv, bool AttrOnCallSite, bool IsThunk)
Get the LLVM attributes and calling convention to use for a particular function type.
void EmitGlobal(GlobalDecl D)
Emit code for a single global function or var decl.
void setDLLImportDLLExport(llvm::GlobalValue *GV, GlobalDecl D) const
The base class of the type hierarchy.
void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const
Set the visibility for the given LLVM GlobalValue.
virtual bool needsDispose() const
CGOpenMPRuntime & getOpenMPRuntime()
Return a reference to the configured OpenMP runtime.
llvm::GlobalValue * GetGlobalValue(StringRef Ref)
GlobalDecl - represents a global declaration.
llvm::Constant * GetFunctionStart(const ValueDecl *Decl)
void GenKernelArgMetadata(llvm::Function *FN, const FunctionDecl *FD=nullptr, CodeGenFunction *CGF=nullptr)
OpenCL v1.2 s5.6.4.6 allows the compiler to store kernel argument information in the program executab...
void setAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *CLE, llvm::GlobalVariable *GV)
Notes that CLE's GlobalVariable is GV.
LangAS GetGlobalConstantAddressSpace() const
Return the AST address space of constant literal, which is used to emit the constant literal as globa...
void EmitTopLevelDecl(Decl *D)
Emit code for a single top level declaration.
llvm::Function * clang_arc_use
void clang.arc.use(...);
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const ItaniumVTableContext & getItaniumVTableContext() const
void printPostfixForExternalizedDecl(llvm::raw_ostream &OS, const Decl *D) const
Print the postfix for externalized static variable or kernels for single source offloading languages ...
uint32_t Literal
Literals are represented as positive integers.
llvm::Constant * getOrCreateStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)
llvm::Function * objc_copyWeak
void objc_copyWeak(id *dest, id *src);
void addMissing(bool MainFile)
Record that a function we've visited has no profile data.
ConstantAddress GetAddrOfConstantCFString(const StringLiteral *Literal)
Return a pointer to a constant CFString object for the given string.
void AddDependentLib(StringRef Lib)
Appends a dependent lib to the appropriate metadata value.
This structure provides a set of types that are commonly used during IR emission.
void EmitOMPDeclareMapper(const OMPDeclareMapperDecl *D, CodeGenFunction *CGF=nullptr)
Emit a code for declare mapper construct.
void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F)
Set the LLVM function attributes which only apply to a function definition.
llvm::InlineAsm * retainAutoreleasedReturnValueMarker
A void(void) inline asm to use to mark that the return value of a call will be immediately retain.
llvm::Metadata * CreateMetadataIdentifierForType(QualType T)
Create a metadata identifier for the given type.
llvm::Constant * getAddrOfGlobalBlockIfEmitted(const BlockExpr *BE)
Returns the address of a block which requires no caputres, or null if we've yet to emit the block for...
Describes a module or submodule.
void finalizeKCFITypes()
Emit KCFI type identifier constants and remove unused identifiers.
Organizes the cross-function state that is used while generating code coverage mapping data.
This represents '#pragma omp declare reduction ...' directive.
CharUnits getVBaseAlignment(CharUnits DerivedAlign, const CXXRecordDecl *Derived, const CXXRecordDecl *VBase)
Returns the assumed alignment of a virtual base of a class.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
llvm::Function * objc_release
void objc_release(id);
CGObjCRuntime & getObjCRuntime()
Return a reference to the configured Objective-C runtime.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
CharUnits getClassPointerAlignment(const CXXRecordDecl *CD)
Returns the assumed alignment of an opaque pointer to the given class.
llvm::SanitizerStatReport & getSanStats()
A pair of helper functions for a __block variable.
bool isPaddedAtomicType(QualType type)
CharUnits getNaturalPointeeTypeAlignment(QualType T, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr)
void setTypeDescriptorInMap(QualType Ty, llvm::Constant *C)
const GlobalDecl getMangledNameDecl(StringRef)
bool ReturnTypeUsesSRet(const CGFunctionInfo &FI)
Return true iff the given type uses 'sret' when used as a return type.
const CodeGenOptions & getCodeGenOpts() const
llvm::ConstantInt * CreateKCFITypeId(QualType T)
Generate a KCFI type identifier for T.
Address createUnnamedGlobalFrom(const VarDecl &D, llvm::Constant *Constant, CharUnits Align)
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
CharUnits getMinimumObjectSize(QualType Ty)
Returns the minimum object size for an object of the given type.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
llvm::Constant * EmitAnnotationArgs(const AnnotateAttr *Attr)
Emit additional args of the annotation.
void maybeSetTrivialComdat(const Decl &D, llvm::GlobalObject &GO)
void addVisited(bool MainFile)
Record that we've visited a function and whether or not that function was in the main source file.
llvm::MDNode * getTBAABaseTypeInfo(QualType QTy)
getTBAABaseTypeInfo - Get metadata that describes the given base access type.
MicrosoftVTableContext & getMicrosoftVTableContext()
void RefreshTypeCacheForClass(const CXXRecordDecl *Class)
virtual bool needsCopy() const
CtorList & getGlobalCtors()
llvm::Constant * GetAddrOfGlobal(GlobalDecl GD, ForDefinition_t IsForDefinition=NotForDefinition)
llvm::Function * objc_storeStrong
void objc_storeStrong(id*, id);
llvm::Type * getVTableComponentType() const
TBAAAccessInfo getTBAAVTablePtrAccessInfo(llvm::Type *VTablePtrType)
getTBAAVTablePtrAccessInfo - Get the TBAA information that describes an access to a virtual table poi...
llvm::GlobalVariable * CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage, llvm::Align Alignment)
Will return a global variable of the given type.
llvm::Module & getModule() const
Represents a C++ destructor within a class.
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
bool shouldUseTBAA() const
void setFunctionLinkage(GlobalDecl GD, llvm::Function *F)
void EmitTentativeDefinition(const VarDecl *D)
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Represents a variable declaration or definition.
void EmitDeferredUnusedCoverageMappings()
Emit all the deferred coverage mappings for the uninstrumented functions.
void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV)
Add global annotations that are set on D, for the global GV.
bool imbueXRayAttrs(llvm::Function *Fn, SourceLocation Loc, StringRef Category=StringRef()) const
Imbue XRay attributes to a function, applying the always/never attribute lists in the process.
llvm::Constant * Initializer
void EmitOMPAllocateDecl(const OMPAllocateDecl *D)
Emit a code for the allocate directive.
Represents the declaration of a struct/union/class/enum.
This represents '#pragma omp declare mapper ...' directive.
void EmitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D)
Emit a code for threadprivate directive.
StringLiteral - This represents a string literal expression, e.g.
CodeGenTypes & getTypes()
CoverageMappingModuleGen * getCoverageMapping() const
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
llvm::FunctionCallee getBlockObjectDispose()
llvm::GlobalVariable * GetOrCreateRTTIProxyGlobalVariable(llvm::Constant *Addr)
ConstantAddress GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *E)
Returns a pointer to a constant global variable for the given file-scope compound literal expression.
ObjCEncodeExpr, used for @encode in Objective-C.
llvm::Constant * GetAddrOfGlobalBlock(const BlockExpr *BE, StringRef Name)
Gets the address of a block which requires no captures.
void AddCXXPrioritizedStermFinalizerEntry(llvm::Function *StermFinalizer, int Priority)
void AppendLinkerOptions(StringRef Opts)
Appends Opts to the "llvm.linker.options" metadata value.
llvm::FunctionCallee getAddrAndTypeOfCXXStructor(GlobalDecl GD, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)
bool operator==(const OrderGlobalInitsOrStermFinalizers &RHS) const
llvm::Constant * getAtomicSetterHelperFnMap(QualType Ty)
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
llvm::Function * objc_autorelease
id objc_autorelease(id);
void EmitVTableTypeMetadata(const CXXRecordDecl *RD, llvm::GlobalVariable *VTable, const VTableLayout &VTLayout)
Emit type metadata for the given vtable using the given layout.
llvm::Function * objc_retainAutorelease
id objc_retainAutorelease(id);
A template parameter object.
Visibility getVisibility() const
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD)
Tell the consumer that this variable has been instantiated.
const TargetInfo & getTarget() const
bool isAllDefaultVisibilityExportMapping() const
llvm::FoldingSet< BlockByrefHelpers > ByrefHelpersCache
llvm::FunctionCallee objc_alloc_init
void objc_alloc_init(id);
A declaration that models statements at global scope.
Visibility
Describes the different kinds of visibility that a declaration may have.
CGDebugInfo * getModuleDebugInfo()
llvm::Type * getBlockDescriptorType()
Fetches the type of a generic block descriptor.
llvm::Function * objc_retain
id objc_retain(id);
void EmitGlobalAnnotations()
Emit all the global annotations.
llvm::ConstantInt * CreateCrossDsoCfiTypeId(llvm::Metadata *MD)
Generate a cross-DSO type identifier for MD.
CharUnits GetTargetTypeStoreSize(llvm::Type *Ty) const
Return the store size, in character units, of the given LLVM type.
llvm::Function * objc_initWeak
id objc_initWeak(id*, id);
llvm::Constant * GetConstantArrayFromStringLiteral(const StringLiteral *E)
Return a constant array for the given string.
LangAS
Defines the address space values used by the address space qualifier of QualType.
llvm::FunctionCallee IsPlatformVersionAtLeastFn
const llvm::DataLayout & getDataLayout() const
CompoundLiteralExpr - [C99 6.5.2.5].
llvm::FunctionCallee objc_autoreleasePoolPopInvoke
void objc_autoreleasePoolPop(void*); Note this method is used when we are using exception handling
Represents a C++ struct/union/class.
const IntrusiveRefCntPtr< llvm::vfs::FileSystem > & getFileSystem() const
bool shouldMapVisibilityToDLLExport(const NamedDecl *D) const
LValue - This represents an lvalue references.
ConstantAddress GetAddrOfTemplateParamObject(const TemplateParamObjectDecl *TPO)
Get the address of a template parameter object.
MicrosoftVTableContext & getMicrosoftVTableContext()
bool hasDefaultVisibilityExportMapping() const
llvm::Constant * getNSConcreteGlobalBlock()
const typedef CXXBaseSpecifier *const * path_const_iterator
CharUnits Alignment
The alignment of the field.
void AddDeferredUnusedCoverageMapping(Decl *D)
Stored a deferred empty coverage mapping for an unused and thus uninstrumented top level declaration.
llvm::FunctionCallee getTerminateFn()
Get the declaration of std::terminate for the platform.
void EmitExplicitCastExprType(const ExplicitCastExpr *E, CodeGenFunction *CGF=nullptr)
Emit type info if type of an expression is a variably modified type.
void setStaticLocalDeclAddress(const VarDecl *D, llvm::Constant *C)
void ErrorUnsupported(const Stmt *S, const char *Type)
Print out an error that codegen doesn't support the specified stmt yet.
ConstantAddress GetAddrOfConstantString(const StringLiteral *Literal)
Return a pointer to a constant NSString object for the given string.
llvm::Metadata * CreateMetadataIdentifierForVirtualMemPtrType(QualType T)
Create a metadata identifier that is intended to be used to check virtual calls via a member function...
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
llvm::Constant * getBuiltinLibFunction(const FunctionDecl *FD, unsigned BuiltinID)
Given a builtin id for a function like "__builtin_fabsf", return a Function* for "fabsf".
QualType getObjCFastEnumerationStateType()
Retrieve the record type that describes the state of an Objective-C fast enumeration loop (for....
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
llvm::Constant * CreateRuntimeVariable(llvm::Type *Ty, StringRef Name)
Create a new runtime global variable with the specified type and name.
CGCXXABI & getCXXABI() const
std::vector< const CXXRecordDecl * > getMostBaseClasses(const CXXRecordDecl *RD)
Return a vector of most-base classes for RD.
llvm::Constant * GetNonVirtualBaseClassOffset(const CXXRecordDecl *ClassDecl, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd)
Returns the offset from a derived class to a class.
This class organizes the cross-function state that is used while generating LLVM code.
llvm::Function * getIntrinsic(unsigned IID, ArrayRef< llvm::Type * > Tys=std::nullopt)
llvm::Constant * GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH=false)
Get the address of the RTTI descriptor for the given type.
void setDSOLocal(llvm::GlobalValue *GV) const
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
CodeGenVTables & getVTables()
void EmitOMPDeclareReduction(const OMPDeclareReductionDecl *D, CodeGenFunction *CGF=nullptr)
Emit a code for declare reduction construct.
Decl - This represents one declaration (or definition), e.g.
ConstantAddress GetAddrOfMSGuidDecl(const MSGuidDecl *GD)
Get the address of a GUID.
Represents a ValueDecl that came out of a declarator.
const llvm::Triple & getTriple() const
ProfileList::ExclusionType isFunctionBlockedFromProfileInstr(llvm::Function *Fn, SourceLocation Loc) const
bool MayDropFunctionReturn(const ASTContext &Context, QualType ReturnType) const
Whether this function's return type has no side effects, and thus may be trivially discarded if it is...
llvm::Function * objc_loadWeak
id objc_loadWeak(id*);
void CreateFunctionTypeMetadataForIcall(const FunctionDecl *FD, llvm::Function *F)
Create and attach type metadata to the given function.
void setKCFIType(const FunctionDecl *FD, llvm::Function *F)
Set type metadata to the given function.
void setLLVMFunctionFEnvAttributes(const FunctionDecl *D, llvm::Function *F)
Set the LLVM function attributes that represent floating point environment.
llvm::Constant * getStaticLocalDeclAddress(const VarDecl *D)
bool ReturnTypeUsesFP2Ret(QualType ResultType)
Return true iff the given type uses 'fp2ret' when used as a return type.
llvm::Function * objc_destroyWeak
void objc_destroyWeak(id*);
llvm::FunctionCallee getBlockObjectAssign()
void EmitVTable(CXXRecordDecl *Class)
This is a callback from Sema to tell us that a particular vtable is required to be emitted in this tr...
This class organizes the cross-module state that is used while lowering AST types to LLVM types.
llvm::FunctionCallee objc_releaseRuntimeFunction
void objc_release(id); Note this is the runtime method not the intrinsic.
llvm::FunctionCallee objc_retainRuntimeFunction
id objc_retain(id); Note this is the runtime method not the intrinsic.
llvm::GlobalVariable::ThreadLocalMode GetDefaultLLVMTLSModel() const
Get LLVM TLS mode from CodeGenOptions.
void Profile(llvm::FoldingSetNodeID &id) const
void addDefaultFunctionDefinitionAttributes(llvm::Function &F)
Adds attributes to F according to our CodeGenOptions and LangOptions, as though we had emitted it our...
TBAAAccessInfo getTBAAAccessInfo(QualType AccessType)
getTBAAAccessInfo - Get TBAA information that describes an access to an object of the given type.
void DecorateInstructionWithTBAA(llvm::Instruction *Inst, TBAAAccessInfo TBAAInfo)
DecorateInstructionWithTBAA - Decorate the instruction with a TBAA tag.
void EmitExternalDeclaration(const VarDecl *D)
llvm::Constant * getNSConcreteStackBlock()
Abstract information about a function or function prototype.
The basic abstraction for the target Objective-C runtime.
llvm::Constant * getNullPointer(llvm::PointerType *T, QualType QT)
Get target specific null pointer.
llvm::FunctionCallee IsOSVersionAtLeastFn
void reportDiagnostics(DiagnosticsEngine &Diags, StringRef MainFile)
Report potential problems we've found to Diags.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
ConstantAddress GetAddrOfConstantStringFromLiteral(const StringLiteral *S, StringRef Name=".str")
Return a pointer to a constant array for the given string literal.
bool supportsCOMDAT() const
CGFunctionInfo - Class to encapsulate the information about a function definition.
bool NeedAllVtablesTypeId() const
Returns whether this module needs the "all-vtables" type identifier.
llvm::Constant * EmitAnnotateAttr(llvm::GlobalValue *GV, const AnnotateAttr *AA, SourceLocation L)
Generate the llvm::ConstantStruct which contains the annotation information for a given GlobalValue.
Structor(int Priority, unsigned LexOrder, llvm::Constant *Initializer, llvm::Constant *AssociatedData)
llvm::Function * objc_unsafeClaimAutoreleasedReturnValue
id objc_unsafeClaimAutoreleasedReturnValue(id);
llvm::GlobalObject::VCallVisibility GetVCallVisibilityLevel(const CXXRecordDecl *RD, llvm::DenseSet< const CXXRecordDecl * > &Visited)
Returns the vcall visibility of the given type.
const HeaderSearchOptions & getHeaderSearchOpts() const
const PreprocessorOptions & getPreprocessorOpts() const
llvm::Constant * getMemberPointerConstant(const UnaryOperator *e)
const std::string & getModuleNameHash() const
virtual void profileImpl(llvm::FoldingSetNodeID &id) const =0
__DEVICE__ void * memset(void *__a, int __b, size_t __c)
llvm::Function * objc_moveWeak
void objc_moveWeak(id *dest, id *src);
void setStaticLocalDeclGuardAddress(const VarDecl *D, llvm::GlobalVariable *C)
std::vector< Structor > CtorList
void addCompilerUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.compiler.used metadata.
llvm::GlobalVariable::LinkageTypes getVTableLinkage(const CXXRecordDecl *RD)
Return the appropriate linkage for the vtable, VTT, and type information of the given class.
void addReplacement(StringRef Name, llvm::Constant *C)
ConstantAddress GetAddrOfConstantCString(const std::string &Str, const char *GlobalName=nullptr)
Returns a pointer to a character array containing the literal and a terminating '\0' character.
Stmt - This represents one statement.
bool TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D)
Try to emit a base destructor as an alias to its primary base-class destructor.
std::optional< CharUnits > getOMPAllocateAlignment(const VarDecl *VD)
Return the alignment specified in an allocate directive, if present.
llvm::FunctionCallee objc_alloc
void objc_alloc(id);
static llvm::GlobalValue::VisibilityTypes GetLLVMVisibility(Visibility V)
@ DefaultVisibility
Objects with "default" visibility are seen by the dynamic linker and act like normal objects.
llvm::Function * getLLVMLifetimeEndFn()
Lazily declare the @llvm.lifetime.end intrinsic.
llvm::Function * objc_retainBlock
id objc_retainBlock(id);
CharUnits getNaturalTypeAlignment(QualType T, LValueBaseInfo *BaseInfo=nullptr, TBAAAccessInfo *TBAAInfo=nullptr, bool forPointeeType=false)
llvm::Function * objc_loadWeakRetained
id objc_loadWeakRetained(id*);
int getUniqueBlockCount()
Fetches the global unique block count.
Attr - This represents one attribute.
InstrProfStats & getPGOStats()
This represents '#pragma omp requires...' directive.
llvm::FunctionCallee objc_autoreleaseRuntimeFunction
id objc_autorelease(id); Note this is the runtime method not the intrinsic.
static TBAAAccessInfo getMayAliasInfo()
DiagnosticsEngine & getDiags() const
ConstantAddress GetWeakRefReference(const ValueDecl *VD)
Get a reference to the target of VD.
llvm::MDNode * getNoObjCARCExceptionsMetadata()
TBAAAccessInfo mergeTBAAInfoForConditionalOperator(TBAAAccessInfo InfoA, TBAAAccessInfo InfoB)
mergeTBAAInfoForConditionalOperator - Get merged TBAA information for the purposes of conditional ope...
void AddDetectMismatch(StringRef Name, StringRef Value)
Appends a detect mismatch command to the linker options.
llvm::GlobalValue::LinkageTypes getLLVMLinkageVarDefinition(const VarDecl *VD, bool IsConstant)
Returns LLVM linkage for a declarator.
const Decl * getDecl() const
CGCUDARuntime & getCUDARuntime()
Return a reference to the configured CUDA runtime.
void UpdateCompletedType(const TagDecl *TD)
StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD)
llvm::Constant * EmitAnnotationString(StringRef Str)
Emit an annotation string.
llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD)
Implements C++ ABI-specific code generation functions.
CharUnits - This is an opaque type for sizes expressed in character units.
ConstantAddress GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *)
Return a pointer to a constant array for the given ObjCEncodeExpr node.
void setGVPropertiesAux(llvm::GlobalValue *GV, const NamedDecl *D) const
llvm::Constant * GetAddrOfThunk(StringRef Name, llvm::Type *FnTy, GlobalDecl GD)
Get the address of the thunk for the given global decl.
This represents one expression.
ItaniumVTableContext & getItaniumVTableContext()
llvm::Constant * getAddrOfCXXStructor(GlobalDecl GD, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false, ForDefinition_t IsForDefinition=NotForDefinition)
Return the address of the constructor/destructor of the given type.
void setGVProperties(llvm::GlobalValue *GV, GlobalDecl GD) const
Set visibility, dllimport/dllexport and dso_local.
ConstantAddress GetAddrOfUnnamedGlobalConstantDecl(const UnnamedGlobalConstantDecl *GCD)
Get the address of a UnnamedGlobalConstant.
llvm::Function * getLLVMLifetimeStartFn()
Lazily declare the @llvm.lifetime.start intrinsic.
ObjCEntrypoints & getObjCEntrypoints() const
void AddVTableTypeMetadata(llvm::GlobalVariable *VTable, CharUnits Offset, const CXXRecordDecl *RD)
Create and attach type metadata for the given vtable.
void DecorateInstructionWithInvariantGroup(llvm::Instruction *I, const CXXRecordDecl *RD)
Adds !invariant.barrier !tag to instruction.
llvm::Constant * CopyHelper
Represents a function declaration or definition.
virtual void emitDispose(CodeGenFunction &CGF, Address field)=0
void setTLSMode(llvm::GlobalValue *GV, const VarDecl &D) const
Set the TLS mode for the given LLVM GlobalValue for the thread-local variable declaration D.
void AddCXXDtorEntry(llvm::FunctionCallee DtorFn, llvm::Constant *Object)
Add a destructor and object to add to the C++ global destructor function.
ConstantAddress GetAddrOfGlobalTemporary(const MaterializeTemporaryExpr *E, const Expr *Inner)
Returns a pointer to a global variable representing a temporary with static or thread storage duratio...
void addGlobalValReplacement(llvm::GlobalValue *GV, llvm::Constant *C)
llvm::GlobalVariable * getAddrOfConstantCompoundLiteralIfEmitted(const CompoundLiteralExpr *E)
If it's been emitted already, returns the GlobalVariable corresponding to a compound literal.
SanitizerMetadata * getSanitizerMetadata()
void moveLazyEmissionStates(CodeGenModule *NewBuilder)
Move some lazily-emitted states to the NewBuilder.
llvm::Constant * AssociatedData
llvm::Constant * EmitAnnotationLineNo(SourceLocation L)
Emit the annotation line number.
bool hasObjCRuntime()
Return true iff an Objective-C runtime has been configured.
llvm::Function * objc_storeWeak
id objc_storeWeak(id*, id);
void Error(SourceLocation loc, StringRef error)
Emit a general error that something can't be done.
llvm::LLVMContext & getLLVMContext()
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
TBAAAccessInfo mergeTBAAInfoForMemoryTransfer(TBAAAccessInfo DestInfo, TBAAAccessInfo SrcInfo)
mergeTBAAInfoForMemoryTransfer - Get merged TBAA information for the purposes of memory transfer call...
void EmitOMPRequiresDecl(const OMPRequiresDecl *D)
Emit a code for requires directive.
ExplicitCastExpr - An explicit cast written in the source code.
void SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV)
Set attributes which are common to any form of a global definition (alias, Objective-C method,...
llvm::Constant * EmitNullConstantForBase(const CXXRecordDecl *Record)
Return a null constant appropriate for zero-initializing a base class with the given type.
Implements runtime-specific code generation functions.
llvm::Constant * getTypeDescriptorFromMap(QualType Ty)
bool isInNoSanitizeList(SanitizerMask Kind, llvm::Function *Fn, SourceLocation Loc) const
llvm::MDNode * getTBAAStructInfo(QualType QTy)
llvm::MDNode * getTBAATypeInfo(QualType QTy)
getTBAATypeInfo - Get metadata used to describe accesses to objects of the given type.
bool getExpressionLocationsEnabled() const
Return true if we should emit location information for expressions.