[flang-commits] [clang] [flang] [flang][draft] Improve debug info generation. (PR #84202)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Thu Mar 7 03:51:05 PST 2024


tblah wrote:

Thank you for this patch! I like the approach so far using the existing debug pass.

My gut feeling is that I would rather this happen in a pass rather than earlier on (lowering or even semantics) because lowering is already too complicated and monolithic. In the past it has proven useful to break down complicated lowering steps into smaller pieces by self-contained passes (e.g. the transition from AST->FIR to AST->HLFIR->FIR). But I don't have any concrete examples - perhaps this won't be so difficult as I suspect, so I am open to other approaches.

>  1. Some of the location information is difficult to extract from FIR. For example, the location where derived types and its members are declared in the source is not available (or at least I could not figure out how to get them).
>  2. Things like fortran module is not a first class entity in IR. One can extract its name from the unique name of the type or variable but this is not ideal.

I would lean towards adding the information you need to (HL)FIR.

Location information is just a kind of attribute on an operation. I presume one could use additional location attributes to store the information you need in (HL)FIR. I'm not super familiar with derived types in FIR, but perhaps `fir.type_info` could be used/extended for this?

Similarly, perhaps the solution for a module would be to add a string attribute naming the module.

As Kiran said, it would be good to seek a wider discussion on this - either in review of a design document and/or in an RFC on https://discourse.llvm.org/c/subprojects/flang/33

https://github.com/llvm/llvm-project/pull/84202


More information about the flang-commits mailing list