summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-09-19 18:39:59 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-09-19 18:39:59 +0000
commitecb41cfe36c9e60664c95970bfae82e4cf7397c5 (patch)
tree63f3db365fcdbaceadb4621ffb28ad0ab876af41 /lib
parentcdfb43f0a68274f40340af73218699265466c074 (diff)
downloadllvm-ecb41cfe36c9e60664c95970bfae82e4cf7397c5.tar.gz
llvm-ecb41cfe36c9e60664c95970bfae82e4cf7397c5.tar.bz2
llvm-ecb41cfe36c9e60664c95970bfae82e4cf7397c5.tar.xz
DebugInfo: Simplify gnu_pubnames index computation.
Names open to bikeshedding. Could switch back to the constants being unshifted, but this way seems a bit easier to work with. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191025 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp45
1 files changed, 10 insertions, 35 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index faf3dbea34..22533f9ace 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2323,21 +2323,9 @@ void DwarfDebug::emitAccelTypes() {
/// computeIndexValue - Compute the gdb index value for the DIE and CU.
static uint8_t computeIndexValue(CompileUnit *CU, DIE *Die) {
-#define UPDATE_VALUE(CURRENT, VALUE) \
- { \
- (CURRENT) |= (((VALUE) & dwarf::GDB_INDEX_SYMBOL_KIND_MASK) \
- << dwarf::GDB_INDEX_SYMBOL_KIND_SHIFT); \
- }
-
-#define UPDATE_STATIC(CURRENT, IS_STATIC) \
- { \
- (CURRENT) |= (((IS_STATIC) & dwarf::GDB_INDEX_SYMBOL_STATIC_MASK) \
- << dwarf::GDB_INDEX_SYMBOL_STATIC_SHIFT); \
- }
-
- // Compute the Attributes for the Die.
- uint32_t Value = dwarf::GDB_INDEX_SYMBOL_KIND_NONE;
- bool External = Die->findAttribute(dwarf::DW_AT_external);
+ uint8_t IsStatic = Die->findAttribute(dwarf::DW_AT_external)
+ ? dwarf::GDB_INDEX_SYMBOL_NON_STATIC
+ : dwarf::GDB_INDEX_SYMBOL_STATIC;
switch (Die->getTag()) {
case dwarf::DW_TAG_class_type:
@@ -2347,33 +2335,20 @@ static uint8_t computeIndexValue(CompileUnit *CU, DIE *Die) {
case dwarf::DW_TAG_typedef:
case dwarf::DW_TAG_base_type:
case dwarf::DW_TAG_subrange_type:
- UPDATE_VALUE(Value, dwarf::GDB_INDEX_SYMBOL_KIND_TYPE);
- UPDATE_STATIC(Value, 1);
- break;
+ return dwarf::GDB_INDEX_SYMBOL_KIND_TYPE | dwarf::GDB_INDEX_SYMBOL_STATIC;
case dwarf::DW_TAG_namespace:
- UPDATE_VALUE(Value, dwarf::GDB_INDEX_SYMBOL_KIND_TYPE);
- break;
+ return dwarf::GDB_INDEX_SYMBOL_KIND_TYPE;
case dwarf::DW_TAG_subprogram:
- UPDATE_VALUE(Value, dwarf::GDB_INDEX_SYMBOL_KIND_FUNCTION);
- UPDATE_STATIC(Value, !External);
- break;
+ return dwarf::GDB_INDEX_SYMBOL_KIND_FUNCTION | IsStatic;
case dwarf::DW_TAG_constant:
case dwarf::DW_TAG_variable:
- UPDATE_VALUE(Value, dwarf::GDB_INDEX_SYMBOL_KIND_VARIABLE);
- UPDATE_STATIC(Value, !External);
- break;
+ return dwarf::GDB_INDEX_SYMBOL_KIND_VARIABLE | IsStatic;
case dwarf::DW_TAG_enumerator:
- UPDATE_VALUE(Value, dwarf::GDB_INDEX_SYMBOL_KIND_VARIABLE);
- UPDATE_STATIC(Value, 1);
- break;
+ return dwarf::GDB_INDEX_SYMBOL_KIND_VARIABLE |
+ dwarf::GDB_INDEX_SYMBOL_STATIC;
default:
- break;
+ return dwarf::GDB_INDEX_SYMBOL_KIND_NONE;
}
- // We don't need to add the CU into the bitmask for two reasons:
- // a) the pubnames/pubtypes sections are per-cu, and
- // b) the linker wouldn't understand it anyhow.
- // so go ahead and make it 1 byte by shifting it down.
- return Value >> dwarf::GDB_INDEX_CU_BITSIZE;
}
/// emitDebugPubNames - Emit visible names into a debug pubnames section.