summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-03-10 16:58:10 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-03-10 16:58:10 +0000
commit063d725fd78bbdeff0c5eecab3d1cfa906bd5d12 (patch)
tree2e4ddd2045d506435b4d0c9de8f5d9c060131c0d /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
parentf1b0db154588760352b968d9134f930c77497614 (diff)
downloadbcm5719-llvm-063d725fd78bbdeff0c5eecab3d1cfa906bd5d12.tar.gz
bcm5719-llvm-063d725fd78bbdeff0c5eecab3d1cfa906bd5d12.zip
Store an optional section start label in MCSection.
This makes code that uses section relative expressions (debug info) simpler and less brittle. This is still a bit awkward as the symbol is created late and has to be stored in a mutable field. I will move the symbol creation earlier in the next patch. llvm-svn: 231802
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 85649492e23..85a6f117caa 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -19,7 +19,7 @@ DwarfCompileUnit::DwarfCompileUnit(unsigned UID, DICompileUnit Node,
AsmPrinter *A, DwarfDebug *DW,
DwarfFile *DWU)
: DwarfUnit(UID, dwarf::DW_TAG_compile_unit, Node, A, DW, DWU),
- Skeleton(nullptr), LabelBegin(nullptr), BaseAddress(nullptr) {
+ Skeleton(nullptr), BaseAddress(nullptr) {
insertDIE(Node, &getUnitDie());
}
@@ -245,7 +245,7 @@ void DwarfCompileUnit::addSectionLabel(DIE &Die, dwarf::Attribute Attribute,
addSectionDelta(Die, Attribute, Label, Sec);
}
-void DwarfCompileUnit::initStmtList(MCSymbol *DwarfLineSectionSym) {
+void DwarfCompileUnit::initStmtList() {
// Define start line table label for each Compile Unit.
MCSymbol *LineTableStartSym =
Asm->OutStreamer.getDwarfLineTableSymbol(getUniqueID());
@@ -257,8 +257,9 @@ void DwarfCompileUnit::initStmtList(MCSymbol *DwarfLineSectionSym) {
// left in the skeleton CU and so not included.
// The line table entries are not always emitted in assembly, so it
// is not okay to use line_table_start here.
+ const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
addSectionLabel(UnitDie, dwarf::DW_AT_stmt_list, LineTableStartSym,
- DwarfLineSectionSym);
+ TLOF.getDwarfLineSection()->getBeginSymbol());
}
void DwarfCompileUnit::applyStmtList(DIE &D) {
@@ -380,9 +381,12 @@ void DwarfCompileUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute,
void DwarfCompileUnit::addScopeRangeList(DIE &ScopeDIE,
SmallVector<RangeSpan, 2> Range) {
+ const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
+
// Emit offset in .debug_range as a relocatable label. emitDIE will handle
// emitting it appropriately.
- auto *RangeSectionSym = DD->getRangeSectionSym();
+ const MCSymbol *RangeSectionSym =
+ TLOF.getDwarfRangesSection()->getBeginSymbol();
RangeSpanList List(
Asm->GetTempSymbol("debug_ranges", DD->getNextRangeNumber()),
@@ -711,14 +715,14 @@ void DwarfCompileUnit::collectDeadVariables(DISubprogram SP) {
}
}
-void DwarfCompileUnit::emitHeader(const MCSymbol *ASectionSym) {
+void DwarfCompileUnit::emitHeader(bool UseOffsets) {
// Don't bother labeling the .dwo unit, as its offset isn't used.
if (!Skeleton) {
LabelBegin = Asm->createTempSymbol("cu_begin", getUniqueID());
Asm->OutStreamer.EmitLabel(LabelBegin);
}
- DwarfUnit::emitHeader(ASectionSym);
+ DwarfUnit::emitHeader(UseOffsets);
}
/// addGlobalName - Add a new global name to the compile unit.
OpenPOWER on IntegriCloud