32 : M(m), VMContext(M.getContext()), CUNode(
CU), DeclareFn(nullptr),
33 ValueFn(nullptr), LabelFn(nullptr), AddrFn(nullptr), AssignFn(nullptr),
34 AllowUnresolvedNodes(AllowUnresolvedNodes) {
37 AllEnumTypes.assign(ETs.begin(), ETs.end());
39 AllRetainTypes.assign(RTs.begin(), RTs.end());
41 AllGVs.assign(GVs.begin(), GVs.end());
43 AllImportedModules.assign(IMs.begin(), IMs.end());
44 if (
const auto &MNs = CUNode->
getMacros())
45 AllMacrosPerParent.insert({
nullptr, {MNs.begin(), MNs.end()}});
49void DIBuilder::trackIfUnresolved(
MDNode *
N) {
55 assert(AllowUnresolvedNodes &&
"Cannot handle unresolved nodes");
56 UnresolvedNodes.emplace_back(
N);
66 auto PV = PreservedVariables.find(SP);
67 if (PV != PreservedVariables.end())
68 RetainedNodes.
append(PV->second.begin(), PV->second.end());
70 auto PL = PreservedLabels.find(SP);
71 if (PL != PreservedLabels.end())
72 RetainedNodes.
append(PL->second.begin(), PL->second.end());
76 TempMDTuple(Temp)->replaceAllUsesWith(Node.get());
81 assert(!AllowUnresolvedNodes &&
82 "creating type nodes without a CU is not supported");
86 if (!AllEnumTypes.empty())
89 AllEnumTypes.end())));
97 for (
unsigned I = 0,
E = AllRetainTypes.size();
I <
E;
I++)
98 if (RetainSet.
insert(AllRetainTypes[
I]).second)
101 if (!RetainValues.
empty())
104 DISubprogramArray SPs =
MDTuple::get(VMContext, AllSubprograms);
107 for (
auto *
N : RetainValues)
108 if (
auto *SP = dyn_cast<DISubprogram>(
N))
114 if (!AllImportedModules.empty())
117 AllImportedModules.end())));
119 for (
const auto &
I : AllMacrosPerParent) {
126 auto *TMF = cast<DIMacroFile>(
I.first);
128 TMF->getLine(), TMF->getFile(),
135 for (
const auto &
N : UnresolvedNodes)
136 if (
N && !
N->isResolved())
138 UnresolvedNodes.clear();
141 AllowUnresolvedNodes =
false;
146 if (!
N || isa<DICompileUnit>(
N))
148 return cast<DIScope>(
N);
155 bool SplitDebugInlining,
bool DebugInfoForProfiling,
159 assert(((Lang <= dwarf::DW_LANG_Ada2012 && Lang >= dwarf::DW_LANG_C89) ||
161 "Invalid Language tag");
163 assert(!CUNode &&
"Can only make one compile unit per DIBuilder instance");
165 VMContext, Lang, File, Producer, isOptimized, Flags, RunTimeVer,
166 SplitName, Kind,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr, DWOId,
167 SplitDebugInlining, DebugInfoForProfiling, NameTableKind,
168 RangesBaseAddress, SysRoot, SDK);
173 trackIfUnresolved(CUNode);
180 DINodeArray Elements,
183 assert(File &&
"Source location has line number but no file");
184 unsigned EntitiesCount =
C.pImpl->DIImportedEntitys.size();
186 File, Line,
Name, Elements);
187 if (EntitiesCount < C.pImpl->DIImportedEntitys.size())
197 DINodeArray Elements) {
198 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
205 DIFile *File,
unsigned Line,
206 DINodeArray Elements) {
207 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
213 DIFile *File,
unsigned Line,
214 DINodeArray Elements) {
215 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_module,
222 DIFile *File,
unsigned Line,
226 return ::createImportedModule(VMContext, dwarf::DW_TAG_imported_declaration,
233 std::optional<StringRef> Source) {
234 return DIFile::get(VMContext, Filename, Directory, CS, Source);
240 assert(!
Name.empty() &&
"Unable to create macro without name");
243 "Unexpected macro type");
245 AllMacrosPerParent[Parent].insert(M);
250 unsigned LineNumber,
DIFile *File) {
252 LineNumber, File, DIMacroNodeArray())
254 AllMacrosPerParent[Parent].insert(MF);
258 AllMacrosPerParent.insert({MF, {}});
264 assert(!
Name.empty() &&
"Unable to create enumerator without name");
270 assert(!
Name.empty() &&
"Unable to create enumerator without name");
275 assert(!
Name.empty() &&
"Unable to create type without name");
286 assert(!
Name.empty() &&
"Unable to create type without name");
292 assert(!
Name.empty() &&
"Unable to create type without name");
300 assert(!
Name.empty() &&
"Unable to create type without name");
302 StringLength,
nullptr, StrLocationExp, 0, 0, 0);
308 assert(!
Name.empty() &&
"Unable to create type without name");
310 StringLengthExp, StrLocationExp, 0, 0, 0);
315 0, 0, std::nullopt, DINode::FlagZero);
321 std::optional<unsigned> DWARFAddressSpace,
325 nullptr, 0,
nullptr, PointeeTy, SizeInBits,
326 AlignInBits, 0, DWARFAddressSpace, DINode::FlagZero,
336 nullptr, 0,
nullptr, PointeeTy, SizeInBits,
337 AlignInBits, 0, std::nullopt, Flags,
Base);
343 std::optional<unsigned> DWARFAddressSpace) {
344 assert(RTy &&
"Unable to create reference type");
346 SizeInBits, AlignInBits, 0, DWARFAddressSpace,
351 DIFile *File,
unsigned LineNo,
357 AlignInBits, 0, std::nullopt, Flags,
nullptr,
362 assert(Ty &&
"Invalid type!");
363 assert(FriendTy &&
"Invalid friend type!");
365 FriendTy, 0, 0, 0, std::nullopt, DINode::FlagZero);
372 assert(Ty &&
"Unable to create inheritance");
376 0, Ty,
BaseTy, 0, 0, BaseOffset, std::nullopt,
386 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
402 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
410 Flags |= DINode::FlagBitField;
412 VMContext, dwarf::DW_TAG_member,
Name, File, LineNumber,
414 OffsetInBits, std::nullopt, Flags,
416 StorageOffsetInBits)),
422 unsigned LineNumber,
DIType *Ty,
425 Flags |= DINode::FlagStaticMember;
428 AlignInBits, 0, std::nullopt, Flags,
439 SizeInBits, AlignInBits, OffsetInBits, std::nullopt,
440 Flags, PropertyNode);
446 unsigned PropertyAttributes,
DIType *Ty) {
448 SetterName, PropertyAttributes, Ty);
453 DIType *Ty,
bool isDefault) {
468 DIType *Ty,
bool isDefault,
471 VMContext, dwarf::DW_TAG_template_value_parameter,
Context,
Name, Ty,
480 VMContext, dwarf::DW_TAG_GNU_template_template_param,
Context,
Name, Ty,
486 DIType *Ty, DINodeArray Val) {
488 VMContext, dwarf::DW_TAG_GNU_template_parameter_pack,
Context,
Name, Ty,
498 "createClassType should be called with a valid Context");
501 VMContext, dwarf::DW_TAG_structure_type,
Name, File, LineNumber,
503 OffsetInBits, Flags, Elements, 0, VTableHolder,
504 cast_or_null<MDTuple>(TemplateParams), UniqueIdentifier);
505 trackIfUnresolved(R);
512 DIType *DerivedFrom, DINodeArray Elements,
unsigned RunTimeLang,
515 VMContext, dwarf::DW_TAG_structure_type,
Name, File, LineNumber,
517 Flags, Elements, RunTimeLang, VTableHolder,
nullptr, UniqueIdentifier);
518 trackIfUnresolved(R);
525 DINodeArray Elements,
unsigned RunTimeLang,
StringRef UniqueIdentifier) {
527 VMContext, dwarf::DW_TAG_union_type,
Name, File, LineNumber,
529 Elements, RunTimeLang,
nullptr,
nullptr, UniqueIdentifier);
530 trackIfUnresolved(R);
536 unsigned LineNumber,
uint64_t SizeInBits,
541 VMContext, dwarf::DW_TAG_variant_part,
Name, File, LineNumber,
543 Elements, 0,
nullptr,
nullptr, UniqueIdentifier, Discriminator);
544 trackIfUnresolved(R);
559 VMContext, dwarf::DW_TAG_enumeration_type,
Name, File, LineNumber,
561 IsScoped ? DINode::FlagEnumClass : DINode::FlagZero, Elements, 0,
nullptr,
562 nullptr, UniqueIdentifier);
563 AllEnumTypes.emplace_back(CTy);
564 trackIfUnresolved(CTy);
569 DIFile *File,
unsigned LineNo,
575 AlignInBits, 0, std::nullopt, DINode::FlagZero);
576 trackIfUnresolved(R);
582 DINodeArray Subscripts,
588 VMContext, dwarf::DW_TAG_array_type,
"",
nullptr, 0,
nullptr, Ty,
Size,
589 AlignInBits, 0, DINode::FlagZero, Subscripts, 0,
nullptr,
nullptr,
"",
599 trackIfUnresolved(R);
605 DINodeArray Subscripts) {
607 nullptr, 0,
nullptr, Ty,
Size, AlignInBits, 0,
608 DINode::FlagVector, Subscripts, 0,
nullptr);
609 trackIfUnresolved(R);
614 auto NewSP = SP->cloneWithFlags(SP->getFlags() | DINode::FlagArtificial);
635 DINode::DIFlags Flags = DINode::FlagObjectPointer | DINode::FlagArtificial;
640 assert(
T &&
"Expected non-null type");
641 assert((isa<DIType>(
T) || (isa<DISubprogram>(
T) &&
642 cast<DISubprogram>(
T)->isDefinition() ==
false)) &&
643 "Expected type or subprogram declaration");
644 AllRetainTypes.emplace_back(
T);
651 DIFile *
F,
unsigned Line,
unsigned RuntimeLang,
658 SizeInBits, AlignInBits, 0, DINode::FlagFwdDecl,
nullptr, RuntimeLang,
659 nullptr,
nullptr, UniqueIdentifier);
660 trackIfUnresolved(
RetTy);
672 SizeInBits, AlignInBits, 0, Flags,
nullptr, RuntimeLang,
nullptr,
673 nullptr, UniqueIdentifier,
nullptr,
nullptr,
nullptr,
nullptr,
676 trackIfUnresolved(
RetTy);
692 if (isa_and_nonnull<MDNode>(
E))
727 ConvToMetadata(LB), ConvToMetadata(UB),
728 ConvToMetadata(Stride));
735 assert(CT->getIdentifier().empty() &&
736 "Context of a global variable should not be a type with identifier");
742 unsigned LineNumber,
DIType *Ty,
bool IsLocalToUnit,
bool isDefined,
749 LineNumber, Ty, IsLocalToUnit, isDefined,
750 cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
761 unsigned LineNumber,
DIType *Ty,
bool IsLocalToUnit,
MDNode *Decl,
767 LineNumber, Ty, IsLocalToUnit,
false,
768 cast_or_null<DIDerivedType>(Decl), TemplateParams, AlignInBits,
786 VMContext, cast_or_null<DILocalScope>(
Context),
Name, File, LineNo, Ty,
788 if (AlwaysPreserve) {
793 assert(Fn &&
"Missing subprogram for local variable");
794 PreservedVariables[Fn].emplace_back(
Node);
800 DIFile *File,
unsigned LineNo,
801 DIType *Ty,
bool AlwaysPreserve,
805 0, File, LineNo, Ty, AlwaysPreserve,
813 assert(ArgNo &&
"Expected non-zero argument number for parameter");
815 File, LineNo, Ty, AlwaysPreserve, Flags,
820 unsigned LineNo,
bool AlwaysPreserve) {
826 if (AlwaysPreserve) {
831 assert(Fn &&
"Missing subprogram for label");
832 PreservedLabels[Fn].emplace_back(Node);
841template <
class... Ts>
855 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
858 Name,
LinkageName, File, LineNo, Ty, ScopeLine,
nullptr, 0, 0, Flags,
859 SPFlags, IsDefinition ? CUNode :
nullptr, TParams, Decl,
864 AllSubprograms.push_back(Node);
865 trackIfUnresolved(Node);
874 DITypeArray ThrownTypes) {
875 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
878 ScopeLine,
nullptr, 0, 0, Flags, SPFlags,
879 IsDefinition ? CUNode :
nullptr, TParams,
880 Decl,
nullptr, ThrownTypes)
889 DITypeArray ThrownTypes) {
891 "Methods should have both a Context and a context that isn't "
892 "the compile unit.");
894 bool IsDefinition = SPFlags & DISubprogram::SPFlagDefinition;
896 IsDefinition, VMContext, cast<DIScope>(
Context),
Name,
897 LinkageName,
F, LineNo, Ty, LineNo, VTableHolder, VIndex, ThisAdjustment,
898 Flags, SPFlags, IsDefinition ? CUNode :
nullptr, TParams,
nullptr,
899 nullptr, ThrownTypes);
902 AllSubprograms.push_back(SP);
903 trackIfUnresolved(SP);
915 bool ExportSymbols) {
929 DIFile *File,
unsigned LineNo,
bool IsDecl) {
931 ConfigurationMacros, IncludePath, APINotesFile, LineNo,
937 unsigned Discriminator) {
942 unsigned Line,
unsigned Col) {
952 return insertDeclare(Storage, VarInfo, Expr,
DL, InsertBefore->
getParent(),
962 return insertDeclare(Storage, VarInfo, Expr,
DL, InsertAtEnd, InsertBefore);
975 auto *Link = LinkedInstr->
getMetadata(LLVMContext::MD_DIAssignID);
976 assert(Link &&
"Linked instruction must have DIAssign metadata attached");
978 std::array<Value *, 6> Args = {
988 B.SetCurrentDebugLocation(
DL);
990 auto *DVI = cast<DbgAssignIntrinsic>(
B.CreateCall(AssignFn, Args));
991 DVI->insertAfter(LinkedInstr);
997 return insertLabel(LabelInfo,
DL,
998 InsertBefore ? InsertBefore->
getParent() :
nullptr,
1004 return insertLabel(LabelInfo,
DL, InsertAtEnd,
nullptr);
1012 return insertDbgValueIntrinsic(
1013 V, VarInfo, Expr,
DL, InsertBefore ? InsertBefore->
getParent() :
nullptr,
1022 return insertDbgValueIntrinsic(V, VarInfo, Expr,
DL, InsertAtEnd,
nullptr);
1030 return insertDbgAddrIntrinsic(
1031 V, VarInfo, Expr,
DL, InsertBefore ? InsertBefore->
getParent() :
nullptr,
1040 return insertDbgAddrIntrinsic(V, VarInfo, Expr,
DL, InsertAtEnd,
nullptr);
1048 Builder.SetInsertPoint(InsertBefore);
1050 Builder.SetInsertPoint(InsertBB);
1055 assert(V &&
"no value passed to dbg intrinsic");
1061 : Intrinsic::dbg_declare);
1069 return insertDbgIntrinsic(ValueFn, Val, VarInfo, Expr,
DL, InsertBB,
1078 return insertDbgIntrinsic(AddrFn, Val, VarInfo, Expr,
DL, InsertBB,
1086 assert(VarInfo &&
"empty or invalid DILocalVariable* passed to dbg.declare");
1087 assert(
DL &&
"Expected debug loc");
1088 assert(
DL->getScope()->getSubprogram() ==
1090 "Expected matching subprograms");
1094 trackIfUnresolved(VarInfo);
1095 trackIfUnresolved(Expr);
1102 return B.CreateCall(DeclareFn, Args);
1111 assert(IntrinsicFn &&
"must pass a non-null intrinsic function");
1112 assert(V &&
"must pass a value to a dbg intrinsic");
1114 "empty or invalid DILocalVariable* passed to debug intrinsic");
1115 assert(
DL &&
"Expected debug loc");
1116 assert(
DL->getScope()->getSubprogram() ==
1118 "Expected matching subprograms");
1120 trackIfUnresolved(VarInfo);
1121 trackIfUnresolved(Expr);
1128 return B.CreateCall(IntrinsicFn, Args);
1134 assert(LabelInfo &&
"empty or invalid DILabel* passed to dbg.label");
1135 assert(
DL &&
"Expected debug loc");
1136 assert(
DL->getScope()->getSubprogram() ==
1138 "Expected matching subprograms");
1142 trackIfUnresolved(LabelInfo);
1147 return B.CreateCall(LabelFn, Args);
1153 N->replaceVTableHolder(VTableHolder);
1158 if (
T != VTableHolder)
1163 if (
T->isResolved())
1165 if (
auto *
N = dyn_cast_or_null<MDNode>(O))
1166 trackIfUnresolved(
N);
1170 DINodeArray TParams) {
1174 N->replaceElements(Elements);
1176 N->replaceTemplateParams(DITemplateParameterArray(TParams));
1181 if (!
T->isResolved())
1188 trackIfUnresolved(Elements.get());
1190 trackIfUnresolved(TParams.get());
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static Function * getDeclareIntrin(Module &M)
static DIImportedEntity * createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope *Context, Metadata *NS, DIFile *File, unsigned Line, StringRef Name, DINodeArray Elements, SmallVectorImpl< TrackingMDNodeRef > &AllImportedModules)
static DIType * createTypeWithFlags(const DIType *Ty, DINode::DIFlags FlagsToSet)
static DIScope * getNonCompileUnitScope(DIScope *N)
If N is compile unit return NULL otherwise return N.
static cl::opt< bool > UseDbgAddr("use-dbg-addr", llvm::cl::desc("Use llvm.dbg.addr for all local variables"), cl::init(false), cl::Hidden)
static void checkGlobalVariableScope(DIScope *Context)
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&...Args)
static ConstantAsMetadata * getConstantOrNull(Constant *C)
static DITemplateValueParameter * createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag, DIScope *Context, StringRef Name, DIType *Ty, bool IsDefault, Metadata *MD)
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, DINodeArray Annotations=nullptr)
static Value * getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V)
static void initIRBuilder(IRBuilder<> &Builder, const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore)
Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics.
This file contains constants used for implementing Dwarf debug support.
Module.h This file contains the declarations for the Module class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Class for arbitrary precision integers.
An arbitrary precision integer that knows its signedness.
Annotations lets you mark points and ranges inside source code, for tests:
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
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.
static ConstantInt * getSigned(IntegerType *Ty, int64_t V)
Return a ConstantInt with the specified value for the specified type.
This is an important base class in LLVM.
Basic type, like 'int' or 'float'.
DIBasicType * createUnspecifiedParameter()
Create unspecified parameter type for a subroutine type.
DIGlobalVariable * createTempGlobalVariableFwdDecl(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0)
Identical to createGlobalVariable except that the resulting DbgNode is temporary and meant to be RAUW...
DITemplateValueParameter * createTemplateTemplateParameter(DIScope *Scope, StringRef Name, DIType *Ty, StringRef Val, bool IsDefault=false)
Create debugging information for a template template parameter.
DIDerivedType * createBitFieldMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint64_t OffsetInBits, uint64_t StorageOffsetInBits, DINode::DIFlags Flags, DIType *Ty, DINodeArray Annotations=nullptr)
Create debugging information entry for a bit field member.
NodeTy * replaceTemporary(TempMDNode &&N, NodeTy *Replacement)
Replace a temporary node.
DIDerivedType * createTypedef(DIType *Ty, StringRef Name, DIFile *File, unsigned LineNo, DIScope *Context, uint32_t AlignInBits=0, DINode::DIFlags Flags=DINode::FlagZero, DINodeArray Annotations=nullptr)
Create debugging information entry for a typedef.
void finalize()
Construct any deferred debug info descriptors.
DbgAssignIntrinsic * insertDbgAssign(Instruction *LinkedInstr, Value *Val, DILocalVariable *SrcVar, DIExpression *ValExpr, Value *Addr, DIExpression *AddrExpr, const DILocation *DL)
Insert a new llvm.dbg.assign intrinsic call.
DISubroutineType * createSubroutineType(DITypeRefArray ParameterTypes, DINode::DIFlags Flags=DINode::FlagZero, unsigned CC=0)
Create subroutine type.
DIMacro * createMacro(DIMacroFile *Parent, unsigned Line, unsigned MacroType, StringRef Name, StringRef Value=StringRef())
Create debugging information entry for a macro.
DIDerivedType * createInheritance(DIType *Ty, DIType *BaseTy, uint64_t BaseOffset, uint32_t VBPtrOffset, DINode::DIFlags Flags)
Create debugging information entry to establish inheritance relationship between two types.
DIDerivedType * createVariantMemberType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, Constant *Discriminant, DINode::DIFlags Flags, DIType *Ty)
Create debugging information entry for a variant.
DILexicalBlockFile * createLexicalBlockFile(DIScope *Scope, DIFile *File, unsigned Discriminator=0)
This creates a descriptor for a lexical block with a new file attached.
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.
void finalizeSubprogram(DISubprogram *SP)
Finalize a specific subprogram - no new variables may be added to this subprogram afterwards.
DIDerivedType * createQualifiedType(unsigned Tag, DIType *FromTy)
Create debugging information entry for a qualified type, e.g.
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, DICompileUnit::DebugNameTableKind NameTableKind=DICompileUnit::DebugNameTableKind::Default, bool RangesBaseAddress=false, StringRef SysRoot={}, StringRef SDK={})
A CompileUnit provides an anchor for all debugging information generated during this instance of comp...
DISubprogram * createTempFunctionFwdDecl(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr)
Identical to createFunction, except that the resulting DbgNode is meant to be RAUWed.
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.
static DIType * createArtificialType(DIType *Ty)
Create a uniqued clone of Ty with FlagArtificial set.
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.
DICompositeType * createVectorType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts)
Create debugging information entry for a vector type.
static DIType * createObjectPointerType(DIType *Ty)
Create a uniqued clone of Ty with FlagObjectPointer and FlagArtificial set.
DILabel * createLabel(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, bool AlwaysPreserve=false)
Create a new descriptor for an label.
DINamespace * createNameSpace(DIScope *Scope, StringRef Name, bool ExportSymbols)
This creates new descriptor for a namespace with the specified parent scope.
DIStringType * createStringType(StringRef Name, uint64_t SizeInBits)
Create debugging information entry for a string type.
DISubprogram * createFunction(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned ScopeLine, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DISubprogram *Decl=nullptr, DITypeArray ThrownTypes=nullptr, DINodeArray Annotations=nullptr, StringRef TargetFuncName="")
Create a new descriptor for the specified subprogram.
DILexicalBlock * createLexicalBlock(DIScope *Scope, DIFile *File, unsigned Line, unsigned Col)
This creates a descriptor for a lexical block with the specified parent context.
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.
DIMacroNodeArray getOrCreateMacroArray(ArrayRef< Metadata * > Elements)
Get a DIMacroNodeArray, create one if required.
DIDerivedType * createSetType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNo, uint64_t SizeInBits, uint32_t AlignInBits, DIType *Ty)
Create debugging information entry for a set.
void replaceVTableHolder(DICompositeType *&T, DIType *VTableHolder)
Replace the vtable holder in the given type.
DIBasicType * createNullPtrType()
Create C++11 nullptr type.
DICommonBlock * createCommonBlock(DIScope *Scope, DIGlobalVariable *decl, StringRef Name, DIFile *File, unsigned LineNo)
Create common block entry for a Fortran common block.
DIDerivedType * createFriend(DIType *Ty, DIType *FriendTy)
Create debugging information entry for a 'friend'.
void retainType(DIScope *T)
Retain DIScope* in a module even if it is not referenced through debug info anchors.
DIDerivedType * createPointerType(DIType *PointeeTy, uint64_t SizeInBits, uint32_t AlignInBits=0, std::optional< unsigned > DWARFAddressSpace=std::nullopt, StringRef Name="", DINodeArray Annotations=nullptr)
Create debugging information entry for a pointer.
DIExpression * createExpression(ArrayRef< uint64_t > Addr=std::nullopt)
Create a new descriptor for the specified variable which has a complex address expression for its add...
DITemplateValueParameter * createTemplateParameterPack(DIScope *Scope, StringRef Name, DIType *Ty, DINodeArray Val)
Create debugging information for a template parameter pack.
DIGlobalVariableExpression * createGlobalVariableExpression(DIScope *Context, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DIType *Ty, bool IsLocalToUnit, bool isDefined=true, DIExpression *Expr=nullptr, MDNode *Decl=nullptr, MDTuple *TemplateParams=nullptr, uint32_t AlignInBits=0, DINodeArray Annotations=nullptr)
Create a new descriptor for the specified variable.
DICompositeType * createEnumerationType(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINodeArray Elements, DIType *UnderlyingType, StringRef UniqueIdentifier="", bool IsScoped=false)
Create debugging information entry for an enumeration.
DISubrange * getOrCreateSubrange(int64_t Lo, int64_t Count)
Create a descriptor for a value range.
DIDerivedType * createReferenceType(unsigned Tag, DIType *RTy, uint64_t SizeInBits=0, uint32_t AlignInBits=0, std::optional< unsigned > DWARFAddressSpace=std::nullopt)
Create debugging information entry for a c++ style reference or rvalue reference type.
DISubprogram * createMethod(DIScope *Scope, StringRef Name, StringRef LinkageName, DIFile *File, unsigned LineNo, DISubroutineType *Ty, unsigned VTableIndex=0, int ThisAdjustment=0, DIType *VTableHolder=nullptr, DINode::DIFlags Flags=DINode::FlagZero, DISubprogram::DISPFlags SPFlags=DISubprogram::SPFlagZero, DITemplateParameterArray TParams=nullptr, DITypeArray ThrownTypes=nullptr)
Create a new descriptor for the specified C++ method.
DIMacroFile * createTempMacroFile(DIMacroFile *Parent, unsigned Line, DIFile *File)
Create debugging information temporary entry for a macro file.
DICompositeType * createArrayType(uint64_t Size, uint32_t AlignInBits, DIType *Ty, DINodeArray Subscripts, PointerUnion< DIExpression *, DIVariable * > DataLocation=nullptr, PointerUnion< DIExpression *, DIVariable * > Associated=nullptr, PointerUnion< DIExpression *, DIVariable * > Allocated=nullptr, PointerUnion< DIExpression *, DIVariable * > Rank=nullptr)
Create debugging information entry for an array.
DIBasicType * createBasicType(StringRef Name, uint64_t SizeInBits, unsigned Encoding, DINode::DIFlags Flags=DINode::FlagZero)
Create debugging information entry for a basic type.
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.
DITypeRefArray getOrCreateTypeArray(ArrayRef< Metadata * > Elements)
Get a DITypeRefArray, create one if required.
DINodeArray getOrCreateArray(ArrayRef< Metadata * > Elements)
Get a DINodeArray, create one if required.
DIEnumerator * createEnumerator(StringRef Name, const APSInt &Value)
Create a single enumerator value.
DITemplateTypeParameter * createTemplateTypeParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault)
Create debugging information for template type parameter.
DIBuilder(Module &M, bool AllowUnresolved=true, DICompileUnit *CU=nullptr)
Construct a builder for a module.
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="", DINodeArray Annotations=nullptr)
Create a temporary forward-declared type.
DICompositeType * createVariantPart(DIScope *Scope, StringRef Name, DIFile *File, unsigned LineNumber, uint64_t SizeInBits, uint32_t AlignInBits, DINode::DIFlags Flags, DIDerivedType *Discriminator, DINodeArray Elements, StringRef UniqueIdentifier="")
Create debugging information entry for a variant part.
DIImportedEntity * createImportedModule(DIScope *Context, DINamespace *NS, DIFile *File, unsigned Line, DINodeArray Elements=nullptr)
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, DINodeArray Annotations=nullptr)
Create debugging information entry for a member.
DIImportedEntity * createImportedDeclaration(DIScope *Context, DINode *Decl, DIFile *File, unsigned Line, StringRef Name="", DINodeArray Elements=nullptr)
Create a descriptor for an imported function.
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 DISubprogram * createArtificialSubprogram(DISubprogram *SP)
Create a distinct clone of SP with FlagArtificial set.
DIGenericSubrange * getOrCreateGenericSubrange(DIGenericSubrange::BoundType Count, DIGenericSubrange::BoundType LowerBound, DIGenericSubrange::BoundType UpperBound, DIGenericSubrange::BoundType Stride)
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.
DIBasicType * createUnspecifiedType(StringRef Name)
Create a DWARF unspecified type.
DIObjCProperty * createObjCProperty(StringRef Name, DIFile *File, unsigned LineNumber, StringRef GetterName, StringRef SetterName, unsigned PropertyAttributes, DIType *Ty)
Create debugging information entry for Objective-C property.
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.
DITemplateValueParameter * createTemplateValueParameter(DIScope *Scope, StringRef Name, DIType *Ty, bool IsDefault, Constant *Val)
Create debugging information for template value parameter.
DILocalVariable * createParameterVariable(DIScope *Scope, StringRef Name, unsigned ArgNo, DIFile *File, unsigned LineNo, DIType *Ty, bool AlwaysPreserve=false, DINode::DIFlags Flags=DINode::FlagZero, DINodeArray Annotations=nullptr)
Create a new descriptor for a parameter variable.
DIFile * createFile(StringRef Filename, StringRef Directory, std::optional< DIFile::ChecksumInfo< StringRef > > Checksum=std::nullopt, std::optional< StringRef > Source=std::nullopt)
Create a file descriptor to hold debugging information for a file.
void replaceArrays(DICompositeType *&T, DINodeArray Elements, DINodeArray TParams=DINodeArray())
Replace arrays on a composite type.
DIModule * createModule(DIScope *Scope, StringRef Name, StringRef ConfigurationMacros, StringRef IncludePath, StringRef APINotesFile={}, DIFile *File=nullptr, unsigned LineNo=0, bool IsDecl=false)
This creates new descriptor for a module with the specified parent scope.
DICompositeTypeArray getEnumTypes() const
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
DIMacroNodeArray getMacros() const
void replaceRetainedTypes(DITypeArray N)
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
void replaceMacros(DIMacroNodeArray N)
DIImportedEntityArray getImportedEntities() const
DIScopeArray getRetainedTypes() const
void replaceImportedEntities(DIImportedEntityArray N)
DIGlobalVariableExpressionArray getGlobalVariables() const
A pair of DIGlobalVariable and DIExpression.
An imported module (C++ using directive or similar).
DILocalScope * getScope() const
Get the local scope for this label.
DISubprogram * getSubprogram() const
Get the subprogram for this scope.
DILocalScope * getScope() const
Get the local scope for this variable.
Represents a module in the programming language, for example, a Clang module, or a Fortran module.
Tagged DWARF-like metadata node.
Base class for scope-like contexts.
String type, Fortran CHARACTER(n)
DISPFlags
Debug info subprogram flags.
Type array for a subprogram.
TempDIType cloneWithFlags(DIFlags NewFlags) const
Returns a new temporary DIType with updated Flags.
bool isObjectPointer() const
bool isArtificial() const
Base class for variables.
This represents the llvm.dbg.assign instruction.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
const BasicBlock * getParent() const
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
This is an important class for using LLVM in a threaded context.
static MDTuple * getDistinct(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithDistinct(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a distinct one.
static std::enable_if_t< std::is_base_of< MDNode, T >::value, T * > replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
Tracking metadata reference owned by Metadata.
static MDString * get(LLVMContext &Context, StringRef Str)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
static TempMDTuple getTemporary(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Return a temporary node.
A Module instance is used to store all the information related to an LLVM module.
NamedMDNode * getOrInsertNamedMetadata(StringRef Name)
Return the named MDNode in the module with the specified name.
void addOperand(MDNode *M)
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
T get() const
Returns the value of the specified pointer type.
bool is() const
Test if the Union currently holds the type matching T.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
static IntegerType * getInt64Ty(LLVMContext &C)
LLVM Value Representation.
LLVMContext & getContext() const
All values hold a context through their type.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
@ C
The default llvm calling convention, compatible with C.
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
DISubprogram * getDISubprogram(const MDNode *Scope)
Find subprogram that is enclosing this scope.
A single checksum, represented by a Kind and a Value (a string).