summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-02-14 22:41:51 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-02-14 22:41:51 +0000
commit2494fdb83820afadd1049e9d1451fe4d014423e1 (patch)
tree26fa3ea9221c744528cb576639b5decf70064e68 /llvm/lib/CodeGen/AsmPrinter
parent30616362d3a55592ec12abd7152af370ed1df709 (diff)
downloadbcm5719-llvm-2494fdb83820afadd1049e9d1451fe4d014423e1.tar.gz
bcm5719-llvm-2494fdb83820afadd1049e9d1451fe4d014423e1.zip
DwarfUnit: Refactor out DW_AT_stmt_list creation into common function for fission and non-fission cases
This probably also addresses the FIXME in the fission case regarding multiple compile units, though I haven't tested that. This code still confuses me (the literal zero offset makes little sense, the limitations surrounding asm output I'm not sure about either - but perhaps we should just always emit one line table? Or should we not rely on .loc/.file even in assembly so we can produce the same output between asm and object output?) but this maintains the existing functionality. llvm-svn: 201441
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp32
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp27
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h2
3 files changed, 31 insertions, 30 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 4d0eb445d34..4c5fe2ecb99 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -762,31 +762,9 @@ DwarfCompileUnit *DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
DIUnit.getLanguage());
NewCU->addString(Die, dwarf::DW_AT_name, FN);
- // Define start line table label for each Compile Unit.
- MCSymbol *LineTableStartSym =
- Asm->GetTempSymbol("line_table_start", NewCU->getUniqueID());
- Asm->OutStreamer.getContext().setMCLineTableSymbol(LineTableStartSym,
- NewCU->getUniqueID());
-
- // Use a single line table if we are generating assembly.
- bool UseTheFirstCU =
- Asm->OutStreamer.hasRawTextSupport() || (NewCU->getUniqueID() == 0);
if (!useSplitDwarf()) {
- // DW_AT_stmt_list is a offset of line number information for this
- // compile unit in debug_line section. For split dwarf this is
- // 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.
- if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
- NewCU->addSectionLabel(Die, dwarf::DW_AT_stmt_list,
- UseTheFirstCU ? DwarfLineSectionSym
- : LineTableStartSym);
- else if (UseTheFirstCU)
- NewCU->addSectionOffset(Die, dwarf::DW_AT_stmt_list, 0);
- else
- NewCU->addSectionDelta(Die, dwarf::DW_AT_stmt_list, LineTableStartSym,
- DwarfLineSectionSym);
+ NewCU->initStmtList(DwarfLineSectionSym);
// If we're using split dwarf the compilation dir is going to be in the
// skeleton CU and so we don't need to duplicate it here.
@@ -2956,13 +2934,7 @@ DwarfCompileUnit *DwarfDebug::constructSkeletonCU(const DwarfCompileUnit *CU) {
NewCU->initSection(Asm->getObjFileLowering().getDwarfInfoSection(),
DwarfInfoSectionSym);
- // DW_AT_stmt_list is a offset of line number information for this
- // compile unit in debug_line section.
- // FIXME: Should handle multiple compile units.
- if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
- NewCU->addSectionLabel(Die, dwarf::DW_AT_stmt_list, DwarfLineSectionSym);
- else
- NewCU->addSectionOffset(Die, dwarf::DW_AT_stmt_list, 0);
+ NewCU->initStmtList(DwarfLineSectionSym);
initSkeletonUnit(CU, Die, NewCU);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
index db354e6f161..57e8abe04c0 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
@@ -1981,6 +1981,33 @@ void DwarfUnit::emitHeader(const MCSection *ASection,
}
DwarfCompileUnit::~DwarfCompileUnit() {}
+
+void DwarfCompileUnit::initStmtList(MCSymbol *DwarfLineSectionSym) {
+ // Define start line table label for each Compile Unit.
+ MCSymbol *LineTableStartSym =
+ Asm->GetTempSymbol("line_table_start", getUniqueID());
+ Asm->OutStreamer.getContext().setMCLineTableSymbol(LineTableStartSym,
+ getUniqueID());
+
+ // Use a single line table if we are generating assembly.
+ bool UseTheFirstCU =
+ Asm->OutStreamer.hasRawTextSupport() || (getUniqueID() == 0);
+
+ // DW_AT_stmt_list is a offset of line number information for this
+ // compile unit in debug_line section. For split dwarf this is
+ // 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.
+ if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
+ addSectionLabel(UnitDie.get(), dwarf::DW_AT_stmt_list,
+ UseTheFirstCU ? DwarfLineSectionSym : LineTableStartSym);
+ else if (UseTheFirstCU)
+ addSectionOffset(UnitDie.get(), dwarf::DW_AT_stmt_list, 0);
+ else
+ addSectionDelta(UnitDie.get(), dwarf::DW_AT_stmt_list, LineTableStartSym,
+ DwarfLineSectionSym);
+}
+
DwarfTypeUnit::~DwarfTypeUnit() {}
void DwarfTypeUnit::emitHeader(const MCSection *ASection,
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
index 60e86c5d828..4eabeaf00fd 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
@@ -544,6 +544,8 @@ public:
DwarfDebug *DW, DwarfFile *DWU);
virtual ~DwarfCompileUnit() LLVM_OVERRIDE;
+ void initStmtList(MCSymbol *DwarfLineSectionSym);
+
/// createGlobalVariableDIE - create global variable DIE.
void createGlobalVariableDIE(DIGlobalVariable GV);
OpenPOWER on IntegriCloud