[llvm] r326395 - [DWARF] Emit a split line table only if there are split type units.

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 5 16:43:20 PST 2018


Hm.  Actually seems quite feasible.  I'll have a go at that next.  The DwarfTypeUnit instances don't survive after they've been emitted, right?  so the extra bit isn't that big a deal.
--paulr

From: David Blaikie [mailto:dblaikie at gmail.com]
Sent: Monday, March 05, 2018 3:15 PM
To: Robinson, Paul
Cc: llvm-commits at lists.llvm.org
Subject: Re: [llvm] r326395 - [DWARF] Emit a split line table only if there are split type units.

Sure - would make sense to have the type units conditional on whether they need/use the line table too? Though I guess that'd mean having a bit in every DwarfTypeUnit to keep track of that property.

But fair enough - maybe a comment somewhere about the tradeoffs might be worthwhile, but up to you.

As for the size - mostly I'm motivated here by some vague sense of purity - not producing an empty chunk of stuff seems good. Smaller units, etc.
On Mon, Mar 5, 2018 at 1:34 PM <paul.robinson at sony.com<mailto:paul.robinson at sony.com>> wrote:
I considered that, but the type unit would then have a dangling reference to a non-existent line table, which presumably would end up being a reference to some other unit's table (in a .dwp for example).  That could be confusing.
The space occupied by a split line table header with no file entries isn't that much, IMO.  Note the split line table does not have the number-of-operands list either.
--paulr

From: David Blaikie [mailto:dblaikie at gmail.com<mailto:dblaikie at gmail.com>]
Sent: Monday, March 05, 2018 10:59 AM
To: Robinson, Paul
Cc: llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
Subject: Re: [llvm] r326395 - [DWARF] Emit a split line table only if there are split type units.

Any chance of testing if the line table is empty instead? (I doubt it makes a difference here - but imagine if we just had one artificial type, which isn't defined in any source file & so doesn't create any file names or directory names in the line table section, etc)

On Wed, Feb 28, 2018 at 4:14 PM Paul Robinson via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> wrote:
Author: probinson
Date: Wed Feb 28 16:12:35 2018
New Revision: 326395

URL: http://llvm.org/viewvc/llvm-project?rev=326395&view=rev
Log:
[DWARF] Emit a split line table only if there are split type units.

A .debug_info.dwo section doesn't use the .debug_line.dwo section.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
    llvm/trunk/test/DebugInfo/Generic/empty.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=326395&r1=326394&r2=326395&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Feb 28 16:12:35 2018
@@ -2105,6 +2105,8 @@ void DwarfDebug::emitDebugAbbrevDWO() {

 void DwarfDebug::emitDebugLineDWO() {
   assert(useSplitDwarf() && "No split dwarf?");
+  if (!HasSplitTypeUnits)
+    return;
   Asm->OutStreamer->SwitchSection(
       Asm->getObjFileLowering().getDwarfLineDWOSection());
   SplitTypeUnitFileTable.Emit(*Asm->OutStreamer, MCDwarfLineTableParams());
@@ -2220,6 +2222,7 @@ void DwarfDebug::addDwarfTypeUnitType(Dw
       InfoHolder.computeSizeAndOffsetsForUnit(TU.first.get());
       InfoHolder.emitUnit(TU.first.get(), useSplitDwarf());
     }
+    HasSplitTypeUnits = useSplitDwarf();
   }
   CU.addDIETypeSignature(RefDie, Signature);
 }

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=326395&r1=326394&r2=326395&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Wed Feb 28 16:12:35 2018
@@ -274,6 +274,10 @@ class DwarfDebug : public DebugHandlerBa
   /// a monolithic sequence of string offsets.
   bool UseSegmentedStringOffsetsTable;

+  /// Whether we have emitted any type units with split DWARF (and therefore
+  /// need to emit a line table to the .dwo file).
+  bool HasSplitTypeUnits = false;
+
   /// Separated Dwarf Variables
   /// In general these will all be for bits that are left in the
   /// original object file, rather than things that are meant

Modified: llvm/trunk/test/DebugInfo/Generic/empty.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/empty.ll?rev=326395&r1=326394&r2=326395&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/empty.ll (original)
+++ llvm/trunk/test/DebugInfo/Generic/empty.ll Wed Feb 28 16:12:35 2018
@@ -16,7 +16,9 @@
 ; CHECK: contents:

 ; Don't emit DW_AT_addr_base when there are no addresses.
+; Also don't emit a split line table when there are no type units.
 ; FISSION-NOT: DW_AT_GNU_addr_base [DW_FORM_sec_offset]
+; FISSION-NOT: .debug_line.dwo contents:

 !llvm.dbg.cu<http://llvm.dbg.cu> = !{!0}
 !llvm.module.flags = !{!5}


_______________________________________________
llvm-commits mailing list
llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180306/be9d5127/attachment.html>


More information about the llvm-commits mailing list