DebugInfo: Avoid creating unnecessary/empty line tables and remove the special case of '0' in DwarfCompileUnit::initStmtList by just always using a label difference

This moves one case of raw text checking down into the MCStreamer
interfaces in the form of a virtual function, even if we ultimately end
up consolidating on the one-or-many line tables issue one day, this is
nicer in the interim. This just generally streamlines a bunch of use
cases into a common code path.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205287 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2014-04-01 08:07:52 +00:00
parent 5b2de5dd3d
commit a07c1ab4e6
11 changed files with 32 additions and 29 deletions

View File

@@ -2070,13 +2070,7 @@ void DwarfUnit::addRange(RangeSpan Range) {
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);
Asm->OutStreamer.getDwarfLineTableSymbol(getUniqueID());
stmtListIndex = UnitDie->getValues().size();
@@ -2086,10 +2080,7 @@ void DwarfCompileUnit::initStmtList(MCSymbol *DwarfLineSectionSym) {
// 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);
addSectionLabel(UnitDie.get(), dwarf::DW_AT_stmt_list, LineTableStartSym);
else
addSectionDelta(UnitDie.get(), dwarf::DW_AT_stmt_list, LineTableStartSym,
DwarfLineSectionSym);