[PATCH] D45589: [DWARF] Defer emitting type units until the compile units are done.

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 15:05:03 PDT 2018


probinson added a comment.

In https://reviews.llvm.org/D45589#1066264, @dblaikie wrote:

> This would regress memory usage significantly - see r260578 / https://reviews.llvm.org/D17118 for more details. (17% decrease in memory usage when this was implemented)
>
> Could you explain more what would be problematic about emitting type units immediately in DWARF5?


Because compile units and type units go in the same section in DWARF5.  We can't serialize a type unit into the middle of a compile unit.  One or the other has to be deferred, and it was obviously simple to defer type units.  We could conditionalize the deferral on DWARF version but that just kicks the can down the road.

It might be interesting to see what happens if we erase the DwarfTypeUnit immediately after emitting it to MC in emitDebugTypes(), instead of letting it hang around.  That way we don't have two complete copies of all type units taking up redundant space.

Another potential solution would be to continue dumping the type units to what MC initially treats as separate sections, but then paste the types onto the end of the .debug_info instead of actually emitting separate sections.  That's monkeying with relatively low-level details of MC, though, and I was not sanguine about being able to do that smoothly.  I am pretty sure there are never references *into* the type units so we shouldn't have offsets/relocations to fix up, except maybe if the length computation is done using that sort of trickery.  Then the section-pasting code would have to DTRT to make those go away.

Other ideas?


Repository:
  rL LLVM

https://reviews.llvm.org/D45589





More information about the llvm-commits mailing list