14 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
15 #define LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
29 #include "llvm/ADT/DenseMap.h"
30 #include "llvm/ADT/SetVector.h"
31 #include "llvm/ADT/SmallPtrSet.h"
32 #include "llvm/ADT/StringMap.h"
33 #include "llvm/IR/CallingConv.h"
34 #include "llvm/IR/Module.h"
35 #include "llvm/IR/ValueHandle.h"
46 class IndexedInstrProfReader;
50 class TargetCodeGenInfo;
56 class ObjCImplementationDecl;
57 class ObjCCategoryImplDecl;
58 class ObjCProtocolDecl;
72 class HeaderSearchOptions;
73 class PreprocessorOptions;
74 class DiagnosticsEngine;
76 class CXXDestructorDecl;
78 class CoverageSourceInfo;
83 class CodeGenFunction;
88 class CGOpenCLRuntime;
91 class BlockFieldFlags;
92 class FunctionArgList;
93 class CoverageMappingModuleGen;
229 uint32_t VisitedInMainFile;
230 uint32_t MissingInMainFile;
237 : VisitedInMainFile(0), MissingInMainFile(0), Visited(0), Missing(0),
271 : Priority(Priority), Initializer(Initializer),
272 AssociatedData(AssociatedData) {}
286 llvm::Module &TheModule;
288 const llvm::DataLayout &TheDataLayout;
290 std::unique_ptr<CGCXXABI> ABI;
291 llvm::LLVMContext &VMContext;
311 llvm::MDNode *NoObjCARCExceptionsMetadata;
313 std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader;
319 llvm::SmallPtrSet<llvm::GlobalValue*, 10> WeakRefReferences;
325 std::map<StringRef, GlobalDecl> DeferredDecls;
329 struct DeferredGlobal {
330 DeferredGlobal(llvm::GlobalValue *GV,
GlobalDecl GD) : GV(GV), GD(GD) {}
331 llvm::TrackingVH<llvm::GlobalValue> GV;
334 std::vector<DeferredGlobal> DeferredDeclsToEmit;
335 void addDeferredDeclToEmit(llvm::GlobalValue *GV,
GlobalDecl GD) {
336 DeferredDeclsToEmit.emplace_back(GV, GD);
341 std::vector<GlobalDecl> Aliases;
343 typedef llvm::StringMap<llvm::TrackingVH<llvm::Constant> > ReplacementsTy;
344 ReplacementsTy Replacements;
347 std::vector<const CXXRecordDecl*> DeferredVTables;
352 std::vector<llvm::WeakVH> LLVMUsed;
353 std::vector<llvm::WeakVH> LLVMCompilerUsed;
364 llvm::MapVector<GlobalDecl, StringRef> MangledDeclNames;
365 llvm::StringMap<GlobalDecl, llvm::BumpPtrAllocator> Manglings;
368 std::vector<llvm::Constant*> Annotations;
371 llvm::StringMap<llvm::Constant*> AnnotationStrings;
373 llvm::StringMap<llvm::GlobalVariable *> CFConstantStringMap;
375 llvm::DenseMap<llvm::Constant *, llvm::GlobalVariable *> ConstantStringMap;
376 llvm::DenseMap<const Decl*, llvm::Constant *> StaticLocalDeclMap;
377 llvm::DenseMap<const Decl*, llvm::GlobalVariable*> StaticLocalDeclGuardMap;
378 llvm::DenseMap<const Expr*, llvm::Constant *> MaterializedGlobalTemporaryMap;
380 llvm::DenseMap<QualType, llvm::Constant *> AtomicSetterHelperFnMap;
381 llvm::DenseMap<QualType, llvm::Constant *> AtomicGetterHelperFnMap;
384 llvm::DenseMap<QualType, llvm::Constant *> TypeDescriptorMap;
389 llvm::GlobalValue *> StaticExternCMap;
390 StaticExternCMap StaticExternCValues;
393 std::vector<std::pair<const VarDecl *, llvm::GlobalVariable *> >
398 std::vector<llvm::Function *> CXXThreadLocalInits;
399 std::vector<llvm::GlobalVariable *> CXXThreadLocalInitVars;
402 std::vector<llvm::Function *> CXXGlobalInits;
409 llvm::DenseMap<const Decl*, unsigned> DelayedCXXInitPosition;
411 typedef std::pair<OrderGlobalInits, llvm::Function*> GlobalInitData;
413 struct GlobalInitPriorityCmp {
414 bool operator()(
const GlobalInitData &LHS,
415 const GlobalInitData &RHS)
const {
416 return LHS.first.priority < RHS.first.priority;
422 SmallVector<GlobalInitData, 8> PrioritizedCXXGlobalInits;
425 std::vector<std::pair<llvm::WeakVH,llvm::Constant*> > CXXGlobalDtors;
428 llvm::SetVector<clang::Module *> ImportedModules;
431 SmallVector<llvm::Metadata *, 16> LinkerOptionsMetadata;
438 llvm::WeakVH CFConstantStringClassRef;
442 llvm::WeakVH ConstantStringClassRef;
445 llvm::StructType *NSConstantStringType;
449 QualType ObjCFastEnumerationStateType;
454 void createObjCRuntime();
456 void createOpenCLRuntime();
457 void createOpenMPRuntime();
458 void createCUDARuntime();
460 bool isTriviallyRecursive(
const FunctionDecl *F);
461 bool shouldEmitFunction(GlobalDecl GD);
466 llvm::Constant *NSConcreteGlobalBlock;
467 llvm::Constant *NSConcreteStackBlock;
469 llvm::Constant *BlockObjectAssign;
470 llvm::Constant *BlockObjectDispose;
472 llvm::Type *BlockDescriptorType;
473 llvm::Type *GenericBlockLiteralType;
480 llvm::Constant *LifetimeStartFn;
483 llvm::Constant *LifetimeEndFn;
487 std::unique_ptr<SanitizerMetadata> SanitizerMD;
491 llvm::DenseMap<const Decl *, bool> DeferredEmptyCoverageMappingDecls;
493 std::unique_ptr<CoverageMappingModuleGen> CoverageMapping;
499 llvm::Module &M,
const llvm::DataLayout &TD,
521 assert(OpenCLRuntime !=
nullptr);
522 return *OpenCLRuntime;
527 assert(OpenMPRuntime !=
nullptr);
528 return *OpenMPRuntime;
533 assert(CUDARuntime !=
nullptr);
538 assert(
getLangOpts().ObjCAutoRefCount && ARCData !=
nullptr);
543 assert(RRData !=
nullptr);
548 llvm::IndexedInstrProfReader *
getPGOReader()
const {
return PGOReader.get(); }
551 return CoverageMapping.get();
555 return StaticLocalDeclMap[D];
559 StaticLocalDeclMap[D] =
C;
564 llvm::GlobalValue::LinkageTypes
Linkage);
567 return StaticLocalDeclGuardMap[D];
570 llvm::GlobalVariable *
C) {
571 StaticLocalDeclGuardMap[D] =
C;
578 return AtomicSetterHelperFnMap[Ty];
581 llvm::Constant *Fn) {
582 AtomicSetterHelperFnMap[Ty] = Fn;
586 return AtomicGetterHelperFnMap[Ty];
589 llvm::Constant *Fn) {
590 AtomicGetterHelperFnMap[Ty] = Fn;
594 return TypeDescriptorMap[Ty];
597 TypeDescriptorMap[Ty] =
C;
603 if (!NoObjCARCExceptionsMetadata)
605 return NoObjCARCExceptionsMetadata;
611 const {
return HeaderSearchOpts; }
613 const {
return PreprocessorOpts; }
664 llvm::MDNode *TBAAInfo,
665 bool ConvertTypeToTag =
true);
683 llvm_unreachable(
"unknown visibility!");
687 if (isa<CXXConstructorDecl>(GD.
getDecl()))
690 else if (isa<CXXDestructorDecl>(GD.
getDecl()))
693 else if (isa<FunctionDecl>(GD.
getDecl()))
703 llvm::GlobalVariable *
705 llvm::GlobalValue::LinkageTypes
Linkage);
723 llvm::Type *Ty =
nullptr);
728 bool ForVTable =
false,
729 bool DontDefer =
false);
772 void Profile(llvm::FoldingSetNodeID &
id)
const {
776 virtual void profileImpl(llvm::FoldingSetNodeID &
id)
const = 0;
812 llvm::GlobalVariable *
814 StringRef Name =
".str");
817 llvm::GlobalVariable *
825 llvm::GlobalVariable *
827 const char *GlobalName =
nullptr,
828 unsigned Alignment = 0);
853 llvm::FunctionType *FnType =
nullptr,
854 bool DontDefer =
false);
884 template<
typename SomeDecl>
895 CXXGlobalDtors.emplace_back(DtorFn, Object);
901 llvm::AttributeSet ExtraAttrs =
902 llvm::AttributeSet());
906 llvm::AttributeSet ExtraAttrs =
907 llvm::AttributeSet());
1007 const Decl *TargetDecl,
1010 bool AttrOnCallSite);
1048 llvm::GlobalValue::LinkageTypes
1050 bool IsConstantVariable);
1053 llvm::GlobalValue::LinkageTypes
1076 const AnnotateAttr *AA,
1087 StringRef Category = StringRef())
const;
1090 return SanitizerMD.get();
1094 DeferredVTables.push_back(RD);
1148 GetOrCreateLLVMFunction(StringRef MangledName, llvm::Type *Ty,
GlobalDecl D,
1149 bool ForVTable,
bool DontDefer =
false,
1150 bool IsThunk =
false,
1151 llvm::AttributeSet ExtraAttrs = llvm::AttributeSet());
1153 llvm::Constant *GetOrCreateLLVMGlobal(StringRef MangledName,
1154 llvm::PointerType *PTy,
1157 void setNonAliasAttributes(
const Decl *D, llvm::GlobalObject *GO);
1160 void SetFunctionAttributes(
GlobalDecl GD, llvm::Function *F,
1161 bool IsIncompleteFunction,
bool IsThunk);
1163 void EmitGlobalDefinition(
GlobalDecl D, llvm::GlobalValue *GV =
nullptr);
1165 void EmitGlobalFunctionDefinition(
GlobalDecl GD, llvm::GlobalValue *GV);
1166 void EmitGlobalVarDefinition(
const VarDecl *D);
1178 void EmitCXXThreadLocalInitFunc();
1181 void EmitCXXGlobalInitFunc();
1184 void EmitCXXGlobalDtorFunc();
1188 void EmitCXXGlobalVarDeclInitFunc(
const VarDecl *D,
1189 llvm::GlobalVariable *Addr,
1192 void EmitPointerToInitFunc(
const VarDecl *VD, llvm::GlobalVariable *Addr,
1193 llvm::Function *InitFunc, InitSegAttr *ISA);
1196 void AddGlobalCtor(llvm::Function *Ctor,
int Priority = 65535,
1197 llvm::Constant *AssociatedData = 0);
1198 void AddGlobalDtor(llvm::Function *Dtor,
int Priority = 65535);
1203 void EmitCtorList(
const CtorList &Fns,
const char *GlobalName);
1209 void EmitDeferred();
1212 void applyReplacements();
1214 void checkAliases();
1217 void EmitDeferredVTables();
1220 void emitLLVMUsed();
1223 void EmitModuleLinkOptions();
1227 void EmitStaticExternCAliases();
1229 void EmitDeclMetadata();
1232 void EmitVersionIdentMetadata();
1235 void EmitTargetMetadata();
1239 void EmitCoverageFile();
1242 llvm::Constant *EmitUuidofInitializer(StringRef uuidstr);
1252 bool MayBeEmittedEagerly(
const ValueDecl *D);
1256 void SimplifyPersonality();
llvm::Constant * GetAddrOfConstantCFString(const StringLiteral *Literal)
Return a pointer to a constant CFString object for the given string.
llvm::PointerType * Int8PtrPtrTy
CGOpenCLRuntime & getOpenCLRuntime()
Return a reference to the configured OpenCL runtime.
llvm::MDNode * getTBAAStructTypeInfo(QualType QTy)
Return the MDNode in the type DAG for the given struct type.
llvm::Constant * objc_loadWeak
id objc_loadWeak(id*);
llvm::IntegerType * IntTy
int
llvm::Type * getGenericBlockLiteralType()
The type of a generic block literal.
void EmitDeferredUnusedCoverageMappings()
Emit all the deferred coverage mappings for the uninstrumented functions.
virtual void emitDispose(CodeGenFunction &CGF, llvm::Value *field)=0
void setTypeDescriptorInMap(QualType Ty, llvm::Constant *C)
A pair of helper functions for a __block variable.
bool ReturnTypeUsesSRet(const CGFunctionInfo &FI)
Return true iff the given type uses 'sret' when used as a return type.
CodeGenTypes & getTypes()
llvm::Constant * AssociatedData
virtual bool needsCopy() const
CXXCtorType getCtorType() const
bool hasObjCRuntime()
Return true iff an Objective-C runtime has been configured.
llvm::Module & getModule() const
llvm::Constant * getMemberPointerConstant(const UnaryOperator *e)
llvm::LLVMContext & getLLVMContext()
ARCEntrypoints & getARCEntrypoints() const
llvm::CallingConv::ID BuiltinCC
virtual void profileImpl(llvm::FoldingSetNodeID &id) const =0
llvm::Constant * objc_autoreleaseReturnValue
id objc_autoreleaseReturnValue(id);
Implements runtime-specific code generation functions.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Defines the clang::Module class, which describes a module in the source code.
llvm::Constant * objc_copyWeak
void objc_copyWeak(id *dest, id *src);
llvm::MDNode * getTBAAStructInfo(QualType QTy)
void setAliasAttributes(const Decl *D, llvm::GlobalValue *GV)
llvm::CallingConv::ID getRuntimeCC() const
llvm::Type * FloatTy
float, double
const llvm::DataLayout & getDataLayout() const
void setFunctionLinkage(GlobalDecl GD, llvm::Function *F)
Stores additional source code information like skipped ranges which is required by the coverage mappi...
NamespaceDecl - Represent a C++ namespace.
llvm::Constant * objc_retainBlock
id objc_retainBlock(id);
const PreprocessorOptions & getPreprocessorOpts() const
CtorList & getGlobalCtors()
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
bool operator==(const OrderGlobalInits &RHS) const
bool TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D)
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
static llvm::GlobalValue::VisibilityTypes GetLLVMVisibility(Visibility V)
llvm::Constant * EmitConstantValue(const APValue &Value, QualType DestType, CodeGenFunction *CGF=nullptr)
const CXXBaseSpecifier *const * path_const_iterator
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD)
Tell the consumer that this variable has been instantiated.
void setFunctionDefinitionAttributes(const FunctionDecl *D, llvm::Function *F)
Set attributes for a global definition.
llvm::Constant * objc_retainAutoreleasedReturnValue
id objc_retainAutoreleasedReturnValue(id);
CGDebugInfo * getModuleDebugInfo()
void setFunctionDLLStorageClass(GlobalDecl GD, llvm::Function *F)
Set the DLL storage class on F.
CharUnits GetTargetTypeStoreSize(llvm::Type *Ty) const
Return the store size, in character units, of the given LLVM type.
llvm::Constant * GetAddrOfGlobalVar(const VarDecl *D, llvm::Type *Ty=nullptr)
void DecorateInstruction(llvm::Instruction *Inst, llvm::MDNode *TBAAInfo, bool ConvertTypeToTag=true)
llvm::Constant * getAtomicSetterHelperFnMap(QualType Ty)
llvm::GlobalVariable * GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *)
Return a pointer to a constant array for the given ObjCEncodeExpr node.
llvm::Constant * getAddrOfCXXCatchHandlerType(QualType Ty, QualType CatchHandlerType)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
llvm::GlobalVariable * GetAddrOfConstantStringFromLiteral(const StringLiteral *S, StringRef Name=".str")
Return a pointer to a constant array for the given string literal.
llvm::Constant * EmitConstantValueForMemory(const APValue &Value, QualType DestType, CodeGenFunction *CGF=nullptr)
llvm::GlobalVariable * getStaticLocalDeclGuardAddress(const VarDecl *D)
llvm::Constant * getAtomicGetterHelperFnMap(QualType Ty)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
llvm::IntegerType * Int64Ty
llvm::Constant * objc_storeStrong
id objc_storeStrong(id*, id);
llvm::IntegerType * SizeTy
StructorType getFromDtorType(CXXDtorType T)
llvm::Constant * CreateBuiltinFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeSet ExtraAttrs=llvm::AttributeSet())
Create a new compiler builtin function with the specified type and name.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
llvm::Function * codegenCXXStructor(const CXXMethodDecl *MD, StructorType Type)
The this pointer adjustment as well as an optional return adjustment for a thunk. ...
llvm::CallingConv::ID RuntimeCC
bool isPaddedAtomicType(QualType type)
const Decl * getDecl() const
llvm::Constant * objc_destroyWeak
void objc_destroyWeak(id*);
RREntrypoints & getRREntrypoints() const
llvm::Constant * GetConstantArrayFromStringLiteral(const StringLiteral *E)
Return a constant array for the given string.
llvm::Constant * getLLVMLifetimeStartFn()
Lazily declare the .lifetime.start intrinsic.
bool operator<(const OrderGlobalInits &RHS) const
CGOpenMPRuntime(CodeGenModule &CGM)
CGCUDARuntime & getCUDARuntime()
Return a reference to the configured CUDA runtime.
llvm::Constant * objc_loadWeakRetained
id objc_loadWeakRetained(id*);
Structor(int Priority, llvm::Constant *Initializer, llvm::Constant *AssociatedData)
llvm::GlobalVariable * GetAddrOfConstantCString(const std::string &Str, const char *GlobalName=nullptr, unsigned Alignment=0)
Visibility
Describes the different kinds of visibility that a declaration may have.
unsigned char PointerWidthInBits
The width of a pointer into the generic address space.
llvm::PointerType * VoidPtrTy
void setStaticLocalDeclAddress(const VarDecl *D, llvm::Constant *C)
Concrete class used by the front-end to report problems and issues.
void addDeferredVTable(const CXXRecordDecl *RD)
void setAtomicGetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
llvm::Constant * getTerminateFn()
Get the declaration of std::terminate for the platform.
void addMissing(bool MainFile)
Record that a function we've visited has no profile data.
llvm::PointerType * VoidPtrPtrTy
void addCompilerUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.compiler.used metadata.
Enums/classes describing ABI related information about constructors, destructors and thunks...
llvm::Constant * CreateRuntimeVariable(llvm::Type *Ty, StringRef Name)
Create a new runtime global variable with the specified type and name.
ItaniumVTableContext & getItaniumVTableContext()
void EmitTentativeDefinition(const VarDecl *D)
Represents a linkage specification.
void setGlobalVisibility(llvm::GlobalValue *GV, const NamedDecl *D) const
Set the visibility for the given LLVM GlobalValue.
llvm::Constant * getNSConcreteStackBlock()
llvm::Constant * Initializer
InstrProfStats & getPGOStats()
bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor)
llvm::GlobalValue * getAddrOfCXXStructor(const CXXMethodDecl *MD, StructorType Type, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false)
Return the address of the constructor/destructor of the given type.
llvm::Constant * DisposeHelper
const HeaderSearchOptions & getHeaderSearchOpts() const
llvm::Constant * objc_release
void objc_release(id);
llvm::Constant * getStaticLocalDeclAddress(const VarDecl *D)
const TargetCodeGenInfo & getTargetCodeGenInfo()
void AddDetectMismatch(StringRef Name, StringRef Value)
Appends a detect mismatch command to the linker options.
const TargetInfo & getTarget() const
Represents a ValueDecl that came out of a declarator. Contains type source information through TypeSo...
CtorList & getGlobalDtors()
bool shouldUseTBAA() const
StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD)
ID
Defines the set of possible language-specific address spaces.
Exposes information about the current target.
CGObjCRuntime & getObjCRuntime()
Return a reference to the configured Objective-C runtime.
void SetLLVMFunctionAttributes(const Decl *D, const CGFunctionInfo &Info, llvm::Function *F)
Set the LLVM function attributes (sext, zext, etc).
llvm::Constant * EmitAnnotationUnit(SourceLocation Loc)
Emit the annotation's translation unit.
Defines the clang::LangOptions interface.
CXXDtorType getDtorType() const
CGCXXABI & getCXXABI() const
void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV)
void SetInternalFunctionAttributes(const Decl *D, llvm::Function *F, const CGFunctionInfo &FI)
Organizes the cross-function state that is used while generating code coverage mapping data...
Represents a C++ destructor within a class.
llvm::Constant * objc_moveWeak
void objc_moveWeak(id *dest, id *src);
void reportDiagnostics(DiagnosticsEngine &Diags, StringRef MainFile)
Report potential problems we've found to Diags.
void AddCXXDtorEntry(llvm::Constant *DtorFn, llvm::Constant *Object)
Add a destructor and object to add to the C++ global destructor function.
llvm::FoldingSet< ByrefHelpers > ByrefHelpersCache
ASTContext & getContext() const
void setStaticLocalDeclGuardAddress(const VarDecl *D, llvm::GlobalVariable *C)
MicrosoftVTableContext & getMicrosoftVTableContext()
bool ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI)
llvm::IntegerType * Int32Ty
llvm::GlobalValue::LinkageTypes getLLVMLinkageVarDefinition(const VarDecl *VD, bool IsConstant)
Returns LLVM linkage for a declarator.
void addMismatched(bool MainFile)
Record that a function we've visited has mismatched profile data.
llvm::Constant * EmitAnnotationString(StringRef Str)
Emit an annotation string.
llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD)
llvm::Function * getIntrinsic(unsigned IID, ArrayRef< llvm::Type * > Tys=None)
llvm::Constant * GetAddrOfUuidDescriptor(const CXXUuidofExpr *E)
Get the address of a uuid descriptor .
ByrefHelpers(CharUnits alignment)
bool lookupRepresentativeDecl(StringRef MangledName, GlobalDecl &Result) const
CallingConv
CallingConv - Specifies the calling convention that a function uses.
llvm::GlobalVariable * CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage)
llvm::Constant * EmitAnnotateAttr(llvm::GlobalValue *GV, const AnnotateAttr *AA, SourceLocation L)
llvm::Constant * GetAddrOfThunk(GlobalDecl GD, const ThunkInfo &Thunk)
Get the address of the thunk for the given global decl.
llvm::Constant * objc_retainAutoreleaseReturnValue
id objc_retainAutoreleaseReturnValue(id);
void addVisited(bool MainFile)
llvm::Constant * GetWeakRefReference(const ValueDecl *VD)
Get a reference to the target of VD.
llvm::Constant * getOrCreateStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)
llvm::Constant * objc_autoreleasePoolPush
void *objc_autoreleasePoolPush(void);
llvm::CallingConv::ID getBuiltinCC() const
llvm::Constant * CreateRuntimeFunction(llvm::FunctionType *Ty, StringRef Name, llvm::AttributeSet ExtraAttrs=llvm::AttributeSet())
Create a new runtime function with the specified type and name.
bool ReturnTypeUsesFPRet(QualType ResultType)
Return true iff the given type uses 'fpret' when used as a return type.
llvm::Constant * GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *E)
void MaybeHandleStaticInExternC(const SomeDecl *D, llvm::GlobalValue *GV)
If the declaration has internal linkage but is inside an extern "C" linkage specification, prepare to emit an alias for it to the expected name.
llvm::Constant * EmitConstantExpr(const Expr *E, QualType DestType, CodeGenFunction *CGF=nullptr)
virtual bool needsDispose() const
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
llvm::Constant * getTypeDescriptorFromMap(QualType Ty)
void Profile(llvm::FoldingSetNodeID &id) const
llvm::Constant * objc_retain
id objc_retain(id);
TagDecl - Represents the declaration of a struct/union/class/enum.
llvm::IntegerType * Int16Ty
Represents a static or instance method of a struct/union/class.
llvm::Constant * EmitNullConstantForBase(const CXXRecordDecl *Record)
llvm::Constant * GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH=false)
Get the address of the RTTI descriptor for the given type.
llvm::MDNode * getTBAAStructTagInfo(QualType BaseTy, llvm::MDNode *AccessN, uint64_t O)
Return the path-aware tag for given base type, access node and offset.
llvm::InlineAsm * retainAutoreleasedReturnValueMarker
const CodeGenOptions & getCodeGenOpts() const
llvm::Constant * getBlockObjectDispose()
llvm::Constant * objc_autoreleasePoolPop
void objc_autoreleasePoolPop(void*);
const LangOptions & getLangOpts() const
void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F)
llvm::MDTuple * CreateVTableBitSetEntry(llvm::GlobalVariable *VTable, CharUnits Offset, const CXXRecordDecl *RD)
Create a bitset entry for the given vtable.
void EmitTopLevelDecl(Decl *D)
Emit code for a single top level declaration.
llvm::Constant * EmitAnnotationLineNo(SourceLocation L)
Emit the annotation line number.
llvm::Constant * GetAddrOfGlobalTemporary(const MaterializeTemporaryExpr *E, const Expr *Inner)
Returns a pointer to a global variable representing a temporary with static or thread storage duratio...
ItaniumVTableContext & getItaniumVTableContext()
llvm::Constant * objc_initWeak
id objc_initWeak(id*, id);
bool ReturnTypeUsesFP2Ret(QualType ResultType)
Return true iff the given type uses 'fp2ret' when used as a return type.
void Error(SourceLocation loc, StringRef error)
Emit a general error that something can't be done.
void EmitFundamentalRTTIDescriptors()
Emit the RTTI descriptors for the builtin types.
llvm::Constant * getLLVMLifetimeEndFn()
Lazily declare the .lifetime.end intrinsic.
std::vector< Structor > CtorList
void addReplacement(StringRef Name, llvm::Constant *C)
llvm::Value * getBuiltinLibFunction(const FunctionDecl *FD, unsigned BuiltinID)
void addUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.used metadata.
void EmitVTableBitSetEntries(llvm::GlobalVariable *VTable, const VTableLayout &VTLayout)
void ErrorUnsupported(const Stmt *S, const char *Type)
Print out an error that codegen doesn't support the specified stmt yet.
CGOpenMPRuntime & getOpenMPRuntime()
Return a reference to the configured OpenMP runtime.
llvm::GlobalValue * GetGlobalValue(StringRef Ref)
llvm::Constant * objc_autorelease
id objc_autorelease(id);
llvm::Constant * GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty=0, bool ForVTable=false, bool DontDefer=false)
int getUniqueBlockCount()
Fetches the global unique block count.
unsigned char PointerAlignInBytes
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
The basic abstraction for the target Objective-C runtime.
static __inline__ uint32_t volatile uint32_t * p
bool TryEmitDefinitionAsAlias(GlobalDecl Alias, GlobalDecl Target, bool InEveryTU)
void ConstructAttributeList(const CGFunctionInfo &Info, const Decl *TargetDecl, AttributeListType &PAL, unsigned &CallingConv, bool AttrOnCallSite)
void setTLSMode(llvm::GlobalValue *GV, const VarDecl &D) const
void EmitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D)
Emit a code for threadprivate directive.
llvm::IntegerType * IntPtrTy
llvm::Constant * objc_retainAutorelease
id objc_retainAutorelease(id);
llvm::Constant * EmitNullConstant(QualType T)
void UpdateCompletedType(const TagDecl *TD)
unsigned GetGlobalVarAddressSpace(const VarDecl *D, unsigned AddrSpace)
const llvm::Triple & getTriple() const
void maybeSetTrivialComdat(const Decl &D, llvm::GlobalObject &GO)
bool isInSanitizerBlacklist(llvm::Function *Fn, SourceLocation Loc) const
void AddDeferredUnusedCoverageMapping(Decl *D)
Stored a deferred empty coverage mapping for an unused and thus uninstrumented top level declaration...
llvm::GlobalVariable * GetAddrOfConstantString(const StringLiteral *Literal)
llvm::GlobalVariable::LinkageTypes getVTableLinkage(const CXXRecordDecl *RD)
StructorType getFromCtorType(CXXCtorType T)
void AppendLinkerOptions(StringRef Opts)
Appends Opts to the "Linker Options" metadata value.
Implements C++ ABI-specific code generation functions.
bool hasDiagnostics()
Whether or not the stats we've gathered indicate any potential problems.
llvm::PointerType * Int8PtrTy
This class records statistics on instrumentation based profiling.
llvm::Constant * GetNonVirtualBaseClassOffset(const CXXRecordDecl *ClassDecl, CastExpr::path_const_iterator PathBegin, CastExpr::path_const_iterator PathEnd)
llvm::Constant * GetAddrOfGlobalBlock(const BlockExpr *BE, const char *)
Gets the address of a block which requires no captures.
StringRef getMangledName(GlobalDecl GD)
llvm::Constant * getBlockObjectAssign()
void setAtomicSetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
llvm::Constant * EmitConstantInit(const VarDecl &D, CodeGenFunction *CGF=nullptr)
llvm::MDNode * getNoObjCARCExceptionsMetadata()
llvm::ConstantInt * getSize(CharUnits numChars)
Emit the given number of characters as a value of type size_t.
llvm::IntegerType * PtrDiffTy
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
MicrosoftVTableContext & getMicrosoftVTableContext()
DiagnosticsEngine & getDiags() const
Represents a C++ struct/union/class.
bool IsCFIBlacklistedRecord(const CXXRecordDecl *RD)
void Release()
Finalize LLVM code generation.
llvm::Constant * CopyHelper
void ClearUnusedCoverageMapping(const Decl *D)
Remove the deferred empty coverage mapping as this declaration is actually instrumented.
llvm::Constant * GetAddrOfGlobal(GlobalDecl GD)
void EmitGlobalAnnotations()
Emit all the global annotations.
OrderGlobalInits(unsigned int p, unsigned int l)
void SetCommonAttributes(const Decl *D, llvm::GlobalValue *GV)
llvm::Constant * clang_arc_use
void clang.arc.use(...);
llvm::Constant * objc_storeWeak
id objc_storeWeak(id*, id);
CharUnits computeNonVirtualBaseClassOffset(const CXXRecordDecl *DerivedClass, CastExpr::path_const_iterator Start, CastExpr::path_const_iterator End)
llvm::MDNode * getTBAAInfo(QualType QTy)
llvm::Function * CreateGlobalInitOrDestructFunction(llvm::FunctionType *ty, const Twine &name, SourceLocation Loc=SourceLocation(), bool TLS=false)
QualType getObjCFastEnumerationStateType()
Retrieve the record type that describes the state of an Objective-C fast enumeration loop (for...
unsigned char SizeSizeInBytes
virtual void emitCopy(CodeGenFunction &CGF, llvm::Value *dest, llvm::Value *src)=0
GVALinkage
A more specific kind of linkage than enum Linkage.
CoverageMappingModuleGen * getCoverageMapping() const
llvm::Constant * getNSConcreteGlobalBlock()
llvm::Type * getBlockDescriptorType()
Fetches the type of a generic block descriptor.
CodeGenVTables & getVTables()
SanitizerMetadata * getSanitizerMetadata()
llvm::IndexedInstrProfReader * getPGOReader() const
This represents '#pragma omp threadprivate ...' directive. For example, in the following, both 'a' and 'A::b' are threadprivate:
void EmitGlobal(GlobalDecl D)
void AddDependentLib(StringRef Lib)
Appends a dependent lib to the "Linker Options" metadata value.
llvm::GlobalValue::LinkageTypes getLLVMLinkageForDeclarator(const DeclaratorDecl *D, GVALinkage Linkage, bool IsConstantVariable)
Returns LLVM linkage for a declarator.
bool supportsCOMDAT() const
void EmitVTable(CXXRecordDecl *Class)
llvm::MDNode * getTBAAInfoForVTablePtr()
unsigned char PointerSizeInBytes