1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

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)

llvm-svn: 221072
This commit is contained in:
David Blaikie 2014-11-01 23:59:23 +00:00
parent a568073754
commit 44f17e492d
4 changed files with 14 additions and 7 deletions

View File

@ -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

View File

@ -177,6 +177,8 @@ public:
return sizeof(uint32_t) + // Length field
getHeaderSize() + UnitDie.getSize();
}
void emitHeader(const MCSymbol *ASectionSym) const override;
};
} // end llvm namespace

View File

@ -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);

View File

@ -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");