aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
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 /llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
parentd671eb7e7c7796c679f71bc117b0561b57d246cd (diff)
downloadllvm-e20bf9ab91e44747471ca2c1f76bd4f830e222b4.zip
llvm-e20bf9ab91e44747471ca2c1f76bd4f830e222b4.tar.gz
llvm-e20bf9ab91e44747471ca2c1f76bd4f830e222b4.tar.bz2
DebugInfo: Use assembly label arithmetic for address pool size for easier reading/editing
llvm-svn: 350048
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
index 042243b7..97c08da 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);
}