25 using namespace llvm::dwarf;
28 : M(m), VMContext(M.getContext()), CUNode(nullptr),
29 DeclareFn(nullptr), ValueFn(nullptr),
30 AllowUnresolvedNodes(AllowUnresolvedNodes) {}
32 void DIBuilder::trackIfUnresolved(
MDNode *
N) {
38 assert(AllowUnresolvedNodes &&
"Cannot handle unresolved nodes");
39 UnresolvedNodes.emplace_back(N);
49 auto PV = PreservedVariables.find(SP);
50 if (PV != PreservedVariables.end())
51 Variables.
append(PV->second.begin(), PV->second.end());
54 TempMDTuple(Temp)->replaceAllUsesWith(AV.get());
59 assert(!AllowUnresolvedNodes &&
60 "creating type nodes without a CU is not supported");
72 for (
unsigned I = 0,
E = AllRetainTypes.size();
I <
E;
I++)
73 if (RetainSet.
insert(AllRetainTypes[
I]).second)
74 RetainValues.
push_back(AllRetainTypes[I]);
76 if (!RetainValues.
empty())
79 DISubprogramArray SPs =
MDTuple::get(VMContext, AllSubprograms);
82 for (
auto *N : RetainValues)
83 if (
auto *SP = dyn_cast<DISubprogram>(N))
89 if (!AllImportedModules.empty())
92 AllImportedModules.end())));
94 for (
const auto &I : AllMacrosPerParent) {
101 auto *TMF = cast<DIMacroFile>(I.first);
103 TMF->getLine(), TMF->getFile(),
110 for (
const auto &N : UnresolvedNodes)
113 UnresolvedNodes.clear();
116 AllowUnresolvedNodes =
false;
121 if (!N || isa<DICompileUnit>(N))
123 return cast<DIScope>(
N);
130 bool SplitDebugInlining,
bool DebugInfoForProfiling) {
132 assert(((Lang <= dwarf::DW_LANG_Fortran08 && Lang >= dwarf::DW_LANG_C89) ||
134 "Invalid Language tag");
136 assert(!CUNode &&
"Can only make one compile unit per DIBuilder instance");
138 VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
139 SplitName, Kind,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, DWOId,
140 SplitDebugInlining, DebugInfoForProfiling);
145 trackIfUnresolved(CUNode);
154 assert(File &&
"Source location has line number but no file");
155 unsigned EntitiesCount = C.
pImpl->DIImportedEntitys.size();
158 if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
196 Context, Decl, File, Line, Name,
202 return DIFile::get(VMContext, Filename, Directory, CSKind, Checksum);
208 assert(!Name.
empty() &&
"Unable to create macro without name");
211 "Unexpected macro type");
212 auto *M =
DIMacro::get(VMContext, MacroType, LineNumber, Name, Value);
213 AllMacrosPerParent[Parent].insert(M);
220 LineNumber, File, DIMacroNodeArray())
222 AllMacrosPerParent[Parent].insert(MF);
226 AllMacrosPerParent.insert({MF, {}});
231 assert(!Name.
empty() &&
"Unable to create enumerator without name");
236 assert(!Name.
empty() &&
"Unable to create type without name");
246 assert(!Name.
empty() &&
"Unable to create type without name");
247 return DIBasicType::get(VMContext, dwarf::DW_TAG_base_type, Name, SizeInBits,
253 0, 0,
None, DINode::FlagZero);
264 nullptr, 0,
nullptr, PointeeTy, SizeInBits,
265 AlignInBits, 0, DWARFAddressSpace,
275 nullptr, 0,
nullptr, PointeeTy, SizeInBits,
276 AlignInBits, 0,
None, Flags, Base);
284 assert(RTy &&
"Unable to create reference type");
286 SizeInBits, AlignInBits, 0, DWARFAddressSpace,
295 0,
None, DINode::FlagZero);
299 assert(Ty &&
"Invalid type!");
300 assert(FriendTy &&
"Invalid friend type!");
302 FriendTy, 0, 0, 0,
None, DINode::FlagZero);
308 assert(Ty &&
"Unable to create inheritance");
310 0, Ty, BaseTy, 0, 0, BaseOffset,
None, Flags);
317 uint64_t OffsetInBits,
321 SizeInBits, AlignInBits, OffsetInBits,
None, Flags);
332 uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits,
334 Flags |= DINode::FlagBitField;
336 VMContext, dwarf::DW_TAG_member, Name, File, LineNumber,
338 OffsetInBits,
None, Flags,
340 StorageOffsetInBits)));
345 unsigned LineNumber,
DIType *Ty,
348 Flags |= DINode::FlagStaticMember;
351 AlignInBits, 0,
None, Flags,
357 uint64_t SizeInBits,
uint32_t AlignInBits,
362 SizeInBits, AlignInBits, OffsetInBits,
None, Flags,
369 unsigned PropertyAttributes,
DIType *Ty) {
371 SetterName, PropertyAttributes, Ty);
377 assert((!Context || isa<DICompileUnit>(Context)) &&
"Expected compile unit");
385 assert((!Context || isa<DICompileUnit>(Context)) &&
"Expected compile unit");
393 VMContext, dwarf::DW_TAG_template_value_parameter, Context, Name, Ty,
401 VMContext, dwarf::DW_TAG_GNU_template_template_param, Context, Name, Ty,
407 DIType *Ty, DINodeArray Val) {
409 VMContext, dwarf::DW_TAG_GNU_template_parameter_pack, Context, Name, Ty,
415 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
418 assert((!Context || isa<DIScope>(Context)) &&
419 "createClassType should be called with a valid Context");
422 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
424 OffsetInBits, Flags, Elements, 0, VTableHolder,
425 cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
426 trackIfUnresolved(R);
433 DIType *DerivedFrom, DINodeArray Elements,
unsigned RunTimeLang,
436 VMContext, dwarf::DW_TAG_structure_type, Name, File, LineNumber,
438 Flags, Elements, RunTimeLang, VTableHolder,
nullptr, UniqueIdentifier);
439 trackIfUnresolved(R);
446 DINodeArray Elements,
unsigned RunTimeLang,
StringRef UniqueIdentifier) {
448 VMContext, dwarf::DW_TAG_union_type, Name, File, LineNumber,
450 Elements, RunTimeLang,
nullptr,
nullptr, UniqueIdentifier);
451 trackIfUnresolved(R);
463 uint64_t SizeInBits,
uint32_t AlignInBits, DINodeArray Elements,
466 VMContext, dwarf::DW_TAG_enumeration_type, Name, File, LineNumber,
468 DINode::FlagZero, Elements, 0,
nullptr,
nullptr, UniqueIdentifier);
469 AllEnumTypes.push_back(CTy);
470 trackIfUnresolved(CTy);
476 DINodeArray Subscripts) {
478 nullptr, 0,
nullptr, Ty, Size, AlignInBits, 0,
479 DINode::FlagZero, Subscripts, 0,
nullptr);
480 trackIfUnresolved(R);
486 DINodeArray Subscripts) {
488 nullptr, 0,
nullptr, Ty, Size, AlignInBits, 0,
489 DINode::FlagVector, Subscripts, 0,
nullptr);
490 trackIfUnresolved(R);
496 auto NewTy = Ty->
clone();
497 NewTy->setFlags(NewTy->getFlags() | FlagsToSet);
517 assert(T &&
"Expected non-null type");
518 assert((isa<DIType>(T) || (isa<DISubprogram>(T) &&
519 cast<DISubprogram>(T)->isDefinition() ==
false)) &&
520 "Expected type or subprogram declaration");
521 AllRetainTypes.emplace_back(T);
528 DIFile *
F,
unsigned Line,
unsigned RuntimeLang,
529 uint64_t SizeInBits,
uint32_t AlignInBits,
535 SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl,
nullptr, RuntimeLang,
536 nullptr,
nullptr, UniqueIdentifier);
537 trackIfUnresolved(RetTy);
543 unsigned RuntimeLang, uint64_t SizeInBits,
uint32_t AlignInBits,
548 SizeInBits, AlignInBits, 0, Flags,
nullptr, RuntimeLang,
nullptr,
549 nullptr, UniqueIdentifier)
551 trackIfUnresolved(RetTy);
566 for (
unsigned i = 0, e = Elements.
size(); i != e; ++i) {
567 if (Elements[i] && isa<MDNode>(Elements[i]))
568 Elts.
push_back(cast<DIType>(Elements[i]));
583 assert(CT->getIdentifier().empty() &&
584 "Context of a global variable should not be a type with identifier");
595 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
596 LineNumber, Ty, isLocalToUnit,
true, cast_or_null<DIDerivedType>(Decl),
605 unsigned LineNumber,
DIType *Ty,
bool isLocalToUnit,
MDNode *Decl,
610 VMContext, cast_or_null<DIScope>(Context), Name, LinkageName, F,
611 LineNumber, Ty, isLocalToUnit,
false,
612 cast_or_null<DIDerivedType>(Decl), AlignInBits)
630 File, LineNo, Ty, ArgNo, Flags, AlignInBits);
631 if (AlwaysPreserve) {
636 assert(Fn &&
"Missing subprogram for local variable");
637 PreservedVariables[Fn].emplace_back(Node);
644 DIType *Ty,
bool AlwaysPreserve,
648 0, File, LineNo, Ty, AlwaysPreserve,
655 assert(ArgNo &&
"Expected non-zero argument number for parameter");
657 File, LineNo, Ty, AlwaysPreserve, Flags,
672 unsigned SizeInBytes) {
677 template <
class... Ts>
688 bool isOptimized, DITemplateParameterArray TParams,
DISubprogram *Decl,
689 DITypeArray ThrownTypes) {
691 isDefinition, VMContext,
693 isLocalToUnit, isDefinition, ScopeLine,
nullptr, 0, 0, 0, Flags,
694 isOptimized, isDefinition ? CUNode :
nullptr, TParams, Decl,
698 AllSubprograms.push_back(Node);
699 trackIfUnresolved(Node);
707 bool isOptimized, DITemplateParameterArray TParams,
DISubprogram *Decl,
708 DITypeArray ThrownTypes) {
711 File, LineNo, Ty, isLocalToUnit, isDefinition, ScopeLine,
nullptr,
712 0, 0, 0, Flags, isOptimized, isDefinition ? CUNode :
nullptr,
713 TParams, Decl,
nullptr, ThrownTypes)
720 bool isDefinition,
unsigned VK,
unsigned VIndex,
int ThisAdjustment,
722 DITemplateParameterArray TParams, DITypeArray ThrownTypes) {
724 "Methods should have both a Context and a context that isn't "
725 "the compile unit.");
728 isDefinition, VMContext, cast<DIScope>(Context), Name,
729 LinkageName, F, LineNo, Ty, isLocalToUnit, isDefinition, LineNo,
730 VTableHolder, VK, VIndex, ThisAdjustment, Flags, isOptimized,
731 isDefinition ? CUNode :
nullptr, TParams,
nullptr,
nullptr, ThrownTypes);
734 AllSubprograms.push_back(SP);
735 trackIfUnresolved(SP);
740 bool ExportSymbols) {
756 ConfigurationMacros, IncludePath, ISysRoot);
761 unsigned Discriminator) {
766 unsigned Line,
unsigned Col) {
774 assert(V &&
"no value passed to dbg intrinsic");
786 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.declare");
787 assert(DL &&
"Expected debug loc");
788 assert(DL->getScope()->getSubprogram() ==
790 "Expected matching subprograms");
794 trackIfUnresolved(VarInfo);
795 trackIfUnresolved(Expr);
805 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.declare");
806 assert(DL &&
"Expected debug loc");
807 assert(DL->getScope()->getSubprogram() ==
809 "Expected matching subprograms");
813 trackIfUnresolved(VarInfo);
814 trackIfUnresolved(Expr);
831 assert(V &&
"no value passed to dbg.value");
832 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.value");
833 assert(DL &&
"Expected debug loc");
834 assert(DL->getScope()->getSubprogram() ==
836 "Expected matching subprograms");
840 trackIfUnresolved(VarInfo);
841 trackIfUnresolved(Expr);
854 assert(V &&
"no value passed to dbg.value");
855 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.value");
856 assert(DL &&
"Expected debug loc");
857 assert(DL->getScope()->getSubprogram() ==
859 "Expected matching subprograms");
863 trackIfUnresolved(VarInfo);
864 trackIfUnresolved(Expr);
882 if (T != VTableHolder)
889 if (
auto *N = dyn_cast_or_null<MDNode>(O))
890 trackIfUnresolved(N);
894 DINodeArray TParams) {
912 trackIfUnresolved(Elements.get());
914 trackIfUnresolved(TParams.get());
void finalize()
Construct any deferred debug info descriptors.
DISubprogram * createTempFunctionFwdDecl(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit, bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, bool isOptimized=false, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr)
Identical to createFunction, except that the resulting DbgNode is meant to be RAUWed.
DISubprogram * createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit, bool isDefinition, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, bool isOptimized=false, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr)
Create a new descriptor for the specified subprogram.
void push_back(const T &Elt)
Tracking metadata reference owned by Metadata.
DIDerivedType * createPointerType(DIType *PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits=0, Optional< unsigned > DWARFAddressSpace=None, StringRef Name="")
Create debugging information entry for a pointer.
static Value * getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V)
bool isArtificial() const
DIGlobalVariableExpression * createGlobalVariableExpression(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool isLocalToUnit, DIExpression *Expr=nullptr, MDNode *Decl=nullptr, uint32_t AlignInBits=0)
Create a new descriptor for the specified variable.
A Module instance is used to store all the information related to an LLVM module. ...
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
void replaceTemplateParams(DITemplateParameterArray TemplateParams)
DINamespace * createNameSpace(DIScope *Scope, StringRef Name, bool ExportSymbols)
This creates new descriptor for a namespace with the specified parent scope.
static MDString * get(LLVMContext &Context, StringRef Str)
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
DILocalScope * getScope() const
Get the local scope for this variable.
DIDerivedType * createBitFieldMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty)
Create debugging information entry for a bit field member.
DICompositeType * createUnionType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DINodeArray Elements, unsigned RunTimeLang=0, StringRef UniqueIdentifier="")
Create debugging information entry for an union.
void addOperand(MDNode *M)
DICompositeType * createArrayType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
Create debugging information entry for an array.
DICompositeType * createReplaceableCompositeType(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagFwdDecl, StringRef UniqueIdentifier="")
Create a temporary forward-declared type.
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Return the named MDNode in the module with the specified name.
DICompositeType * createClassType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, DIType *VTableHolder=nullptr, MDNode *TemplateParms=nullptr, StringRef UniqueIdentifier="")
Create debugging information entry for a class.
DIGlobalVariable * createTempGlobalVariableFwdDecl(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool isLocalToUnit, MDNode *Decl=nullptr, uint32_t AlignInBits=0)
Identical to createGlobalVariable except that the resulting DbgNode is temporary and meant to be RAUW...
DISubrange * getOrCreateSubrange(int64_t Lo, int64_t Count)
Create a descriptor for a value range.
DIMacro * createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType, StringRef Name, StringRef Value=StringRef())
Create debugging information entry for a macro.
static IntegerType * getInt64Ty(LLVMContext &C)
void replaceArrays(DICompositeType *&T, DINodeArray Elements, DINodeArray TParams=DINodeArray())
Replace arrays on a composite type.
DICompositeType * createForwardDecl(unsigned Tag, StringRef Name, DIScope *Scope, DIFile *F, unsigned Line, unsigned RuntimeLang=0, uint64_t SizeInBits=0, uint32_t AlignInBits=0, StringRef UniqueIdentifier="")
Create a permanent forward-declared type.
DIDerivedType * createStaticMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, DINode::DIFlags Flags, Constant *Val, uint32_t AlignInBits=0)
Create debugging information entry for a C++ static data member.
DISubprogram * createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, bool isLocalToUnit, bool isDefinition, unsigned Virtuality=0, unsigned VTableIndex=0, int ThisAdjustment=0, DIType *VTableHolder=nullptr, DINode::DIFlags Flags=DINode::FlagZero, bool isOptimized=false, DITemplateParameterArray TParams=nullptr, DITypeArray ThrownTypes=nullptr)
Create a new descriptor for the specified C++ method.
Instruction * insertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
Insert a new llvm.dbg.value intrinsic call.
DIType * createObjectPointerType(DIType *Ty)
Create a new DIType* with the "object pointer" flag set.
DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line)
Create a descriptor for an imported module.
DIDerivedType * createMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty)
Create debugging information entry for a member.
DITypeRefArray getOrCreateTypeArray(ArrayRef< Metadata * > Elements)
Get a DITypeRefArray, create one if required.
Tagged DWARF-like metadata node.
void replaceRetainedTypes(DITypeArray N)
DILexicalBlockFile * createLexicalBlockFile(DIScope *Scope, DIFile *File, unsigned Discriminator=0)
This creates a descriptor for a lexical block with a new file attached.
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, DIFile *File, unsigned Line, StringRef Name, SmallVectorImpl< TrackingMDNodeRef > &AllImportedModules)
DINodeArray getOrCreateArray(ArrayRef< Metadata * > Elements)
Get a DINodeArray, create one if required.
DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty)
Create debugging information for template type parameter.
Instruction * insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo, DIExpression *Expr, const DILocation *DL, BasicBlock *InsertAtEnd)
Insert a new llvm.dbg.declare intrinsic call.
DIDerivedType * createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context)
Create debugging information entry for a typedef.
DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
DIMacroFile * createTempMacroFile(DIMacroFile *Parent, unsigned Line, DIFile *File)
Create debugging information temporary entry for a macro file.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
DISubroutineType * createSubroutineType(DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
Only used in LLVM metadata.
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
void resolveCycles()
Resolve cycles.
LLVM_NODISCARD bool empty() const
DIEnumerator * createEnumerator(StringRef Name, int64_t Val)
Create a single enumerator value.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a temporary node.
size_t size() const
size - Get the array size.
DIBasicType * createNullPtrType()
Create C++11 nullptr type.
DICompositeType * createEnumerationType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier="")
Create debugging information entry for an enumeration.
static Instruction * withDebugLoc(Instruction *I, const DILocation *DL)
void replaceVTableHolder(DITypeRef VTableHolder)
DICompositeType * createStructType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIType *DerivedFrom, DINodeArray Elements, unsigned RunTimeLang=0, DIType *VTableHolder=nullptr, StringRef UniqueIdentifier="")
Create debugging information entry for a struct.
DIType * createArtificialType(DIType *Ty)
Create a new DIType* with "artificial" flag set.
DIFile * createFile(StringRef Filename, StringRef Directory, DIFile::ChecksumKind CSKind=DIFile::CSK_None, StringRef Checksum=StringRef())
Create a file descriptor to hold debugging information for a file.
static std::enable_if< std::is_base_of< MDNode, T >::value, T * >::type replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
DIDerivedType * createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits=0, uint32_t AlignInBits=0, Optional< unsigned > DWARFAddressSpace=None)
Create debugging information entry for a c++ style reference or rvalue reference type.
TypedDINodeRef< DINode > DINodeRef
Subclasses of this class are all able to terminate a basic block.
void setDebugLoc(DebugLoc Loc)
Set the debug location information for this instruction.
void replaceVTableHolder(DICompositeType *&T, DICompositeType *VTableHolder)
Replace the vtable holder in the given composite type.
LLVM Basic Block Representation.
This is an important class for using LLVM in a threaded context.
static void checkGlobalVariableScope(DIScope *Context)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
This is an important base class in LLVM.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
This file contains the declarations for the subclasses of Constant, which represent the different fla...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
A pair of DIGlobalVariable and DIExpression.
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
DIBuilder(Module &M, bool AllowUnresolved=true)
Construct a builder for a module.
static DILocalVariable * createLocalVariable(LLVMContext &VMContext, DenseMap< MDNode *, SmallVector< TrackingMDNodeRef, 1 >> &PreservedVariables, DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve, DINode::DIFlags Flags, uint32_t AlignInBits)
DIExpression * createFragmentExpression(unsigned OffsetInBits, unsigned SizeInBits)
Create a descriptor to describe one part of aggregate variable that is fragmented across multiple Val...
bool isObjectPointer() const
LLVMContextImpl *const pImpl
void retainType(DIScope *T)
Retain DIScope* in a module even if it is not referenced through debug info anchors.
An imported module (C++ using directive or similar).
Base class for scope-like contexts.
DITemplateValueParameter * createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty, Constant *Val)
Create debugging information for template value parameter.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
static DIScope * getNonCompileUnitScope(DIScope *N)
If N is compile unit return NULL otherwise return N.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
DITemplateValueParameter * createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
Create debugging information for a template parameter pack.
static CallInst * Create(Value *Func, ArrayRef< Value * > Args, ArrayRef< OperandBundleDef > Bundles=None, const Twine &NameStr="", Instruction *InsertBefore=nullptr)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Module.h This file contains the declarations for the Module class.
DIExpression * createExpression(ArrayRef< uint64_t > Addr=None)
Create a new descriptor for the specified variable which has a complex address expression for its add...
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
A (clang) module that has been imported by the compile unit.
DIObjCProperty * createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, unsigned PropertyAttributes, DIType *Ty)
Create debugging information entry for Objective-C property.
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
DIBasicType * createBasicType(StringRef Name, uint64_t SizeInBits, unsigned Encoding)
Create debugging information entry for a basic type.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
DITemplateValueParameter * createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val)
Create debugging information for a template template parameter.
Type array for a subprogram.
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static std::vector< std::string > Flags
NodeTy * replaceTemporary(TempMDNode &&N, NodeTy *Replacement)
Replace a temporary node.
DICompositeType * createVectorType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
Create debugging information entry for a vector type.
void emplace_back(ArgTypes &&...Args)
DIDerivedType * createObjCIVar(StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DINode::DIFlags Flags, DIType *Ty, MDNode *PropertyNode)
Create debugging information entry for Objective-C instance variable.
DILexicalBlock * createLexicalBlock(DIScope *Scope, DIFile *File, unsigned Line, unsigned Col)
This creates a descriptor for a lexical block with the specified parent context.
DILocalVariable * createAutoVariable(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero, uint32_t AlignInBits=0)
Create a new descriptor for an auto variable.
static DITemplateValueParameter * createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag, DIScope *Context, StringRef Name, DIType *Ty, Metadata *MD)
op_range operands() const
void finalizeSubprogram(DISubprogram *SP)
Finalize a specific subprogram - no new variables may be added to this subprogram afterwards...
DIDerivedType * createInheritance(DIType *Ty, DIType *BaseTy, uint64_t BaseOffset, DINode::DIFlags Flags)
Create debugging information entry to establish inheritance relationship between two types...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
DIImportedEntity * createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File, unsigned Line, StringRef Name="")
Create a descriptor for an imported function.
static ConstantAsMetadata * getConstantOrNull(Constant *C)
DIModule * createModule(DIScope *Scope, StringRef Name, StringRef ConfigurationMacros, StringRef IncludePath, StringRef ISysRoot)
This creates new descriptor for a module with the specified parent scope.
LLVM Value Representation.
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&...Args)
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
void replaceMacros(DIMacroNodeArray N)
StringRef - Represent a constant reference to a string, i.e.
DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
const TerminatorInst * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
DICompileUnit * createCompileUnit(unsigned Lang, DIFile *File, StringRef Producer, bool isOptimized, StringRef Flags, unsigned RV, StringRef SplitName=StringRef(), DICompileUnit::DebugEmissionKind Kind=DICompileUnit::DebugEmissionKind::FullDebug, uint64_t DWOId=0, bool SplitDebugInlining=true, bool DebugInfoForProfiling=false)
A CompileUnit provides an anchor for all debugging information generated during this instance of comp...
bool isResolved() const
Check if node is fully resolved.
DILocalVariable * createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero)
Create a new descriptor for a parameter variable.
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
void replaceElements(DINodeArray Elements)
Replace operands.
DIDerivedType * createMemberPointerType(DIType *PointeeTy, DIType *Class, uint64_t SizeInBits, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagZero)
Create debugging information entry for a pointer to member.
static DIType * createTypeWithFlags(LLVMContext &Context, DIType *Ty, DINode::DIFlags FlagsToSet)
DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
void replaceImportedEntities(DIImportedEntityArray N)
Basic type, like 'int' or 'float'.