[llvm] r285472 - Refactor DW_CFA_* into Dwarf.def
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 28 15:56:53 PDT 2016
Author: adrian
Date: Fri Oct 28 17:56:53 2016
New Revision: 285472
URL: http://llvm.org/viewvc/llvm-project?rev=285472&view=rev
Log:
Refactor DW_CFA_* into Dwarf.def
Modified:
llvm/trunk/include/llvm/Support/Dwarf.def
llvm/trunk/include/llvm/Support/Dwarf.h
llvm/trunk/lib/Support/Dwarf.cpp
Modified: llvm/trunk/include/llvm/Support/Dwarf.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.def?rev=285472&r1=285471&r2=285472&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.def (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.def Fri Oct 28 17:56:53 2016
@@ -12,12 +12,12 @@
//===----------------------------------------------------------------------===//
// TODO: Add other DW-based macros.
-#if !(defined HANDLE_DW_TAG || defined HANDLE_DW_AT || \
- defined HANDLE_DW_FORM || defined HANDLE_DW_OP || \
- defined HANDLE_DW_LANG || defined HANDLE_DW_ATE || \
- defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \
- defined HANDLE_DW_CC || defined HANDLE_DW_LNCT || \
- defined HANDLE_DW_MACRO || defined HANDLE_DW_RLE)
+#if !( \
+ defined HANDLE_DW_TAG || defined HANDLE_DW_AT || defined HANDLE_DW_FORM || \
+ defined HANDLE_DW_OP || defined HANDLE_DW_LANG || defined HANDLE_DW_ATE || \
+ defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \
+ defined HANDLE_DW_CC || defined HANDLE_DW_LNCT || \
+ defined HANDLE_DW_MACRO || defined HANDLE_DW_RLE || defined HANDLE_DW_CFA)
#error "Missing macro definition of HANDLE_DW*"
#endif
@@ -69,6 +69,10 @@
#define HANDLE_DW_RLE(ID, NAME)
#endif
+#ifndef HANDLE_DW_CFA
+#define HANDLE_DW_CFA(ID, NAME)
+#endif
+
HANDLE_DW_TAG(0x0000, null)
HANDLE_DW_TAG(0x0001, array_type)
HANDLE_DW_TAG(0x0002, class_type)
@@ -704,6 +708,37 @@ HANDLE_DW_RLE(0x05, base_address)
HANDLE_DW_RLE(0x06, start_end)
HANDLE_DW_RLE(0x07, start_length)
+// Call frame instruction encodings.
+HANDLE_DW_CFA(0x00, nop)
+HANDLE_DW_CFA(0x40, advance_loc)
+HANDLE_DW_CFA(0x80, offset)
+HANDLE_DW_CFA(0xc0, restore)
+HANDLE_DW_CFA(0x01, set_loc)
+HANDLE_DW_CFA(0x02, advance_loc1)
+HANDLE_DW_CFA(0x03, advance_loc2)
+HANDLE_DW_CFA(0x04, advance_loc4)
+HANDLE_DW_CFA(0x05, offset_extended)
+HANDLE_DW_CFA(0x06, restore_extended)
+HANDLE_DW_CFA(0x07, undefined)
+HANDLE_DW_CFA(0x08, same_value)
+HANDLE_DW_CFA(0x09, register)
+HANDLE_DW_CFA(0x0a, remember_state)
+HANDLE_DW_CFA(0x0b, restore_state)
+HANDLE_DW_CFA(0x0c, def_cfa)
+HANDLE_DW_CFA(0x0d, def_cfa_register)
+HANDLE_DW_CFA(0x0e, def_cfa_offset)
+HANDLE_DW_CFA(0x0f, def_cfa_expression)
+HANDLE_DW_CFA(0x10, expression)
+HANDLE_DW_CFA(0x11, offset_extended_sf)
+HANDLE_DW_CFA(0x12, def_cfa_sf)
+HANDLE_DW_CFA(0x13, def_cfa_offset_sf)
+HANDLE_DW_CFA(0x14, val_offset)
+HANDLE_DW_CFA(0x15, val_offset_sf)
+HANDLE_DW_CFA(0x16, val_expression)
+HANDLE_DW_CFA(0x1d, MIPS_advance_loc8)
+HANDLE_DW_CFA(0x2d, GNU_window_save)
+HANDLE_DW_CFA(0x2e, GNU_args_size)
+
#undef HANDLE_DW_TAG
#undef HANDLE_DW_AT
#undef HANDLE_DW_FORM
@@ -716,3 +751,4 @@ HANDLE_DW_RLE(0x07, start_length)
#undef HANDLE_DW_LNCT
#undef HANDLE_DW_MACRO
#undef HANDLE_DW_RLE
+#undef HANDLE_DW_CFA
Modified: llvm/trunk/include/llvm/Support/Dwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=285472&r1=285471&r2=285472&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.h (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.h Fri Oct 28 17:56:53 2016
@@ -263,38 +263,12 @@ enum RangeListEntries {
};
+/// Call frame instruction encodings.
enum CallFrameInfo {
- // Call frame instruction encodings
+#define HANDLE_DW_CFA(ID, NAME) DW_CFA_##NAME = ID,
+#include "llvm/Support/Dwarf.def"
DW_CFA_extended = 0x00,
- DW_CFA_nop = 0x00,
- DW_CFA_advance_loc = 0x40,
- DW_CFA_offset = 0x80,
- DW_CFA_restore = 0xc0,
- DW_CFA_set_loc = 0x01,
- DW_CFA_advance_loc1 = 0x02,
- DW_CFA_advance_loc2 = 0x03,
- DW_CFA_advance_loc4 = 0x04,
- DW_CFA_offset_extended = 0x05,
- DW_CFA_restore_extended = 0x06,
- DW_CFA_undefined = 0x07,
- DW_CFA_same_value = 0x08,
- DW_CFA_register = 0x09,
- DW_CFA_remember_state = 0x0a,
- DW_CFA_restore_state = 0x0b,
- DW_CFA_def_cfa = 0x0c,
- DW_CFA_def_cfa_register = 0x0d,
- DW_CFA_def_cfa_offset = 0x0e,
- DW_CFA_def_cfa_expression = 0x0f,
- DW_CFA_expression = 0x10,
- DW_CFA_offset_extended_sf = 0x11,
- DW_CFA_def_cfa_sf = 0x12,
- DW_CFA_def_cfa_offset_sf = 0x13,
- DW_CFA_val_offset = 0x14,
- DW_CFA_val_offset_sf = 0x15,
- DW_CFA_val_expression = 0x16,
- DW_CFA_MIPS_advance_loc8 = 0x1d,
- DW_CFA_GNU_window_save = 0x2d,
- DW_CFA_GNU_args_size = 0x2e,
+
DW_CFA_lo_user = 0x1c,
DW_CFA_hi_user = 0x3f
};
Modified: llvm/trunk/lib/Support/Dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Dwarf.cpp?rev=285472&r1=285471&r2=285472&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Dwarf.cpp (original)
+++ llvm/trunk/lib/Support/Dwarf.cpp Fri Oct 28 17:56:53 2016
@@ -290,39 +290,13 @@ unsigned llvm::dwarf::getMacinfo(StringR
StringRef llvm::dwarf::CallFrameString(unsigned Encoding) {
switch (Encoding) {
- case DW_CFA_nop: return "DW_CFA_nop";
- case DW_CFA_advance_loc: return "DW_CFA_advance_loc";
- case DW_CFA_offset: return "DW_CFA_offset";
- case DW_CFA_restore: return "DW_CFA_restore";
- case DW_CFA_set_loc: return "DW_CFA_set_loc";
- case DW_CFA_advance_loc1: return "DW_CFA_advance_loc1";
- case DW_CFA_advance_loc2: return "DW_CFA_advance_loc2";
- case DW_CFA_advance_loc4: return "DW_CFA_advance_loc4";
- case DW_CFA_offset_extended: return "DW_CFA_offset_extended";
- case DW_CFA_restore_extended: return "DW_CFA_restore_extended";
- case DW_CFA_undefined: return "DW_CFA_undefined";
- case DW_CFA_same_value: return "DW_CFA_same_value";
- case DW_CFA_register: return "DW_CFA_register";
- case DW_CFA_remember_state: return "DW_CFA_remember_state";
- case DW_CFA_restore_state: return "DW_CFA_restore_state";
- case DW_CFA_def_cfa: return "DW_CFA_def_cfa";
- case DW_CFA_def_cfa_register: return "DW_CFA_def_cfa_register";
- case DW_CFA_def_cfa_offset: return "DW_CFA_def_cfa_offset";
- case DW_CFA_def_cfa_expression: return "DW_CFA_def_cfa_expression";
- case DW_CFA_expression: return "DW_CFA_expression";
- case DW_CFA_offset_extended_sf: return "DW_CFA_offset_extended_sf";
- case DW_CFA_def_cfa_sf: return "DW_CFA_def_cfa_sf";
- case DW_CFA_def_cfa_offset_sf: return "DW_CFA_def_cfa_offset_sf";
- case DW_CFA_val_offset: return "DW_CFA_val_offset";
- case DW_CFA_val_offset_sf: return "DW_CFA_val_offset_sf";
- case DW_CFA_val_expression: return "DW_CFA_val_expression";
- case DW_CFA_MIPS_advance_loc8: return "DW_CFA_MIPS_advance_loc8";
- case DW_CFA_GNU_window_save: return "DW_CFA_GNU_window_save";
- case DW_CFA_GNU_args_size: return "DW_CFA_GNU_args_size";
- case DW_CFA_lo_user: return "DW_CFA_lo_user";
- case DW_CFA_hi_user: return "DW_CFA_hi_user";
+ default:
+ return StringRef();
+#define HANDLE_DW_CFA(ID, NAME) \
+ case DW_CFA_##NAME: \
+ return "DW_CFA_" #NAME;
+#include "llvm/Support/Dwarf.def"
}
- return StringRef();
}
StringRef llvm::dwarf::ApplePropertyString(unsigned Prop) {
More information about the llvm-commits
mailing list