14 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
15 #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"
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;
178 uint32_t VisitedInMainFile;
179 uint32_t MissingInMainFile;
186 : VisitedInMainFile(0), MissingInMainFile(0), Visited(0), Missing(0),
226 void Profile(llvm::FoldingSetNodeID &
id)
const {
230 virtual void profileImpl(llvm::FoldingSetNodeID &
id)
const = 0;
250 : Priority(Priority), Initializer(Initializer),
251 AssociatedData(AssociatedData) {}
265 llvm::Module &TheModule;
268 std::unique_ptr<CGCXXABI> ABI;
269 llvm::LLVMContext &VMContext;
289 llvm::MDNode *NoObjCARCExceptionsMetadata;
290 std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader;
296 llvm::SmallPtrSet<llvm::GlobalValue*, 10> WeakRefReferences;
302 std::map<StringRef, GlobalDecl> DeferredDecls;
306 struct DeferredGlobal {
307 DeferredGlobal(llvm::GlobalValue *GV,
GlobalDecl GD) : GV(GV), GD(GD) {}
308 llvm::TrackingVH<llvm::GlobalValue> GV;
311 std::vector<DeferredGlobal> DeferredDeclsToEmit;
312 void addDeferredDeclToEmit(llvm::GlobalValue *GV,
GlobalDecl GD) {
313 DeferredDeclsToEmit.emplace_back(GV, GD);
318 std::vector<GlobalDecl> Aliases;
320 typedef llvm::StringMap<llvm::TrackingVH<llvm::Constant> > ReplacementsTy;
321 ReplacementsTy Replacements;
327 GlobalValReplacements;
335 std::vector<const CXXRecordDecl*> DeferredVTables;
340 std::vector<llvm::WeakVH> LLVMUsed;
341 std::vector<llvm::WeakVH> LLVMCompilerUsed;
352 llvm::MapVector<GlobalDecl, StringRef> MangledDeclNames;
353 llvm::StringMap<GlobalDecl, llvm::BumpPtrAllocator> Manglings;
356 std::vector<llvm::Constant*> Annotations;
359 llvm::StringMap<llvm::Constant*> AnnotationStrings;
361 llvm::StringMap<llvm::GlobalVariable *> CFConstantStringMap;
363 llvm::DenseMap<llvm::Constant *, llvm::GlobalVariable *> ConstantStringMap;
364 llvm::DenseMap<const Decl*, llvm::Constant *> StaticLocalDeclMap;
365 llvm::DenseMap<const Decl*, llvm::GlobalVariable*> StaticLocalDeclGuardMap;
366 llvm::DenseMap<const Expr*, llvm::Constant *> MaterializedGlobalTemporaryMap;
368 llvm::DenseMap<QualType, llvm::Constant *> AtomicSetterHelperFnMap;
369 llvm::DenseMap<QualType, llvm::Constant *> AtomicGetterHelperFnMap;
372 llvm::DenseMap<QualType, llvm::Constant *> TypeDescriptorMap;
377 llvm::GlobalValue *> StaticExternCMap;
378 StaticExternCMap StaticExternCValues;
381 std::vector<const VarDecl *> CXXThreadLocals;
385 std::vector<llvm::Function *> CXXThreadLocalInits;
386 std::vector<const VarDecl *> CXXThreadLocalInitVars;
389 std::vector<llvm::Function *> CXXGlobalInits;
396 llvm::DenseMap<const Decl*, unsigned> DelayedCXXInitPosition;
398 typedef std::pair<OrderGlobalInits, llvm::Function*> GlobalInitData;
400 struct GlobalInitPriorityCmp {
401 bool operator()(
const GlobalInitData &LHS,
402 const GlobalInitData &RHS)
const {
403 return LHS.first.priority < RHS.first.priority;
409 SmallVector<GlobalInitData, 8> PrioritizedCXXGlobalInits;
412 std::vector<std::pair<llvm::WeakVH,llvm::Constant*> > CXXGlobalDtors;
415 llvm::SetVector<clang::Module *> ImportedModules;
418 SmallVector<llvm::Metadata *, 16> LinkerOptionsMetadata;
425 llvm::WeakVH CFConstantStringClassRef;
429 llvm::WeakVH ConstantStringClassRef;
432 llvm::StructType *NSConstantStringType;
436 QualType ObjCFastEnumerationStateType;
441 void createObjCRuntime();
443 void createOpenCLRuntime();
444 void createOpenMPRuntime();
445 void createCUDARuntime();
447 bool isTriviallyRecursive(
const FunctionDecl *F);
448 bool shouldEmitFunction(GlobalDecl GD);
453 llvm::Constant *NSConcreteGlobalBlock;
454 llvm::Constant *NSConcreteStackBlock;
456 llvm::Constant *BlockObjectAssign;
457 llvm::Constant *BlockObjectDispose;
467 llvm::Constant *LifetimeStartFn;
470 llvm::Constant *LifetimeEndFn;
474 std::unique_ptr<SanitizerMetadata> SanitizerMD;
478 llvm::DenseMap<const Decl *, bool> DeferredEmptyCoverageMappingDecls;
480 std::unique_ptr<CoverageMappingModuleGen> CoverageMapping;
485 llvm::DenseMap<QualType, llvm::Metadata *> MetadataIdMap;
512 assert(OpenCLRuntime !=
nullptr);
513 return *OpenCLRuntime;
518 assert(OpenMPRuntime !=
nullptr);
519 return *OpenMPRuntime;
524 assert(CUDARuntime !=
nullptr);
529 assert(ObjCData !=
nullptr);
534 llvm::IndexedInstrProfReader *
getPGOReader()
const {
return PGOReader.get(); }
537 return CoverageMapping.get();
541 return StaticLocalDeclMap[D];
545 StaticLocalDeclMap[D] =
C;
550 llvm::GlobalValue::LinkageTypes
Linkage);
553 return StaticLocalDeclGuardMap[D];
556 llvm::GlobalVariable *
C) {
557 StaticLocalDeclGuardMap[D] =
C;
564 return AtomicSetterHelperFnMap[Ty];
567 llvm::Constant *Fn) {
568 AtomicSetterHelperFnMap[Ty] = Fn;
572 return AtomicGetterHelperFnMap[Ty];
575 llvm::Constant *Fn) {
576 AtomicGetterHelperFnMap[Ty] = Fn;
580 return TypeDescriptorMap[Ty];
583 TypeDescriptorMap[Ty] =
C;
589 if (!NoObjCARCExceptionsMetadata)
591 return NoObjCARCExceptionsMetadata;
597 const {
return HeaderSearchOpts; }
599 const {
return PreprocessorOpts; }
604 return TheModule.getDataLayout();
650 llvm::MDNode *TBAAInfo,
651 bool ConvertTypeToTag =
true);
673 llvm_unreachable(
"unknown visibility!");
682 llvm::GlobalVariable *
684 llvm::GlobalValue::LinkageTypes
Linkage);
708 bool ForVTable =
false,
709 bool DontDefer =
false,
710 bool IsForDefinition =
false);
779 StringRef
Name =
".str");
792 const char *GlobalName =
nullptr);
817 llvm::FunctionType *FnType =
nullptr,
818 bool DontDefer =
false,
bool IsForDefinition =
false);
848 template<
typename SomeDecl>
859 CXXGlobalDtors.emplace_back(DtorFn, Object);
865 llvm::AttributeSet ExtraAttrs =
866 llvm::AttributeSet());
870 llvm::AttributeSet ExtraAttrs =
871 llvm::AttributeSet());
1018 llvm::GlobalValue::LinkageTypes
1020 bool IsConstantVariable);
1023 llvm::GlobalValue::LinkageTypes
1046 const AnnotateAttr *AA,
1057 StringRef
Category = StringRef())
const;
1060 return SanitizerMD.get();
1064 DeferredVTables.push_back(RD);
1132 bool ForVTable,
bool DontDefer =
false,
1133 bool IsThunk =
false,
1134 llvm::AttributeSet ExtraAttrs = llvm::AttributeSet(),
1135 bool IsForDefinition =
false);
1137 llvm::Constant *GetOrCreateLLVMGlobal(StringRef MangledName,
1138 llvm::PointerType *PTy,
1141 void setNonAliasAttributes(
const Decl *D, llvm::GlobalObject *GO);
1144 void SetFunctionAttributes(
GlobalDecl GD, llvm::Function *F,
1145 bool IsIncompleteFunction,
bool IsThunk);
1147 void EmitGlobalDefinition(
GlobalDecl D, llvm::GlobalValue *GV =
nullptr);
1149 void EmitGlobalFunctionDefinition(
GlobalDecl GD, llvm::GlobalValue *GV);
1150 void EmitGlobalVarDefinition(
const VarDecl *D);
1162 void EmitCXXThreadLocalInitFunc();
1165 void EmitCXXGlobalInitFunc();
1168 void EmitCXXGlobalDtorFunc();
1172 void EmitCXXGlobalVarDeclInitFunc(
const VarDecl *D,
1173 llvm::GlobalVariable *Addr,
1176 void EmitPointerToInitFunc(
const VarDecl *VD, llvm::GlobalVariable *Addr,
1177 llvm::Function *InitFunc, InitSegAttr *ISA);
1180 void AddGlobalCtor(llvm::Function *Ctor,
int Priority = 65535,
1181 llvm::Constant *AssociatedData =
nullptr);
1182 void AddGlobalDtor(llvm::Function *Dtor,
int Priority = 65535);
1187 void EmitCtorList(
const CtorList &Fns,
const char *GlobalName);
1190 void EmitDeferred();
1193 void applyReplacements();
1196 void applyGlobalValReplacements();
1198 void checkAliases();
1201 void EmitDeferredVTables();
1204 void emitLLVMUsed();
1207 void EmitModuleLinkOptions();
1211 void EmitStaticExternCAliases();
1213 void EmitDeclMetadata();
1216 void EmitVersionIdentMetadata();
1219 void EmitTargetMetadata();
1223 void EmitCoverageFile();
1226 llvm::Constant *EmitUuidofInitializer(StringRef uuidstr);
1236 bool MayBeEmittedEagerly(
const ValueDecl *D);
1240 void SimplifyPersonality();
1245 #endif // LLVM_CLANG_LIB_CODEGEN_CODEGENMODULE_H
CGOpenCLRuntime & getOpenCLRuntime()
Return a reference to the configured OpenCL runtime.
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
llvm::Type * getGenericBlockLiteralType()
The type of a generic block literal.
void EmitDeferredUnusedCoverageMappings()
Emit all the deferred coverage mappings for the uninstrumented functions.
void DecorateInstructionWithInvariantGroup(llvm::Instruction *I, const CXXRecordDecl *RD)
Adds !invariant.barrier !tag to instruction.
ObjCEntrypoints & getObjCEntrypoints() const
void Profile(llvm::FoldingSetNodeID &id) const
void setTypeDescriptorInMap(QualType Ty, llvm::Constant *C)
A (possibly-)qualified type.
bool ReturnTypeUsesSRet(const CGFunctionInfo &FI)
Return true iff the given type uses 'sret' when used as a return type.
CodeGenTypes & getTypes()
llvm::Constant * AssociatedData
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()
ConstantAddress GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *)
Return a pointer to a constant array for the given ObjCEncodeExpr node.
llvm::Constant * CopyHelper
CharUnits getClassPointerAlignment(const CXXRecordDecl *CD)
Returns the assumed alignment of an opaque pointer to the given class.
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.
Decl - This represents one declaration (or definition), e.g.
llvm::Constant * objc_autoreleaseReturnValue
id objc_autoreleaseReturnValue(id);
llvm::MDNode * getTBAAStructInfo(QualType QTy)
BlockByrefHelpers(CharUnits alignment)
void setAliasAttributes(const Decl *D, llvm::GlobalValue *GV)
Set attributes which must be preserved by an alias.
const llvm::DataLayout & getDataLayout() const
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...
NamespaceDecl - Represent a C++ namespace.
llvm::Constant * objc_loadWeakRetained
id objc_loadWeakRetained(id*);
const PreprocessorOptions & getPreprocessorOpts() const
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
CtorList & getGlobalCtors()
bool operator==(const OrderGlobalInits &RHS) const
bool TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D)
Try to emit a base destructor as an alias to its primary base-class destructor.
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)
Emit the given constant value as a constant, in the type's scalar representation. ...
const CXXBaseSpecifier *const * path_const_iterator
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD)
Tell the consumer that this variable has been instantiated.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Objects with "hidden" visibility are not seen by the dynamic linker.
CompoundLiteralExpr - [C99 6.5.2.5].
void setFunctionDefinitionAttributes(const FunctionDecl *D, llvm::Function *F)
Set attributes for a global definition.
CGDebugInfo * getModuleDebugInfo()
void setFunctionDLLStorageClass(GlobalDecl GD, llvm::Function *F)
Set the DLL storage class on F.
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
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)
Return the llvm::Constant for the address of the given global variable.
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::Constant * EmitConstantValueForMemory(const APValue &Value, QualType DestType, CodeGenFunction *CGF=nullptr)
Emit the given constant value as a constant, in the type's memory representation. ...
llvm::Constant * objc_autorelease
id objc_autorelease(id);
llvm::GlobalVariable * getStaticLocalDeclGuardAddress(const VarDecl *D)
llvm::Constant * objc_copyWeak
void objc_copyWeak(id *dest, id *src);
llvm::Constant * getAtomicGetterHelperFnMap(QualType Ty)
One of these records is kept for each identifier that is lexed.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
llvm::Constant * objc_loadWeak
id objc_loadWeak(id*);
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
llvm::Constant * objc_retainAutoreleasedReturnValue
id objc_retainAutoreleasedReturnValue(id);
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. ...
bool isPaddedAtomicType(QualType type)
Objects with "default" visibility are seen by the dynamic linker and act like normal objects...
llvm::Constant * GetConstantArrayFromStringLiteral(const StringLiteral *E)
Return a constant array for the given string.
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 * getLLVMLifetimeStartFn()
Lazily declare the .lifetime.start intrinsic.
virtual void profileImpl(llvm::FoldingSetNodeID &id) const =0
bool operator<(const OrderGlobalInits &RHS) const
CGOpenMPRuntime(CodeGenModule &CGM)
CGCUDARuntime & getCUDARuntime()
Return a reference to the configured CUDA runtime.
llvm::Constant * objc_initWeak
id objc_initWeak(id*, id);
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 * objc_release
void objc_release(id);
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.
void addCompilerUsedGlobal(llvm::GlobalValue *GV)
Add a global to a list to be added to the llvm.compiler.used metadata.
llvm::Constant * GetAddrOfGlobal(GlobalDecl GD, bool IsForDefinition=false)
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.
detail::InMemoryDirectory::const_iterator I
llvm::Constant * getNSConcreteStackBlock()
llvm::Constant * Initializer
InstrProfStats & getPGOStats()
bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor)
isTypeConstant - Determine whether an object of this type can be emitted as a constant.
const HeaderSearchOptions & getHeaderSearchOpts() const
llvm::Constant * getStaticLocalDeclAddress(const VarDecl *D)
const TargetCodeGenInfo & getTargetCodeGenInfo()
llvm::Constant * objc_storeStrong
id objc_storeStrong(id*, id);
virtual void emitCopy(CodeGenFunction &CGF, Address dest, Address src)=0
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.
CtorList & getGlobalDtors()
bool shouldUseTBAA() const
StringRef getBlockMangledName(GlobalDecl GD, const BlockDecl *BD)
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *FD)
Exposes information about the current target.
void DecorateInstructionWithTBAA(llvm::Instruction *Inst, llvm::MDNode *TBAAInfo, bool ConvertTypeToTag=true)
Decorate the instruction with a TBAA tag.
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.
CharUnits Alignment
The alignment of the field.
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
Defines the clang::LangOptions interface.
llvm::Constant * objc_autoreleasePoolPop
void objc_autoreleasePoolPop(void*);
virtual bool needsCopy() const
CGCXXABI & getCXXABI() const
void AddGlobalAnnotations(const ValueDecl *D, llvm::GlobalValue *GV)
Add global annotations that are set on D, for the global GV.
llvm::Constant * DisposeHelper
void SetInternalFunctionAttributes(const Decl *D, llvm::Function *F, const CGFunctionInfo &FI)
Set the attributes on the LLVM function for the given decl and function info.
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.
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::Constant * objc_retain
id objc_retain(id);
ASTContext & getContext() const
void setStaticLocalDeclGuardAddress(const VarDecl *D, llvm::GlobalVariable *C)
MicrosoftVTableContext & getMicrosoftVTableContext()
bool ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI)
Return true iff the given type uses an argument slot when 'sret' is used as a return type...
llvm::GlobalValue::LinkageTypes getLLVMLinkageVarDefinition(const VarDecl *VD, bool IsConstant)
Returns LLVM linkage for a declarator.
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues, like target-specific attributes, builtins and so on.
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.
llvm::Constant * EmitAnnotationString(StringRef Str)
Emit an annotation string.
ConstantAddress GetAddrOfUuidDescriptor(const CXXUuidofExpr *E)
Get the address of a uuid descriptor .
llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD)
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
llvm::Function * getIntrinsic(unsigned IID, ArrayRef< llvm::Type * > Tys=None)
bool lookupRepresentativeDecl(StringRef MangledName, GlobalDecl &Result) const
CallingConv
CallingConv - Specifies the calling convention that a function uses.
GlobalDecl - represents a global declaration.
llvm::GlobalVariable * CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage)
Will return a global variable of the given type.
llvm::Constant * EmitAnnotateAttr(llvm::GlobalValue *GV, const AnnotateAttr *AA, SourceLocation L)
Generate the llvm::ConstantStruct which contains the annotation information for a given GlobalValue...
llvm::Constant * GetAddrOfThunk(GlobalDecl GD, const ThunkInfo &Thunk)
Get the address of the thunk for the given global decl.
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 addVisited(bool MainFile)
Record that we've visited a function and whether or not that function was in the main source file...
The l-value was considered opaque, so the alignment was determined from a type.
llvm::Constant * objc_retainBlock
id objc_retainBlock(id);
llvm::Constant * getOrCreateStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)
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 * objc_storeWeak
id objc_storeWeak(id*, id);
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)
Try to emit the given expression as a constant; returns 0 if the expression cannot be emitted as a co...
Encodes a location in the source.
llvm::Constant * getTypeDescriptorFromMap(QualType Ty)
ConstantAddress GetAddrOfConstantCFString(const StringLiteral *Literal)
Return a pointer to a constant CFString object for the given string.
TagDecl - Represents the declaration of a struct/union/class/enum.
llvm::Metadata * CreateMetadataIdentifierForType(QualType T)
Create a metadata identifier for the given type.
llvm::Constant * objc_autoreleasePoolPush
void *objc_autoreleasePoolPush(void);
Represents a static or instance method of a struct/union/class.
ConstantAddress GetAddrOfConstantStringFromLiteral(const StringLiteral *S, StringRef Name=".str")
Return a pointer to a constant array for the given string literal.
llvm::Constant * EmitNullConstantForBase(const CXXRecordDecl *Record)
Return a null constant appropriate for zero-initializing a base class with the given type...
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
A void(void) inline asm to use to mark that the return value of a call will be immediately retain...
const CodeGenOptions & getCodeGenOpts() const
void addGlobalValReplacement(llvm::GlobalValue *GV, llvm::Constant *C)
ConstantAddress GetWeakRefReference(const ValueDecl *VD)
Get a reference to the target of VD.
llvm::Constant * getBlockObjectDispose()
const LangOptions & getLangOpts() const
void SetLLVMFunctionAttributesForDefinition(const Decl *D, llvm::Function *F)
Set the LLVM function attributes which only apply to a function definition.
void EmitTopLevelDecl(Decl *D)
Emit code for a single top level declaration.
llvm::Constant * EmitAnnotationLineNo(SourceLocation L)
Emit the annotation line number.
llvm::Constant * getAddrOfCXXStructor(const CXXMethodDecl *MD, StructorType Type, const CGFunctionInfo *FnInfo=nullptr, llvm::FunctionType *FnType=nullptr, bool DontDefer=false, bool IsForDefinition=false)
Return the address of the constructor/destructor of the given type.
virtual bool needsDispose() const
ItaniumVTableContext & getItaniumVTableContext()
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.
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)
Given a builtin id for a function like "__builtin_fabsf", return a Function* for "fabsf".
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...
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)
Emit bit set entries for the given vtable using the given layout if vptr CFI is enabled.
void ErrorUnsupported(const Stmt *S, const char *Type)
Print out an error that codegen doesn't support the specified stmt yet.
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.
void CreateFunctionBitSetEntry(const FunctionDecl *FD, llvm::Function *F)
Create a bitset entry for the given function and add it to BitsetsMD.
llvm::GlobalValue * GetGlobalValue(StringRef Ref)
llvm::FoldingSet< BlockByrefHelpers > ByrefHelpersCache
int getUniqueBlockCount()
Fetches the global unique block count.
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)
Try to emit a definition as a global alias for another definition.
llvm::ConstantInt * CreateCfiIdForTypeMetadata(llvm::Metadata *MD)
Generate a cross-DSO type identifier for type.
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 EmitOMPThreadPrivateDecl(const OMPThreadPrivateDecl *D)
Emit a code for threadprivate directive.
llvm::Constant * objc_destroyWeak
void objc_destroyWeak(id*);
llvm::Constant * clang_arc_use
void clang.arc.use(...);
ConstantAddress GetAddrOfConstantString(const StringLiteral *Literal)
Return a pointer to a constant NSString object for the given string.
llvm::Constant * EmitNullConstant(QualType T)
Return the result of value-initializing the given type, i.e.
void UpdateCompletedType(const TagDecl *TD)
detail::InMemoryDirectory::const_iterator E
unsigned GetGlobalVarAddressSpace(const VarDecl *D, unsigned AddrSpace)
Return the address space of the underlying global variable for D, as determined by its declaration...
const llvm::Triple & getTriple() const
ExplicitCastExpr - An explicit cast written in the source code.
void maybeSetTrivialComdat(const Decl &D, llvm::GlobalObject &GO)
CharUnits getVBaseAlignment(CharUnits DerivedAlign, const CXXRecordDecl *Derived, const CXXRecordDecl *VBase)
Returns the assumed alignment of a virtual base of a class.
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::LinkageTypes getVTableLinkage(const CXXRecordDecl *RD)
Return the appropriate linkage for the vtable, VTT, and type information of the given class...
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
void EmitExplicitCastExprType(const ExplicitCastExpr *E, CodeGenFunction *CGF=nullptr)
Emit type info if type of an expression is a variably modified type.
void AppendLinkerOptions(StringRef Opts)
Appends Opts to the "Linker Options" metadata value.
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.
llvm::Constant * objc_retainAutorelease
id objc_retainAutorelease(id);
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
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.
llvm::Constant * GetAddrOfGlobalBlock(const BlockExpr *BE, const char *)
Gets the address of a block which requires no captures.
StringRef getMangledName(GlobalDecl GD)
virtual void emitDispose(CodeGenFunction &CGF, Address field)=0
llvm::Constant * getBlockObjectAssign()
void setAtomicSetterHelperFnMap(QualType Ty, llvm::Constant *Fn)
ConstantAddress GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *E)
Returns a pointer to a constant global variable for the given file-scope compound literal expression...
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
CodeGenTBAA - This class organizes the cross-module state that is used while lowering AST types to LL...
llvm::Constant * EmitConstantInit(const VarDecl &D, CodeGenFunction *CGF=nullptr)
Try to emit the initializer for the given declaration as a constant; returns 0 if the expression cann...
llvm::MDNode * getNoObjCARCExceptionsMetadata()
llvm::Constant * objc_moveWeak
void objc_moveWeak(id *dest, id *src);
llvm::ConstantInt * getSize(CharUnits numChars)
Emit the given number of characters as a value of type size_t.
A pair of helper functions for a __block variable.
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.
llvm::Function * CreateGlobalInitOrDestructFunction(llvm::FunctionType *ty, const Twine &name, const CGFunctionInfo &FI, SourceLocation Loc=SourceLocation(), bool TLS=false)
bool IsCFIBlacklistedRecord(const CXXRecordDecl *RD)
Returns whether the given record is blacklisted from control flow integrity checks.
A specialization of Address that requires the address to be an LLVM Constant.
void Release()
Finalize LLVM code generation.
void ClearUnusedCoverageMapping(const Decl *D)
Remove the deferred empty coverage mapping as this declaration is actually instrumented.
void EmitGlobalAnnotations()
Emit all the global annotations.
virtual ~BlockByrefHelpers()
OrderGlobalInits(unsigned int p, unsigned int l)
void CreateVTableBitSetEntry(llvm::NamedMDNode *BitsetsMD, llvm::GlobalVariable *VTable, CharUnits Offset, const CXXRecordDecl *RD)
Create a bitset entry for the given vtable and add it to BitsetsMD.
void SetCommonAttributes(const Decl *D, llvm::GlobalValue *GV)
Set attributes which are common to any form of a global definition (alias, Objective-C method...
StringLiteral - This represents a string literal expression, e.g.
CharUnits computeNonVirtualBaseClassOffset(const CXXRecordDecl *DerivedClass, CastExpr::path_const_iterator Start, CastExpr::path_const_iterator End)
llvm::MDNode * getTBAAInfo(QualType QTy)
QualType getObjCFastEnumerationStateType()
Retrieve the record type that describes the state of an Objective-C fast enumeration loop (for...
GVALinkage
A more specific kind of linkage than enum Linkage.
This structure provides a set of types that are commonly used during IR emission. ...
CoverageMappingModuleGen * getCoverageMapping() const
llvm::Constant * getNSConcreteGlobalBlock()
llvm::Type * getBlockDescriptorType()
Fetches the type of a generic block descriptor.
CodeGenVTables & getVTables()
NamedDecl - This represents a decl with a name.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
SanitizerMetadata * getSanitizerMetadata()
llvm::IndexedInstrProfReader * getPGOReader() const
void ConstructAttributeList(StringRef Name, const CGFunctionInfo &Info, CGCalleeInfo CalleeInfo, AttributeListType &PAL, unsigned &CallingConv, bool AttrOnCallSite)
Get the LLVM attributes and calling convention to use for a particular function type.
llvm::Constant * objc_retainAutoreleaseReturnValue
id objc_retainAutoreleaseReturnValue(id);
llvm::Constant * GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty=nullptr, bool ForVTable=false, bool DontDefer=false, bool IsForDefinition=false)
Return the address of the given function.
This represents '#pragma omp threadprivate ...' directive.
void EmitGlobal(GlobalDecl D)
Emit code for a singal global function or var decl.
CGCalleeInfo - Class to encapsulate the information about a callee to be used during the generation o...
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)
This is a callback from Sema to tell us that that a particular v-table is required to be emitted in t...
llvm::MDNode * getTBAAInfoForVTablePtr()