[PATCH] D27170: Abstract almost all DwarfDebug out of the classes in DIE.cpp.

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 10:01:23 PST 2016


clayborg created this revision.
clayborg added reviewers: dblaikie, aprantl, probinson, llvm-commits.

This change removes the dependency on DwarfDebug that was used for DW_FORM_ref_addr by making a new DIEUnit class in DIE.cpp.

The DIEUnit class represents a compile or type unit and it owns the unit DIE as an instance variable. This allows anyone with a DIE, to get the unit DIE, and then get back to its DIEUnit without adding any new ivars to the DIE class. Why was this needed? The DIE class has an Offset that is always the CU relative DIE offset, not the "offset in debug info section" as was commented in the header file (the comment has been corrected). This is great for performance because most DIE references are compile unit relative and this means most code that accessed the DIE's offset didn't need to make it into a compile unit relative offset because it already was. When we needed to emit a DW_FORM_ref_addr though, we needed to find the absolute offset of the DIE by finding the DIE's compile/type unit. This class did have the absolute debug info/type offset and could be added to the CU relative offset to compute the absolute offset. With this change we can easily get back to a DIE's DIEUnit which will have this needed offset. Prior to this is required having a DwarfDebug and required calling:

  DwarfCompileUnit *DwarfDebug::lookupUnit(const DIE *CU) const;

Now we can use the DIEUnit class to do so without needing DwarfDebug. All clients now use DIEUnit objects (the DwarfDebug stack and the DwarfLinker). A follow on patch for the DWARF generator will also take advantage of this.


https://reviews.llvm.org/D27170

Files:
  include/llvm/CodeGen/DIE.h
  include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
  lib/CodeGen/AsmPrinter/DIE.cpp
  lib/CodeGen/AsmPrinter/DwarfAccelTable.cpp
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  lib/CodeGen/AsmPrinter/DwarfDebug.h
  lib/CodeGen/AsmPrinter/DwarfFile.cpp
  lib/CodeGen/AsmPrinter/DwarfUnit.cpp
  lib/CodeGen/AsmPrinter/DwarfUnit.h
  tools/dsymutil/DwarfLinker.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27170.79418.patch
Type: text/x-patch
Size: 25243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161128/195c2db9/attachment.bin>


More information about the llvm-commits mailing list