13 #ifndef LLVM_IR_DEBUGINFOMETADATA_H 14 #define LLVM_IR_DEBUGINFOMETADATA_H 34 #include <type_traits> 38 #define DEFINE_MDNODE_GET_UNPACK_IMPL(...) __VA_ARGS__ 39 #define DEFINE_MDNODE_GET_UNPACK(ARGS) DEFINE_MDNODE_GET_UNPACK_IMPL ARGS 40 #define DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(CLASS, FORMAL, ARGS) \ 41 static CLASS *getDistinct(LLVMContext &Context, \ 42 DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 43 return getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Distinct); \ 45 static Temp##CLASS getTemporary(LLVMContext &Context, \ 46 DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 48 getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Temporary)); \ 50 #define DEFINE_MDNODE_GET(CLASS, FORMAL, ARGS) \ 51 static CLASS *get(LLVMContext &Context, DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 52 return getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Uniqued); \ 54 static CLASS *getIfExists(LLVMContext &Context, \ 55 DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 56 return getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Uniqued, \ 59 DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(CLASS, FORMAL, ARGS) 70 explicit operator bool()
const {
return get(); }
71 explicit operator MDTuple *()
const {
return get(); }
83 class iterator : std::iterator<std::input_iterator_tag, DIType *,
84 std::ptrdiff_t, void, DIType *> {
125 :
MDNode(C, ID, Storage, Ops1, Ops2) {
127 SubclassData16 =
Tag;
132 return cast_or_null<Ty>(getOperand(I));
136 if (
auto *S = getOperandAs<MDString>(I))
137 return S->getString();
151 unsigned getTag()
const {
return SubclassData16; }
158 #define HANDLE_DI_FLAG(ID, NAME) Flag##NAME = ID, 159 #define DI_FLAG_LARGEST_NEEDED 160 #include "llvm/IR/DebugInfoFlags.def" 161 FlagAccessibility = FlagPrivate | FlagProtected | FlagPublic,
162 FlagPtrToMemberRep = FlagSingleInheritance | FlagMultipleInheritance |
163 FlagVirtualInheritance,
181 case GenericDINodeKind:
183 case DIEnumeratorKind:
184 case DIBasicTypeKind:
185 case DIDerivedTypeKind:
186 case DICompositeTypeKind:
187 case DISubroutineTypeKind:
189 case DICompileUnitKind:
190 case DISubprogramKind:
191 case DILexicalBlockKind:
192 case DILexicalBlockFileKind:
193 case DINamespaceKind:
194 case DICommonBlockKind:
195 case DITemplateTypeParameterKind:
196 case DITemplateValueParameterKind:
197 case DIGlobalVariableKind:
198 case DILocalVariableKind:
200 case DIObjCPropertyKind:
201 case DIImportedEntityKind:
221 :
DINode(C, GenericDINodeKind, Storage, Tag, Ops1, Ops2) {
226 void setHash(
unsigned Hash) { SubclassData32 = Hash; }
227 void recalculateHash();
232 return getImpl(Context, Tag, getCanonicalMDString(Context, Header),
233 DwarfOps, Storage, ShouldCreate);
240 TempGenericDINode cloneImpl()
const {
242 getContext(),
getTag(), getHeader(),
247 unsigned getHash()
const {
return SubclassData32; }
251 (Tag, Header, DwarfOps))
254 (Tag, Header, DwarfOps))
257 TempGenericDINode clone()
const {
return cloneImpl(); }
259 unsigned getTag()
const {
return SubclassData16; }
266 return op_range(dwarf_op_begin(), dwarf_op_end());
271 return getOperand(I + 1);
274 replaceOperandWith(I + 1, New);
294 :
DINode(C, DISubrangeKind, Storage, dwarf::DW_TAG_subrange_type, Ops),
295 LowerBound(LowerBound) {}
301 bool ShouldCreate =
true);
305 bool ShouldCreate =
true);
307 TempDISubrange cloneImpl()
const {
308 return getTemporary(getContext(), getRawCountNode(), getLowerBound());
316 (CountNode, LowerBound))
318 TempDISubrange clone()
const {
return cloneImpl(); }
320 int64_t getLowerBound()
const {
return LowerBound; }
323 return getOperand(0).get();
329 if (
auto *MD = dyn_cast<ConstantAsMetadata>(getRawCountNode()))
330 return CountType(cast<ConstantInt>(MD->getValue()));
332 if (
auto *DV = dyn_cast<DIVariable>(getRawCountNode()))
333 return CountType(DV);
354 :
DINode(C, DIEnumeratorKind, Storage, dwarf::DW_TAG_enumerator, Ops),
356 SubclassData32 = IsUnsigned;
363 return getImpl(Context, Value, IsUnsigned,
364 getCanonicalMDString(Context, Name), Storage, ShouldCreate);
370 TempDIEnumerator cloneImpl()
const {
371 return getTemporary(getContext(), getValue(), isUnsigned(),
getName());
376 (Value, IsUnsigned, Name))
378 (Value, IsUnsigned, Name))
380 TempDIEnumerator clone()
const {
return cloneImpl(); }
403 :
DINode(C, ID, Storage, Tag, Ops) {}
423 return isa<DIFile>(
this) ? const_cast<DIScope *>(
this)
424 :
static_cast<Metadata *
>(getOperand(0));
431 case DIBasicTypeKind:
432 case DIDerivedTypeKind:
433 case DICompositeTypeKind:
434 case DISubroutineTypeKind:
436 case DICompileUnitKind:
437 case DISubprogramKind:
438 case DILexicalBlockKind:
439 case DILexicalBlockFileKind:
440 case DINamespaceKind:
441 case DICommonBlockKind:
472 template <
typename T>
482 return Kind == X.
Kind && Value == X.
Value;
495 :
DIScope(C, DIFileKind, Storage, dwarf::DW_TAG_file_type, Ops),
496 Checksum(CS),
Source(Src) {}
506 MDChecksum.
emplace(CS->Kind, getCanonicalMDString(Context, CS->Value));
507 return getImpl(Context, getCanonicalMDString(Context, Filename),
508 getCanonicalMDString(Context, Directory), MDChecksum,
510 Storage, ShouldCreate);
516 bool ShouldCreate =
true);
518 TempDIFile cloneImpl()
const {
519 return getTemporary(getContext(),
getFilename(), getDirectory(),
520 getChecksum(), getSource());
527 (Filename, Directory, CS, Source))
531 (Filename, Directory, CS, Source))
533 TempDIFile clone()
const {
return cloneImpl(); }
536 StringRef getDirectory()
const {
return getStringOperand(1); }
540 StringRefChecksum.
emplace(Checksum->Kind, Checksum->Value->getString());
541 return StringRefChecksum;
547 MDString *getRawFilename()
const {
return getOperandAs<MDString>(0); }
548 MDString *getRawDirectory()
const {
return getOperandAs<MDString>(1); }
561 if (
auto *
F = getFile())
562 return F->getFilename();
567 if (
auto *
F = getFile())
568 return F->getDirectory();
573 if (
auto *
F = getFile())
574 return F->getSource();
587 uint64_t OffsetInBits;
592 unsigned Line, uint64_t SizeInBits,
uint32_t AlignInBits,
594 :
DIScope(C, ID, Storage, Tag, Ops) {
595 init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
600 uint64_t OffsetInBits,
DIFlags Flags) {
603 this->SizeInBits = SizeInBits;
604 this->AlignInBits = AlignInBits;
605 this->OffsetInBits = OffsetInBits;
609 void mutate(
unsigned Tag,
unsigned Line, uint64_t SizeInBits,
611 assert(isDistinct() &&
"Only distinct nodes can mutate");
613 init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
637 auto NewTy = clone();
638 NewTy->Flags = NewFlags;
643 return (
getFlags() & FlagAccessibility) == FlagPrivate;
646 return (
getFlags() & FlagAccessibility) == FlagProtected;
649 return (
getFlags() & FlagAccessibility) == FlagPublic;
657 return getFlags() & FlagObjcClassComplete;
666 return getFlags() & FlagTypePassByReference;
676 case DIBasicTypeKind:
677 case DIDerivedTypeKind:
678 case DICompositeTypeKind:
679 case DISubroutineTypeKind:
696 uint64_t SizeInBits,
uint32_t AlignInBits,
unsigned Encoding,
698 :
DIType(C, DIBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0,
700 Encoding(Encoding) {}
705 uint32_t AlignInBits,
unsigned Encoding,
707 bool ShouldCreate =
true) {
708 return getImpl(Context, Tag, getCanonicalMDString(Context, Name),
709 SizeInBits, AlignInBits, Encoding, Flags, Storage,
713 MDString *Name, uint64_t SizeInBits,
714 uint32_t AlignInBits,
unsigned Encoding,
716 bool ShouldCreate =
true);
718 TempDIBasicType cloneImpl()
const {
720 getAlignInBits(), getEncoding(),
getFlags());
725 (Tag, Name, 0, 0, 0, FlagZero))
729 (Tag, Name, SizeInBits, AlignInBits, Encoding, Flags))
731 (
unsigned Tag,
MDString *Name, uint64_t SizeInBits,
733 (Tag, Name, SizeInBits, AlignInBits, Encoding, Flags))
735 TempDIBasicType clone()
const {
return cloneImpl(); }
765 unsigned Line, uint64_t SizeInBits,
uint32_t AlignInBits,
768 :
DIType(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits,
769 AlignInBits, OffsetInBits, Flags, Ops),
770 DWARFAddressSpace(DWARFAddressSpace) {}
776 uint32_t AlignInBits, uint64_t OffsetInBits,
779 return getImpl(Context, Tag, getCanonicalMDString(Context, Name), File,
780 Line, Scope, BaseType, SizeInBits, AlignInBits, OffsetInBits,
781 DWARFAddressSpace, Flags, ExtraData, Storage, ShouldCreate);
786 uint64_t SizeInBits,
uint32_t AlignInBits,
787 uint64_t OffsetInBits,
792 TempDIDerivedType cloneImpl()
const {
793 return getTemporary(getContext(),
getTag(),
getName(), getFile(), getLine(),
795 getAlignInBits(), getOffsetInBits(),
796 getDWARFAddressSpace(),
getFlags(), getExtraData());
803 uint64_t SizeInBits,
uint32_t AlignInBits,
804 uint64_t OffsetInBits,
807 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
808 AlignInBits, OffsetInBits, DWARFAddressSpace, Flags,
813 uint32_t AlignInBits, uint64_t OffsetInBits,
816 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
817 AlignInBits, OffsetInBits, DWARFAddressSpace, Flags,
820 TempDIDerivedType clone()
const {
return cloneImpl(); }
824 Metadata *getRawBaseType()
const {
return getOperand(3); }
838 Metadata *getExtraData()
const {
return getRawExtraData(); }
839 Metadata *getRawExtraData()
const {
return getOperand(4); }
843 DIType *getClassType()
const {
845 return cast_or_null<DIType>(getExtraData());
849 return dyn_cast_or_null<DIObjCProperty>(getExtraData());
854 if (
auto *CM = cast_or_null<ConstantAsMetadata>(getExtraData()))
855 if (
auto *CI = dyn_cast_or_null<ConstantInt>(CM->getValue()))
856 return static_cast<uint32_t>(CI->getZExtValue());
860 Constant *getStorageOffsetInBits()
const {
861 assert(
getTag() == dwarf::DW_TAG_member && isBitField());
862 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
863 return C->getValue();
868 assert(
getTag() == dwarf::DW_TAG_member && isStaticMember());
869 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
870 return C->getValue();
873 Constant *getDiscriminantValue()
const {
874 assert(
getTag() == dwarf::DW_TAG_member && !isStaticMember());
875 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
876 return C->getValue();
881 static bool classof(
const Metadata *MD) {
894 unsigned RuntimeLang;
897 unsigned Line,
unsigned RuntimeLang, uint64_t SizeInBits,
900 :
DIType(C, DICompositeTypeKind, Storage, Tag, Line, SizeInBits,
901 AlignInBits, OffsetInBits, Flags, Ops),
902 RuntimeLang(RuntimeLang) {}
906 void mutate(
unsigned Tag,
unsigned Line,
unsigned RuntimeLang,
907 uint64_t SizeInBits,
uint32_t AlignInBits,
908 uint64_t OffsetInBits,
DIFlags Flags) {
909 assert(isDistinct() &&
"Only distinct nodes can mutate");
910 assert(getRawIdentifier() &&
"Only ODR-uniqued nodes should mutate");
911 this->RuntimeLang = RuntimeLang;
912 DIType::mutate(Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
917 unsigned Line,
DIScope *Scope,
DIType *BaseType, uint64_t SizeInBits,
919 DINodeArray Elements,
unsigned RuntimeLang,
DIType *VTableHolder,
922 bool ShouldCreate =
true) {
924 Context, Tag, getCanonicalMDString(Context, Name), File, Line, Scope,
925 BaseType, SizeInBits, AlignInBits, OffsetInBits, Flags, Elements.get(),
926 RuntimeLang, VTableHolder, TemplateParams.
get(),
927 getCanonicalMDString(Context, Identifier), Discriminator, Storage, ShouldCreate);
932 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
938 TempDICompositeType cloneImpl()
const {
939 return getTemporary(getContext(),
getTag(),
getName(), getFile(), getLine(),
941 getAlignInBits(), getOffsetInBits(),
getFlags(),
942 getElements(), getRuntimeLang(), getVTableHolder(),
943 getTemplateParams(), getIdentifier(), getDiscriminator());
951 DINodeArray Elements,
unsigned RuntimeLang,
953 DITemplateParameterArray TemplateParams =
nullptr,
956 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
957 AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
958 VTableHolder, TemplateParams, Identifier, Discriminator))
962 uint64_t SizeInBits,
uint32_t AlignInBits,
964 unsigned RuntimeLang,
Metadata *VTableHolder,
968 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
969 AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
970 VTableHolder, TemplateParams, Identifier, Discriminator))
972 TempDICompositeType clone()
const {
return cloneImpl(); }
986 unsigned RuntimeLang,
Metadata *VTableHolder,
1005 unsigned RuntimeLang,
Metadata *VTableHolder,
1010 return cast_or_null<MDTuple>(getRawElements());
1013 return cast_or_null<DIType>(getRawVTableHolder());
1016 return cast_or_null<MDTuple>(getRawTemplateParams());
1039 "Lost a member during member list replacement");
1041 replaceOperandWith(4, Elements.get());
1045 replaceOperandWith(5, VTableHolder);
1049 replaceOperandWith(6, TemplateParams.get());
1071 :
DIType(C, DISubroutineTypeKind, Storage, dwarf::DW_TAG_subroutine_type,
1072 0, 0, 0, 0, Flags, Ops),
1079 bool ShouldCreate =
true) {
1080 return getImpl(Context, Flags, CC, TypeArray.
get(), Storage, ShouldCreate);
1085 bool ShouldCreate =
true);
1087 TempDISubroutineType cloneImpl()
const {
1088 return getTemporary(getContext(),
getFlags(), getCC(), getTypeArray());
1094 (Flags, CC, TypeArray))
1097 (Flags, CC, TypeArray))
1099 TempDISubroutineType clone()
const {
return cloneImpl(); }
1104 return cast_or_null<MDTuple>(getRawTypeArray());
1125 LastEmissionKind = DebugDirectivesOnly
1132 LastDebugNameTableKind =
None 1143 unsigned RuntimeVersion;
1146 bool SplitDebugInlining;
1147 bool DebugInfoForProfiling;
1149 bool RangesBaseAddress;
1152 bool IsOptimized,
unsigned RuntimeVersion,
1153 unsigned EmissionKind, uint64_t DWOId,
bool SplitDebugInlining,
1154 bool DebugInfoForProfiling,
unsigned NameTableKind,
1156 :
DIScope(C, DICompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
1158 RuntimeVersion(RuntimeVersion),
EmissionKind(EmissionKind),
1159 DWOId(DWOId), SplitDebugInlining(SplitDebugInlining),
1160 DebugInfoForProfiling(DebugInfoForProfiling),
1161 NameTableKind(NameTableKind), RangesBaseAddress(RangesBaseAddress) {
1162 assert(Storage != Uniqued);
1169 unsigned RuntimeVersion,
StringRef SplitDebugFilename,
1170 unsigned EmissionKind, DICompositeTypeArray EnumTypes,
1171 DIScopeArray RetainedTypes,
1172 DIGlobalVariableExpressionArray GlobalVariables,
1173 DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
1174 uint64_t DWOId,
bool SplitDebugInlining,
bool DebugInfoForProfiling,
1175 unsigned NameTableKind,
bool RangesBaseAddress,
StorageType Storage,
1176 bool ShouldCreate =
true) {
1177 return getImpl(Context, SourceLanguage, File,
1178 getCanonicalMDString(Context, Producer), IsOptimized,
1179 getCanonicalMDString(Context, Flags), RuntimeVersion,
1180 getCanonicalMDString(Context, SplitDebugFilename),
1181 EmissionKind, EnumTypes.get(), RetainedTypes.get(),
1182 GlobalVariables.get(), ImportedEntities.get(), Macros.get(),
1183 DWOId, SplitDebugInlining, DebugInfoForProfiling,
1189 unsigned RuntimeVersion,
MDString *SplitDebugFilename,
1192 Metadata *Macros, uint64_t DWOId,
bool SplitDebugInlining,
1193 bool DebugInfoForProfiling,
unsigned NameTableKind,
1194 bool RangesBaseAddress,
StorageType Storage,
bool ShouldCreate =
true);
1196 TempDICompileUnit cloneImpl()
const {
1197 return getTemporary(
1198 getContext(), getSourceLanguage(), getFile(), getProducer(),
1199 isOptimized(),
getFlags(), getRuntimeVersion(), getSplitDebugFilename(),
1200 getEmissionKind(), getEnumTypes(), getRetainedTypes(),
1201 getGlobalVariables(), getImportedEntities(), getMacros(), DWOId,
1202 getSplitDebugInlining(), getDebugInfoForProfiling(), getNameTableKind(),
1203 getRangesBaseAddress());
1207 static void get() =
delete;
1208 static void getIfExists() =
delete;
1213 bool IsOptimized,
StringRef Flags,
unsigned RuntimeVersion,
1215 DICompositeTypeArray EnumTypes, DIScopeArray RetainedTypes,
1216 DIGlobalVariableExpressionArray GlobalVariables,
1217 DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
1218 uint64_t DWOId,
bool SplitDebugInlining,
bool DebugInfoForProfiling,
1220 (SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1221 SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
1222 GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
1223 DebugInfoForProfiling, (
unsigned)NameTableKind, RangesBaseAddress))
1227 bool IsOptimized,
MDString *Flags,
unsigned RuntimeVersion,
1231 bool SplitDebugInlining,
bool DebugInfoForProfiling,
1232 unsigned NameTableKind,
bool RangesBaseAddress),
1233 (SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1234 SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
1235 GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
1236 DebugInfoForProfiling, NameTableKind, RangesBaseAddress))
1238 TempDICompileUnit clone()
const {
return cloneImpl(); }
1247 return EmissionKind == DebugDirectivesOnly;
1254 return RangesBaseAddress; }
1256 return getStringOperand(1); }
1258 return getStringOperand(2); }
1260 return getStringOperand(3); }
1262 return cast_or_null<MDTuple>(getRawEnumTypes());
1265 return cast_or_null<MDTuple>(getRawRetainedTypes());
1268 return cast_or_null<MDTuple>(getRawGlobalVariables());
1271 return cast_or_null<MDTuple>(getRawImportedEntities());
1274 return cast_or_null<MDTuple>(getRawMacros());
1280 this->SplitDebugInlining = SplitDebugInlining;
1286 return getOperandAs<MDString>(3);
1301 replaceOperandWith(4, N.get());
1304 replaceOperandWith(5, N.get());
1307 replaceOperandWith(6, N.get());
1310 replaceOperandWith(7, N.get());
1329 :
DIScope(C, ID, Storage, Tag, Ops) {}
1365 Metadata *InlinedAt,
bool ImplicitCode,
1371 return getImpl(Context, Line, Column, static_cast<Metadata *>(Scope),
1372 static_cast<Metadata *>(InlinedAt), ImplicitCode, Storage,
1380 static unsigned getPrefixEncodingFromUnsigned(
unsigned U) {
1382 return U > 0x1f ? (((U & 0xfe0) << 1) | (U & 0x1f) | 0x20) : U;
1386 static unsigned getUnsignedFromPrefixEncoding(
unsigned U) {
1390 return (U & 0x20) ? (((U >> 1) & 0xfe0) | (U & 0x1f)) : (U & 0x1f);
1394 static unsigned getNextComponentInDiscriminator(
unsigned D) {
1396 return D >> ((D & 0x40) ? 14 : 7);
1401 TempDILocation cloneImpl()
const {
1404 return getTemporary(getContext(), getLine(), getColumn(), getRawScope(),
1405 getRawInlinedAt(), isImplicitCode());
1408 static unsigned encodeComponent(
unsigned C) {
1409 return (C == 0) ? 1U : (getPrefixEncodingFromUnsigned(C) << 1);
1412 static unsigned encodingBits(
unsigned C) {
1413 return (C == 0) ? 1 : (C > 0x1f ? 14 : 7);
1418 void replaceOperandWith(
unsigned I,
Metadata *New) =
delete;
1421 (
unsigned Line,
unsigned Column,
Metadata *Scope,
1422 Metadata *InlinedAt =
nullptr,
bool ImplicitCode =
false),
1423 (Line, Column, Scope, InlinedAt, ImplicitCode))
1427 bool ImplicitCode =
false),
1428 (Line, Column, Scope, InlinedAt, ImplicitCode))
1431 TempDILocation clone()
const {
return cloneImpl(); }
1433 unsigned getLine()
const {
return SubclassData32; }
1434 unsigned getColumn()
const {
return SubclassData16; }
1435 DILocalScope *getScope()
const {
return cast<DILocalScope>(getRawScope()); }
1438 return cast_or_null<DILocation>(getRawInlinedAt());
1447 bool isImplicitCode()
const {
return ImplicitCode; }
1448 void setImplicitCode(
bool ImplicitCode) { this->ImplicitCode = ImplicitCode; }
1452 StringRef getDirectory()
const {
return getScope()->getDirectory(); }
1460 if (
auto *IA = getInlinedAt())
1461 return IA->getInlinedAtScope();
1499 inline unsigned getDiscriminator()
const;
1502 inline const DILocation *cloneWithDiscriminator(
unsigned Discriminator)
const;
1512 inline unsigned getDuplicationFactor()
const;
1515 inline unsigned getCopyIdentifier()
const;
1518 inline unsigned getBaseDiscriminator()
const;
1545 return getUnsignedFromPrefixEncoding(D);
1557 static Optional<unsigned> encodeDiscriminator(
unsigned BD,
unsigned DF,
unsigned CI);
1560 static void decodeDiscriminator(
unsigned D,
unsigned &BD,
unsigned &DF,
1566 D = getNextComponentInDiscriminator(D);
1567 unsigned Ret = getUnsignedFromPrefixEncoding(D);
1575 return getUnsignedFromPrefixEncoding(getNextComponentInDiscriminator(
1576 getNextComponentInDiscriminator(D)));
1582 if (getNumOperands() == 2)
1583 return getOperand(1);
1599 unsigned VirtualIndex;
1609 #define HANDLE_DISP_FLAG(ID, NAME) SPFlag##NAME = ID, 1610 #define DISP_FLAG_LARGEST_NEEDED 1611 #include "llvm/IR/DebugInfoFlags.def" 1612 SPFlagNonvirtual = SPFlagZero,
1613 SPFlagVirtuality = SPFlagVirtual | SPFlagPureVirtual,
1630 unsigned Virtuality = SPFlagNonvirtual,
1631 bool IsMainSubprogram =
false) {
1634 int(SPFlagVirtual) ==
int(dwarf::DW_VIRTUALITY_virtual) &&
1635 int(SPFlagPureVirtual) ==
int(dwarf::DW_VIRTUALITY_pure_virtual),
1636 "Virtuality constant mismatch");
1638 (Virtuality & SPFlagVirtuality) |
1639 (IsLocalToUnit ? SPFlagLocalToUnit : SPFlagZero) |
1640 (IsDefinition ? SPFlagDefinition : SPFlagZero) |
1641 (IsOptimized ? SPFlagOptimized : SPFlagZero) |
1642 (IsMainSubprogram ? SPFlagMainSubprogram : SPFlagZero));
1650 unsigned ScopeLine,
unsigned VirtualIndex,
int ThisAdjustment,
1652 :
DILocalScope(C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram,
1654 Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex),
1655 ThisAdjustment(ThisAdjustment), Flags(Flags), SPFlags(SPFlags) {
1664 unsigned VirtualIndex,
int ThisAdjustment,
DIFlags Flags,
1666 DITemplateParameterArray TemplateParams,
DISubprogram *Declaration,
1667 DINodeArray RetainedNodes, DITypeArray ThrownTypes,
1669 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
1670 getCanonicalMDString(Context, LinkageName), File, Line, Type,
1671 ScopeLine, ContainingType, VirtualIndex, ThisAdjustment,
1672 Flags, SPFlags, Unit, TemplateParams.
get(), Declaration,
1673 RetainedNodes.
get(), ThrownTypes.
get(), Storage,
1679 unsigned ScopeLine,
Metadata *ContainingType,
1680 unsigned VirtualIndex,
int ThisAdjustment,
1686 TempDISubprogram cloneImpl()
const {
1688 getFile(), getLine(),
getType(), getScopeLine(),
1689 getContainingType(), getVirtualIndex(),
1690 getThisAdjustment(),
getFlags(), getSPFlags(),
1692 getRetainedNodes(), getThrownTypes());
1700 DIType *ContainingType,
unsigned VirtualIndex,
int ThisAdjustment,
1702 DITemplateParameterArray TemplateParams =
nullptr,
1703 DISubprogram *Declaration =
nullptr, DINodeArray RetainedNodes =
nullptr,
1704 DITypeArray ThrownTypes =
nullptr),
1705 (Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType,
1706 VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams,
1707 Declaration, RetainedNodes, ThrownTypes))
1712 unsigned Line,
Metadata *Type,
unsigned ScopeLine,
1713 Metadata *ContainingType,
unsigned VirtualIndex,
int ThisAdjustment,
1717 (Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType,
1718 VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams,
1719 Declaration, RetainedNodes, ThrownTypes))
1721 TempDISubprogram clone()
const {
return cloneImpl(); }
1724 TempDISubprogram cloneWithFlags(
DIFlags NewFlags)
const {
1725 auto NewSP = clone();
1726 NewSP->Flags = NewFlags;
1731 unsigned getLine()
const {
return Line; }
1732 unsigned getVirtuality()
const {
return getSPFlags() & SPFlagVirtuality; }
1733 unsigned getVirtualIndex()
const {
return VirtualIndex; }
1734 int getThisAdjustment()
const {
return ThisAdjustment; }
1735 unsigned getScopeLine()
const {
return ScopeLine; }
1737 DISPFlags getSPFlags()
const {
return SPFlags; }
1738 bool isLocalToUnit()
const {
return getSPFlags() & SPFlagLocalToUnit; }
1739 bool isDefinition()
const {
return getSPFlags() & SPFlagDefinition; }
1740 bool isOptimized()
const {
return getSPFlags() & SPFlagOptimized; }
1741 bool isMainSubprogram()
const {
return getSPFlags() & SPFlagMainSubprogram; }
1743 bool isArtificial()
const {
return getFlags() & FlagArtificial; }
1744 bool isPrivate()
const {
1745 return (
getFlags() & FlagAccessibility) == FlagPrivate;
1747 bool isProtected()
const {
1748 return (
getFlags() & FlagAccessibility) == FlagProtected;
1750 bool isPublic()
const {
1751 return (
getFlags() & FlagAccessibility) == FlagPublic;
1753 bool isExplicit()
const {
return getFlags() & FlagExplicit; }
1754 bool isPrototyped()
const {
return getFlags() & FlagPrototyped; }
1755 bool areAllCallsDescribed()
const {
1756 return getFlags() & FlagAllCallsDescribed;
1758 bool isPure()
const {
return getSPFlags() & SPFlagPure; }
1759 bool isElemental()
const {
return getSPFlags() & SPFlagElemental; }
1760 bool isRecursive()
const {
return getSPFlags() & SPFlagRecursive; }
1761 bool isObjCDirect()
const {
return getSPFlags() & SPFlagObjCDirect; }
1767 bool isDeleted()
const {
return getSPFlags() & SPFlagDeleted; }
1773 bool isLValueReference()
const {
return getFlags() & FlagLValueReference; }
1779 bool isRValueReference()
const {
return getFlags() & FlagRValueReference; }
1784 bool isNoReturn()
const {
return getFlags() & FlagNoReturn; }
1789 bool isThunk()
const {
return getFlags() & FlagThunk; }
1791 DIScope *getScope()
const {
return cast_or_null<DIScope>(getRawScope()); }
1797 return cast_or_null<DISubroutineType>(getRawType());
1799 DIType *getContainingType()
const {
1800 return cast_or_null<DIType>(getRawContainingType());
1804 return cast_or_null<DICompileUnit>(getRawUnit());
1807 DITemplateParameterArray getTemplateParams()
const {
1808 return cast_or_null<MDTuple>(getRawTemplateParams());
1811 return cast_or_null<DISubprogram>(getRawDeclaration());
1813 DINodeArray getRetainedNodes()
const {
1814 return cast_or_null<MDTuple>(getRawRetainedNodes());
1816 DITypeArray getThrownTypes()
const {
1817 return cast_or_null<MDTuple>(getRawThrownTypes());
1820 Metadata *getRawScope()
const {
return getOperand(1); }
1821 MDString *getRawName()
const {
return getOperandAs<MDString>(2); }
1822 MDString *getRawLinkageName()
const {
return getOperandAs<MDString>(3); }
1823 Metadata *getRawType()
const {
return getOperand(4); }
1824 Metadata *getRawUnit()
const {
return getOperand(5); }
1825 Metadata *getRawDeclaration()
const {
return getOperand(6); }
1826 Metadata *getRawRetainedNodes()
const {
return getOperand(7); }
1827 Metadata *getRawContainingType()
const {
1828 return getNumOperands() > 8 ? getOperandAs<Metadata>(8) :
nullptr;
1830 Metadata *getRawTemplateParams()
const {
1831 return getNumOperands() > 9 ? getOperandAs<Metadata>(9) :
nullptr;
1833 Metadata *getRawThrownTypes()
const {
1834 return getNumOperands() > 10 ? getOperandAs<Metadata>(10) :
nullptr;
1840 bool describes(
const Function *
F)
const;
1851 :
DILocalScope(C, ID, Storage, dwarf::DW_TAG_lexical_block, Ops) {}
1876 assert(Column < (1u << 16) &&
"Expected 16-bit column");
1881 DIFile *File,
unsigned Line,
unsigned Column,
1883 bool ShouldCreate =
true) {
1884 return getImpl(Context, static_cast<Metadata *>(Scope),
1885 static_cast<Metadata *>(File), Line, Column, Storage,
1890 Metadata *File,
unsigned Line,
unsigned Column,
1893 TempDILexicalBlock cloneImpl()
const {
1894 return getTemporary(getContext(), getScope(), getFile(), getLine(),
1900 unsigned Line,
unsigned Column),
1901 (Scope, File, Line, Column))
1903 unsigned Line,
unsigned Column),
1904 (Scope, File, Line, Column))
1906 TempDILexicalBlock clone()
const {
return cloneImpl(); }
1920 unsigned Discriminator;
1925 Discriminator(Discriminator) {}
1929 DIFile *File,
unsigned Discriminator,
1931 bool ShouldCreate =
true) {
1932 return getImpl(Context, static_cast<Metadata *>(Scope),
1933 static_cast<Metadata *>(File), Discriminator, Storage,
1938 Metadata *File,
unsigned Discriminator,
1940 bool ShouldCreate =
true);
1942 TempDILexicalBlockFile cloneImpl()
const {
1943 return getTemporary(getContext(), getScope(), getFile(),
1944 getDiscriminator());
1949 unsigned Discriminator),
1950 (Scope, File, Discriminator))
1953 (Scope, File, Discriminator))
1955 TempDILexicalBlockFile clone()
const {
return cloneImpl(); }
1958 unsigned getLine()
const =
delete;
1959 unsigned getColumn()
const =
delete;
1968 unsigned DILocation::getDiscriminator()
const {
1969 if (
auto *
F = dyn_cast<DILexicalBlockFile>(getScope()))
1970 return F->getDiscriminator();
1981 for (
auto *LBF = dyn_cast<DILexicalBlockFile>(Scope);
1982 LBF && LBF->getDiscriminator() != 0;
1987 return DILocation::get(getContext(), getLine(), getColumn(), NewScope,
1992 return getBaseDiscriminatorFromDiscriminator(getDiscriminator());
1996 return getDuplicationFactorFromDiscriminator(getDiscriminator());
2000 return getCopyIdentifierFromDiscriminator(getDiscriminator());
2004 unsigned BD,
DF, CI;
2005 decodeDiscriminator(getDiscriminator(), BD, DF, CI);
2009 return cloneWithDiscriminator(*Encoded);
2014 DF *= getDuplicationFactor();
2018 unsigned BD = getBaseDiscriminator();
2019 unsigned CI = getCopyIdentifier();
2021 return cloneWithDiscriminator(*D);
2029 unsigned ExportSymbols : 1;
2033 :
DIScope(Context, DINamespaceKind, Storage, dwarf::DW_TAG_namespace,
2035 ExportSymbols(ExportSymbols) {}
2041 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
2042 ExportSymbols, Storage, ShouldCreate);
2045 MDString *Name,
bool ExportSymbols,
2048 TempDINamespace cloneImpl()
const {
2049 return getTemporary(getContext(), getScope(),
getName(),
2050 getExportSymbols());
2056 (Scope, Name, ExportSymbols))
2059 (Scope, Name, ExportSymbols))
2061 TempDINamespace clone()
const {
return cloneImpl(); }
2082 :
DIScope(Context, DIModuleKind, Storage, dwarf::DW_TAG_module, Ops) {}
2089 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
2090 getCanonicalMDString(Context, ConfigurationMacros),
2091 getCanonicalMDString(Context, IncludePath),
2092 getCanonicalMDString(Context, SysRoot),
2093 Storage, ShouldCreate);
2100 TempDIModule cloneImpl()
const {
2101 return getTemporary(getContext(), getScope(),
getName(),
2102 getConfigurationMacros(), getIncludePath(),
2110 (Scope, Name, ConfigurationMacros, IncludePath, SysRoot))
2114 (Scope, Name, ConfigurationMacros, IncludePath, SysRoot))
2116 TempDIModule clone()
const {
return cloneImpl(); }
2140 :
DINode(Context, ID, Storage, Tag, Ops) {}
2151 return MD->
getMetadataID() == DITemplateTypeParameterKind ||
2163 dwarf::DW_TAG_template_type_parameter, Ops) {}
2168 bool ShouldCreate =
true) {
2169 return getImpl(Context, getCanonicalMDString(Context, Name), Type, Storage,
2174 bool ShouldCreate =
true);
2176 TempDITemplateTypeParameter cloneImpl()
const {
2186 TempDITemplateTypeParameter clone()
const {
return cloneImpl(); }
2206 bool ShouldCreate =
true) {
2207 return getImpl(Context, Tag, getCanonicalMDString(Context, Name), Type,
2208 Value, Storage, ShouldCreate);
2213 bool ShouldCreate =
true);
2215 TempDITemplateValueParameter cloneImpl()
const {
2224 (Tag, Name, Type, Value))
2227 (Tag, Name, Type, Value))
2229 TempDITemplateValueParameter clone()
const {
return cloneImpl(); }
2246 :
DINode(C, ID, Storage, dwarf::DW_TAG_variable, Ops), Line(Line),
2247 AlignInBits(AlignInBits) {}
2264 if (
auto *
BT = dyn_cast<DIBasicType>(
getType()))
2265 return BT->getSignedness();
2270 if (
auto *
F = getFile())
2271 return F->getFilename();
2276 if (
auto *
F = getFile())
2277 return F->getDirectory();
2282 if (
auto *
F = getFile())
2283 return F->getSource();
2311 std::vector<uint64_t> Elements;
2314 :
MDNode(C, DIExpressionKind, Storage,
None),
2315 Elements(Elements.
begin(), Elements.
end()) {}
2320 bool ShouldCreate =
true);
2322 TempDIExpression cloneImpl()
const {
2323 return getTemporary(getContext(), getElements());
2329 TempDIExpression clone()
const {
return cloneImpl(); }
2336 assert(I < Elements.
size() &&
"Index out of range");
2353 const uint64_t *
Op =
nullptr;
2359 const uint64_t *
get()
const {
return Op; }
2367 uint64_t
getArg(
unsigned I)
const {
return Op[I + 1]; }
2374 unsigned getSize()
const;
2378 V.
append(
get(),
get() + getSize());
2384 :
public std::iterator<std::input_iterator_tag, ExprOperand> {
2413 return getBase() == X.
getBase();
2416 return getBase() != X.
getBase();
2438 return {expr_op_begin(), expr_op_end()};
2442 bool isValid()
const;
2450 return getNumElements() > 0 && getElement(0) == dwarf::DW_OP_deref;
2465 return getFragmentInfo(expr_op_begin(), expr_op_end());
2472 bool isImplicit()
const;
2476 bool isComplex()
const;
2483 bool extractIfOffset(int64_t &Offset)
const;
2489 unsigned &AddrClass);
2494 DerefBefore = 1 << 0,
2495 DerefAfter = 1 << 1,
2496 StackValue = 1 << 2,
2503 int64_t Offset = 0);
2509 bool StackValue =
false,
2510 bool EntryValue =
false);
2536 createFragmentExpression(
const DIExpression *Expr,
unsigned OffsetInBits,
2537 unsigned SizeInBits);
2558 static ExtOps getExtOps(
unsigned FromSize,
unsigned ToSize,
bool Signed);
2563 unsigned ToSize,
bool Signed);
2567 return fragmentCmp(A, B) == 0;
2573 auto Fragment1 = *getFragmentInfo();
2575 return fragmentCmp(Fragment1, Fragment2);
2582 return fragmentCmp(Other) == 0;
2588 return getNumElements() > 0 &&
2631 bool IsLocalToUnit,
bool IsDefinition,
uint32_t AlignInBits,
2633 :
DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops, AlignInBits),
2634 IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {}
2640 bool IsLocalToUnit,
bool IsDefinition,
2643 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
2644 getCanonicalMDString(Context, LinkageName), File, Line, Type,
2645 IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration,
2646 cast_or_null<Metadata>(TemplateParams), AlignInBits, Storage,
2652 bool IsLocalToUnit,
bool IsDefinition,
2656 TempDIGlobalVariable cloneImpl()
const {
2658 getFile(), getLine(),
getType(), isLocalToUnit(),
2659 isDefinition(), getStaticDataMemberDeclaration(),
2660 getTemplateParams(), getAlignInBits());
2667 bool IsLocalToUnit,
bool IsDefinition,
2670 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
2671 IsDefinition, StaticDataMemberDeclaration, TemplateParams,
2676 bool IsLocalToUnit,
bool IsDefinition,
2677 Metadata *StaticDataMemberDeclaration,
2679 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
2680 IsDefinition, StaticDataMemberDeclaration, TemplateParams,
2683 TempDIGlobalVariable clone()
const {
return cloneImpl(); }
2690 return cast_or_null<DIDerivedType>(getRawStaticDataMemberDeclaration());
2711 :
DIScope(Context, DICommonBlockKind, Storage, dwarf::DW_TAG_common_block,
2712 Ops), LineNo(LineNo) {}
2716 DIFile *File,
unsigned LineNo,
2718 bool ShouldCreate =
true) {
2719 return getImpl(Context, Scope, Decl, getCanonicalMDString(Context, Name),
2720 File, LineNo, Storage, ShouldCreate);
2727 TempDICommonBlock cloneImpl()
const {
2728 return getTemporary(getContext(), getScope(), getDecl(),
getName(),
2729 getFile(), getLineNo());
2735 DIFile *File,
unsigned LineNo),
2736 (Scope, Decl, Name, File, LineNo))
2740 (Scope, Decl, Name, File, LineNo))
2742 TempDICommonBlock clone()
const {
return cloneImpl(); }
2746 return cast_or_null<DIGlobalVariable>(getRawDecl());
2775 :
DIVariable(C, DILocalVariableKind, Storage, Line, Ops, AlignInBits),
2776 Arg(Arg), Flags(Flags) {
2777 assert(Arg < (1 << 16) &&
"DILocalVariable: Arg out of range");
2785 bool ShouldCreate =
true) {
2786 return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
2787 Line, Type, Arg, Flags, AlignInBits, Storage, ShouldCreate);
2793 bool ShouldCreate =
true);
2795 TempDILocalVariable cloneImpl()
const {
2796 return getTemporary(getContext(), getScope(),
getName(), getFile(),
2806 (Scope, Name, File, Line, Type, Arg, Flags, AlignInBits))
2809 unsigned Line,
Metadata *Type,
unsigned Arg,
2811 (Scope, Name, File, Line, Type, Arg, Flags, AlignInBits))
2813 TempDILocalVariable clone()
const {
return cloneImpl(); }
2835 return DL && getScope()->getSubprogram() == DL->getScope()->getSubprogram();
2853 :
DINode(C, DILabelKind, Storage, dwarf::DW_TAG_label, Ops), Line(Line) {}
2859 bool ShouldCreate =
true) {
2860 return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
2861 Line, Storage, ShouldCreate);
2866 bool ShouldCreate =
true);
2868 TempDILabel cloneImpl()
const {
2869 return getTemporary(getContext(), getScope(),
getName(), getFile(),
2877 (Scope, Name, File, Line))
2881 (Scope, Name, File, Line))
2883 TempDILabel clone()
const {
return cloneImpl(); }
2889 return cast_or_null<DILocalScope>(getRawScope());
2905 return DL && getScope()->getSubprogram() == DL->getScope()->getSubprogram();
2918 unsigned Attributes;
2922 :
DINode(C, DIObjCPropertyKind, Storage, dwarf::DW_TAG_APPLE_property,
2924 Line(Line), Attributes(Attributes) {}
2931 return getImpl(Context, getCanonicalMDString(Context, Name), File, Line,
2932 getCanonicalMDString(Context, GetterName),
2933 getCanonicalMDString(Context, SetterName), Attributes, Type,
2934 Storage, ShouldCreate);
2939 unsigned Attributes,
Metadata *Type,
2942 TempDIObjCProperty cloneImpl()
const {
2943 return getTemporary(getContext(),
getName(), getFile(), getLine(),
2952 unsigned Attributes,
DIType *Type),
2953 (Name, File, Line, GetterName, SetterName, Attributes,
2958 unsigned Attributes,
Metadata *Type),
2959 (Name, File, Line, GetterName, SetterName, Attributes,
2962 TempDIObjCProperty clone()
const {
return cloneImpl(); }
2973 if (
auto *
F = getFile())
2974 return F->getFilename();
2979 if (
auto *
F = getFile())
2980 return F->getDirectory();
2985 if (
auto *
F = getFile())
2986 return F->getSource();
3010 :
DINode(C, DIImportedEntityKind, Storage, Tag, Ops), Line(Line) {}
3017 bool ShouldCreate =
true) {
3018 return getImpl(Context, Tag, Scope, Entity, File, Line,
3019 getCanonicalMDString(Context, Name), Storage, ShouldCreate);
3025 bool ShouldCreate =
true);
3027 TempDIImportedEntity cloneImpl()
const {
3028 return getTemporary(getContext(),
getTag(), getScope(), getEntity(),
3029 getFile(), getLine(),
getName());
3036 (Tag, Scope, Entity, File, Line, Name))
3040 (Tag, Scope, Entity, File, Line, Name))
3042 TempDIImportedEntity clone()
const {
return cloneImpl(); }
3067 :
MDNode(C, DIGlobalVariableExpressionKind, Storage, Ops) {}
3074 TempDIGlobalVariableExpression cloneImpl()
const {
3075 return getTemporary(getContext(), getVariable(), getExpression());
3081 (Variable, Expression))
3083 TempDIGlobalVariableExpression clone()
const {
return cloneImpl(); }
3088 return cast_or_null<DIGlobalVariable>(getRawVariable());
3094 return cast<DIExpression>(getRawExpression());
3098 return MD->
getMetadataID() == DIGlobalVariableExpressionKind;
3115 :
MDNode(C, ID, Storage, Ops1, Ops2) {
3116 assert(MIType < 1u << 16);
3117 SubclassData16 = MIType;
3122 return cast_or_null<Ty>(getOperand(I));
3126 if (
auto *S = getOperandAs<MDString>(I))
3127 return S->getString();
3145 case DIMacroFileKind:
3159 :
DIMacroNode(C, DIMacroKind, Storage, MIType, Ops), Line(Line) {}
3164 bool ShouldCreate =
true) {
3165 return getImpl(Context, MIType, Line, getCanonicalMDString(Context, Name),
3166 getCanonicalMDString(Context, Value), Storage, ShouldCreate);
3170 bool ShouldCreate =
true);
3172 TempDIMacro cloneImpl()
const {
3173 return getTemporary(getContext(), getMacinfoType(), getLine(),
getName(),
3180 (MIType, Line, Name, Value))
3183 (MIType, Line, Name, Value))
3185 TempDIMacro clone()
const {
return cloneImpl(); }
3208 :
DIMacroNode(C, DIMacroFileKind, Storage, MIType, Ops), Line(Line) {}
3212 unsigned Line,
DIFile *File,
3214 bool ShouldCreate =
true) {
3215 return getImpl(Context, MIType, Line, static_cast<Metadata *>(File),
3216 Elements.get(), Storage, ShouldCreate);
3223 TempDIMacroFile cloneImpl()
const {
3224 return getTemporary(getContext(), getMacinfoType(), getLine(), getFile(),
3230 DIMacroNodeArray Elements),
3231 (MIType, Line, File, Elements))
3234 (MIType, Line, File, Elements))
3236 TempDIMacroFile clone()
const {
return cloneImpl(); }
3242 "Lost a macro node during macro node list replacement");
3244 replaceOperandWith(1, Elements.get());
3251 return cast_or_null<MDTuple>(getRawElements());
3287 : Variable(Var), Fragment(FragmentInfo), InlinedAt(InlinedAt) {}
3292 Fragment(DIExpr ? DIExpr->getFragmentInfo() :
NoneType()),
3293 InlinedAt(InlinedAt) {}
3304 return F == DefaultFragment;
3308 return std::tie(Variable, Fragment, InlinedAt) ==
3309 std::tie(Other.Variable, Other.Fragment, Other.InlinedAt);
3313 return std::tie(Variable, Fragment, InlinedAt) <
3314 std::tie(Other.Variable, Other.Fragment, Other.InlinedAt);
3347 #undef DEFINE_MDNODE_GET_UNPACK_IMPL 3348 #undef DEFINE_MDNODE_GET_UNPACK 3349 #undef DEFINE_MDNODE_GET 3351 #endif // LLVM_IR_DEBUGINFOMETADATA_H Scope
Defines the scope in which this symbol should be visible: Default – Visible in the public interface ...
T Value
The string value of the checksum.
bool operator==(const expr_op_iterator &X) const
bool isObjectPointer() const
const FragmentInfo getFragmentOrDefault() const
StringRef getFilename() const
Metadata * getRawRetainedTypes() const
static bool classof(const Metadata *MD)
MDString * getRawName() const
Tracking metadata reference owned by Metadata.
ArrayRef< uint64_t > getElements() const
#define LLVM_MARK_AS_BITMASK_ENUM(LargestValue)
LLVM_MARK_AS_BITMASK_ENUM lets you opt in an individual enum type so you can perform bitwise operatio...
StringRef getKindAsString() const
uint64_t getOffsetInBits() const
static void r2(uint32_t &A, uint32_t &B, uint32_t &C, uint32_t &D, uint32_t &E, int I, uint32_t *Buf)
DIType * operator[](unsigned I) const
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static bool isConstant(const MachineInstr &MI)
static std::string getLinkageName(GlobalValue::LinkageTypes LT)
bool isTypePassByValue() const
bool isEntryValue() const
Check if the expression consists of exactly one entry value operand.
bool isDefinition() const
Metadata * getRawVariable() const
StringRef getName() const
ChecksumKind Kind
The kind of checksum which Value encodes.
static bool fragmentsOverlap(const FragmentInfo &A, const FragmentInfo &B)
Check if fragments overlap between a pair of FragmentInfos.
This class represents lattice values for constants.
StringRef getName() const
unsigned getRuntimeVersion() const
Metadata * getRawGlobalVariables() const
Metadata * getRawScope() const
MDString * getRawName() const
StringRef getGetterName() const
Metadata * getRawVTableHolder() const
MDTuple * operator->() const
Optional< const DILocation * > cloneByMultiplyingDuplicationFactor(unsigned DF) const
Returns a new DILocation with duplication factor DF * current duplication factor encoded in the discr...
void replaceTemplateParams(DITemplateParameterArray TemplateParams)
MDString * getRawName() const
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
static MDString * get(LLVMContext &Context, StringRef Str)
unsigned getNumArgs() const
NoneType
A simple null object to allow implicit construction of Optional<T> and similar types without having t...
Metadata * getRawFile() const
unsigned getSizeInBits(Register Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI) const
Get the size in bits of Reg.
bool operator!=(const expr_op_iterator &X) const
DIScope(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, ArrayRef< Metadata *> Ops)
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
static bool classof(const Metadata *MD)
unsigned getDiscriminator() const
MDString * getRawValue() const
constexpr T getValueOr(U &&value) const LLVM_LVALUE_FUNCTION
static SmallString< 128 > getFilename(const DISubprogram *SP)
Extract a filename for a DISubprogram.
Metadata * getRawFile() const
Return the raw underlying file.
static bool classof(const Metadata *MD)
void setSplitDebugInlining(bool SplitDebugInlining)
void emplace(ArgTypes &&... Args)
Create a new object by constructing it in place with the given arguments.
static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized, unsigned Virtuality=SPFlagNonvirtual, bool IsMainSubprogram=false)
Metadata * getRawInlinedAt() const
static DebugVariable getEmptyKey()
Empty key: no key should be generated that has no DILocalVariable.
DIType(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, unsigned Line, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags, ArrayRef< Metadata *> Ops)
static enum BaseType getBaseType(const Value *Val)
Return the baseType for Val which states whether Val is exclusively derived from constant/null, or not exclusively derived from constant.
unsigned getSize() const
Return the size of the operand.
ArrayRef< uint64_t >::iterator element_iterator
Optional< const DILocation * > cloneWithBaseDiscriminator(unsigned BD) const
Returns a new DILocation with updated base discriminator BD.
DICompositeTypeArray getEnumTypes() const
const ExprOperand & operator*() const
DebugVariable(const DILocalVariable *Var, const DIExpression *DIExpr, const DILocation *InlinedAt)
uint64_t getDWOId() const
static bool classof(const Metadata *MD)
static bool classof(const Metadata *MD)
Optional< DIBasicType::Signedness > getSignedness() const
Return the signedness of this variable's type, or None if this type is neither signed nor unsigned...
Metadata * getRawScope() const
const MDOperand & getOperand(unsigned I) const
static bool classof(const Metadata *MD)
StringRef getConfigurationMacros() const
static bool classof(const Metadata *MD)
static bool classof(const Metadata *MD)
StringRef getProducer() const
Metadata * getRawTemplateParams() const
static bool classof(const Metadata *MD)
bool isForwardDecl() const
bool getDebugInfoForProfiling() const
unsigned getVirtuality(StringRef VirtualityString)
op_iterator op_end() const
StringRef getName() const
Tagged DWARF-like metadata node.
void replaceRetainedTypes(DITypeArray N)
DINodeArray getElements() const
TempMDNode clone() const
Create a (temporary) clone of this.
MDString * getRawName() const
op_range dwarf_operands() const
static bool classof(const Metadata *MD)
Identifies a unique instance of a variable.
StringRef getStringOperand(unsigned I) const
DIScope * getScope() const
Metadata * getRawTypeArray() const
Ty * getOperandAs(unsigned I) const
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
StringRef getSplitDebugFilename() const
StringRef getName() const
StringRef getFlags() const
StringRef getName() const
bool isLValueReference() const
bool isStaticMember() const
bool isDebugDirectivesOnly() const
static bool classof(const Metadata *MD)
DIGlobalVariable * getVariable() const
static bool classof(const Metadata *MD)
static unsigned getHashValue(const FragInfo &Frag)
expr_op_iterator expr_op_begin() const
Visit the elements via ExprOperand wrappers.
MDString * getRawSetterName() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef getName() const
bool isArtificial() const
static bool classof(const Metadata *MD)
iterator(MDNode::op_iterator I)
static StringRef getName(Value *V)
const uint64_t * get() const
bool getRangesBaseAddress() const
uint64_t getSizeInBits() const
StringRef getSysRoot() const
StringRef getDirectory() const
Metadata * getRawType() const
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
StringRef getFilename() const
op_iterator op_begin() const
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
bool getExportSymbols() const
Metadata * getRawImportedEntities() const
bool isLocalToUnit() const
expr_op_iterator expr_op_end() const
DIType * getBaseType() const
StringRef getIncludePath() const
DIScope * getScope() const
Holds the characteristics of one fragment of a larger variable.
unsigned getRuntimeLang() const
unsigned getDuplicationFactor() const
Returns the duplication factor stored in the discriminator, or 1 if no duplication factor (or 0) is e...
MDString * getRawName() const
DIMacroNodeArray getElements() const
uint32_t getAlignInBytes() const
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
const MDOperand & getDwarfOperand(unsigned I) const
uint32_t getAlignInBits() const
static Optional< FragmentInfo > getFragmentInfo(expr_op_iterator Start, expr_op_iterator End)
Retrieve the details of this fragment expression.
DINode(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, ArrayRef< Metadata *> Ops1, ArrayRef< Metadata *> Ops2=None)
const DILocation * getInlinedAt() const
Metadata * getRawEntity() const
StringRef getFilename() const
TempDIType cloneWithFlags(DIFlags NewFlags) const
Returns a new temporary DIType with updated Flags.
DIScope * getScope() const
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
uint64_t getArg(unsigned I) const
Get an argument to the operand.
StringRef getDirectory() const
Metadata * getRawFile() const
StringRef getStringOperand(unsigned I) const
Flag
These should be considered private to the implementation of the MCInstrDesc class.
StringRef getName() const
static unsigned getHashValue(const DebugVariable &D)
bool operator==(const DebugVariable &Other) const
DIScope * getScope() const
static bool classof(const Metadata *MD)
uint64_t getOp() const
Get the operand code.
DIMacroNodeArray getMacros() const
bool isValidLocationForIntrinsic(const DILocation *DL) const
Check that a location is valid for this label.
ExprOperand(const uint64_t *Op)
Metadata * getValue() const
op_iterator dwarf_op_begin() const
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
DITemplateParameterArray getTemplateParams() const
DIType * operator*() const
initializer< Ty > init(const Ty &Val)
unsigned getColumn() const
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
expr_op_iterator(element_iterator I)
Metadata * getRawDiscriminator() const
static bool isEqual(const DebugVariable &A, const DebugVariable &B)
bool operator==(const ChecksumInfo< T > &X) const
static bool classof(const Metadata *MD)
A single checksum, represented by a Kind and a Value (a string).
static bool isEqual(const FragInfo &A, const FragInfo &B)
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
static bool classof(const Metadata *MD)
void replaceDwarfOperandWith(unsigned I, Metadata *New)
Instrumentation for Order File
size_t size() const
size - Get the array size.
This is an important base class in LLVM.
expr_op_iterator & operator++()
CountType getCount() const
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Metadata * getRawExpression() const
static FragInfo getTombstoneKey()
Base class for template parameters.
unsigned getAttributes() const
ChecksumInfo(ChecksumKind Kind, T Value)
Ty * getOperandAs(unsigned I) const
DIExpression * getExpression() const
StringRef getName() const
A lightweight wrapper around an expression operand.
bool isValidLocationForIntrinsic(const DILocation *DL) const
Check that a location is valid for this variable.
A pair of DIGlobalVariable and DIExpression.
DIImportedEntityArray getImportedEntities() const
MDTuple * getTemplateParams() const
static MDString * getCanonicalMDString(LLVMContext &Context, StringRef S)
void replaceEnumTypes(DICompositeTypeArray N)
Replace arrays.
void mutate(unsigned Tag, unsigned Line, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags)
Change fields in place.
DIDerivedType * getStaticDataMemberDeclaration() const
Optional< FragmentInfo > getFragmentInfo() const
Retrieve the details of this fragment expression.
Only used in LLVM metadata.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
DEFINE_MDNODE_GET(DIGlobalVariableExpression,(Metadata *Variable, Metadata *Expression),(Variable, Expression)) TempDIGlobalVariableExpression clone() const
DebugVariable(const DILocalVariable *Var, Optional< FragmentInfo > FragmentInfo, const DILocation *InlinedAt)
Base class for variables.
ChecksumKind
Which algorithm (e.g.
DIVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Line, ArrayRef< Metadata *> Ops, uint32_t AlignInBits=0)
void init(unsigned Line, uint64_t SizeInBits, uint32_t AlignInBits, uint64_t OffsetInBits, DIFlags Flags)
bool isObjectPointer() const
bool isObjcClassComplete() const
void appendToVector(SmallVectorImpl< uint64_t > &V) const
Append the elements of this operand to V.
static void r1(uint32_t &A, uint32_t &B, uint32_t &C, uint32_t &D, uint32_t &E, int I, uint32_t *Buf)
StringRef getHeader() const
DebugNameTableKind getNameTableKind() const
static bool classof(const Metadata *MD)
MDString * getRawConfigurationMacros() const
element_iterator getBase() const
DIScope * getScope() const
StringRef getDirectory() const
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&... Args)
element_iterator elements_end() const
static wasm::ValType getType(const TargetRegisterClass *RC)
uint64_t getElement(unsigned I) const
Metadata * getRawType() const
static bool classof(const Metadata *MD)
MDString * getRawName() const
MDString * getRawName() const
static bool classof(const Metadata *MD)
bool isRValueReference() const
static bool classof(const Metadata *MD)
Optional< StringRef > getSource() const
static RegisterPass< DebugifyFunctionPass > DF("debugify-function", "Attach debug info to a function")
An imported module (C++ using directive or similar).
StringRef getSetterName() const
Base class for scope-like contexts.
iterator_range< expr_op_iterator > expr_ops() const
expr_op_iterator operator++(int)
op_iterator dwarf_op_end() const
void setTag(unsigned Tag)
Allow subclasses to mutate the tag.
MDString * getRawName() const
Metadata * getRawElements() const
BaseType
A given derived pointer can have multiple base pointers through phi/selects.
bool isLittleEndian() const
static bool classof(const Metadata *MD)
Metadata * getRawScope() const
static unsigned getBaseDiscriminatorFromDiscriminator(unsigned D)
Returns the base discriminator for a given encoded discriminator D.
void setDWOId(uint64_t DwoId)
static MDString * getCanonicalMDString(LLVMContext &Context, StringRef S)
DITemplateParameter(LLVMContext &Context, unsigned ID, StorageType Storage, unsigned Tag, ArrayRef< Metadata *> Ops)
static FragInfo getEmptyKey()
Align max(MaybeAlign Lhs, Align Rhs)
PrependOps
Used for DIExpression::prepend.
Metadata * getRawTemplateParams() const
zlib-gnu style compression
static bool classof(const Metadata *MD)
static unsigned getDuplicationFactorFromDiscriminator(unsigned D)
Returns the duplication factor for a given encoded discriminator D, or 1 if no value or 0 is encoded...
unsigned getCopyIdentifier() const
Returns the copy identifier stored in the discriminator.
const Optional< FragmentInfo > getFragment() const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static bool classof(const Metadata *MD)
DIScope * getScope() const
static bool classof(const Metadata *MD)
MDString * getRawHeader() const
static uint32_t getFlags(const Symbol *Sym)
const ExprOperand * operator->() const
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
MDTuple & operator*() const
static unsigned getCopyIdentifierFromDiscriminator(unsigned D)
Returns the copy identifier for a given encoded discriminator D.
static Optional< unsigned > getTag(const TargetRegisterInfo *TRI, const MachineInstr &MI, const LoadInfo &LI)
Metadata * getRawElements() const
Metadata * getRawFile() const
StringRef getDisplayName() const
DebugEmissionKind getEmissionKind() const
unsigned getSourceLanguage() const
StringRef getLinkageName() const
A range adaptor for a pair of iterators.
This file contains constants used for implementing Dwarf debug support.
DIType * getVTableHolder() const
Metadata * getRawFile() const
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
bool fragmentsOverlap(const DIExpression *Other) const
Check if fragments overlap between this DIExpression and Other.
A (clang) module that has been imported by the compile unit.
DIGlobalVariableExpressionArray getGlobalVariables() const
Generic tagged DWARF-like metadata node.
unsigned getNumElements() const
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
Metadata * getRawFile() const
static int fragmentCmp(const FragmentInfo &A, const FragmentInfo &B)
Determine the relative position of the fragments passed in.
Metadata * getRawBaseType() const
StringRef getIdentifier() const
MDString * getRawName() const
Type array for a subprogram.
static bool classof(const Metadata *MD)
StringRef getName() const
bool getSplitDebugInlining() const
MDString * getRawIdentifier() const
Macro Info DWARF-like metadata node.
unsigned getBaseDiscriminator() const
Returns the base discriminator stored in the discriminator.
static bool classof(const Metadata *MD)
bool operator<(const DebugVariable &Other) const
bool isArtificial() const
Metadata * getRawEnumTypes() const
unsigned getEncoding() const
Metadata * getRawScope() const
Metadata * getRawScope() const
MDString * getRawSplitDebugFilename() const
DIGlobalVariable * getDecl() const
DIMacroNode(LLVMContext &C, unsigned ID, StorageType Storage, unsigned MIType, ArrayRef< Metadata *> Ops1, ArrayRef< Metadata *> Ops2=None)
static bool classof(const Metadata *MD)
static bool classof(const Metadata *MD)
MDString * getRawProducer() const
void replaceVTableHolder(DIType *VTableHolder)
Optional< StringRef > getSource() const
MDString * getRawName() const
element_iterator elements_begin() const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getMacinfoType() const
StringRef getValue() const
DITypeRefArray(const MDTuple *N)
const DILocalVariable * getVariable() const
bool getExportSymbols() const
DISPFlags
Debug info subprogram flags.
MDString * getRawLinkageName() const
unsigned getNumDwarfOperands() const
Optional< StringRef > getSource() const
Metadata * getRawStaticDataMemberDeclaration() const
DIScopeArray getRetainedTypes() const
static bool classof(const Metadata *MD)
bool operator!=(const iterator &X) const
DILocalScope * getScope() const
Get the local scope for this label.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uint32_t getAlignInBits() const
bool operator<(int64_t V1, const APSInt &V2)
Metadata * getRawFile() const
DINode * getEntity() const
uint32_t getAlignInBytes() const
static bool classof(const Metadata *MD)
const DILocation * cloneWithDiscriminator(unsigned Discriminator) const
Returns a new DILocation with updated Discriminator.
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
Metadata * getRawMacros() const
Metadata * getRawScope() const
int fragmentCmp(const DIExpression *Other) const
Determine the relative position of the fragments described by this DIExpression and Other...
DIScope * getScope() const
bool operator!=(const ChecksumInfo< T > &X) const
expr_op_iterator getNext() const
Get the next iterator.
DITypeRefArray getTypeArray() const
bool isAppleBlockExtension() const
DIDerivedType * getDiscriminator() const
MDString * getRawSysRoot() const
static DebugVariable getTombstoneKey()
Difference in tombstone is that the Optional is meaningful.
Metadata * getRawScope() const
An iterator for expression operands.
void replaceMacros(DIMacroNodeArray N)
unsigned getLineNo() const
StringRef - Represent a constant reference to a string, i.e.
DILocalScope * getScope() const
MDString * getRawIncludePath() const
bool operator==(const iterator &X) const
bool startsWithDeref() const
Return whether the first element a DW_OP_deref.
static bool classof(const Metadata *MD)
Metadata * getRawType() const
Metadata * getRawScope() const
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const DataLayout *DL, DominatorTree *DT=nullptr)
This lazily constructs the LazyValueInfoImpl.
DILocalScope * getScope() const
Get the local scope for this variable.
unsigned getNumOperands() const
Return number of MDNode operands.
DILexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage, ArrayRef< Metadata *> Ops)
DEFINE_MDNODE_GET(DIExpression,(ArrayRef< uint64_t > Elements),(Elements)) TempDIExpression clone() const
void replaceElements(DINodeArray Elements)
Replace operands.
bool isFragment() const
Return whether this is a piece of an aggregate variable.
Metadata * getRawDecl() const
MDString * getRawName() const
MDString * getRawGetterName() const
DILocalScope(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag, ArrayRef< Metadata *> Ops)
StringRef getName() const
static bool classof(const Metadata *MD)
Metadata * getRawScope() const
void replaceElements(DIMacroNodeArray Elements)
static bool isDefaultFragment(const FragmentInfo F)
static bool classof(const Metadata *MD)
bool isTypePassByReference() const
static bool classof(const Metadata *MD)
MDString * getRawFlags() const
void replaceImportedEntities(DIImportedEntityArray N)
StringRef getName() const
A discriminated union of two or more pointer types, with the discriminator in the low bit of the poin...
Basic type, like 'int' or 'float'.
std::array< uint64_t, 6 > ExtOps
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.