[llvm] 498e37e - [DebugInfo]: Added DWARFv5 macro header flags and corresponding helper
Sourabh Singh Tomar via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 7 04:23:50 PST 2020
Author: Sourabh Singh Tomar
Date: 2020-03-07T17:53:01+05:30
New Revision: 498e37e786ea2632b1c8596ad2512c306b3c8f58
URL: https://github.com/llvm/llvm-project/commit/498e37e786ea2632b1c8596ad2512c306b3c8f58
DIFF: https://github.com/llvm/llvm-project/commit/498e37e786ea2632b1c8596ad2512c306b3c8f58.diff
LOG: [DebugInfo]: Added DWARFv5 macro header flags and corresponding helper
functions.
Added:
Modified:
llvm/include/llvm/BinaryFormat/Dwarf.def
llvm/include/llvm/BinaryFormat/Dwarf.h
llvm/lib/BinaryFormat/Dwarf.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def
index 3faf3be65032..5f744fc2ad25 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.def
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -17,6 +17,7 @@
defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \
defined HANDLE_DW_CC || defined HANDLE_DW_LNS || defined HANDLE_DW_LNE || \
defined HANDLE_DW_LNCT || defined HANDLE_DW_MACRO || \
+ defined HANDLE_MACRO_FLAG || \
defined HANDLE_DW_RLE || defined HANDLE_DW_LLE || \
(defined HANDLE_DW_CFA && defined HANDLE_DW_CFA_PRED) || \
defined HANDLE_DW_APPLE_PROPERTY || defined HANDLE_DW_UT || \
@@ -87,6 +88,10 @@
#define HANDLE_DW_MACRO(ID, NAME)
#endif
+#ifndef HANDLE_MACRO_FLAG
+#define HANDLE_MACRO_FLAG(ID, NAME)
+#endif
+
#ifndef HANDLE_DW_RLE
#define HANDLE_DW_RLE(ID, NAME)
#endif
@@ -822,6 +827,11 @@ HANDLE_DW_MACRO(0x0a, import_sup)
HANDLE_DW_MACRO(0x0b, define_strx)
HANDLE_DW_MACRO(0x0c, undef_strx)
+// DWARF v5 Macro header flags.
+HANDLE_MACRO_FLAG(0x01, OFFSET_SIZE)
+HANDLE_MACRO_FLAG(0x02, DEBUG_LINE_OFFSET)
+HANDLE_MACRO_FLAG(0x04, OPCODE_OPERANDS_TABLE)
+
// DWARF v5 Range List Entry encoding values.
HANDLE_DW_RLE(0x00, end_of_list)
HANDLE_DW_RLE(0x01, base_addressx)
@@ -956,6 +966,7 @@ HANDLE_DW_IDX(0x05, type_hash)
#undef HANDLE_DW_LNE
#undef HANDLE_DW_LNCT
#undef HANDLE_DW_MACRO
+#undef HANDLE_MACRO_FLAG
#undef HANDLE_DW_RLE
#undef HANDLE_DW_LLE
#undef HANDLE_DW_CFA
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h
index 27747300f229..45a3fc98d4b5 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.h
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -470,6 +470,7 @@ StringRef ArrayOrderString(unsigned Order);
StringRef LNStandardString(unsigned Standard);
StringRef LNExtendedString(unsigned Encoding);
StringRef MacinfoString(unsigned Encoding);
+StringRef MacroString(unsigned Encoding);
StringRef RangeListEncodingString(unsigned Encoding);
StringRef LocListEncodingString(unsigned Encoding);
StringRef CallFrameString(unsigned Encoding, Triple::ArchType Arch);
@@ -498,6 +499,7 @@ unsigned getLanguage(StringRef LanguageString);
unsigned getCallingConvention(StringRef LanguageString);
unsigned getAttributeEncoding(StringRef EncodingString);
unsigned getMacinfo(StringRef MacinfoString);
+unsigned getMacro(StringRef MacroString);
/// @}
/// \defgroup DwarfConstantsVersioning Dwarf version for constants
diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp
index c3da0e2c4312..30c7e9c311b0 100644
--- a/llvm/lib/BinaryFormat/Dwarf.cpp
+++ b/llvm/lib/BinaryFormat/Dwarf.cpp
@@ -477,6 +477,23 @@ unsigned llvm::dwarf::getMacinfo(StringRef MacinfoString) {
.Default(DW_MACINFO_invalid);
}
+StringRef llvm::dwarf::MacroString(unsigned Encoding) {
+ switch (Encoding) {
+ default:
+ return StringRef();
+#define HANDLE_DW_MACRO(ID, NAME) \
+ case DW_MACRO_##NAME: \
+ return "DW_MACRO_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::getMacro(StringRef MacroString) {
+ return StringSwitch<unsigned>(MacroString)
+#define HANDLE_DW_MACRO(ID, NAME) .Case("DW_MACRO_" #NAME, ID)
+#include "llvm/BinaryFormat/Dwarf.def"
+ .Default(DW_MACINFO_invalid);
+}
StringRef llvm::dwarf::RangeListEncodingString(unsigned Encoding) {
switch (Encoding) {
default:
More information about the llvm-commits
mailing list