[PATCH] D17321: DIEData, DIEWriter: introduce and begin migration.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 18:33:01 PST 2016


pcc created this revision.
pcc added reviewers: dblaikie, echristo, dexonsmith.
pcc added a subscriber: llvm-commits.

This patch introduces the DIEData class, which stores a sequence of DWARF
DIEs directly in the format in which they will be emitted to the object file
(i.e. bytes and relocations), together with the DIEWriter class, which is
used to add DIEs to a DIEData. The goal is to decrease memory consumption
in the DWARF emitter by migrating all DIE emission to go through these
classes instead of the current memory-inefficient DIE and DIEValue classes
(see mailing list thread [1]).

This patch also takes the first step towards migrating the DWARF emitter. It
introduces the necessary scaffolding for the migration in the form of the
ability for a DIE to use a DIEData-based representation, and replaces the
existing DWARF emission code for base types with code that uses DIEData.
To avoid a regression in memory consumption, I coded my changes to DIE to
avoid increasing its size.

A few notes on this patch:

- This doesn't add any support for relocations (other than symbol
  relocations) or insertions as mentioned in the thread, because they aren't
  needed to emit base types, and I wanted to make this first patch as simple
  as possible. Future patches will add this as needed.

- The way that the current DWARF hasher code works is by walking DIE entries.
  This won't work in the new world, so I've added a new mechanism for
  generating a hash from metadata. To get from a DIE to metadata, I store a
  reference to the MDNode in the DIE. I reckon that hashes will eventually
  be computed by walking MDNodes directly starting at a compilation unit or
  type, perhaps supplemented by additional information collected by walking
  the IR, so you can see how the current code might evolve into that.

  This code isn't very DRY, but I think we can address this as needed as we
  migrate more tags to DIEData.

- The old and new abbreviation emitter code don't interact except by
  choosing to use different abbreviation numbers (the old code uses odd
  numbers, the new code uses even numbers).

[1] http://lists.llvm.org/pipermail/llvm-dev/2016-February/094974.html

http://reviews.llvm.org/D17321

Files:
  include/llvm/CodeGen/DIE.h
  include/llvm/CodeGen/DIEData.h
  include/llvm/Support/Allocator.h
  lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
  lib/CodeGen/AsmPrinter/CMakeLists.txt
  lib/CodeGen/AsmPrinter/DIE.cpp
  lib/CodeGen/AsmPrinter/DIEData.cpp
  lib/CodeGen/AsmPrinter/DIEHash.cpp
  lib/CodeGen/AsmPrinter/DIEHash.h
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  lib/CodeGen/AsmPrinter/DwarfFile.cpp
  lib/CodeGen/AsmPrinter/DwarfFile.h
  lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  lib/CodeGen/AsmPrinter/DwarfUnit.h
  test/DebugInfo/X86/enum-class.ll
  test/DebugInfo/X86/fission-cu.ll
  test/DebugInfo/X86/linkage-name.ll
  test/DebugInfo/X86/low-pc-cu.ll
  test/DebugInfo/X86/pieces-2.ll
  test/DebugInfo/X86/pieces-3.ll
  unittests/CodeGen/CMakeLists.txt
  unittests/CodeGen/DIEDataTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17321.48139.patch
Type: text/x-patch
Size: 39197 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160217/3749831d/attachment.bin>


More information about the llvm-commits mailing list