This is an archive of the discontinued LLVM Phabricator instance.

[DebugInfo] [DWARFv5] Support for DW_AT_calling_convention for types
AbandonedPublic

Authored by vleschuk on Feb 25 2017, 7:26 AM.

Details

Summary

Add support for DW_AT_calling_convention attribute for C++ types (http://www.dwarfstd.org/ShowIssue.php?issue=141215.1). As recommended in DWARF issue this attribute uses DW_FORM_implicit_const to allow the producer to represent this attributes as compactly as possible. Code adds new field to DICompositeType class to encode calling convention, field is named ArgABI to match clang code naming. DW_CC_normal value is not emitted to DWARF output as absence of attribute is similar to its presence with DW_CC_normal.

Diff Detail

Event Timeline

vleschuk created this revision.Feb 25 2017, 7:26 AM
dblaikie added inline comments.Feb 27 2017, 10:10 AM
include/llvm/IR/DIBuilder.h
770–772

why does this attribute require a 'replace' API - generally all the values (including things like size/alignment) are provided up-front when the type is built, and do not require replacing/updating after that, if I recall/understand correctly.

aprantl edited edge metadata.Feb 27 2017, 1:31 PM

Thanks for working on this!

  • There also needs to be a bitcode upgrade test (using a .bc file generated by current LLVM trunk)
  • There also needs to be an IR llvm-as | llvm-dis | llvm-as | ... roundtrip test
  • This needs to be added to the metadata unit tests.
include/llvm/IR/DIBuilder.h
312

Please document the new argument.

319

Maybe call this CallingConvention?

331

comment

349

comment

lib/Bitcode/Reader/MetadataLoader.cpp
1130

Since there are only 2 bits necessary to encode the CC, we should just use some bits in Record[0] for this and save some space.

lib/Bitcode/Writer/BitcodeWriter.cpp
1500

See my comment in MetadataLoader.cpp

lib/CodeGen/AsmPrinter/DwarfUnit.cpp
973

Technically true, but I think there is no harm in emitting this attribute also in DWARF 4 or earlier. We usually only do this if the new attribute cannot be safely ignored by an older consumer.

probinson added inline comments.Feb 28 2017, 3:26 PM
lib/CodeGen/AsmPrinter/DwarfUnit.cpp
973

Actually DW_FORM_implicit_const is new in DWARF 5, and new FORMs cannot be used in prior-version DIEs. So, either we have to guard the entire attribute, or we have to conditionalize the FORM.

vleschuk abandoned this revision.Jul 29 2018, 11:07 PM