[PATCH] D49493: [DebugInfo] Reduce debug_str_offsets section size

Pavel Labath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 18 09:27:51 PDT 2018


labath created this revision.
labath added reviewers: probinson, dblaikie, JDevlieghere.
Herald added subscribers: mgrang, aprantl.

The accelerator tables use the debug_str section to store their strings.
However, they do not support the indirect method of access that is
available for the debug_info section (DW_FORM_strx et al.).

Currently our code is assuming that all strings can/will be referenced
indirectly, and puts all of them into the debug_str_offsets section.
This is generally true for regular (unsplit) dwarf, but in the DWO case,
most of the strings in the debug_str section will only be used from the
accelerator tables. Therefore the contents of the debug_str_offsets
section will be largely unused and bloating the main executable.

This patch rectifies this by teaching the DwarfStringPool to
differentiate between strings accessed directly and indirectly. When a
user inserts a string into the pool it has to declare whether that
string will be referenced directly or not. If at least one user requsts
indirect access, that string will be assigned an index ID and put into
debug_str_offsets table. Otherwise, the offset table is skipped.

This approach reduces the overall binary size (when compiled with
-gdwarf-5 -gsplit-dwarf) in my tests by about 2% (debug_str_offsets is
shrunk by 99%).


Repository:
  rL LLVM

https://reviews.llvm.org/D49493

Files:
  include/llvm/CodeGen/DwarfStringPoolEntry.h
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  lib/CodeGen/AsmPrinter/DwarfFile.cpp
  lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
  lib/CodeGen/AsmPrinter/DwarfStringPool.h
  lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  test/DebugInfo/X86/string-offsets-table.ll
  unittests/DebugInfo/DWARF/DwarfGenerator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49493.156095.patch
Type: text/x-patch
Size: 11558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180718/c0c920e0/attachment.bin>


More information about the llvm-commits mailing list