DebugInfo: Implement debug_line.dwo for file names used in type units during -gsplit-dwarf

This removes an attribute (and more importantly, a relocation) from
skeleton type units and removes some unnecessary file names from the
debug_line section that remains in the .o (and linked executable) file.

There's still a few places we could shave off some more space here:

* use compilation dir of the underlying compilation unit (since all the
  type units share that compilation dir - though this would be more
  complicated in LTO cases where they don't (keep a map of compilation
  dir->line table header?))

* Remove some of the unnecessary header fields from the line table since
  they're not needed in this situation (about 12 bytes per table).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204099 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2014-03-18 01:17:26 +00:00
parent cdbfefbfed
commit 9c1e56a84d
5 changed files with 57 additions and 16 deletions

View File

@ -56,8 +56,13 @@ DwarfCompileUnit::DwarfCompileUnit(unsigned UID, DIE *D, DICompileUnit Node,
}
DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU,
AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU)
: DwarfUnit(UID, D, CU.getCUNode(), A, DW, DWU), CU(CU) {}
AsmPrinter *A, DwarfDebug *DW, DwarfFile *DWU,
MCDwarfLineTableHeader *SplitLineTable)
: DwarfUnit(UID, D, CU.getCUNode(), A, DW, DWU), CU(CU),
SplitLineTable(SplitLineTable) {
if (SplitLineTable)
addSectionOffset(UnitDie.get(), dwarf::DW_AT_stmt_list, 0);
}
/// ~Unit - Destructor for compile unit.
DwarfUnit::~DwarfUnit() {
@ -307,6 +312,11 @@ unsigned DwarfCompileUnit::getOrCreateSourceID(StringRef FileName, StringRef Dir
Asm->OutStreamer.hasRawTextSupport() ? 0 : getUniqueID());
}
unsigned DwarfTypeUnit::getOrCreateSourceID(StringRef FileName, StringRef DirName) {
return SplitLineTable ? SplitLineTable->getFile(DirName, FileName)
: getCU().getOrCreateSourceID(FileName, DirName);
}
/// addOpAddress - Add a dwarf op address data and value using the
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
///
@ -394,7 +404,7 @@ void DwarfUnit::addSourceLine(DIE *Die, unsigned Line, StringRef File,
if (Line == 0)
return;
unsigned FileID = getCU().getOrCreateSourceID(File, Directory);
unsigned FileID = getOrCreateSourceID(File, Directory);
assert(FileID && "Invalid file id");
addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);
addUInt(Die, dwarf::DW_AT_decl_line, None, Line);