From: David Blaikie Date: Sat, 1 Nov 2014 23:59:23 +0000 (+0000) Subject: Sink dwarf unit length emission down into DwarfUnit::emitHeader X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5e8ee21fb6e9b27c8c678484e3ae486d33c27ce8;p=oota-llvm.git Sink dwarf unit length emission down into DwarfUnit::emitHeader This allows the CU label to be emitted only for compile units, as they're the only ones that need it (so they can be referenced from pubnames) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221072 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp index d214e36677f..885be61b7c9 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp @@ -686,4 +686,12 @@ void DwarfCompileUnit::collectDeadVariables(DISubprogram SP) { } } +void DwarfCompileUnit::emitHeader(const MCSymbol *ASectionSym) const { + // Emit the compile units header. + Asm->OutStreamer.EmitLabel(LabelBegin); + + DwarfUnit::emitHeader(ASectionSym); +} + + } // end llvm namespace diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h index a84c81e0bf5..def0cf78c6c 100644 --- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h +++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h @@ -177,6 +177,8 @@ public: return sizeof(uint32_t) + // Length field getHeaderSize() + UnitDie.getSize(); } + + void emitHeader(const MCSymbol *ASectionSym) const override; }; } // end llvm namespace diff --git a/lib/CodeGen/AsmPrinter/DwarfFile.cpp b/lib/CodeGen/AsmPrinter/DwarfFile.cpp index 89d38a2e3ae..50180ea0a16 100644 --- a/lib/CodeGen/AsmPrinter/DwarfFile.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfFile.cpp @@ -55,13 +55,6 @@ void DwarfFile::emitUnits(const MCSymbol *ASectionSym) { const MCSection *USection = TheU->getSection(); Asm->OutStreamer.SwitchSection(USection); - // Emit the compile units header. - Asm->OutStreamer.EmitLabel(TheU->getLabelBegin()); - - // Emit size of content not including length itself - Asm->OutStreamer.AddComment("Length of Unit"); - Asm->EmitInt32(TheU->getHeaderSize() + Die.getSize()); - TheU->emitHeader(ASectionSym); DD.emitDIE(Die); diff --git a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index bdcb8cc11ee..2086c8d84d4 100644 --- a/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -1730,6 +1730,10 @@ DIE *DwarfUnit::getOrCreateStaticMemberDIE(DIDerivedType DT) { } void DwarfUnit::emitHeader(const MCSymbol *ASectionSym) const { + // Emit size of content not including length itself + Asm->OutStreamer.AddComment("Length of Unit"); + Asm->EmitInt32(getHeaderSize() + UnitDie.getSize()); + Asm->OutStreamer.AddComment("DWARF version number"); Asm->EmitInt16(DD->getDwarfVersion()); Asm->OutStreamer.AddComment("Offset Into Abbrev. Section");