14 #ifndef LLVM_IR_DEBUGINFOMETADATA_H 15 #define LLVM_IR_DEBUGINFOMETADATA_H 35 #include <type_traits> 39 #define DEFINE_MDNODE_GET_UNPACK_IMPL(...) __VA_ARGS__ 40 #define DEFINE_MDNODE_GET_UNPACK(ARGS) DEFINE_MDNODE_GET_UNPACK_IMPL ARGS 41 #define DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(CLASS, FORMAL, ARGS) \ 42 static CLASS *getDistinct(LLVMContext &Context, \ 43 DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 44 return getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Distinct); \ 46 static Temp##CLASS getTemporary(LLVMContext &Context, \ 47 DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 49 getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Temporary)); \ 51 #define DEFINE_MDNODE_GET(CLASS, FORMAL, ARGS) \ 52 static CLASS *get(LLVMContext &Context, DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 53 return getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Uniqued); \ 55 static CLASS *getIfExists(LLVMContext &Context, \ 56 DEFINE_MDNODE_GET_UNPACK(FORMAL)) { \ 57 return getImpl(Context, DEFINE_MDNODE_GET_UNPACK(ARGS), Uniqued, \ 60 DEFINE_MDNODE_GET_DISTINCT_TEMPORARY(CLASS, FORMAL, ARGS) 80 assert((!MD || isa<T>(MD)) &&
"Expected valid type ref");
86 typename std::enable_if<std::is_convertible<U *, T *>::value>::
type * =
92 T *
resolve()
const {
return const_cast<T *
>(cast_or_null<T>(MD)); }
109 explicit operator bool()
const {
return get(); }
110 explicit operator MDTuple *()
const {
return get(); }
120 class iterator : std::iterator<std::input_iterator_tag, DITypeRef,
121 std::ptrdiff_t, void, DITypeRef> {
162 :
MDNode(C, ID, Storage, Ops1, Ops2) {
164 SubclassData16 =
Tag;
169 return cast_or_null<Ty>(getOperand(I));
173 if (
auto *S = getOperandAs<MDString>(I))
174 return S->getString();
188 unsigned getTag()
const {
return SubclassData16; }
195 #define HANDLE_DI_FLAG(ID, NAME) Flag##NAME = ID, 196 #define DI_FLAG_LARGEST_NEEDED 197 #include "llvm/IR/DebugInfoFlags.def" 198 FlagAccessibility = FlagPrivate | FlagProtected | FlagPublic,
199 FlagPtrToMemberRep = FlagSingleInheritance | FlagMultipleInheritance |
200 FlagVirtualInheritance,
218 case GenericDINodeKind:
220 case DIEnumeratorKind:
221 case DIBasicTypeKind:
222 case DIDerivedTypeKind:
223 case DICompositeTypeKind:
224 case DISubroutineTypeKind:
226 case DICompileUnitKind:
227 case DISubprogramKind:
228 case DILexicalBlockKind:
229 case DILexicalBlockFileKind:
230 case DINamespaceKind:
231 case DITemplateTypeParameterKind:
232 case DITemplateValueParameterKind:
233 case DIGlobalVariableKind:
234 case DILocalVariableKind:
236 case DIObjCPropertyKind:
237 case DIImportedEntityKind:
269 :
DINode(C, GenericDINodeKind, Storage, Tag, Ops1, Ops2) {
274 void setHash(
unsigned Hash) { SubclassData32 = Hash; }
275 void recalculateHash();
280 return getImpl(Context, Tag, getCanonicalMDString(Context, Header),
281 DwarfOps, Storage, ShouldCreate);
288 TempGenericDINode cloneImpl()
const {
290 getContext(),
getTag(), getHeader(),
295 unsigned getHash()
const {
return SubclassData32; }
299 (Tag, Header, DwarfOps))
302 (Tag, Header, DwarfOps))
305 TempGenericDINode clone()
const {
return cloneImpl(); }
307 unsigned getTag()
const {
return SubclassData16; }
314 return op_range(dwarf_op_begin(), dwarf_op_end());
319 return getOperand(I + 1);
322 replaceOperandWith(I + 1, New);
342 :
DINode(C, DISubrangeKind, Storage, dwarf::DW_TAG_subrange_type, Ops),
343 LowerBound(LowerBound) {}
349 bool ShouldCreate =
true);
353 bool ShouldCreate =
true);
355 TempDISubrange cloneImpl()
const {
356 return getTemporary(getContext(), getRawCountNode(), getLowerBound());
364 (CountNode, LowerBound))
366 TempDISubrange clone()
const {
return cloneImpl(); }
368 int64_t getLowerBound()
const {
return LowerBound; }
371 return getOperand(0).get();
377 if (
auto *MD = dyn_cast<ConstantAsMetadata>(getRawCountNode()))
378 return CountType(cast<ConstantInt>(MD->getValue()));
380 if (
auto *DV = dyn_cast<DIVariable>(getRawCountNode()))
381 return CountType(DV);
402 :
DINode(C, DIEnumeratorKind, Storage, dwarf::DW_TAG_enumerator, Ops),
404 SubclassData32 = IsUnsigned;
411 return getImpl(Context, Value, IsUnsigned,
412 getCanonicalMDString(Context, Name), Storage, ShouldCreate);
418 TempDIEnumerator cloneImpl()
const {
419 return getTemporary(getContext(), getValue(), isUnsigned(),
getName());
424 (Value, IsUnsigned, Name))
426 (Value, IsUnsigned, Name))
428 TempDIEnumerator clone()
const {
return cloneImpl(); }
451 :
DINode(C, ID, Storage, Tag, Ops) {}
471 return isa<DIFile>(
this) ? const_cast<DIScope *>(
this)
472 :
static_cast<Metadata *
>(getOperand(0));
479 case DIBasicTypeKind:
480 case DIDerivedTypeKind:
481 case DICompositeTypeKind:
482 case DISubroutineTypeKind:
484 case DICompileUnitKind:
485 case DISubprogramKind:
486 case DILexicalBlockKind:
487 case DILexicalBlockFileKind:
488 case DINamespaceKind:
519 template <
typename T>
529 return Kind == X.
Kind && Value == X.
Value;
542 :
DIScope(C, DIFileKind, Storage, dwarf::DW_TAG_file_type, Ops),
543 Checksum(CS),
Source(Src) {}
553 MDChecksum.
emplace(CS->Kind, getCanonicalMDString(Context, CS->Value));
554 return getImpl(Context, getCanonicalMDString(Context, Filename),
555 getCanonicalMDString(Context, Directory), MDChecksum,
557 Storage, ShouldCreate);
563 bool ShouldCreate =
true);
565 TempDIFile cloneImpl()
const {
566 return getTemporary(getContext(),
getFilename(), getDirectory(),
567 getChecksum(), getSource());
574 (Filename, Directory, CS, Source))
578 (Filename, Directory, CS, Source))
580 TempDIFile clone()
const {
return cloneImpl(); }
583 StringRef getDirectory()
const {
return getStringOperand(1); }
587 StringRefChecksum.
emplace(Checksum->Kind, Checksum->Value->getString());
588 return StringRefChecksum;
594 MDString *getRawFilename()
const {
return getOperandAs<MDString>(0); }
595 MDString *getRawDirectory()
const {
return getOperandAs<MDString>(1); }
608 if (
auto *
F = getFile())
609 return F->getFilename();
614 if (
auto *
F = getFile())
615 return F->getDirectory();
620 if (
auto *
F = getFile())
621 return F->getSource();
634 uint64_t OffsetInBits;
639 unsigned Line, uint64_t SizeInBits,
uint32_t AlignInBits,
641 :
DIScope(C, ID, Storage, Tag, Ops) {
642 init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
647 uint64_t OffsetInBits,
DIFlags Flags) {
650 this->SizeInBits = SizeInBits;
651 this->AlignInBits = AlignInBits;
652 this->OffsetInBits = OffsetInBits;
656 void mutate(
unsigned Tag,
unsigned Line, uint64_t SizeInBits,
658 assert(isDistinct() &&
"Only distinct nodes can mutate");
660 init(Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
684 auto NewTy = clone();
685 NewTy->Flags = NewFlags;
690 return (getFlags() & FlagAccessibility) == FlagPrivate;
693 return (getFlags() & FlagAccessibility) == FlagProtected;
696 return (getFlags() & FlagAccessibility) == FlagPublic;
701 bool isVirtual()
const {
return getFlags() & FlagVirtual; }
705 return getFlags() & FlagObjcClassComplete;
707 bool isVector()
const {
return getFlags() & FlagVector; }
708 bool isBitField()
const {
return getFlags() & FlagBitField; }
714 return getFlags() & FlagTypePassByReference;
723 case DIBasicTypeKind:
724 case DIDerivedTypeKind:
725 case DICompositeTypeKind:
726 case DISubroutineTypeKind:
743 uint64_t SizeInBits,
uint32_t AlignInBits,
unsigned Encoding,
745 :
DIType(C, DIBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0,
747 Encoding(Encoding) {}
752 uint32_t AlignInBits,
unsigned Encoding,
754 bool ShouldCreate =
true) {
755 return getImpl(Context, Tag, getCanonicalMDString(Context, Name),
756 SizeInBits, AlignInBits, Encoding, Flags, Storage,
760 MDString *Name, uint64_t SizeInBits,
761 uint32_t AlignInBits,
unsigned Encoding,
763 bool ShouldCreate =
true);
765 TempDIBasicType cloneImpl()
const {
767 getAlignInBits(), getEncoding(), getFlags());
772 (Tag, Name, 0, 0, 0, FlagZero))
776 (Tag, Name, SizeInBits, AlignInBits, Encoding, Flags))
778 (
unsigned Tag,
MDString *Name, uint64_t SizeInBits,
780 (Tag, Name, SizeInBits, AlignInBits, Encoding, Flags))
782 TempDIBasicType clone()
const {
return cloneImpl(); }
812 unsigned Line, uint64_t SizeInBits,
uint32_t AlignInBits,
815 :
DIType(C, DIDerivedTypeKind, Storage, Tag, Line, SizeInBits,
816 AlignInBits, OffsetInBits, Flags, Ops),
817 DWARFAddressSpace(DWARFAddressSpace) {}
823 uint64_t SizeInBits,
uint32_t AlignInBits,
824 uint64_t OffsetInBits,
828 return getImpl(Context, Tag, getCanonicalMDString(Context, Name), File,
829 Line, Scope, BaseType, SizeInBits, AlignInBits, OffsetInBits,
830 DWARFAddressSpace, Flags, ExtraData, Storage, ShouldCreate);
835 uint64_t SizeInBits,
uint32_t AlignInBits,
836 uint64_t OffsetInBits,
841 TempDIDerivedType cloneImpl()
const {
842 return getTemporary(getContext(),
getTag(),
getName(), getFile(), getLine(),
844 getAlignInBits(), getOffsetInBits(),
845 getDWARFAddressSpace(), getFlags(), getExtraData());
852 uint64_t SizeInBits,
uint32_t AlignInBits,
853 uint64_t OffsetInBits,
856 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
857 AlignInBits, OffsetInBits, DWARFAddressSpace, Flags,
862 uint32_t AlignInBits, uint64_t OffsetInBits,
865 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
866 AlignInBits, OffsetInBits, DWARFAddressSpace, Flags,
869 TempDIDerivedType clone()
const {
return cloneImpl(); }
873 Metadata *getRawBaseType()
const {
return getOperand(3); }
887 Metadata *getExtraData()
const {
return getRawExtraData(); }
888 Metadata *getRawExtraData()
const {
return getOperand(4); }
898 return dyn_cast_or_null<DIObjCProperty>(getExtraData());
903 if (
auto *CM = cast_or_null<ConstantAsMetadata>(getExtraData()))
904 if (
auto *CI = dyn_cast_or_null<ConstantInt>(CM->getValue()))
905 return static_cast<uint32_t>(CI->getZExtValue());
909 Constant *getStorageOffsetInBits()
const {
910 assert(
getTag() == dwarf::DW_TAG_member && isBitField());
911 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
912 return C->getValue();
917 assert(
getTag() == dwarf::DW_TAG_member && isStaticMember());
918 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
919 return C->getValue();
922 Constant *getDiscriminantValue()
const {
923 assert(
getTag() == dwarf::DW_TAG_member && !isStaticMember());
924 if (
auto *
C = cast_or_null<ConstantAsMetadata>(getExtraData()))
925 return C->getValue();
930 static bool classof(
const Metadata *MD) {
943 unsigned RuntimeLang;
946 unsigned Line,
unsigned RuntimeLang, uint64_t SizeInBits,
949 :
DIType(C, DICompositeTypeKind, Storage, Tag, Line, SizeInBits,
950 AlignInBits, OffsetInBits, Flags, Ops),
951 RuntimeLang(RuntimeLang) {}
955 void mutate(
unsigned Tag,
unsigned Line,
unsigned RuntimeLang,
956 uint64_t SizeInBits,
uint32_t AlignInBits,
957 uint64_t OffsetInBits,
DIFlags Flags) {
958 assert(isDistinct() &&
"Only distinct nodes can mutate");
959 assert(getRawIdentifier() &&
"Only ODR-uniqued nodes should mutate");
960 this->RuntimeLang = RuntimeLang;
961 DIType::mutate(Tag, Line, SizeInBits, AlignInBits, OffsetInBits, Flags);
967 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
968 DIFlags Flags, DINodeArray Elements,
unsigned RuntimeLang,
969 DITypeRef VTableHolder, DITemplateParameterArray TemplateParams,
973 Context, Tag, getCanonicalMDString(Context, Name), File, Line, Scope,
974 BaseType, SizeInBits, AlignInBits, OffsetInBits, Flags, Elements.get(),
975 RuntimeLang, VTableHolder, TemplateParams.get(),
976 getCanonicalMDString(Context, Identifier), Discriminator, Storage, ShouldCreate);
981 uint64_t SizeInBits,
uint32_t AlignInBits, uint64_t OffsetInBits,
987 TempDICompositeType cloneImpl()
const {
988 return getTemporary(getContext(),
getTag(),
getName(), getFile(), getLine(),
990 getAlignInBits(), getOffsetInBits(), getFlags(),
991 getElements(), getRuntimeLang(), getVTableHolder(),
992 getTemplateParams(), getIdentifier(), getDiscriminator());
999 uint32_t AlignInBits, uint64_t OffsetInBits,
1000 DIFlags Flags, DINodeArray Elements,
unsigned RuntimeLang,
1002 DITemplateParameterArray TemplateParams =
nullptr,
1004 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
1005 AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
1006 VTableHolder, TemplateParams, Identifier, Discriminator))
1010 uint64_t SizeInBits,
uint32_t AlignInBits,
1012 unsigned RuntimeLang,
Metadata *VTableHolder,
1016 (Tag, Name, File, Line, Scope, BaseType, SizeInBits,
1017 AlignInBits, OffsetInBits, Flags, Elements, RuntimeLang,
1018 VTableHolder, TemplateParams, Identifier, Discriminator))
1020 TempDICompositeType clone()
const {
return cloneImpl(); }
1034 unsigned RuntimeLang,
Metadata *VTableHolder,
1053 unsigned RuntimeLang,
Metadata *VTableHolder,
1058 return cast_or_null<MDTuple>(getRawElements());
1062 return cast_or_null<MDTuple>(getRawTemplateParams());
1085 "Lost a member during member list replacement");
1087 replaceOperandWith(4, Elements.get());
1091 replaceOperandWith(5, VTableHolder);
1095 replaceOperandWith(6, TemplateParams.get());
1117 :
DIType(C, DISubroutineTypeKind, Storage, dwarf::DW_TAG_subroutine_type,
1118 0, 0, 0, 0, Flags, Ops),
1125 bool ShouldCreate =
true) {
1126 return getImpl(Context, Flags, CC, TypeArray.
get(), Storage, ShouldCreate);
1131 bool ShouldCreate =
true);
1133 TempDISubroutineType cloneImpl()
const {
1134 return getTemporary(getContext(), getFlags(), getCC(), getTypeArray());
1140 (Flags, CC, TypeArray))
1143 (Flags, CC, TypeArray))
1145 TempDISubroutineType clone()
const {
return cloneImpl(); }
1150 return cast_or_null<MDTuple>(getRawTypeArray());
1171 LastEmissionKind = DebugDirectivesOnly
1178 LastDebugNameTableKind =
None 1189 unsigned RuntimeVersion;
1192 bool SplitDebugInlining;
1193 bool DebugInfoForProfiling;
1195 bool RangesBaseAddress;
1198 bool IsOptimized,
unsigned RuntimeVersion,
1199 unsigned EmissionKind, uint64_t DWOId,
bool SplitDebugInlining,
1200 bool DebugInfoForProfiling,
unsigned NameTableKind,
1202 :
DIScope(C, DICompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
1204 RuntimeVersion(RuntimeVersion),
EmissionKind(EmissionKind),
1205 DWOId(DWOId), SplitDebugInlining(SplitDebugInlining),
1206 DebugInfoForProfiling(DebugInfoForProfiling),
1207 NameTableKind(NameTableKind), RangesBaseAddress(RangesBaseAddress) {
1208 assert(Storage != Uniqued);
1215 unsigned RuntimeVersion,
StringRef SplitDebugFilename,
1216 unsigned EmissionKind, DICompositeTypeArray EnumTypes,
1217 DIScopeArray RetainedTypes,
1218 DIGlobalVariableExpressionArray GlobalVariables,
1219 DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
1220 uint64_t DWOId,
bool SplitDebugInlining,
bool DebugInfoForProfiling,
1221 unsigned NameTableKind,
bool RangesBaseAddress,
StorageType Storage,
1222 bool ShouldCreate =
true) {
1223 return getImpl(Context, SourceLanguage, File,
1224 getCanonicalMDString(Context, Producer), IsOptimized,
1225 getCanonicalMDString(Context, Flags), RuntimeVersion,
1226 getCanonicalMDString(Context, SplitDebugFilename),
1227 EmissionKind, EnumTypes.get(), RetainedTypes.get(),
1228 GlobalVariables.get(), ImportedEntities.get(), Macros.get(),
1229 DWOId, SplitDebugInlining, DebugInfoForProfiling,
1235 unsigned RuntimeVersion,
MDString *SplitDebugFilename,
1238 Metadata *Macros, uint64_t DWOId,
bool SplitDebugInlining,
1239 bool DebugInfoForProfiling,
unsigned NameTableKind,
1240 bool RangesBaseAddress,
StorageType Storage,
bool ShouldCreate =
true);
1242 TempDICompileUnit cloneImpl()
const {
1243 return getTemporary(
1244 getContext(), getSourceLanguage(), getFile(), getProducer(),
1245 isOptimized(), getFlags(), getRuntimeVersion(), getSplitDebugFilename(),
1246 getEmissionKind(), getEnumTypes(), getRetainedTypes(),
1247 getGlobalVariables(), getImportedEntities(), getMacros(), DWOId,
1248 getSplitDebugInlining(), getDebugInfoForProfiling(), getNameTableKind(),
1249 getRangesBaseAddress());
1253 static void get() =
delete;
1254 static void getIfExists() =
delete;
1259 bool IsOptimized,
StringRef Flags,
unsigned RuntimeVersion,
1261 DICompositeTypeArray EnumTypes, DIScopeArray RetainedTypes,
1262 DIGlobalVariableExpressionArray GlobalVariables,
1263 DIImportedEntityArray ImportedEntities, DIMacroNodeArray Macros,
1264 uint64_t DWOId,
bool SplitDebugInlining,
bool DebugInfoForProfiling,
1266 (SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1267 SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
1268 GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
1269 DebugInfoForProfiling, (
unsigned)NameTableKind, RangesBaseAddress))
1273 bool IsOptimized,
MDString *Flags,
unsigned RuntimeVersion,
1277 bool SplitDebugInlining,
bool DebugInfoForProfiling,
1278 unsigned NameTableKind,
bool RangesBaseAddress),
1279 (SourceLanguage, File, Producer, IsOptimized, Flags, RuntimeVersion,
1280 SplitDebugFilename, EmissionKind, EnumTypes, RetainedTypes,
1281 GlobalVariables, ImportedEntities, Macros, DWOId, SplitDebugInlining,
1282 DebugInfoForProfiling, NameTableKind, RangesBaseAddress))
1284 TempDICompileUnit clone()
const {
return cloneImpl(); }
1293 return EmissionKind == DebugDirectivesOnly;
1300 return RangesBaseAddress; }
1302 return getStringOperand(1); }
1304 return getStringOperand(2); }
1306 return getStringOperand(3); }
1308 return cast_or_null<MDTuple>(getRawEnumTypes());
1311 return cast_or_null<MDTuple>(getRawRetainedTypes());
1314 return cast_or_null<MDTuple>(getRawGlobalVariables());
1317 return cast_or_null<MDTuple>(getRawImportedEntities());
1320 return cast_or_null<MDTuple>(getRawMacros());
1326 this->SplitDebugInlining = SplitDebugInlining;
1332 return getOperandAs<MDString>(3);
1347 replaceOperandWith(4, N.get());
1350 replaceOperandWith(5, N.get());
1353 replaceOperandWith(6, N.get());
1356 replaceOperandWith(7, N.get());
1375 :
DIScope(C, ID, Storage, Tag, Ops) {}
1411 Metadata *InlinedAt,
bool ImplicitCode,
1417 return getImpl(Context, Line, Column, static_cast<Metadata *>(Scope),
1418 static_cast<Metadata *>(InlinedAt), ImplicitCode, Storage,
1426 static unsigned getPrefixEncodingFromUnsigned(
unsigned U) {
1428 return U > 0x1f ? (((U & 0xfe0) << 1) | (U & 0x1f) | 0x20) : U;
1432 static unsigned getUnsignedFromPrefixEncoding(
unsigned U) {
1436 return (U & 0x20) ? (((U >> 1) & 0xfe0) | (U & 0x1f)) : (U & 0x1f);
1440 static unsigned getNextComponentInDiscriminator(
unsigned D) {
1442 return D >> ((D & 0x40) ? 14 : 7);
1447 TempDILocation cloneImpl()
const {
1450 return getTemporary(getContext(), getLine(), getColumn(), getRawScope(),
1451 getRawInlinedAt(), isImplicitCode());
1454 static unsigned encodeComponent(
unsigned C) {
1455 return (C == 0) ? 1U : (getPrefixEncodingFromUnsigned(C) << 1);
1458 static unsigned encodingBits(
unsigned C) {
1459 return (C == 0) ? 1 : (C > 0x1f ? 14 : 7);
1464 void replaceOperandWith(
unsigned I,
Metadata *New) =
delete;
1467 (
unsigned Line,
unsigned Column,
Metadata *Scope,
1468 Metadata *InlinedAt =
nullptr,
bool ImplicitCode =
false),
1469 (Line, Column, Scope, InlinedAt, ImplicitCode))
1473 bool ImplicitCode =
false),
1474 (Line, Column, Scope, InlinedAt, ImplicitCode))
1477 TempDILocation clone()
const {
return cloneImpl(); }
1479 unsigned getLine()
const {
return SubclassData32; }
1480 unsigned getColumn()
const {
return SubclassData16; }
1481 DILocalScope *getScope()
const {
return cast<DILocalScope>(getRawScope()); }
1484 return cast_or_null<DILocation>(getRawInlinedAt());
1493 bool isImplicitCode()
const {
return ImplicitCode; }
1494 void setImplicitCode(
bool ImplicitCode) { this->ImplicitCode = ImplicitCode; }
1498 StringRef getDirectory()
const {
return getScope()->getDirectory(); }
1506 if (
auto *IA = getInlinedAt())
1507 return IA->getInlinedAtScope();
1548 inline unsigned getDiscriminator()
const;
1551 inline const DILocation *cloneWithDiscriminator(
unsigned Discriminator)
const;
1561 inline unsigned getDuplicationFactor()
const;
1564 inline unsigned getCopyIdentifier()
const;
1567 inline unsigned getBaseDiscriminator()
const;
1594 return getUnsignedFromPrefixEncoding(D);
1605 static Optional<unsigned> encodeDiscriminator(
unsigned BD,
unsigned DF,
unsigned CI);
1608 static void decodeDiscriminator(
unsigned D,
unsigned &BD,
unsigned &DF,
1614 D = getNextComponentInDiscriminator(D);
1615 unsigned Ret = getUnsignedFromPrefixEncoding(D);
1623 return getUnsignedFromPrefixEncoding(getNextComponentInDiscriminator(
1624 getNextComponentInDiscriminator(D)));
1630 if (getNumOperands() == 2)
1631 return getOperand(1);
1650 unsigned VirtualIndex;
1660 #define HANDLE_DISP_FLAG(ID, NAME) SPFlag##NAME = ID, 1661 #define DISP_FLAG_LARGEST_NEEDED 1662 #include "llvm/IR/DebugInfoFlags.def" 1663 SPFlagNonvirtual = SPFlagZero,
1664 SPFlagVirtuality = SPFlagVirtual | SPFlagPureVirtual,
1681 unsigned Virtuality = SPFlagNonvirtual) {
1684 int(SPFlagVirtual) ==
int(dwarf::DW_VIRTUALITY_virtual) &&
1685 int(SPFlagPureVirtual) ==
int(dwarf::DW_VIRTUALITY_pure_virtual),
1686 "Virtuality constant mismatch");
1688 (Virtuality & SPFlagVirtuality) |
1689 (IsLocalToUnit ? SPFlagLocalToUnit : SPFlagZero) |
1690 (IsDefinition ? SPFlagDefinition : SPFlagZero) |
1691 (IsOptimized ? SPFlagOptimized : SPFlagZero));
1699 unsigned ScopeLine,
unsigned VirtualIndex,
int ThisAdjustment,
1701 :
DILocalScope(C, DISubprogramKind, Storage, dwarf::DW_TAG_subprogram,
1703 Line(Line), ScopeLine(ScopeLine), VirtualIndex(VirtualIndex),
1704 ThisAdjustment(ThisAdjustment), Flags(Flags), SPFlags(SPFlags) {
1713 unsigned VirtualIndex,
int ThisAdjustment,
DIFlags Flags,
1715 DITemplateParameterArray TemplateParams,
DISubprogram *Declaration,
1716 DINodeArray RetainedNodes, DITypeArray ThrownTypes,
1718 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
1719 getCanonicalMDString(Context, LinkageName), File, Line, Type,
1720 ScopeLine, ContainingType, VirtualIndex, ThisAdjustment,
1721 Flags, SPFlags, Unit, TemplateParams.
get(), Declaration,
1722 RetainedNodes.
get(), ThrownTypes.
get(), Storage,
1728 unsigned ScopeLine,
Metadata *ContainingType,
1729 unsigned VirtualIndex,
int ThisAdjustment,
1735 TempDISubprogram cloneImpl()
const {
1737 getFile(), getLine(),
getType(), getScopeLine(),
1738 getContainingType(), getVirtualIndex(),
1739 getThisAdjustment(), getFlags(), getSPFlags(),
1741 getRetainedNodes(), getThrownTypes());
1749 DITypeRef ContainingType,
unsigned VirtualIndex,
int ThisAdjustment,
1751 DITemplateParameterArray TemplateParams =
nullptr,
1752 DISubprogram *Declaration =
nullptr, DINodeArray RetainedNodes =
nullptr,
1753 DITypeArray ThrownTypes =
nullptr),
1754 (Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType,
1755 VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams,
1756 Declaration, RetainedNodes, ThrownTypes))
1761 unsigned Line,
Metadata *Type,
unsigned ScopeLine,
1762 Metadata *ContainingType,
unsigned VirtualIndex,
int ThisAdjustment,
1766 (Scope, Name, LinkageName, File, Line, Type, ScopeLine, ContainingType,
1767 VirtualIndex, ThisAdjustment, Flags, SPFlags, Unit, TemplateParams,
1768 Declaration, RetainedNodes, ThrownTypes))
1770 TempDISubprogram clone()
const {
return cloneImpl(); }
1773 TempDISubprogram cloneWithFlags(
DIFlags NewFlags)
const {
1774 auto NewSP = clone();
1775 NewSP->Flags = NewFlags;
1780 unsigned getLine()
const {
return Line; }
1781 unsigned getVirtuality()
const {
return getSPFlags() & SPFlagVirtuality; }
1782 unsigned getVirtualIndex()
const {
return VirtualIndex; }
1783 int getThisAdjustment()
const {
return ThisAdjustment; }
1784 unsigned getScopeLine()
const {
return ScopeLine; }
1785 DIFlags getFlags()
const {
return Flags; }
1786 DISPFlags getSPFlags()
const {
return SPFlags; }
1787 bool isLocalToUnit()
const {
return getSPFlags() & SPFlagLocalToUnit; }
1788 bool isDefinition()
const {
return getSPFlags() & SPFlagDefinition; }
1789 bool isOptimized()
const {
return getSPFlags() & SPFlagOptimized; }
1791 bool isArtificial()
const {
return getFlags() & FlagArtificial; }
1792 bool isPrivate()
const {
1793 return (getFlags() & FlagAccessibility) == FlagPrivate;
1795 bool isProtected()
const {
1796 return (getFlags() & FlagAccessibility) == FlagProtected;
1798 bool isPublic()
const {
1799 return (getFlags() & FlagAccessibility) == FlagPublic;
1801 bool isExplicit()
const {
return getFlags() & FlagExplicit; }
1802 bool isPrototyped()
const {
return getFlags() & FlagPrototyped; }
1803 bool areAllCallsDescribed()
const {
1804 return getFlags() & FlagAllCallsDescribed;
1806 bool isMainSubprogram()
const {
return getFlags() & FlagMainSubprogram; }
1812 bool isLValueReference()
const {
return getFlags() & FlagLValueReference; }
1818 bool isRValueReference()
const {
return getFlags() & FlagRValueReference; }
1823 bool isNoReturn()
const {
return getFlags() & FlagNoReturn; }
1828 bool isThunk()
const {
return getFlags() & FlagThunk; }
1836 return cast_or_null<DISubroutineType>(getRawType());
1839 return DITypeRef(getRawContainingType());
1843 return cast_or_null<DICompileUnit>(getRawUnit());
1846 DITemplateParameterArray getTemplateParams()
const {
1847 return cast_or_null<MDTuple>(getRawTemplateParams());
1850 return cast_or_null<DISubprogram>(getRawDeclaration());
1852 DINodeArray getRetainedNodes()
const {
1853 return cast_or_null<MDTuple>(getRawRetainedNodes());
1855 DITypeArray getThrownTypes()
const {
1856 return cast_or_null<MDTuple>(getRawThrownTypes());
1859 Metadata *getRawScope()
const {
return getOperand(1); }
1860 MDString *getRawName()
const {
return getOperandAs<MDString>(2); }
1861 MDString *getRawLinkageName()
const {
return getOperandAs<MDString>(3); }
1862 Metadata *getRawType()
const {
return getOperand(4); }
1863 Metadata *getRawUnit()
const {
return getOperand(5); }
1864 Metadata *getRawDeclaration()
const {
return getOperand(6); }
1865 Metadata *getRawRetainedNodes()
const {
return getOperand(7); }
1866 Metadata *getRawContainingType()
const {
1867 return getNumOperands() > 8 ? getOperandAs<Metadata>(8) :
nullptr;
1869 Metadata *getRawTemplateParams()
const {
1870 return getNumOperands() > 9 ? getOperandAs<Metadata>(9) :
nullptr;
1872 Metadata *getRawThrownTypes()
const {
1873 return getNumOperands() > 10 ? getOperandAs<Metadata>(10) :
nullptr;
1879 bool describes(
const Function *
F)
const;
1890 :
DILocalScope(C, ID, Storage, dwarf::DW_TAG_lexical_block, Ops) {}
1915 assert(Column < (1u << 16) &&
"Expected 16-bit column");
1920 DIFile *File,
unsigned Line,
unsigned Column,
1922 bool ShouldCreate =
true) {
1923 return getImpl(Context, static_cast<Metadata *>(Scope),
1924 static_cast<Metadata *>(File), Line, Column, Storage,
1929 Metadata *File,
unsigned Line,
unsigned Column,
1932 TempDILexicalBlock cloneImpl()
const {
1933 return getTemporary(getContext(), getScope(), getFile(), getLine(),
1939 unsigned Line,
unsigned Column),
1940 (Scope, File, Line, Column))
1942 unsigned Line,
unsigned Column),
1943 (Scope, File, Line, Column))
1945 TempDILexicalBlock clone()
const {
return cloneImpl(); }
1959 unsigned Discriminator;
1964 Discriminator(Discriminator) {}
1968 DIFile *File,
unsigned Discriminator,
1970 bool ShouldCreate =
true) {
1971 return getImpl(Context, static_cast<Metadata *>(Scope),
1972 static_cast<Metadata *>(File), Discriminator, Storage,
1977 Metadata *File,
unsigned Discriminator,
1979 bool ShouldCreate =
true);
1981 TempDILexicalBlockFile cloneImpl()
const {
1982 return getTemporary(getContext(), getScope(), getFile(),
1983 getDiscriminator());
1988 unsigned Discriminator),
1989 (Scope, File, Discriminator))
1992 (Scope, File, Discriminator))
1994 TempDILexicalBlockFile clone()
const {
return cloneImpl(); }
1997 unsigned getLine()
const =
delete;
1998 unsigned getColumn()
const =
delete;
2007 unsigned DILocation::getDiscriminator()
const {
2008 if (
auto *
F = dyn_cast<DILexicalBlockFile>(getScope()))
2009 return F->getDiscriminator();
2020 for (
auto *LBF = dyn_cast<DILexicalBlockFile>(Scope);
2021 LBF && LBF->getDiscriminator() != 0;
2026 return DILocation::get(getContext(), getLine(), getColumn(), NewScope,
2031 return getBaseDiscriminatorFromDiscriminator(getDiscriminator());
2035 return getDuplicationFactorFromDiscriminator(getDiscriminator());
2039 return getCopyIdentifierFromDiscriminator(getDiscriminator());
2047 return cloneWithDiscriminator(encodeComponent(D));
2051 DF *= getDuplicationFactor();
2055 unsigned BD = getBaseDiscriminator();
2056 unsigned CI = getCopyIdentifier();
2058 return cloneWithDiscriminator(*D);
2066 unsigned ExportSymbols : 1;
2070 :
DIScope(Context, DINamespaceKind, Storage, dwarf::DW_TAG_namespace,
2072 ExportSymbols(ExportSymbols) {}
2078 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
2079 ExportSymbols, Storage, ShouldCreate);
2082 MDString *Name,
bool ExportSymbols,
2085 TempDINamespace cloneImpl()
const {
2086 return getTemporary(getContext(), getScope(),
getName(),
2087 getExportSymbols());
2093 (Scope, Name, ExportSymbols))
2096 (Scope, Name, ExportSymbols))
2098 TempDINamespace clone()
const {
return cloneImpl(); }
2119 :
DIScope(Context, DIModuleKind, Storage, dwarf::DW_TAG_module, Ops) {}
2126 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
2127 getCanonicalMDString(Context, ConfigurationMacros),
2128 getCanonicalMDString(Context, IncludePath),
2129 getCanonicalMDString(Context, ISysRoot),
2130 Storage, ShouldCreate);
2137 TempDIModule cloneImpl()
const {
2138 return getTemporary(getContext(), getScope(),
getName(),
2139 getConfigurationMacros(), getIncludePath(),
2147 (Scope, Name, ConfigurationMacros, IncludePath, ISysRoot))
2151 (Scope, Name, ConfigurationMacros, IncludePath, ISysRoot))
2153 TempDIModule clone()
const {
return cloneImpl(); }
2177 :
DINode(Context, ID, Storage, Tag, Ops) {}
2188 return MD->
getMetadataID() == DITemplateTypeParameterKind ||
2200 dwarf::DW_TAG_template_type_parameter, Ops) {}
2205 bool ShouldCreate =
true) {
2206 return getImpl(Context, getCanonicalMDString(Context, Name), Type, Storage,
2211 bool ShouldCreate =
true);
2213 TempDITemplateTypeParameter cloneImpl()
const {
2223 TempDITemplateTypeParameter clone()
const {
return cloneImpl(); }
2243 bool ShouldCreate =
true) {
2244 return getImpl(Context, Tag, getCanonicalMDString(Context, Name), Type,
2245 Value, Storage, ShouldCreate);
2250 bool ShouldCreate =
true);
2252 TempDITemplateValueParameter cloneImpl()
const {
2260 (Tag, Name, Type, Value))
2263 (Tag, Name, Type, Value))
2265 TempDITemplateValueParameter clone()
const {
return cloneImpl(); }
2282 :
DINode(C, ID, Storage, dwarf::DW_TAG_variable, Ops), Line(Line),
2283 AlignInBits(AlignInBits) {}
2301 return BT->getSignedness();
2306 if (
auto *
F = getFile())
2307 return F->getFilename();
2312 if (
auto *
F = getFile())
2313 return F->getDirectory();
2318 if (
auto *
F = getFile())
2319 return F->getSource();
2347 std::vector<uint64_t> Elements;
2350 :
MDNode(C, DIExpressionKind, Storage,
None),
2351 Elements(Elements.
begin(), Elements.
end()) {}
2356 bool ShouldCreate =
true);
2358 TempDIExpression cloneImpl()
const {
2359 return getTemporary(getContext(), getElements());
2365 TempDIExpression clone()
const {
return cloneImpl(); }
2372 assert(I < Elements.
size() &&
"Index out of range");
2389 const uint64_t *
Op =
nullptr;
2395 const uint64_t *
get()
const {
return Op; }
2403 uint64_t
getArg(
unsigned I)
const {
return Op[I + 1]; }
2410 unsigned getSize()
const;
2414 V.
append(
get(),
get() + getSize());
2420 :
public std::iterator<std::input_iterator_tag, ExprOperand> {
2449 return getBase() == X.
getBase();
2452 return getBase() != X.
getBase();
2474 return {expr_op_begin(), expr_op_end()};
2478 bool isValid()
const;
2486 return getNumElements() > 0 && getElement(0) == dwarf::DW_OP_deref;
2501 return getFragmentInfo(expr_op_begin(), expr_op_end());
2512 bool extractIfOffset(int64_t &Offset)
const;
2515 enum { NoDeref =
false, WithDeref =
true, WithStackValue =
true };
2520 int64_t Offset = 0,
bool DerefAfter =
false,
2521 bool StackValue =
false);
2527 bool StackValue =
false);
2553 createFragmentExpression(
const DIExpression *Expr,
unsigned OffsetInBits,
2554 unsigned SizeInBits);
2561 auto Fragment1 = *getFragmentInfo();
2563 unsigned l1 = Fragment1.OffsetInBits;
2564 unsigned l2 = Fragment2.OffsetInBits;
2565 unsigned r1 = l1 + Fragment1.SizeInBits;
2566 unsigned r2 = l2 + Fragment2.SizeInBits;
2579 return fragmentCmp(Other) == 0;
2594 bool IsLocalToUnit,
bool IsDefinition,
uint32_t AlignInBits,
2596 :
DIVariable(C, DIGlobalVariableKind, Storage, Line, Ops, AlignInBits),
2597 IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {}
2603 bool IsLocalToUnit,
bool IsDefinition,
2606 return getImpl(Context, Scope, getCanonicalMDString(Context, Name),
2607 getCanonicalMDString(Context, LinkageName), File, Line, Type,
2608 IsLocalToUnit, IsDefinition, StaticDataMemberDeclaration,
2609 cast_or_null<Metadata>(TemplateParams), AlignInBits, Storage,
2615 bool IsLocalToUnit,
bool IsDefinition,
2619 TempDIGlobalVariable cloneImpl()
const {
2621 getFile(), getLine(),
getType(), isLocalToUnit(),
2622 isDefinition(), getStaticDataMemberDeclaration(),
2623 getTemplateParams(), getAlignInBits());
2630 bool IsLocalToUnit,
bool IsDefinition,
2633 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
2634 IsDefinition, StaticDataMemberDeclaration, TemplateParams,
2639 bool IsLocalToUnit,
bool IsDefinition,
2640 Metadata *StaticDataMemberDeclaration,
2642 (Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit,
2643 IsDefinition, StaticDataMemberDeclaration, TemplateParams,
2646 TempDIGlobalVariable clone()
const {
return cloneImpl(); }
2653 return cast_or_null<DIDerivedType>(getRawStaticDataMemberDeclaration());
2679 :
DIVariable(C, DILocalVariableKind, Storage, Line, Ops, AlignInBits),
2680 Arg(Arg), Flags(Flags) {
2681 assert(Arg < (1 << 16) &&
"DILocalVariable: Arg out of range");
2689 bool ShouldCreate =
true) {
2690 return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
2691 Line, Type, Arg, Flags, AlignInBits, Storage, ShouldCreate);
2697 bool ShouldCreate =
true);
2699 TempDILocalVariable cloneImpl()
const {
2700 return getTemporary(getContext(), getScope(),
getName(), getFile(),
2701 getLine(),
getType(), getArg(), getFlags(),
2708 unsigned Line,
DITypeRef Type,
unsigned Arg,
2710 (Scope, Name, File, Line, Type, Arg, Flags, AlignInBits))
2713 unsigned Line,
Metadata *Type,
unsigned Arg,
2715 (Scope, Name, File, Line, Type, Arg, Flags, AlignInBits))
2717 TempDILocalVariable clone()
const {
return cloneImpl(); }
2739 return DL && getScope()->getSubprogram() == DL->getScope()->getSubprogram();
2757 :
DINode(C, DILabelKind, Storage, dwarf::DW_TAG_label, Ops), Line(Line) {}
2763 bool ShouldCreate =
true) {
2764 return getImpl(Context, Scope, getCanonicalMDString(Context, Name), File,
2765 Line, Storage, ShouldCreate);
2770 bool ShouldCreate =
true);
2772 TempDILabel cloneImpl()
const {
2773 return getTemporary(getContext(), getScope(),
getName(), getFile(),
2781 (Scope, Name, File, Line))
2785 (Scope, Name, File, Line))
2787 TempDILabel clone()
const {
return cloneImpl(); }
2793 return cast_or_null<DILocalScope>(getRawScope());
2809 return DL && getScope()->getSubprogram() == DL->getScope()->getSubprogram();
2822 unsigned Attributes;
2826 :
DINode(C, DIObjCPropertyKind, Storage, dwarf::DW_TAG_APPLE_property,
2828 Line(Line), Attributes(Attributes) {}
2835 return getImpl(Context, getCanonicalMDString(Context, Name), File, Line,
2836 getCanonicalMDString(Context, GetterName),
2837 getCanonicalMDString(Context, SetterName), Attributes, Type,
2838 Storage, ShouldCreate);
2843 unsigned Attributes,
Metadata *Type,
2846 TempDIObjCProperty cloneImpl()
const {
2847 return getTemporary(getContext(),
getName(), getFile(), getLine(),
2857 (Name, File, Line, GetterName, SetterName, Attributes,
2862 unsigned Attributes,
Metadata *Type),
2863 (Name, File, Line, GetterName, SetterName, Attributes,
2866 TempDIObjCProperty clone()
const {
return cloneImpl(); }
2877 if (
auto *
F = getFile())
2878 return F->getFilename();
2883 if (
auto *
F = getFile())
2884 return F->getDirectory();
2889 if (
auto *
F = getFile())
2890 return F->getSource();
2914 :
DINode(C, DIImportedEntityKind, Storage, Tag, Ops), Line(Line) {}
2921 bool ShouldCreate =
true) {
2922 return getImpl(Context, Tag, Scope, Entity, File, Line,
2923 getCanonicalMDString(Context, Name), Storage, ShouldCreate);
2929 bool ShouldCreate =
true);
2931 TempDIImportedEntity cloneImpl()
const {
2932 return getTemporary(getContext(),
getTag(), getScope(), getEntity(),
2933 getFile(), getLine(),
getName());
2940 (Tag, Scope, Entity, File, Line, Name))
2944 (Tag, Scope, Entity, File, Line, Name))
2946 TempDIImportedEntity clone()
const {
return cloneImpl(); }
2971 :
MDNode(C, DIGlobalVariableExpressionKind, Storage, Ops) {}
2978 TempDIGlobalVariableExpression cloneImpl()
const {
2979 return getTemporary(getContext(), getVariable(), getExpression());
2985 (Variable, Expression))
2987 TempDIGlobalVariableExpression clone()
const {
return cloneImpl(); }
2992 return cast_or_null<DIGlobalVariable>(getRawVariable());
2998 return cast<DIExpression>(getRawExpression());
3002 return MD->
getMetadataID() == DIGlobalVariableExpressionKind;
3019 :
MDNode(C, ID, Storage, Ops1, Ops2) {
3020 assert(MIType < 1u << 16);
3021 SubclassData16 = MIType;
3026 return cast_or_null<Ty>(getOperand(I));
3030 if (
auto *S = getOperandAs<MDString>(I))
3031 return S->getString();
3049 case DIMacroFileKind:
3063 :
DIMacroNode(C, DIMacroKind, Storage, MIType, Ops), Line(Line) {}
3068 bool ShouldCreate =
true) {
3069 return getImpl(Context, MIType, Line, getCanonicalMDString(Context, Name),
3070 getCanonicalMDString(Context, Value), Storage, ShouldCreate);
3074 bool ShouldCreate =
true);
3076 TempDIMacro cloneImpl()
const {
3077 return getTemporary(getContext(), getMacinfoType(), getLine(),
getName(),
3084 (MIType, Line, Name, Value))
3087 (MIType, Line, Name, Value))
3089 TempDIMacro clone()
const {
return cloneImpl(); }
3112 :
DIMacroNode(C, DIMacroFileKind, Storage, MIType, Ops), Line(Line) {}
3116 unsigned Line,
DIFile *File,
3118 bool ShouldCreate =
true) {
3119 return getImpl(Context, MIType, Line, static_cast<Metadata *>(File),
3120 Elements.get(), Storage, ShouldCreate);
3127 TempDIMacroFile cloneImpl()
const {
3128 return getTemporary(getContext(), getMacinfoType(), getLine(), getFile(),
3134 DIMacroNodeArray Elements),
3135 (MIType, Line, File, Elements))
3138 (MIType, Line, File, Elements))
3140 TempDIMacroFile clone()
const {
return cloneImpl(); }
3146 "Lost a macro node during macro node list replacement");
3148 replaceOperandWith(1, Elements.get());
3155 return cast_or_null<MDTuple>(getRawElements());
3168 #undef DEFINE_MDNODE_GET_UNPACK_IMPL 3169 #undef DEFINE_MDNODE_GET_UNPACK 3170 #undef DEFINE_MDNODE_GET 3172 #endif // LLVM_IR_DEBUGINFOMETADATA_H
T Value
The string value of the checksum.
bool operator==(const expr_op_iterator &X) const
bool isObjectPointer() const
StringRef getFilename() const
Metadata * getRawRetainedTypes() const
static bool classof(const Metadata *MD)
MDString * getRawName() const
const_iterator end(StringRef path)
Get end iterator over path.
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)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
DITypeRef operator[](unsigned I) const
static bool isConstant(const MachineInstr &MI)
static std::string getLinkageName(GlobalValue::LinkageTypes LT)
bool isTypePassByValue() const
bool isDefinition() const
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Metadata * getRawVariable() const
StringRef getName() const
ChecksumKind Kind
The kind of checksum which Value encodes.
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
void replaceTemplateParams(DITemplateParameterArray TemplateParams)
MDString * getRawName() const
static MDString * get(LLVMContext &Context, StringRef Str)
unsigned getNumArgs() const
Metadata * getRawFile() const
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...
DITypeRef getBaseType() const
static bool classof(const Metadata *MD)
unsigned getDiscriminator() const
MDString * getRawValue() const
static SmallString< 128 > getFilename(const DISubprogram *SP)
Extract a filename for a DISubprogram.
Metadata * getRawFile() const
Return the raw underlying file.
TypedDINodeRef(std::nullptr_t)
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.
Metadata * getRawInlinedAt() const
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
DICompositeTypeArray getEnumTypes() const
const ExprOperand & operator*() const
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)
bool operator!=(const TypedDINodeRef< T > &X) const
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)
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
amdgpu Simplify well known AMD library false Value Value const Twine & Name
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)
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...
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
Holds a subclass of DINode.
StringRef getDirectory() const
Metadata * getRawType() const
DITypeRef getVTableHolder() const
StringRef getFilename() const
MDString * getRawISysRoot() const
op_iterator op_begin() const
static int64_t getConstant(const MachineInstr *MI)
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
TypedDINodeRef(const T *MD)
StringRef getIncludePath() 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...
DITypeRef getType() const
MDString * getRawName() const
DITypeRef operator*() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
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)
Metadata * getRawEntity() const
Optional< const DILocation * > cloneWithDuplicationFactor(unsigned DF) const
Returns a new DILocation with duplication factor DF * current duplication factor encoded in the discr...
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
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
void replaceVTableHolder(DITypeRef VTableHolder)
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata *> MDs)
DITemplateParameterArray getTemplateParams() const
static DISPFlags toSPFlags(bool IsLocalToUnit, bool IsDefinition, bool IsOptimized, unsigned Virtuality=SPFlagNonvirtual)
initializer< Ty > init(const Ty &Val)
unsigned getColumn() const
TypedDINodeRef< DINode > DINodeRef
expr_op_iterator(element_iterator I)
Metadata * getRawDiscriminator() const
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).
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)
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
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.
DEFINE_MDNODE_GET(DIGlobalVariableExpression,(Metadata *Variable, Metadata *Expression),(Variable, Expression)) TempDIGlobalVariableExpression clone() const
Base class for variables.
TypedDINodeRef(const TypedDINodeRef< U > &X, typename std::enable_if< std::is_convertible< U *, T *>::value >::type *=nullptr)
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
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
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.
Metadata * getRawElements() const
BaseType
A given derived pointer can have multiple base pointers through phi/selects.
static SimpleType getSimplifiedValue(const TypedDINodeRef< T > &MD)
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)
Metadata * getRawTemplateParams() const
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.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
static bool classof(const Metadata *MD)
static bool classof(const Metadata *MD)
TypedDINodeRef(const Metadata *MD)
MDString * getRawHeader() const
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)
DITypeRef getType() const
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.
Metadata * getRawFile() const
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
bool isBlockByrefStruct() 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
amdgpu Simplify well known AMD library false Value Value * Arg
Metadata * getRawBaseType() const
StringRef getIdentifier() const
MDString * getRawName() const
Optional< const DILocation * > setBaseDiscriminator(unsigned BD) const
Returns a new DILocation with updated base discriminator BD.
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 isArtificial() const
Metadata * getRawEnumTypes() const
unsigned getEncoding() const
Metadata * getRawScope() const
MDString * getRawSplitDebugFilename() const
DIMacroNode(LLVMContext &C, unsigned ID, StorageType Storage, unsigned MIType, ArrayRef< Metadata *> Ops1, ArrayRef< Metadata *> Ops2=None)
static bool classof(const Metadata *MD)
MDString * getRawProducer() const
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)
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
DITypeRef getType() const
DILocalScope * getScope() const
Get the local scope for this label.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uint32_t getAlignInBits() const
uint32_t getAlignInBytes() const
LLVM Value Representation.
DIScopeRef getScope() const
static bool classof(const Metadata *MD)
const DILocation * cloneWithDiscriminator(unsigned Discriminator) const
Returns a new DILocation with updated Discriminator.
unsigned getSizeInBits(unsigned Reg, const MachineRegisterInfo &MRI, const TargetRegisterInfo &TRI) const
Get the size in bits of Reg.
void replaceGlobalVariables(DIGlobalVariableExpressionArray N)
Metadata * getRawMacros() const
Metadata * getRawScope() const
DINodeRef getEntity() 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 TypedDINodeRef< T > &X) 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
Metadata * getRawScope() const
An iterator for expression operands.
void replaceMacros(DIMacroNodeArray N)
TypedDINodeRef< DIScope > DIScopeRef
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
TypedDINodeRef< DIType > DITypeRef
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.
MDString * getRawName() const
MDString * getRawGetterName() const
StringRef getISysRoot() 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 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 pointer types, with the discriminator in the low bit of the pointer...
Basic type, like 'int' or 'float'.
DIScopeRef getScope() const
bool is_contained(R &&Range, const E &Element)
Wrapper function around std::find to detect if an element exists in a container.