summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-09-19 22:19:37 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-09-19 22:19:37 +0000
commitd0a869d0bf8d111cad7b9c89e886ff9a5c243de5 (patch)
tree0c1e928ccf9f950a4ae8cf7ce7abca7aaf597842
parent4e380b0a0479e1e322e659af2b16cf6f2c7bd2f3 (diff)
downloadbcm5719-llvm-d0a869d0bf8d111cad7b9c89e886ff9a5c243de5.tar.gz
bcm5719-llvm-d0a869d0bf8d111cad7b9c89e886ff9a5c243de5.zip
DebugInfo: Improve IR annotation comments for GNU pubthings.
llvm-svn: 191043
-rw-r--r--llvm/include/llvm/Support/Dwarf.h20
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp14
-rw-r--r--llvm/lib/Support/Dwarf.cpp34
-rw-r--r--llvm/test/DebugInfo/X86/gnu-public-names.ll22
4 files changed, 68 insertions, 22 deletions
diff --git a/llvm/include/llvm/Support/Dwarf.h b/llvm/include/llvm/Support/Dwarf.h
index 20c2200a714..30f268c6519 100644
--- a/llvm/include/llvm/Support/Dwarf.h
+++ b/llvm/include/llvm/Support/Dwarf.h
@@ -17,6 +17,7 @@
#define LLVM_SUPPORT_DWARF_H
#include "llvm/Support/DataTypes.h"
+#include "llvm/ADT/StringRef.h"
namespace llvm {
@@ -801,11 +802,15 @@ enum GDBIndexEntryKind {
GIEK_UNUSED7,
};
+StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind);
+
enum GDBIndexEntryLinkage {
GIEL_EXTERNAL,
GIEL_STATIC
};
+StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
+
/// The gnu_pub* kind looks like:
///
/// 0-3 reserved
@@ -816,24 +821,25 @@ enum GDBIndexEntryLinkage {
/// offset of the cu within the debug_info section stored in those 24 bits.
struct PubIndexEntryDescriptor {
GDBIndexEntryKind Kind;
- bool Static;
- PubIndexEntryDescriptor(GDBIndexEntryKind Kind, bool Static)
+ GDBIndexEntryLinkage Static;
+ PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Static)
: Kind(Kind), Static(Static) {}
/* implicit */ PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
- : Kind(Kind), Static(false) {}
+ : Kind(Kind), Static(GIEL_EXTERNAL) {}
explicit PubIndexEntryDescriptor(uint8_t Value)
: Kind(static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >>
KIND_OFFSET)),
- Static(Value & STATIC_MASK) {}
+ Static(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
+ LINKAGE_OFFSET)) {}
uint8_t toBits() {
- return Kind << KIND_OFFSET | Static << STATIC_OFFSET;
+ return Kind << KIND_OFFSET | Static << LINKAGE_OFFSET;
}
private:
enum {
KIND_OFFSET = 4,
KIND_MASK = 7 << KIND_OFFSET,
- STATIC_OFFSET = 7,
- STATIC_MASK = 1 << STATIC_OFFSET
+ LINKAGE_OFFSET = 7,
+ LINKAGE_MASK = 1 << LINKAGE_OFFSET
};
};
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index a814b72f288..a5b5905f3b1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2401,8 +2401,11 @@ void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
Asm->EmitInt32(Entity->getOffset());
if (GnuStyle) {
- Asm->OutStreamer.AddComment("Index value");
- Asm->EmitInt8(computeIndexValue(TheCU, Entity).toBits());
+ dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity);
+ Asm->OutStreamer.AddComment(
+ "Kind: " + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
+ dwarf::GDBIndexEntryLinkageString(Desc.Static));
+ Asm->EmitInt8(Desc.toBits());
}
if (Asm->isVerbose())
@@ -2460,8 +2463,11 @@ void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
Asm->EmitInt32(Entity->getOffset());
if (GnuStyle) {
- Asm->OutStreamer.AddComment("Index value");
- Asm->EmitInt8(computeIndexValue(TheCU, Entity).toBits());
+ dwarf::PubIndexEntryDescriptor Desc = computeIndexValue(TheCU, Entity);
+ Asm->OutStreamer.AddComment(
+ "Kind: " + dwarf::GDBIndexEntryKindString(Desc.Kind) + ", " +
+ dwarf::GDBIndexEntryLinkageString(Desc.Static));
+ Asm->EmitInt8(Desc.toBits());
}
if (Asm->isVerbose())
diff --git a/llvm/lib/Support/Dwarf.cpp b/llvm/lib/Support/Dwarf.cpp
index 3bacdd35793..0e64035c0bd 100644
--- a/llvm/lib/Support/Dwarf.cpp
+++ b/llvm/lib/Support/Dwarf.cpp
@@ -12,6 +12,8 @@
//===----------------------------------------------------------------------===//
#include "llvm/Support/Dwarf.h"
+#include "llvm/Support/ErrorHandling.h"
+
using namespace llvm;
using namespace dwarf;
@@ -739,3 +741,35 @@ const char *llvm::dwarf::AtomTypeString(unsigned AT) {
}
return 0;
}
+
+StringRef llvm::dwarf::GDBIndexEntryKindString(GDBIndexEntryKind Kind) {
+ switch (Kind) {
+ case GIEK_NONE:
+ return "NONE";
+ case GIEK_TYPE:
+ return "TYPE";
+ case GIEK_VARIABLE:
+ return "VARIABLE";
+ case GIEK_FUNCTION:
+ return "FUNCTION";
+ case GIEK_OTHER:
+ return "OTHER";
+ case GIEK_UNUSED5:
+ return "UNUSED5";
+ case GIEK_UNUSED6:
+ return "UNUSED6";
+ case GIEK_UNUSED7:
+ return "UNUSED7";
+ }
+ llvm_unreachable("Unknown GDBIndexEntryKind value");
+}
+
+StringRef llvm::dwarf::GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage) {
+ switch (Linkage) {
+ case GIEL_EXTERNAL:
+ return "EXTERNAL";
+ case GIEL_STATIC:
+ return "STATIC";
+ }
+ llvm_unreachable("Unknown GDBIndexEntryLinkage value");
+}
diff --git a/llvm/test/DebugInfo/X86/gnu-public-names.ll b/llvm/test/DebugInfo/X86/gnu-public-names.ll
index 68af3a1660f..19dd5b57126 100644
--- a/llvm/test/DebugInfo/X86/gnu-public-names.ll
+++ b/llvm/test/DebugInfo/X86/gnu-public-names.ll
@@ -33,18 +33,18 @@
; }
-; CHECK: .byte 32 # Index value
+; CHECK: .byte 32 # Kind: VARIABLE, EXTERNAL
; CHECK-NEXT: .asciz "global_namespace_variable" # External Name
-; CHECK: .byte 48 # Index value
-; CHECK: .asciz "global_namespace_function" # External Name
-; CHECK: .byte 176 # Index value
-; CHECK: .asciz "static_member_function" # External Name
-; CHECK: .byte 32 # Index value
-; CHECK: .asciz "global_variable" # External Name
-; CHECK: .byte 48 # Index value
-; CHECK: .asciz "global_function" # External Name
-; CHECK: .byte 176 # Index value
-; CHECK: .asciz "member_function" # External Name
+; CHECK: .byte 48 # Kind: FUNCTION, EXTERNAL
+; CHECK-NEXT: .asciz "global_namespace_function" # External Name
+; CHECK: .byte 176 # Kind: FUNCTION, STATIC
+; CHECK-NEXT: .asciz "static_member_function" # External Name
+; CHECK: .byte 32 # Kind: VARIABLE, EXTERNAL
+; CHECK-NEXT: .asciz "global_variable" # External Name
+; CHECK: .byte 48 # Kind: FUNCTION, EXTERNAL
+; CHECK-NEXT: .asciz "global_function" # External Name
+; CHECK: .byte 176 # Kind: FUNCTION, STATIC
+; CHECK-NEXT: .asciz "member_function" # External Name
%struct.C = type { i8 }
OpenPOWER on IntegriCloud