summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2018-12-24 07:35:10 +0000
committerDavid Blaikie <dblaikie@gmail.com>2018-12-24 07:35:10 +0000
commite20bf9ab91e44747471ca2c1f76bd4f830e222b4 (patch)
tree2b51ebea4ea716d1b8bdeed5bacc1b7d99dbc8a1
parentd671eb7e7c7796c679f71bc117b0561b57d246cd (diff)
downloadbcm5719-llvm-e20bf9ab91e44747471ca2c1f76bd4f830e222b4.tar.gz
bcm5719-llvm-e20bf9ab91e44747471ca2c1f76bd4f830e222b4.zip
DebugInfo: Use assembly label arithmetic for address pool size for easier reading/editing
llvm-svn: 350048
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp13
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AddressPool.h2
-rw-r--r--llvm/test/DebugInfo/X86/addr_comments.ll16
3 files changed, 19 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
index 042243b7925..97c08da3827 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
@@ -27,12 +27,13 @@ unsigned AddressPool::getIndex(const MCSymbol *Sym, bool TLS) {
void AddressPool::emitHeader(AsmPrinter &Asm, MCSection *Section) {
static const uint8_t AddrSize = Asm.getDataLayout().getPointerSize();
- uint64_t Length = sizeof(uint16_t) // version
- + sizeof(uint8_t) // address_size
- + sizeof(uint8_t) // segment_selector_size
- + AddrSize * Pool.size(); // entries
+ StringRef Prefix = "debug_addr_";
+ MCSymbol *BeginLabel = Asm.createTempSymbol(Prefix + "start");
+ EndLabel = Asm.createTempSymbol(Prefix + "end");
Asm.OutStreamer->AddComment("Length of contribution");
- Asm.emitInt32(Length); // TODO: Support DWARF64 format.
+ Asm.EmitLabelDifference(EndLabel, BeginLabel,
+ 4); // TODO: Support DWARF64 format.
+ Asm.OutStreamer->EmitLabel(BeginLabel);
Asm.OutStreamer->AddComment("DWARF version number");
Asm.emitInt16(Asm.getDwarfVersion());
Asm.OutStreamer->AddComment("Address size");
@@ -67,4 +68,6 @@ void AddressPool::emit(AsmPrinter &Asm, MCSection *AddrSection) {
for (const MCExpr *Entry : Entries)
Asm.OutStreamer->EmitValue(Entry, Asm.getDataLayout().getPointerSize());
+
+ Asm.OutStreamer->EmitLabel(EndLabel);
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.h b/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
index 2209c7eb50e..e1bf3e9ae58 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
@@ -30,6 +30,8 @@ class AddressPool {
};
DenseMap<const MCSymbol *, AddressPoolEntry> Pool;
+ MCSymbol *EndLabel;
+
/// Record whether the AddressPool has been queried for an address index since
/// the last "resetUsedFlag" call. Used to implement type unit fallback - a
/// type that references addresses cannot be placed in a type unit when using
diff --git a/llvm/test/DebugInfo/X86/addr_comments.ll b/llvm/test/DebugInfo/X86/addr_comments.ll
index 780b37915a4..487973d2267 100644
--- a/llvm/test/DebugInfo/X86/addr_comments.ll
+++ b/llvm/test/DebugInfo/X86/addr_comments.ll
@@ -1,12 +1,14 @@
; RUN: llc %s -mtriple=i386-unknown-linux-gnu -filetype=asm -o - | FileCheck %s
-; CHECK: .section .debug_addr
-; CHECK: .long 8 # Length of contribution
-; CHECK: .short 5 # DWARF version number
-; CHECK: .byte 4 # Address size
-; CHECK: .byte 0 # Segment selector size
-; CHECK: .Laddr_table_base0:
-; CHECK: .long .Lfunc_begin0
+; CHECK: .section .debug_addr
+; CHECK-NEXT: .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
+; CHECK-NEXT: .Ldebug_addr_startt 0:
+; CHECK-NEXT: .short 5 # DWARF version number
+; CHECK-NEXT: .byte 4 # Address size
+; CHECK-NEXT: .byte 0 # Segment selector size
+; CHECK-NEXT: .Laddr_table_base0:
+; CHECK-NEXT: .long .Lfunc_begin0
+; CHECK-NEXT: .Ldebug_addr_end0:
; Function Attrs: noinline nounwind optnone uwtable
define dso_local void @foo() #0 !dbg !7 {
OpenPOWER on IntegriCloud