summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-12-06 22:33:05 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-12-06 22:33:05 +0000
commit7d734602186feb97f89aedebff8be616fe885503 (patch)
tree6a37bd090fd3ac9ad6308e88fc2c3feafcced59d
parent793d8d9c006de8a2fcdb3047d7a49194a1146862 (diff)
downloadbcm5719-llvm-7d734602186feb97f89aedebff8be616fe885503.tar.gz
bcm5719-llvm-7d734602186feb97f89aedebff8be616fe885503.zip
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. llvm-svn: 196617
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp28
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h23
2 files changed, 29 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index d92258ce1d8..14d784e8a26 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2137,8 +2137,7 @@ void DwarfFile::emitUnits(DwarfDebug *DD, const MCSection *ASection,
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, const MCSection *ASection,
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 computeIndexValue(Unit *CU,
/// 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 GnuStyle) {
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 GnuStyle) {
}
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 GnuStyle) {
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)");
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index 852b4c3cc5a..0ffaacf02a1 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -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;
OpenPOWER on IntegriCloud