13 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H 14 #define LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H 30 #include "llvm/ADT/DenseMap.h" 31 #include "llvm/ADT/SetVector.h" 32 #include "llvm/ADT/SmallPtrSet.h" 33 #include "llvm/ADT/StringMap.h" 34 #include "llvm/IR/Module.h" 35 #include "llvm/IR/ValueHandle.h" 36 #include "llvm/Transforms/Utils/SanitizerStats.h" 47 class OpenMPIRBuilder;
48 class IndexedInstrProfReader;
57 class ObjCImplementationDecl;
58 class ObjCCategoryImplDecl;
59 class ObjCProtocolDecl;
73 class HeaderSearchOptions;
74 class PreprocessorOptions;
75 class DiagnosticsEngine;
77 class CXXDestructorDecl;
79 class CoverageSourceInfo;
82 struct ParsedTargetAttr;
87 class CodeGenFunction;
92 class CGOpenCLRuntime;
95 class BlockFieldFlags;
96 class FunctionArgList;
97 class CoverageMappingModuleGen;
98 class TargetCodeGenInfo;
109 : priority(p), lex_order(l) {}
116 return std::tie(priority, lex_order) <
216 uint32_t VisitedInMainFile;
217 uint32_t MissingInMainFile;
224 : VisitedInMainFile(0), MissingInMainFile(0), Visited(0), Missing(0),
261 : CopyHelper(nullptr), DisposeHelper(nullptr), Alignment(alignment) {}
265 void Profile(llvm::FoldingSetNodeID &
id)
const {
269 virtual void profileImpl(llvm::FoldingSetNodeID &
id)
const = 0;
288 llvm::Constant *AssociatedData)
289 : Priority(Priority), Initializer(Initializer),
290 AssociatedData(AssociatedData) {}
304 llvm::Module &TheModule;
307 std::unique_ptr<CGCXXABI> ABI;
308 llvm::LLVMContext &VMContext;
310 std::unique_ptr<CodeGenTBAA> TBAA;
312 mutable std::unique_ptr<TargetCodeGenInfo> TheTargetCodeGenInfo;
323 std::unique_ptr<CGOpenCLRuntime> OpenCLRuntime;
324 std::unique_ptr<CGOpenMPRuntime> OpenMPRuntime;
325 std::unique_ptr<llvm::OpenMPIRBuilder> OMPBuilder;
326 std::unique_ptr<CGCUDARuntime> CUDARuntime;
327 std::unique_ptr<CGDebugInfo> DebugInfo;
328 std::unique_ptr<ObjCEntrypoints> ObjCData;
329 llvm::MDNode *NoObjCARCExceptionsMetadata =
nullptr;
330 std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader;
332 std::unique_ptr<llvm::SanitizerStatReport> SanStats;
337 llvm::SmallPtrSet<llvm::GlobalValue*, 10> WeakRefReferences;
343 std::map<StringRef, GlobalDecl> DeferredDecls;
347 std::vector<GlobalDecl> DeferredDeclsToEmit;
349 DeferredDeclsToEmit.emplace_back(GD);
354 std::vector<GlobalDecl> Aliases;
358 std::vector<GlobalDecl> MultiVersionFuncs;
360 typedef llvm::StringMap<llvm::TrackingVH<llvm::Constant> > ReplacementsTy;
361 ReplacementsTy Replacements;
367 GlobalValReplacements;
371 llvm::DenseMap<const VarDecl*, llvm::GlobalVariable*> InitializerConstants;
379 std::vector<const CXXRecordDecl*> DeferredVTables;
382 std::vector<const CXXRecordDecl *> OpportunisticVTables;
387 std::vector<llvm::WeakTrackingVH> LLVMUsed;
388 std::vector<llvm::WeakTrackingVH> LLVMCompilerUsed;
392 CtorList GlobalCtors;
396 CtorList GlobalDtors;
399 llvm::MapVector<GlobalDecl, StringRef> MangledDeclNames;
400 llvm::StringMap<GlobalDecl, llvm::BumpPtrAllocator> Manglings;
404 llvm::MapVector<std::pair<GlobalDecl, unsigned>, StringRef>
405 CPUSpecificMangledDeclNames;
406 llvm::StringMap<std::pair<GlobalDecl, unsigned>, llvm::BumpPtrAllocator>
407 CPUSpecificManglings;
410 std::vector<llvm::Constant*> Annotations;
413 llvm::StringMap<llvm::Constant*> AnnotationStrings;
415 llvm::StringMap<llvm::GlobalVariable *> CFConstantStringMap;
417 llvm::DenseMap<llvm::Constant *, llvm::GlobalVariable *> ConstantStringMap;
418 llvm::DenseMap<const Decl*, llvm::Constant *> StaticLocalDeclMap;
419 llvm::DenseMap<const Decl*, llvm::GlobalVariable*> StaticLocalDeclGuardMap;
420 llvm::DenseMap<const Expr*, llvm::Constant *> MaterializedGlobalTemporaryMap;
422 llvm::DenseMap<QualType, llvm::Constant *> AtomicSetterHelperFnMap;
423 llvm::DenseMap<QualType, llvm::Constant *> AtomicGetterHelperFnMap;
426 llvm::DenseMap<QualType, llvm::Constant *> TypeDescriptorMap;
431 llvm::GlobalValue *> StaticExternCMap;
432 StaticExternCMap StaticExternCValues;
435 std::vector<const VarDecl *> CXXThreadLocals;
439 std::vector<llvm::Function *> CXXThreadLocalInits;
440 std::vector<const VarDecl *> CXXThreadLocalInitVars;
443 std::vector<llvm::Function *> CXXGlobalInits;
450 llvm::DenseMap<const Decl*, unsigned> DelayedCXXInitPosition;
452 typedef std::pair<OrderGlobalInits, llvm::Function*> GlobalInitData;
454 struct GlobalInitPriorityCmp {
455 bool operator()(
const GlobalInitData &LHS,
456 const GlobalInitData &RHS)
const {
457 return LHS.first.priority < RHS.first.priority;
467 std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH, llvm::Constant *>>
471 llvm::SetVector<clang::Module *> ImportedModules;
475 llvm::SmallPtrSet<clang::Module *, 16> EmittedModuleInitializers;
488 llvm::WeakTrackingVH CFConstantStringClassRef;
492 QualType ObjCFastEnumerationStateType;
497 void createObjCRuntime();
499 void createOpenCLRuntime();
500 void createOpenMPRuntime();
501 void createCUDARuntime();
505 bool shouldOpportunisticallyEmitVTables();
507 llvm::DenseMap<const CompoundLiteralExpr *, llvm::GlobalVariable *>
508 EmittedCompoundLiterals;
512 llvm::DenseMap<const BlockExpr *, llvm::Constant *> EmittedGlobalBlocks;
517 llvm::Constant *NSConcreteGlobalBlock =
nullptr;
518 llvm::Constant *NSConcreteStackBlock =
nullptr;
520 llvm::FunctionCallee BlockObjectAssign =
nullptr;
521 llvm::FunctionCallee BlockObjectDispose =
nullptr;
523 llvm::Type *BlockDescriptorType =
nullptr;
524 llvm::Type *GenericBlockLiteralType =
nullptr;
535 llvm::Function *LifetimeStartFn =
nullptr;
538 llvm::Function *LifetimeEndFn =
nullptr;
540 std::unique_ptr<SanitizerMetadata> SanitizerMD;
542 llvm::MapVector<const Decl *, bool> DeferredEmptyCoverageMappingDecls;
544 std::unique_ptr<CoverageMappingModuleGen> CoverageMapping;
549 typedef llvm::DenseMap<QualType, llvm::Metadata *> MetadataTypeMap;
550 MetadataTypeMap MetadataIdMap;
551 MetadataTypeMap VirtualMetadataIdMap;
552 MetadataTypeMap GeneralizedMetadataIdMap;
569 bool getExpressionLocationsEnabled()
const;
573 if (!ObjCRuntime) createObjCRuntime();
582 assert(OpenCLRuntime !=
nullptr);
583 return *OpenCLRuntime;
588 assert(OpenMPRuntime !=
nullptr);
589 return *OpenMPRuntime;
597 assert(CUDARuntime !=
nullptr);
602 assert(ObjCData !=
nullptr);
608 llvm::FunctionCallee IsOSVersionAtLeastFn =
nullptr;
611 llvm::IndexedInstrProfReader *
getPGOReader()
const {
return PGOReader.get(); }
614 return CoverageMapping.get();
618 return StaticLocalDeclMap[D];
622 StaticLocalDeclMap[D] = C;
626 getOrCreateStaticVarDecl(
const VarDecl &D,
627 llvm::GlobalValue::LinkageTypes
Linkage);
630 return StaticLocalDeclGuardMap[D];
633 llvm::GlobalVariable *C) {
634 StaticLocalDeclGuardMap[D] = C;
637 Address createUnnamedGlobalFrom(
const VarDecl &D, llvm::Constant *Constant,
640 bool lookupRepresentativeDecl(StringRef MangledName,
644 return AtomicSetterHelperFnMap[Ty];
647 llvm::Constant *Fn) {
648 AtomicSetterHelperFnMap[Ty] = Fn;
652 return AtomicGetterHelperFnMap[Ty];
655 llvm::Constant *Fn) {
656 AtomicGetterHelperFnMap[Ty] = Fn;
660 return TypeDescriptorMap[Ty];
663 TypeDescriptorMap[Ty] = C;
669 if (!NoObjCARCExceptionsMetadata)
670 NoObjCARCExceptionsMetadata = llvm::MDNode::get(getLLVMContext(), None);
671 return NoObjCARCExceptionsMetadata;
677 const {
return HeaderSearchOpts; }
679 const {
return PreprocessorOpts; }
684 return TheModule.getDataLayout();
688 bool supportsCOMDAT()
const;
689 void maybeSetTrivialComdat(
const Decl &D, llvm::GlobalObject &GO);
715 llvm::MDNode *getTBAATypeInfo(
QualType QTy);
723 TBAAAccessInfo getTBAAVTablePtrAccessInfo(llvm::Type *VTablePtrType);
725 llvm::MDNode *getTBAAStructInfo(
QualType QTy);
729 llvm::MDNode *getTBAABaseTypeInfo(
QualType QTy);
753 return TBAAAccessInfo::getMayAliasInfo();
754 return getTBAAAccessInfo(AccessType);
757 bool isTypeConstant(
QualType QTy,
bool ExcludeCtorDtor);
760 bool isPaddedAtomicType(
const AtomicType *type);
763 void DecorateInstructionWithTBAA(llvm::Instruction *Inst,
767 void DecorateInstructionWithInvariantGroup(llvm::Instruction *I,
771 llvm::ConstantInt *getSize(
CharUnits numChars);
774 void setGlobalVisibility(llvm::GlobalValue *GV,
const NamedDecl *D)
const;
776 void setDSOLocal(llvm::GlobalValue *GV)
const;
778 void setDLLImportDLLExport(llvm::GlobalValue *GV,
GlobalDecl D)
const;
779 void setDLLImportDLLExport(llvm::GlobalValue *GV,
const NamedDecl *D)
const;
782 void setGVProperties(llvm::GlobalValue *GV,
GlobalDecl GD)
const;
783 void setGVProperties(llvm::GlobalValue *GV,
const NamedDecl *D)
const;
785 void setGVPropertiesAux(llvm::GlobalValue *GV,
const NamedDecl *D)
const;
789 void setTLSMode(llvm::GlobalValue *GV,
const VarDecl &D)
const;
797 llvm_unreachable(
"unknown visibility!");
800 llvm::Constant *GetAddrOfGlobal(
GlobalDecl GD,
808 llvm::GlobalVariable *
809 CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty,
810 llvm::GlobalValue::LinkageTypes Linkage,
814 CreateGlobalInitOrDestructFunction(llvm::FunctionType *ty,
const Twine &
name,
835 llvm::Constant *GetAddrOfGlobalVar(
const VarDecl *D,
836 llvm::Type *Ty =
nullptr,
845 LangAS getStringLiteralAddressSpace()
const;
849 llvm::Constant *GetAddrOfFunction(
GlobalDecl GD, llvm::Type *Ty =
nullptr,
850 bool ForVTable =
false,
851 bool DontDefer =
false,
856 llvm::Constant *GetAddrOfRTTIDescriptor(
QualType Ty,
bool ForEH =
false);
862 llvm::Constant *GetAddrOfThunk(StringRef Name, llvm::Type *FnTy,
884 computeNonVirtualBaseClassOffset(
const CXXRecordDecl *DerivedClass,
901 llvm::Type *getBlockDescriptorType();
904 llvm::Type *getGenericBlockLiteralType();
907 llvm::Constant *GetAddrOfGlobalBlock(
const BlockExpr *BE, StringRef Name);
912 return EmittedGlobalBlocks.lookup(BE);
917 void setAddrOfGlobalBlock(
const BlockExpr *BE, llvm::Constant *Addr);
928 llvm::Constant *GetConstantArrayFromStringLiteral(
const StringLiteral *E);
933 StringRef Name =
".str");
945 GetAddrOfConstantCString(
const std::string &Str,
946 const char *GlobalName =
nullptr);
954 llvm::GlobalVariable *
960 llvm::GlobalVariable *GV);
969 QualType getObjCFastEnumerationStateType();
974 llvm::Function *codegenCXXStructor(
GlobalDecl GD);
979 llvm::FunctionType *FnType =
nullptr,
980 bool DontDefer =
false,
982 return cast<llvm::Constant>(getAddrAndTypeOfCXXStructor(GD, FnInfo, FnType,
988 llvm::FunctionCallee getAddrAndTypeOfCXXStructor(
990 llvm::FunctionType *FnType =
nullptr,
bool DontDefer =
false,
995 llvm::Constant *getBuiltinLibFunction(
const FunctionDecl *FD,
1001 void EmitTopLevelDecl(
Decl *D);
1005 void AddDeferredUnusedCoverageMapping(
Decl *D);
1009 void ClearUnusedCoverageMapping(
const Decl *D);
1013 void EmitDeferredUnusedCoverageMappings();
1016 void HandleCXXStaticMemberVarInstantiation(
VarDecl *VD);
1021 template<
typename SomeDecl>
1022 void MaybeHandleStaticInExternC(
const SomeDecl *D, llvm::GlobalValue *GV);
1025 void addUsedGlobal(llvm::GlobalValue *GV);
1028 void addCompilerUsedGlobal(llvm::GlobalValue *GV);
1032 CXXGlobalDtors.emplace_back(DtorFn.getFunctionType(), DtorFn.getCallee(),
1039 llvm::FunctionCallee
1040 CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name,
1041 llvm::AttributeList ExtraAttrs = llvm::AttributeList(),
1042 bool Local =
false,
bool AssumeConvergent =
false);
1048 llvm::FunctionType *Ty, StringRef Name,
1049 llvm::AttributeList ExtraAttrs = llvm::AttributeList(),
1050 bool Local =
false) {
1051 return CreateRuntimeFunction(Ty, Name, ExtraAttrs, Local,
true);
1055 llvm::Constant *CreateRuntimeVariable(llvm::Type *Ty,
1061 llvm::Constant *getNSConcreteGlobalBlock();
1062 llvm::Constant *getNSConcreteStackBlock();
1063 llvm::FunctionCallee getBlockObjectAssign();
1064 llvm::FunctionCallee getBlockObjectDispose();
1068 llvm::Function *getLLVMLifetimeStartFn();
1069 llvm::Function *getLLVMLifetimeEndFn();
1072 void UpdateCompletedType(
const TagDecl *TD);
1074 llvm::Constant *getMemberPointerConstant(
const UnaryOperator *e);
1094 void ErrorUnsupported(
const Stmt *S,
const char *
Type);
1097 void ErrorUnsupported(
const Decl *D,
const char *Type);
1102 void SetInternalFunctionAttributes(
GlobalDecl GD, llvm::Function *F,
1111 void SetLLVMFunctionAttributesForDefinition(
const Decl *D, llvm::Function *F);
1121 bool ReturnTypeUsesFPRet(
QualType ResultType);
1124 bool ReturnTypeUsesFP2Ret(
QualType ResultType);
1136 void ConstructAttributeList(StringRef Name,
const CGFunctionInfo &Info,
1138 llvm::AttributeList &Attrs,
unsigned &
CallingConv,
1139 bool AttrOnCallSite);
1158 void AddDefaultFnAttrs(llvm::Function &F);
1163 void EmitTentativeDefinition(
const VarDecl *D);
1165 void EmitExternalDeclaration(
const VarDecl *D);
1172 void AppendLinkerOptions(StringRef Opts);
1175 void AddDetectMismatch(StringRef Name, StringRef
Value);
1178 void AddDependentLib(StringRef Lib);
1181 llvm::GlobalVariable::LinkageTypes getFunctionLinkage(
GlobalDecl GD);
1184 F->setLinkage(getFunctionLinkage(GD));
1189 llvm::GlobalVariable::LinkageTypes getVTableLinkage(
const CXXRecordDecl *RD);
1192 CharUnits GetTargetTypeStoreSize(llvm::Type *Ty)
const;
1195 llvm::GlobalValue::LinkageTypes
1197 bool IsConstantVariable);
1200 llvm::GlobalValue::LinkageTypes
1201 getLLVMLinkageVarDefinition(
const VarDecl *VD,
bool IsConstant);
1204 void EmitGlobalAnnotations();
1207 llvm::Constant *EmitAnnotationString(StringRef Str);
1222 llvm::Constant *EmitAnnotateAttr(llvm::GlobalValue *GV,
1223 const AnnotateAttr *AA,
1228 void AddGlobalAnnotations(
const ValueDecl *D, llvm::GlobalValue *GV);
1233 bool isInSanitizerBlacklist(llvm::GlobalVariable *GV,
SourceLocation Loc,
1235 StringRef
Category = StringRef())
const;
1241 StringRef
Category = StringRef())
const;
1244 return SanitizerMD.get();
1248 DeferredVTables.push_back(RD);
1257 llvm::GlobalValue *GetGlobalValue(StringRef Ref);
1263 void SetCommonAttributes(
GlobalDecl GD, llvm::GlobalValue *GV);
1265 void addReplacement(StringRef Name, llvm::Constant *C);
1267 void addGlobalValReplacement(llvm::GlobalValue *GV, llvm::Constant *C);
1288 llvm::GlobalValue *GV);
1299 llvm::GlobalObject::VCallVisibility
1304 llvm::GlobalVariable *VTable,
1308 llvm::ConstantInt *CreateCrossDsoCfiTypeId(llvm::Metadata *MD);
1313 llvm::Metadata *CreateMetadataIdentifierForType(
QualType T);
1317 llvm::Metadata *CreateMetadataIdentifierForVirtualMemPtrType(
QualType T);
1322 llvm::Metadata *CreateMetadataIdentifierGeneralized(
QualType T);
1325 void CreateFunctionTypeMetadataForIcall(
const FunctionDecl *FD,
1329 bool NeedAllVtablesTypeId()
const;
1332 void AddVTableTypeMetadata(llvm::GlobalVariable *VTable,
CharUnits Offset,
1340 std::vector<const CXXRecordDecl *>
1344 llvm::FunctionCallee getTerminateFn();
1346 llvm::SanitizerStatReport &getSanStats();
1361 void GenOpenCLArgMetadata(llvm::Function *FN,
1368 llvm::Constant *getNullPointer(llvm::PointerType *T,
QualType QT);
1371 llvm::Constant *GetOrCreateLLVMFunction(
1372 StringRef MangledName, llvm::Type *Ty,
GlobalDecl D,
bool ForVTable,
1373 bool DontDefer =
false,
bool IsThunk =
false,
1374 llvm::AttributeList ExtraAttrs = llvm::AttributeList(),
1377 llvm::Constant *GetOrCreateMultiVersionResolver(
GlobalDecl GD,
1382 llvm::Constant *GetOrCreateLLVMGlobal(StringRef MangledName,
1383 llvm::PointerType *PTy,
1388 bool GetCPUAndFeaturesAttributes(
GlobalDecl GD,
1389 llvm::AttrBuilder &AttrBuilder);
1390 void setNonAliasAttributes(
GlobalDecl GD, llvm::GlobalObject *GO);
1393 void SetFunctionAttributes(
GlobalDecl GD, llvm::Function *F,
1394 bool IsIncompleteFunction,
bool IsThunk);
1396 void EmitGlobalDefinition(
GlobalDecl D, llvm::GlobalValue *GV =
nullptr);
1398 void EmitGlobalFunctionDefinition(
GlobalDecl GD, llvm::GlobalValue *GV);
1399 void EmitMultiVersionFunctionDefinition(
GlobalDecl GD, llvm::GlobalValue *GV);
1401 void EmitGlobalVarDefinition(
const VarDecl *D,
bool IsTentative =
false);
1402 void EmitExternalVarDeclaration(
const VarDecl *D);
1405 void emitCPUDispatchDefinition(
GlobalDecl GD);
1415 void EmitCXXThreadLocalInitFunc();
1418 void EmitCXXGlobalInitFunc();
1421 void EmitCXXGlobalDtorFunc();
1425 void EmitCXXGlobalVarDeclInitFunc(
const VarDecl *D,
1426 llvm::GlobalVariable *Addr,
1429 void EmitPointerToInitFunc(
const VarDecl *VD, llvm::GlobalVariable *Addr,
1430 llvm::Function *InitFunc, InitSegAttr *ISA);
1433 void AddGlobalCtor(llvm::Function *Ctor,
int Priority = 65535,
1434 llvm::Constant *AssociatedData =
nullptr);
1435 void AddGlobalDtor(llvm::Function *Dtor,
int Priority = 65535);
1440 void EmitCtorList(CtorList &Fns,
const char *GlobalName);
1443 void EmitDeferred();
1449 void EmitVTablesOpportunistically();
1452 void applyReplacements();
1455 void applyGlobalValReplacements();
1457 void checkAliases();
1459 std::map<int, llvm::TinyPtrVector<llvm::Function *>> DtorsUsingAtExit;
1463 void registerGlobalDtorsWithAtExit();
1465 void emitMultiVersionFunctions();
1468 void EmitDeferredVTables();
1472 void emitAtAvailableLinkGuard();
1475 void emitLLVMUsed();
1478 void EmitModuleLinkOptions();
1482 void EmitStaticExternCAliases();
1484 void EmitDeclMetadata();
1487 void EmitVersionIdentMetadata();
1490 void EmitCommandLineMetadata();
1493 void EmitTargetMetadata();
1496 void EmitOpenCLMetadata();
1500 void EmitCoverageFile();
1503 llvm::Constant *EmitUuidofInitializer(StringRef uuidstr);
1513 bool MayBeEmittedEagerly(
const ValueDecl *D);
1517 void SimplifyPersonality();
1521 void ConstructDefaultFnAttrList(StringRef Name,
bool HasOptnone,
1522 bool AttrOnCallSite,
1523 llvm::AttrBuilder &FuncAttrs);
1525 llvm::Metadata *CreateMetadataIdentifierImpl(
QualType T, MetadataTypeMap &Map,
1532 #endif // LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H const llvm::DataLayout & getDataLayout() const
TBAAAccessInfo getTBAAInfoForSubobject(LValue Base, QualType AccessType)
getTBAAInfoForSubobject - Get TBAA information for an access with a given base lvalue.
CGOpenCLRuntime & getOpenCLRuntime()
Return a reference to the configured OpenCL runtime.
llvm::Function * objc_retainAutoreleaseReturnValue
id objc_retainAutoreleaseReturnValue(id);
llvm::FunctionCallee objc_releaseRuntimeFunction
void objc_release(id); Note this is the runtime method not the intrinsic.
Represents a function declaration or definition.
bool operator==(const OrderGlobalInits &RHS) const
llvm::Function * objc_copyWeak
void objc_copyWeak(id *dest, id *src);
unsigned llvm::PointerUnion< const Decl *, const Expr * > DeclTy
void setTypeDescriptorInMap(QualType Ty, llvm::Constant *C)
A (possibly-)qualified type.
CodeGenTypes & getTypes()
llvm::Constant * AssociatedData
const CodeGenOptions & getCodeGenOpts() const
bool hasObjCRuntime()
Return true iff an Objective-C runtime has been configured.
llvm::LLVMContext & getLLVMContext()
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
llvm::Constant * CopyHelper
Stmt - This represents one statement.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
Implements runtime-specific code generation functions.
Decl - This represents one declaration (or definition), e.g.
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.
BlockByrefHelpers(CharUnits alignment)
The base class of the type hierarchy.
void setFunctionLinkage(GlobalDecl GD, llvm::Function *F)
Stores additional source code information like skipped ranges which is required by the coverage mappi...
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
constexpr XRayInstrMask Function
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
CtorList & getGlobalCtors()
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
static llvm::GlobalValue::VisibilityTypes GetLLVMVisibility(Visibility V)
const CXXBaseSpecifier *const * path_const_iterator
Represents a variable declaration or definition.
Objects with "hidden" visibility are not seen by the dynamic linker.
CompoundLiteralExpr - [C99 6.5.2.5].
CGDebugInfo * getModuleDebugInfo()
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
bool shouldUseTBAA() const
DiagnosticsEngine & getDiags() const
llvm::Constant * getAtomicSetterHelperFnMap(QualType Ty)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
llvm::Function * objc_retainAutorelease
id objc_retainAutorelease(id);
llvm::GlobalVariable * getStaticLocalDeclGuardAddress(const VarDecl *D)
llvm::Constant * getAtomicGetterHelperFnMap(QualType Ty)
One of these records is kept for each identifier that is lexed.
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
llvm::Function * objc_initWeak
id objc_initWeak(id*, id);
void AddCXXDtorEntry(llvm::FunctionCallee DtorFn, llvm::Constant *Object)
Add a destructor and object to add to the C++ global destructor function.
llvm::FunctionCallee objc_autoreleaseRuntimeFunction
id objc_autorelease(id); Note this is the runtime method not the intrinsic.
llvm::IndexedInstrProfReader * getPGOReader() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Objects with "default" visibility are seen by the dynamic linker and act like normal objects...
llvm::FunctionCallee objc_alloc_init
void objc_alloc_init(id);
llvm::Function * objc_release
void objc_release(id);
CGCUDARuntime & getCUDARuntime()
Return a reference to the configured CUDA runtime.
bool operator<(const OrderGlobalInits &RHS) const
CharUnits - This is an opaque type for sizes expressed in character units.
Structor(int Priority, llvm::Constant *Initializer, llvm::Constant *AssociatedData)
Visibility
Describes the different kinds of visibility that a declaration may have.
void setStaticLocalDeclAddress(const VarDecl *D, llvm::Constant *C)
Concrete class used by the front-end to report problems and issues.
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...
void addDeferredVTable(const CXXRecordDecl *RD)
void setAtomicGetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
void addMissing(bool MainFile)
Record that a function we've visited has no profile data.
Enums/classes describing ABI related information about constructors, destructors and thunks...
ItaniumVTableContext & getItaniumVTableContext()
__DEVICE__ void * memset(void *__a, int __b, size_t __c)
const PreprocessorOptions & getPreprocessorOpts() const
void Profile(llvm::FoldingSetNodeID &id) const
llvm::Function * objc_moveWeak
void objc_moveWeak(id *dest, id *src);
Represents a linkage specification.
llvm::Constant * Initializer
llvm::FunctionCallee CreateConvergentRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeList ExtraAttrs=llvm::AttributeList(), bool Local=false)
Create or return a runtime function declaration with the specified type and name. ...
InstrProfStats & getPGOStats()
llvm::Constant * getStaticLocalDeclAddress(const VarDecl *D)
llvm::Function * objc_unsafeClaimAutoreleasedReturnValue
id objc_unsafeClaimAutoreleasedReturnValue(id);
llvm::Function * objc_retainAutoreleasedReturnValue
id objc_retainAutoreleasedReturnValue(id);
Represents a ValueDecl that came out of a declarator.
CtorList & getGlobalDtors()
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
This represents '#pragma omp requires...' directive.
Exposes information about the current target.
CGObjCRuntime & getObjCRuntime()
Return a reference to the configured Objective-C runtime.
CharUnits Alignment
The alignment of the field.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
This represents one expression.
Defines the clang::LangOptions interface.
llvm::Constant * DisposeHelper
Organizes the cross-function state that is used while generating code coverage mapping data...
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Represents a C++ destructor within a class.
llvm::FunctionCallee objc_alloc
void objc_alloc(id);
void setStaticLocalDeclGuardAddress(const VarDecl *D, llvm::GlobalVariable *C)
MicrosoftVTableContext & getMicrosoftVTableContext()
Objects with "protected" visibility are seen by the dynamic linker but always dynamically resolve to ...
void addMismatched(bool MainFile)
Record that a function we've visited has mismatched profile data.
TBAAAccessInfo getTBAAInfo() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
const TargetInfo & getTarget() const
const LangOptions & getLangOpts() const
ASTContext & getContext() const
CallingConv
CallingConv - Specifies the calling convention that a function uses.
GlobalDecl - represents a global declaration.
virtual bool needsCopy() const
void addVisited(bool MainFile)
Record that we've visited a function and whether or not that function was in the main source file...
llvm::Function * objc_loadWeakRetained
id objc_loadWeakRetained(id*);
llvm::FunctionCallee objc_autoreleasePoolPop
void objc_autoreleasePoolPop(void*);
Encodes a location in the source.
llvm::Function * clang_arc_use
void clang.arc.use(...);
llvm::Constant * getTypeDescriptorFromMap(QualType Ty)
This represents '#pragma omp declare reduction ...' directive.
llvm::OpenMPIRBuilder * getOpenMPIRBuilder()
Return a pointer to the configured OpenMPIRBuilder, if any.
Represents the declaration of a struct/union/class/enum.
llvm::Function * objc_destroyWeak
void objc_destroyWeak(id*);
ObjCEntrypoints & getObjCEntrypoints() const
This file defines OpenMP nodes for declarative directives.
llvm::Function * objc_storeWeak
id objc_storeWeak(id*, id);
llvm::FunctionCallee objc_retainRuntimeFunction
id objc_retain(id); Note this is the runtime method not the intrinsic.
llvm::InlineAsm * retainAutoreleasedReturnValueMarker
A void(void) inline asm to use to mark that the return value of a call will be immediately retain...
Defines the clang::Module class, which describes a module in the source code.
const HeaderSearchOptions & getHeaderSearchOpts() const
virtual bool needsDispose() const
ItaniumVTableContext & getItaniumVTableContext()
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues, like target-specific attributes, builtins and so on.
std::vector< Structor > CtorList
CGFunctionInfo - Class to encapsulate the information about a function definition.
This class organizes the cross-function state that is used while generating LLVM code.
CGOpenMPRuntime & getOpenMPRuntime()
Return a reference to the configured OpenMP runtime.
Dataflow Directional Tag Classes.
llvm::FoldingSet< BlockByrefHelpers > ByrefHelpersCache
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
int getUniqueBlockCount()
Fetches the global unique block count.
The basic abstraction for the target Objective-C runtime.
static llvm::Constant * EmitNullConstantForBase(CodeGenModule &CGM, llvm::Type *baseType, const CXXRecordDecl *base)
Emit the null constant for a base subobject.
CoverageMappingModuleGen * getCoverageMapping() const
llvm::Module & getModule() const
ExplicitCastExpr - An explicit cast written in the source code.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
llvm::FunctionCallee objc_autoreleasePoolPopInvoke
void objc_autoreleasePoolPop(void*); Note this method is used when we are using exception handling ...
Implements C++ ABI-specific code generation functions.
ObjCEncodeExpr, used for @encode in Objective-C.
This class organizes the cross-module state that is used while lowering AST types to LLVM types...
bool hasDiagnostics()
Whether or not the stats we've gathered indicate any potential problems.
This class records statistics on instrumentation based profiling.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
llvm::Function * objc_autoreleaseReturnValue
id objc_autoreleaseReturnValue(id);
void setAtomicSetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
llvm::Function * objc_autorelease
id objc_autorelease(id);
llvm::MDNode * getNoObjCARCExceptionsMetadata()
A pair of helper functions for a __block variable.
static llvm::Constant * EmitNullConstant(CodeGenModule &CGM, const RecordDecl *record, bool asCompleteObject)
llvm::FunctionCallee objc_allocWithZone
void objc_allocWithZone(id);
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
MicrosoftVTableContext & getMicrosoftVTableContext()
Represents a C++ struct/union/class.
llvm::Function * objc_storeStrong
void objc_storeStrong(id*, id);
A specialization of Address that requires the address to be an LLVM Constant.
llvm::Function * objc_loadWeak
id objc_loadWeak(id*);
OrderGlobalInits(unsigned int p, unsigned int l)
This represents '#pragma omp declare mapper ...' directive.
StringLiteral - This represents a string literal expression, e.g.
CGCXXABI & getCXXABI() const
llvm::Function * objc_retain
id objc_retain(id);
GVALinkage
A more specific kind of linkage than enum Linkage.
llvm::Function * objc_autoreleasePoolPush
void *objc_autoreleasePoolPush(void);
This structure provides a set of types that are commonly used during IR emission. ...
CodeGenVTables & getVTables()
LValue - This represents an lvalue references.
This represents a decl that may have a name.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
SanitizerMetadata * getSanitizerMetadata()
This represents '#pragma omp threadprivate ...' directive.
Abstract information about a function or function prototype.
llvm::Function * objc_retainBlock
id objc_retainBlock(id);
const llvm::Triple & getTriple() const