This is an archive of the discontinued LLVM Phabricator instance.

[DWARFv5] Put DWO ID in its place
ClosedPublic

Authored by probinson on May 21 2018, 1:43 PM.

Details

Summary

In v5, the DWO ID is in the (split/skeleton) CU header, not an attribute
on the CU DIE.

This makes header sizes more different, so used the parsed size whenever
we have one, for simplicity.

Diff Detail

Event Timeline

probinson created this revision.May 21 2018, 1:43 PM

Contrary to my usual practice, I did the emission and reading parts in the same patch, it was just easier to manage that way.
I could probably do the use-the-parsed-size stuff as a separate NFC if people want, but it didn't seem like that big a deal.

Seems reasonable to me.

llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
64

This is probably a silly micro-optimization, but for better packing we could move the DWOId here (assuming that it is 9 bytes large on a 64-bit architecture). Alternatively: is 0 a valid DWOId?

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
86

///

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
572
// No DWO ID?
continue;
probinson added inline comments.May 21 2018, 2:59 PM
llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
64

LLVM generates DWOId using MD5, so in principle yes 0 is a valid ID. I can move it; didn't think about it occupying +1 byte.

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
86

This header is inconsistent (might be nice to tidy that up someday) but sure.

llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
572

Would it then be multiline and require braces? :-)
Sure.

JDevlieghere accepted this revision.May 22 2018, 3:13 AM

LGTM

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
227

Nit: This looks a little awkward. I probably would've moved the ternary operator into a separate variable and used that in the return DwarfUnit::getHeaderSize() + DwoIDSize;

This revision is now accepted and ready to land.May 22 2018, 3:13 AM
This revision was automatically updated to reflect the committed changes.
probinson marked 4 inline comments as done.

Addressed review comments prior to commit.