summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-09-19 20:40:26 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-09-19 20:40:26 +0000
commit8dec40764924823d668efa562fa6028916368ec8 (patch)
tree2561e23003c46ac1c9f2747965609b07b729c36b /llvm/lib
parent87cfa71071d73c702a833f19c9fe035f31c1275d (diff)
downloadbcm5719-llvm-8dec40764924823d668efa562fa6028916368ec8.tar.gz
bcm5719-llvm-8dec40764924823d668efa562fa6028916368ec8.zip
Unshift the GDB index/GNU pubnames constants modified in r191025
Based on code review feedback from Eric Christopher, unshifting these constants as they can appear in the gdb_index itself, shifted a further 24 bits. This means that keeping them preshifted is a bit inflexible, so let's not do that. Given the motivation, wrap up some nicer enums, more type safety, and some utility functions. llvm-svn: 191035
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp27
-rw-r--r--llvm/lib/Support/Dwarf.cpp23
2 files changed, 14 insertions, 36 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 22533f9aced..a814b72f288 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2322,10 +2322,11 @@ void DwarfDebug::emitAccelTypes() {
// reference in the pubname header doesn't change.
/// computeIndexValue - Compute the gdb index value for the DIE and CU.
-static uint8_t computeIndexValue(CompileUnit *CU, DIE *Die) {
- uint8_t IsStatic = Die->findAttribute(dwarf::DW_AT_external)
- ? dwarf::GDB_INDEX_SYMBOL_NON_STATIC
- : dwarf::GDB_INDEX_SYMBOL_STATIC;
+static dwarf::PubIndexEntryDescriptor computeIndexValue(CompileUnit *CU,
+ DIE *Die) {
+ dwarf::GDBIndexEntryLinkage IsStatic =
+ Die->findAttribute(dwarf::DW_AT_external) ? dwarf::GIEL_EXTERNAL
+ : dwarf::GIEL_STATIC;
switch (Die->getTag()) {
case dwarf::DW_TAG_class_type:
@@ -2335,19 +2336,19 @@ 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:
- return dwarf::GDB_INDEX_SYMBOL_KIND_TYPE | dwarf::GDB_INDEX_SYMBOL_STATIC;
+ return dwarf::PubIndexEntryDescriptor(dwarf::GIEK_TYPE, dwarf::GIEL_STATIC);
case dwarf::DW_TAG_namespace:
- return dwarf::GDB_INDEX_SYMBOL_KIND_TYPE;
+ return dwarf::GIEK_TYPE;
case dwarf::DW_TAG_subprogram:
- return dwarf::GDB_INDEX_SYMBOL_KIND_FUNCTION | IsStatic;
+ return dwarf::PubIndexEntryDescriptor(dwarf::GIEK_FUNCTION, IsStatic);
case dwarf::DW_TAG_constant:
case dwarf::DW_TAG_variable:
- return dwarf::GDB_INDEX_SYMBOL_KIND_VARIABLE | IsStatic;
+ return dwarf::PubIndexEntryDescriptor(dwarf::GIEK_VARIABLE, IsStatic);
case dwarf::DW_TAG_enumerator:
- return dwarf::GDB_INDEX_SYMBOL_KIND_VARIABLE |
- dwarf::GDB_INDEX_SYMBOL_STATIC;
+ return dwarf::PubIndexEntryDescriptor(dwarf::GIEK_VARIABLE,
+ dwarf::GIEL_STATIC);
default:
- return dwarf::GDB_INDEX_SYMBOL_KIND_NONE;
+ return dwarf::GIEK_NONE;
}
}
@@ -2401,7 +2402,7 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
if (GnuStyle) {
Asm->OutStreamer.AddComment("Index value");
- Asm->EmitInt8(computeIndexValue(TheCU, Entity));
+ Asm->EmitInt8(computeIndexValue(TheCU, Entity).toBits());
}
if (Asm->isVerbose())
@@ -2460,7 +2461,7 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
if (GnuStyle) {
Asm->OutStreamer.AddComment("Index value");
- Asm->EmitInt8(computeIndexValue(TheCU, Entity));
+ Asm->EmitInt8(computeIndexValue(TheCU, Entity).toBits());
}
if (Asm->isVerbose())
diff --git a/llvm/lib/Support/Dwarf.cpp b/llvm/lib/Support/Dwarf.cpp
index 5c780ddc2b8..3bacdd35793 100644
--- a/llvm/lib/Support/Dwarf.cpp
+++ b/llvm/lib/Support/Dwarf.cpp
@@ -739,26 +739,3 @@ const char *llvm::dwarf::AtomTypeString(unsigned AT) {
}
return 0;
}
-
-const char *llvm::dwarf::GDBIndexTypeString(unsigned Kind) {
- switch (Kind) {
- case GDB_INDEX_SYMBOL_KIND_NONE:
- return "case GDB_INDEX_SYMBOL_KIND_NONE";
- case GDB_INDEX_SYMBOL_KIND_TYPE:
- return "case GDB_INDEX_SYMBOL_KIND_TYPE";
- case GDB_INDEX_SYMBOL_KIND_VARIABLE:
- return "case GDB_INDEX_SYMBOL_KIND_VARIABLE";
- case GDB_INDEX_SYMBOL_KIND_FUNCTION:
- return "case GDB_INDEX_SYMBOL_KIND_FUNCTION";
- case GDB_INDEX_SYMBOL_KIND_OTHER:
- return "case GDB_INDEX_SYMBOL_KIND_OTHER";
- // 3 unused bits.
- case GDB_INDEX_SYMBOL_KIND_UNUSED5:
- return "case GDB_INDEX_SYMBOL_KIND_UNUSED5";
- case GDB_INDEX_SYMBOL_KIND_UNUSED6:
- return "case GDB_INDEX_SYMBOL_KIND_UNUSED6";
- case GDB_INDEX_SYMBOL_KIND_UNUSED7:
- return "case GDB_INDEX_SYMBOL_KIND_UNUSED7";
- }
- return 0;
-}
OpenPOWER on IntegriCloud