diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-03-18 01:17:26 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-03-18 01:17:26 +0000 |
commit | 4a2f95f60ee386dc87d29d5f763fa4fb046550ff (patch) | |
tree | 4dc2f624e58e405c9fb6e133613d6d1ee8000a27 /llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | |
parent | cf9e671f5c909334ae5f6e0402e33162282c82fd (diff) | |
download | bcm5719-llvm-4a2f95f60ee386dc87d29d5f763fa4fb046550ff.tar.gz bcm5719-llvm-4a2f95f60ee386dc87d29d5f763fa4fb046550ff.zip |
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).
llvm-svn: 204099
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp index 9b7e38f9bd4..2a74d0552fe 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp @@ -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); |