[llvm] r196617 - DebugInfo: Move unit begin/end labels into the unit
David Blaikie
dblaikie at gmail.com
Fri Dec 6 14:33:06 PST 2013
Author: dblaikie
Date: Fri Dec 6 16:33:05 2013
New Revision: 196617
URL: http://llvm.org/viewvc/llvm-project?rev=196617&view=rev
Log:
DebugInfo: Move unit begin/end labels into the unit
This removes another case of spooky action at a distance (building the
same label names in multiple places creating an implicit dependency
between those places) and helps pave the way for type units.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=196617&r1=196616&r2=196617&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Dec 6 16:33:05 2013
@@ -2137,8 +2137,7 @@ void DwarfFile::emitUnits(DwarfDebug *DD
Asm->OutStreamer.SwitchSection(USection);
// Emit the compile units header.
- Asm->OutStreamer.EmitLabel(
- Asm->GetTempSymbol(USection->getLabelBeginName(), TheU->getUniqueID()));
+ Asm->OutStreamer.EmitLabel(TheU->getLabelBegin());
// Emit size of content not including length itself
Asm->OutStreamer.AddComment("Length of Unit");
@@ -2147,8 +2146,7 @@ void DwarfFile::emitUnits(DwarfDebug *DD
TheU->emitHeader(ASection, ASectionSym);
DD->emitDIE(Die);
- Asm->OutStreamer.EmitLabel(
- Asm->GetTempSymbol(USection->getLabelEndName(), TheU->getUniqueID()));
+ Asm->OutStreamer.EmitLabel(TheU->getLabelEnd());
}
}
@@ -2414,7 +2412,6 @@ static dwarf::PubIndexEntryDescriptor co
/// emitDebugPubNames - Emit visible names into a debug pubnames section.
///
void DwarfDebug::emitDebugPubNames(bool GnuStyle) {
- const MCSection *ISec = Asm->getObjFileLowering().getDwarfInfoSection();
const MCSection *PSec =
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubNamesSection()
: Asm->getObjFileLowering().getDwarfPubNamesSection();
@@ -2444,13 +2441,10 @@ void DwarfDebug::emitDebugPubNames(bool
Asm->EmitInt16(dwarf::DW_PUBNAMES_VERSION);
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
- Asm->EmitSectionOffset(Asm->GetTempSymbol(ISec->getLabelBeginName(), ID),
- TheU->getSectionSym());
+ Asm->EmitSectionOffset(TheU->getLabelBegin(), TheU->getSectionSym());
Asm->OutStreamer.AddComment("Compilation Unit Length");
- Asm->EmitLabelDifference(Asm->GetTempSymbol(ISec->getLabelEndName(), ID),
- Asm->GetTempSymbol(ISec->getLabelBeginName(), ID),
- 4);
+ Asm->EmitLabelDifference(TheU->getLabelEnd(), TheU->getLabelBegin(), 4);
// Emit the pubnames for this compilation unit.
const StringMap<const DIE *> &Globals = getUnits()[ID]->getGlobalNames();
@@ -2482,7 +2476,6 @@ void DwarfDebug::emitDebugPubNames(bool
}
void DwarfDebug::emitDebugPubTypes(bool GnuStyle) {
- const MCSection *ISec = Asm->getObjFileLowering().getDwarfInfoSection();
const MCSection *PSec =
GnuStyle ? Asm->getObjFileLowering().getDwarfGnuPubTypesSection()
: Asm->getObjFileLowering().getDwarfPubTypesSection();
@@ -2512,14 +2505,10 @@ void DwarfDebug::emitDebugPubTypes(bool
Asm->EmitInt16(dwarf::DW_PUBTYPES_VERSION);
Asm->OutStreamer.AddComment("Offset of Compilation Unit Info");
- Asm->EmitSectionOffset(
- Asm->GetTempSymbol(ISec->getLabelBeginName(), TheU->getUniqueID()),
- TheU->getSectionSym());
+ Asm->EmitSectionOffset(TheU->getLabelBegin(), TheU->getSectionSym());
Asm->OutStreamer.AddComment("Compilation Unit Length");
- Asm->EmitLabelDifference(
- Asm->GetTempSymbol(ISec->getLabelEndName(), TheU->getUniqueID()),
- Asm->GetTempSymbol(ISec->getLabelBeginName(), TheU->getUniqueID()), 4);
+ Asm->EmitLabelDifference(TheU->getLabelEnd(), TheU->getLabelBegin(), 4);
// Emit the pubtypes.
const StringMap<const DIE *> &Globals = getUnits()[ID]->getGlobalTypes();
@@ -2825,7 +2814,6 @@ void DwarfDebug::emitDebugARanges() {
}
}
- const MCSection *ISec = Asm->getObjFileLowering().getDwarfInfoSection();
unsigned PtrSize = Asm->getDataLayout().getPointerSize();
// Build a list of CUs used.
@@ -2866,9 +2854,7 @@ void DwarfDebug::emitDebugARanges() {
Asm->OutStreamer.AddComment("DWARF Arange version number");
Asm->EmitInt16(dwarf::DW_ARANGES_VERSION);
Asm->OutStreamer.AddComment("Offset Into Debug Info Section");
- Asm->EmitSectionOffset(
- Asm->GetTempSymbol(ISec->getLabelBeginName(), CU->getUniqueID()),
- CU->getSectionSym());
+ Asm->EmitSectionOffset(CU->getLabelBegin(), CU->getSectionSym());
Asm->OutStreamer.AddComment("Address Size (in bytes)");
Asm->EmitInt8(PtrSize);
Asm->OutStreamer.AddComment("Segment Size (in bytes)");
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=196617&r1=196616&r2=196617&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Fri Dec 6 16:33:05 2013
@@ -22,6 +22,7 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/DebugInfo.h"
#include "llvm/MC/MCExpr.h"
+#include "llvm/MC/MCSection.h"
namespace llvm {
@@ -133,6 +134,12 @@ protected:
/// A label at the start of the non-dwo section related to this unit.
MCSymbol *SectionSym;
+ /// The start of the unit within its section.
+ MCSymbol *LabelBegin;
+
+ /// The end of the unit within its section.
+ MCSymbol *LabelEnd;
+
Unit(unsigned UID, DIE *D, DICompileUnit CU, AsmPrinter *A, DwarfDebug *DW,
DwarfFile *DWU);
@@ -146,17 +153,31 @@ public:
assert(!this->Section);
this->Section = Section;
this->SectionSym = SectionSym;
+ this->LabelBegin =
+ Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
+ this->LabelEnd =
+ Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
}
const MCSection *getSection() const {
assert(Section);
return Section;
}
- MCSymbol *getSectionSym() {
+ MCSymbol *getSectionSym() const {
assert(Section);
return SectionSym;
}
+ MCSymbol *getLabelBegin() const {
+ assert(Section);
+ return LabelBegin;
+ }
+
+ MCSymbol *getLabelEnd() const {
+ assert(Section);
+ return LabelEnd;
+ }
+
// Accessors.
unsigned getUniqueID() const { return UniqueID; }
virtual uint16_t getLanguage() const = 0;
More information about the llvm-commits
mailing list