Revert rL350048 and rL350050
These patches have broken almost all buildbots on test
DebugInfo/X86/addr_comments.ll. Reverting to green.
llvm-svn: 350052
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
index c57e302..042243b 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
@@ -24,23 +24,21 @@
return IterBool.first->second.Number;
}
-MCSymbol *AddressPool::emitHeader(AsmPrinter &Asm, MCSection *Section) {
+
+void AddressPool::emitHeader(AsmPrinter &Asm, MCSection *Section) {
static const uint8_t AddrSize = Asm.getDataLayout().getPointerSize();
- StringRef Prefix = "debug_addr_";
- MCSymbol *BeginLabel = Asm.createTempSymbol(Prefix + "start");
- MCSymbol *EndLabel = Asm.createTempSymbol(Prefix + "end");
+ uint64_t Length = sizeof(uint16_t) // version
+ + sizeof(uint8_t) // address_size
+ + sizeof(uint8_t) // segment_selector_size
+ + AddrSize * Pool.size(); // entries
Asm.OutStreamer->AddComment("Length of contribution");
- Asm.EmitLabelDifference(EndLabel, BeginLabel,
- 4); // TODO: Support DWARF64 format.
- Asm.OutStreamer->EmitLabel(BeginLabel);
+ Asm.emitInt32(Length); // TODO: Support DWARF64 format.
Asm.OutStreamer->AddComment("DWARF version number");
Asm.emitInt16(Asm.getDwarfVersion());
Asm.OutStreamer->AddComment("Address size");
Asm.emitInt8(AddrSize);
Asm.OutStreamer->AddComment("Segment selector size");
Asm.emitInt8(0); // TODO: Support non-zero segment_selector_size.
-
- return EndLabel;
}
// Emit addresses into the section given.
@@ -51,10 +49,8 @@
// Start the dwarf addr section.
Asm.OutStreamer->SwitchSection(AddrSection);
- MCSymbol *EndLabel = nullptr;
-
if (Asm.getDwarfVersion() >= 5)
- EndLabel = emitHeader(Asm, AddrSection);
+ emitHeader(Asm, AddrSection);
// Define the symbol that marks the start of the contribution.
// It is referenced via DW_AT_addr_base.
@@ -71,7 +67,4 @@
for (const MCExpr *Entry : Entries)
Asm.OutStreamer->EmitValue(Entry, Asm.getDataLayout().getPointerSize());
-
- if (EndLabel)
- Asm.OutStreamer->EmitLabel(EndLabel);
}
diff --git a/llvm/lib/CodeGen/AsmPrinter/AddressPool.h b/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
index 44a53b0..2209c7e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
+++ b/llvm/lib/CodeGen/AsmPrinter/AddressPool.h
@@ -55,7 +55,7 @@
void setLabel(MCSymbol *Sym) { AddressTableBaseSym = Sym; }
private:
- MCSymbol *emitHeader(AsmPrinter &Asm, MCSection *Section);
+ void emitHeader(AsmPrinter &Asm, MCSection *Section);
/// Symbol designates the start of the contribution to the address table.
MCSymbol *AddressTableBaseSym = nullptr;