llvm-project
770a1fe3 - [DebugInfo][FLMD] Add printing support for FLDebugLoc+DIDbgLoc

Commit
1 day ago
[DebugInfo][FLMD] Add printing support for FLDebugLoc+DIDbgLoc This patch follows up on the preceding patch by adding support for printing FLDebugLoc as an attachment `!!dbgLoc(...)` for instructions and debug records, and for printing DIDbgLoc nodes which contain a !!dbgLoc operand. A major component of this patch is the addition of a "DebugLoc conversion" layer, which allows for conversion between DILocation and FLDebugLoc formats. This is currently only used for converting DILocation->FLDebugLoc for printing, but provides a common mechanism that will later be used for FLDebugLoc<->DILocation conversion for printing+parsing, switching between the two depending on which format is currently being used in-memory. Due to the constraint of needing to support consistent conversions at different points in time (primarily for MIR printing and lazy bitcode materialization), some information is stored in the LLVMContext, including a third representation of source location information, stored in a format which is easy to convert to/from either existing format. Use of this conversion layer is expensive, but for the most part I expect this to be used almost exclusively for testing, and otherwise for reading old bitcode (which is a case we may optimize for later). We also support two printing options: --print-fl-debug-locs=on, and --print-fl-debug-locs=expanded. The former is the "standard" form, which prints each !!dbgLoc with its index and atom values. The latter is a form that emphasizes readability/editability by printing the SrcLoc contents in-line, e.g. `!!dbgLoc(line: 4, scope: !4, ...)` instead of `!!dbgLoc(srcLoc: 2)`. This is more complicated to parse, but may be useful for testing or inspecting IR.
Author
Committer
Parents
Loading