This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen][Debuginfo][NFC] Refactor DIE values SizeOf method to not depend on AsmPrinter.
ClosedPublic

Authored by avl on Jan 11 2022, 1:02 AM.

Details

Summary

SizeOf() method of DIE values(unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const)
depends on AsmPrinter. AsmPrinter is too specific class here. This patch removes dependency
on AsmPrinter and use dwarf::FormParams structure instead. It allows calculate DIE values
size without using AsmPrinter. That refactoring is useful for D96035([dsymutil][DWARFlinker]
implement separate multi-thread processing for compile units.)

Diff Detail

Event Timeline

avl created this revision.Jan 11 2022, 1:02 AM
avl requested review of this revision.Jan 11 2022, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 11 2022, 1:02 AM
dblaikie accepted this revision.Jan 11 2022, 10:07 AM

Sounds good

This revision is now accepted and ready to land.Jan 11 2022, 10:07 AM
MaskRay added inline comments.Jan 11 2022, 11:14 AM
llvm/include/llvm/CodeGen/DIE.h
305

sizeOf - If you are going to change the signature, switch the case to stick with the function naming convention.

MaskRay added inline comments.Jan 11 2022, 11:16 AM
llvm/include/llvm/CodeGen/DIE.h
935–936

As you switch the case, make a minor change per
https://llvm.org/docs/CodingStandards.html#doxygen-use-in-documentation-comments
"Don’t duplicate the documentation comment in the header file and in the implementation file."

And remove the otherwise empty ///

936–937
avl updated this revision to Diff 399054.Jan 11 2022, 1:20 PM

addressed comments(renamed methods, corrected comments)

MaskRay accepted this revision.Jan 11 2022, 2:15 PM

One nit

llvm/include/llvm/BinaryFormat/Dwarf.h
654

I didn't check what this is. For newer code, DWARF vN is preferred over DwarfN.