This is an archive of the discontinued LLVM Phabricator instance.

[CodeView] Fortran debug info emission in Code View.
ClosedPublic

Authored by cchen15 on Oct 29 2021, 8:52 AM.

Details

Summary

The change set covers the following four areas:

  1. Handling DIStringType with SizeInBits field. DIStringType is used to encode Fortran character types.
  2. Emitting the proper offset for a DIGlobalVariable with a constant offset encoded in the DIExpression field of its DIGlobalVariableExpression.
  3. Handling array count based on the LowerBound field of a DISubrange.
  4. Emitting the name of a DIGlobalVariable without scoping info for Fortran.

Diff Detail

Event Timeline

cchen15 created this revision.Oct 29 2021, 8:52 AM
cchen15 requested review of this revision.Oct 29 2021, 8:52 AM
Herald added a project: Restricted Project. · View Herald Transcript
cchen15 retitled this revision from [DebugInfo] Fortran debug info emission in Code View. to [CodeView] Fortran debug info emission in Code View..Oct 29 2021, 8:58 AM
rnk added inline comments.Nov 1 2021, 1:40 PM
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
1667–1687

Similarly, please put the lowerTypeString implementation here.

2409–2411

This can be simplified to return TypeTable.writeLeafType(AR);.

llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
409–410

This is a bit nitty, but I place the new declaration here after lowerTypeArray, since that's the most related code, not the composite type handling code.

llvm/test/DebugInfo/fortran-basic.ll
1 ↗(On Diff #383377)

Do you find the output of llvm-pdbutil dump -symbols -types more readable in this case? If so, I recommend it over llvm-readobj. It is more FileCheck-friendly because the CHECK lines that match the type indexes contain more disambiguating context.

cchen15 updated this revision to Diff 384057.Nov 2 2021, 6:20 AM

Addresses formatting issues and comments from Reid. Thanks, Reid!

cchen15 marked 2 inline comments as done.Nov 2 2021, 6:20 AM
cchen15 added inline comments.Nov 2 2021, 6:23 AM
llvm/test/DebugInfo/fortran-basic.ll
1 ↗(On Diff #383377)

For this test, I don't have a preference one way or the other between the outputs from readobj and pdbutil. I am keep it as is. If you feel strongly about using pdbutil's output, please let me know and I will make the change. Thanks again.

cchen15 marked an inline comment as done.Nov 2 2021, 6:46 AM

The Windows build seems to be broken by this commit in mlir:

rG1ca35fc89e68: [mlir][linalg][bufferize] Move BufferizableOpInterface implementations

rnk accepted this revision.Nov 2 2021, 10:00 AM

lgtm, thanks!

Regarding the Windows build, if it isn't reverted or fixed soon, I think the LLVM tests are sufficient. You could disable MLIR and test LLVM in isolation.

This revision is now accepted and ready to land.Nov 2 2021, 10:00 AM

Thanks!

FYI: I did check-llvm for both before and after my changes, and the results matched (with the same 9 failed tests).

This revision was landed with ongoing or failed builds.Nov 2 2021, 12:06 PM
This revision was automatically updated to reflect the committed changes.