Go to the documentation of this file.
19 using namespace dwarf;
25 #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR, KIND) \
27 return "DW_TAG_" #NAME;
28 #include "llvm/BinaryFormat/Dwarf.def"
34 #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR, KIND) \
35 .Case("DW_TAG_" #NAME, DW_TAG_##NAME)
36 #include "llvm/BinaryFormat/Dwarf.def"
44 #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR, KIND) \
47 #include "llvm/BinaryFormat/Dwarf.def"
55 #define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR, KIND) \
57 return DWARF_VENDOR_##VENDOR;
58 #include "llvm/BinaryFormat/Dwarf.def"
65 return "DW_CHILDREN_no";
67 return "DW_CHILDREN_yes";
76 #define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) \
78 return "DW_AT_" #NAME;
79 #include "llvm/BinaryFormat/Dwarf.def"
87 #define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) \
90 #include "llvm/BinaryFormat/Dwarf.def"
98 #define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) \
100 return DWARF_VENDOR_##VENDOR;
101 #include "llvm/BinaryFormat/Dwarf.def"
109 #define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) \
110 case DW_FORM_##NAME: \
111 return "DW_FORM_" #NAME;
112 #include "llvm/BinaryFormat/Dwarf.def"
120 #define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) \
121 case DW_FORM_##NAME: \
123 #include "llvm/BinaryFormat/Dwarf.def"
131 #define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) \
132 case DW_FORM_##NAME: \
133 return DWARF_VENDOR_##VENDOR;
134 #include "llvm/BinaryFormat/Dwarf.def"
142 #define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
144 return "DW_OP_" #NAME;
145 #include "llvm/BinaryFormat/Dwarf.def"
147 return "DW_OP_LLVM_convert";
149 return "DW_OP_LLVM_fragment";
151 return "DW_OP_LLVM_tag_offset";
153 return "DW_OP_LLVM_entry_value";
155 return "DW_OP_LLVM_implicit_pointer";
157 return "DW_OP_LLVM_arg";
163 #define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
164 .Case("DW_OP_" #NAME, DW_OP_##NAME)
165 #include "llvm/BinaryFormat/Dwarf.def"
179 #define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
182 #include "llvm/BinaryFormat/Dwarf.def"
190 #define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
192 return DWARF_VENDOR_##VENDOR;
193 #include "llvm/BinaryFormat/Dwarf.def"
201 #define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
202 case DW_ATE_##NAME: \
203 return "DW_ATE_" #NAME;
204 #include "llvm/BinaryFormat/Dwarf.def"
210 #define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
211 .Case("DW_ATE_" #NAME, DW_ATE_##NAME)
212 #include "llvm/BinaryFormat/Dwarf.def"
220 #define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
221 case DW_ATE_##NAME: \
223 #include "llvm/BinaryFormat/Dwarf.def"
231 #define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
232 case DW_ATE_##NAME: \
233 return DWARF_VENDOR_##VENDOR;
234 #include "llvm/BinaryFormat/Dwarf.def"
241 return "DW_DS_unsigned";
243 return "DW_DS_leading_overpunch";
245 return "DW_DS_trailing_overpunch";
247 return "DW_DS_leading_separate";
249 return "DW_DS_trailing_separate";
257 return "DW_END_default";
261 return "DW_END_little";
263 return "DW_END_lo_user";
265 return "DW_END_hi_user";
274 return "DW_ACCESS_public";
276 return "DW_ACCESS_protected";
278 return "DW_ACCESS_private";
284 switch (DefaultedEncodings) {
286 case DW_DEFAULTED_no:
287 return "DW_DEFAULTED_no";
288 case DW_DEFAULTED_in_class:
289 return "DW_DEFAULTED_in_class";
290 case DW_DEFAULTED_out_of_class:
291 return "DW_DEFAULTED_out_of_class";
297 switch (Visibility) {
299 return "DW_VIS_local";
301 return "DW_VIS_exported";
303 return "DW_VIS_qualified";
309 switch (Virtuality) {
312 #define HANDLE_DW_VIRTUALITY(ID, NAME) \
313 case DW_VIRTUALITY_##NAME: \
314 return "DW_VIRTUALITY_" #NAME;
315 #include "llvm/BinaryFormat/Dwarf.def"
321 #define HANDLE_DW_VIRTUALITY(ID, NAME) \
322 .Case("DW_VIRTUALITY_" #NAME, DW_VIRTUALITY_##NAME)
323 #include "llvm/BinaryFormat/Dwarf.def"
331 #define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
332 case DW_LANG_##NAME: \
333 return "DW_LANG_" #NAME;
334 #include "llvm/BinaryFormat/Dwarf.def"
340 #define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
341 .Case("DW_LANG_" #NAME, DW_LANG_##NAME)
342 #include "llvm/BinaryFormat/Dwarf.def"
350 #define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
351 case DW_LANG_##NAME: \
353 #include "llvm/BinaryFormat/Dwarf.def"
361 #define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
362 case DW_LANG_##NAME: \
363 return DWARF_VENDOR_##VENDOR;
364 #include "llvm/BinaryFormat/Dwarf.def"
372 #define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
373 case DW_LANG_##NAME: \
375 #include "llvm/BinaryFormat/Dwarf.def"
382 return "DW_ID_case_sensitive";
384 return "DW_ID_up_case";
386 return "DW_ID_down_case";
388 return "DW_ID_case_insensitive";
397 #define HANDLE_DW_CC(ID, NAME) \
399 return "DW_CC_" #NAME;
400 #include "llvm/BinaryFormat/Dwarf.def"
406 #define HANDLE_DW_CC(ID, NAME) .Case("DW_CC_" #NAME, DW_CC_##NAME)
407 #include "llvm/BinaryFormat/Dwarf.def"
414 return "DW_INL_not_inlined";
416 return "DW_INL_inlined";
418 return "DW_INL_declared_not_inlined";
420 return "DW_INL_declared_inlined";
428 return "DW_ORD_row_major";
430 return "DW_ORD_col_major";
439 #define HANDLE_DW_LNS(ID, NAME) \
440 case DW_LNS_##NAME: \
441 return "DW_LNS_" #NAME;
442 #include "llvm/BinaryFormat/Dwarf.def"
450 #define HANDLE_DW_LNE(ID, NAME) \
451 case DW_LNE_##NAME: \
452 return "DW_LNE_" #NAME;
453 #include "llvm/BinaryFormat/Dwarf.def"
461 return "DW_MACINFO_define";
463 return "DW_MACINFO_undef";
465 return "DW_MACINFO_start_file";
467 return "DW_MACINFO_end_file";
469 return "DW_MACINFO_vendor_ext";
471 return "DW_MACINFO_invalid";
490 #define HANDLE_DW_MACRO(ID, NAME) \
491 case DW_MACRO_##NAME: \
492 return "DW_MACRO_" #NAME;
493 #include "llvm/BinaryFormat/Dwarf.def"
501 #define HANDLE_DW_MACRO_GNU(ID, NAME) \
502 case DW_MACRO_GNU_##NAME: \
503 return "DW_MACRO_GNU_" #NAME;
504 #include "llvm/BinaryFormat/Dwarf.def"
510 #define HANDLE_DW_MACRO(ID, NAME) .Case("DW_MACRO_" #NAME, ID)
511 #include "llvm/BinaryFormat/Dwarf.def"
518 #define HANDLE_DW_RLE(ID, NAME) \
519 case DW_RLE_##NAME: \
520 return "DW_RLE_" #NAME;
521 #include "llvm/BinaryFormat/Dwarf.def"
529 #define HANDLE_DW_LLE(ID, NAME) \
530 case DW_LLE_##NAME: \
531 return "DW_LLE_" #NAME;
532 #include "llvm/BinaryFormat/Dwarf.def"
538 assert(Arch != llvm::Triple::ArchType::UnknownArch);
539 #define SELECT_AARCH64 (Arch == llvm::Triple::aarch64_be || Arch == llvm::Triple::aarch64)
540 #define SELECT_MIPS64 Arch == llvm::Triple::mips64
541 #define SELECT_SPARC (Arch == llvm::Triple::sparc || Arch == llvm::Triple::sparcv9)
542 #define SELECT_X86 (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64)
543 #define HANDLE_DW_CFA(ID, NAME)
544 #define HANDLE_DW_CFA_PRED(ID, NAME, PRED) \
545 if (ID == Encoding && PRED) \
546 return "DW_CFA_" #NAME;
547 #include "llvm/BinaryFormat/Dwarf.def"
552 #define HANDLE_DW_CFA_PRED(ID, NAME, PRED)
553 #define HANDLE_DW_CFA(ID, NAME) \
554 case DW_CFA_##NAME: \
555 return "DW_CFA_" #NAME;
556 #include "llvm/BinaryFormat/Dwarf.def"
561 #undef SELECT_AARCH64
569 #define HANDLE_DW_APPLE_PROPERTY(ID, NAME) \
570 case DW_APPLE_PROPERTY_##NAME: \
571 return "DW_APPLE_PROPERTY_" #NAME;
572 #include "llvm/BinaryFormat/Dwarf.def"
580 #define HANDLE_DW_UT(ID, NAME) \
582 return "DW_UT_" #NAME;
583 #include "llvm/BinaryFormat/Dwarf.def"
590 return "DW_ATOM_null";
592 return "DW_ATOM_die_offset";
594 return "DW_ATOM_cu_offset";
596 return "DW_ATOM_die_tag";
599 return "DW_ATOM_type_flags";
601 return "DW_ATOM_qual_name_hash";
641 case DW_AT_accessibility:
643 case DW_AT_virtuality:
649 case DW_AT_decimal_sign:
651 case DW_AT_endianity:
653 case DW_AT_visibility:
655 case DW_AT_identifier_case:
657 case DW_AT_calling_convention:
663 case DW_AT_APPLE_runtime_class:
665 case DW_AT_defaulted:
687 #define HANDLE_DW_IDX(ID, NAME) \
688 case DW_IDX_##NAME: \
689 return "DW_IDX_" #NAME;
690 #include "llvm/BinaryFormat/Dwarf.def"
709 case DW_FORM_ref_udata:
710 case DW_FORM_indirect:
711 case DW_FORM_exprloc:
714 case DW_FORM_loclistx:
715 case DW_FORM_rnglistx:
716 case DW_FORM_GNU_addr_index:
717 case DW_FORM_GNU_str_index:
720 case DW_FORM_ref_addr:
743 case DW_FORM_ref_sup4:
749 case DW_FORM_GNU_ref_alt:
750 case DW_FORM_GNU_strp_alt:
751 case DW_FORM_line_strp:
752 case DW_FORM_sec_offset:
753 case DW_FORM_strp_sup:
760 case DW_FORM_ref_sig8:
761 case DW_FORM_ref_sup8:
764 case DW_FORM_flag_present:
770 case DW_FORM_implicit_const:
785 return FV > 0 && FV <=
Version;
808 #define HANDLE_DW_RLE(ID, NAME) \
809 case DW_RLE_##NAME: \
810 return "DW_RLE_" #NAME;
811 #include "llvm/BinaryFormat/Dwarf.def"
StringSwitch & Case(StringLiteral S, T Value)
StringRef AttributeEncodingString(unsigned Encoding)
unsigned AttributeEncodingVendor(TypeKind E)
This is an optimization pass for GlobalISel generic memory operations.
StringRef MacroString(unsigned Encoding)
LLVM_NODISCARD R Default(T Value)
@ DW_ATOM_die_offset
Marker as the end of a list of atoms.
StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage)
unsigned getVirtuality(StringRef VirtualityString)
@ DW_OP_LLVM_tag_offset
Only used in LLVM metadata.
StringRef RangeListEncodingString(unsigned Encoding)
unsigned FormVersion(Form F)
@ DW_INL_declared_not_inlined
unsigned AttributeVendor(Attribute A)
unsigned getCallingConvention(StringRef LanguageString)
StringRef VirtualityString(unsigned Virtuality)
StringRef IndexString(unsigned Idx)
StringRef AccessibilityString(unsigned Access)
StringRef GnuMacroString(unsigned Encoding)
unsigned TagVendor(Tag T)
StringRef AtomTypeString(unsigned Atom)
StringRef CallFrameString(unsigned Encoding, Triple::ArchType Arch)
StringRef LNExtendedString(unsigned Encoding)
StringRef LanguageString(unsigned Language)
StringRef AttributeValueString(uint16_t Attr, unsigned Val)
Returns the symbolic string representing Val when used as a value for attribute Attr.
@ DW_DS_trailing_overpunch
constexpr char Language[]
Key for Kernel::Metadata::mLanguage.
@ DW_ATOM_type_type_flags
unsigned getTag(StringRef TagString)
unsigned LanguageVersion(SourceLanguage L)
Optional< unsigned > LanguageLowerBound(SourceLanguage L)
StringRef FormatString(DwarfFormat Format)
StringRef VisibilityString(unsigned Visibility)
StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind)
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
StringRef FormEncodingString(unsigned Encoding)
@ DW_OP_LLVM_entry_value
Only used in LLVM metadata.
unsigned getLanguage(StringRef LanguageString)
unsigned TagVersion(Tag T)
StringRef DefaultedMemberString(unsigned DefaultedEncodings)
unsigned AttributeVersion(Attribute A)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned FormVendor(Form F)
@ DW_INL_declared_inlined
@ DW_OP_LLVM_arg
Only used in LLVM metadata.
unsigned getAttributeEncoding(StringRef EncodingString)
StringRef ArrayOrderString(unsigned Order)
StringRef CaseString(unsigned Case)
@ DW_OP_LLVM_fragment
Only used in LLVM metadata.
@ DW_OP_LLVM_implicit_pointer
Only used in LLVM metadata.
@ DW_TAG_invalid
LLVM mock tags (see also llvm/BinaryFormat/Dwarf.def).
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned LanguageVendor(SourceLanguage L)
StringRef ApplePropertyString(unsigned)
StringRef AtomValueString(uint16_t Atom, unsigned Val)
Returns the symbolic string representing Val when used as a value for atom Atom.
StringRef ChildrenString(unsigned Children)
StringRef ConventionString(unsigned Convention)
Optional< uint8_t > getFixedFormByteSize(dwarf::Form Form, FormParams Params)
Get the fixed byte size for a given form.
unsigned getOperationEncoding(StringRef OperationEncodingString)
StringRef EndianityString(unsigned Endian)
@ DW_VIRTUALITY_invalid
Virtuality for invalid results.
@ DW_DS_trailing_separate
@ DWARF_VENDOR_DWARF
Identifiers we use to distinguish vendor extensions.
@ DW_OP_LLVM_convert
Only used in LLVM metadata.
StringRef LNStandardString(unsigned Standard)
bool isValidFormForVersion(Form F, unsigned Version, bool ExtensionsOk=true)
Tells whether the specified form is defined in the specified version, or is an extension if extension...
unsigned OperationVendor(LocationAtom O)
StringRef MacinfoString(unsigned Encoding)
@ DW_MACINFO_invalid
Macinfo type for invalid results.
unsigned getMacro(StringRef MacroString)
unsigned OperationVersion(LocationAtom O)
StringRef RLEString(unsigned RLE)
A switch()-like statement whose cases are string literals.
StringRef InlineCodeString(unsigned Code)
StringRef TagString(unsigned Tag)
@ DW_DS_leading_overpunch
StringRef DecimalSignString(unsigned Sign)
unsigned AttributeEncodingVersion(TypeKind E)
unsigned getMacinfo(StringRef MacinfoString)
StringRef UnitTypeString(unsigned)
StringRef AttributeString(unsigned Attribute)
StringRef OperationEncodingString(unsigned Encoding)
StringRef LocListEncodingString(unsigned Encoding)