Move label creation close to emission. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231744 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2015-03-10 03:11:11 +00:00
parent d8bd7ce2ca
commit 810c3f5ef9
4 changed files with 10 additions and 12 deletions

View File

@ -711,10 +711,13 @@ void DwarfCompileUnit::collectDeadVariables(DISubprogram SP) {
} }
} }
void DwarfCompileUnit::emitHeader(const MCSymbol *ASectionSym) const { void DwarfCompileUnit::emitHeader(const MCSymbol *ASectionSym) {
// Don't bother labeling the .dwo unit, as its offset isn't used. // Don't bother labeling the .dwo unit, as its offset isn't used.
if (!Skeleton) if (!Skeleton) {
LabelBegin =
Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
Asm->OutStreamer.EmitLabel(LabelBegin); Asm->OutStreamer.EmitLabel(LabelBegin);
}
DwarfUnit::emitHeader(ASectionSym); DwarfUnit::emitHeader(ASectionSym);
} }

View File

@ -179,11 +179,6 @@ public:
void initSection(const MCSection *Section, MCSymbol *SectionSym) { void initSection(const MCSection *Section, MCSymbol *SectionSym) {
DwarfUnit::initSection(Section); DwarfUnit::initSection(Section);
this->SectionSym = SectionSym; this->SectionSym = SectionSym;
// Don't bother labeling the .dwo unit, as its offset isn't used.
if (!Skeleton)
LabelBegin =
Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
} }
unsigned getLength() { unsigned getLength() {
@ -191,7 +186,7 @@ public:
getHeaderSize() + UnitDie.getSize(); getHeaderSize() + UnitDie.getSize();
} }
void emitHeader(const MCSymbol *ASectionSym) const override; void emitHeader(const MCSymbol *ASectionSym) override;
MCSymbol *getLabelBegin() const { MCSymbol *getLabelBegin() const {
assert(Section); assert(Section);

View File

@ -1604,7 +1604,7 @@ DIE *DwarfUnit::getOrCreateStaticMemberDIE(DIDerivedType DT) {
return &StaticMemberDIE; return &StaticMemberDIE;
} }
void DwarfUnit::emitHeader(const MCSymbol *ASectionSym) const { void DwarfUnit::emitHeader(const MCSymbol *ASectionSym) {
// Emit size of content not including length itself // Emit size of content not including length itself
Asm->OutStreamer.AddComment("Length of Unit"); Asm->OutStreamer.AddComment("Length of Unit");
Asm->EmitInt32(getHeaderSize() + UnitDie.getSize()); Asm->EmitInt32(getHeaderSize() + UnitDie.getSize());
@ -1629,7 +1629,7 @@ void DwarfUnit::initSection(const MCSection *Section) {
this->Section = Section; this->Section = Section;
} }
void DwarfTypeUnit::emitHeader(const MCSymbol *ASectionSym) const { void DwarfTypeUnit::emitHeader(const MCSymbol *ASectionSym) {
DwarfUnit::emitHeader(ASectionSym); DwarfUnit::emitHeader(ASectionSym);
Asm->OutStreamer.AddComment("Type Signature"); Asm->OutStreamer.AddComment("Type Signature");
Asm->OutStreamer.EmitIntValue(TypeSignature, sizeof(TypeSignature)); Asm->OutStreamer.EmitIntValue(TypeSignature, sizeof(TypeSignature));

View File

@ -321,7 +321,7 @@ public:
} }
/// Emit the header for this unit, not including the initial length field. /// Emit the header for this unit, not including the initial length field.
virtual void emitHeader(const MCSymbol *ASectionSym) const; virtual void emitHeader(const MCSymbol *ASectionSym);
virtual DwarfCompileUnit &getCU() = 0; virtual DwarfCompileUnit &getCU() = 0;
@ -423,7 +423,7 @@ public:
void setType(const DIE *Ty) { this->Ty = Ty; } void setType(const DIE *Ty) { this->Ty = Ty; }
/// Emit the header for this unit, not including the initial length field. /// Emit the header for this unit, not including the initial length field.
void emitHeader(const MCSymbol *ASectionSym) const override; void emitHeader(const MCSymbol *ASectionSym) override;
unsigned getHeaderSize() const override { unsigned getHeaderSize() const override {
return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
sizeof(uint32_t); // Type DIE Offset sizeof(uint32_t); // Type DIE Offset