Repository navigation
Description
Summary
Full device debug metadata currently supports variable locations that can be described from a single SSA value or a statically projected address.
Some source-level variable locations, however, depend on multiple runtime SSA values. A runtime-indexed projection is the motivating example:
*(base + index * stride)
LLVM represents these locations with a DIArgList and a DIExpression containing DW_OP_LLVM_arg selectors.
This issue tracks the generic multi-value debug-location infrastructure needed to represent and export those expressions.
Part of #226.
Motivation
Static projections can be represented with fixed byte offsets, but runtime-dependent locations cannot be encoded with DW_OP_plus_uconst alone.
For example, a runtime array projection requires both:
- the base address
- the runtime index value
and a location expression equivalent to:
base + index * stride
The debug pipeline therefore needs a way to carry multiple ordered SSA operands together with a typed location expression.
Proposed scope
-
add a MIR debug marker carrying multiple ordered SSA values
-
preserve the marker through MIR-to-LLVM lowering
-
add an LLVM-export marker carrying the same ordered operands
-
introduce a typed representation for the required debug-expression operations
-
export multi-value locations as:
llvm.dbg.value( metadata !DIArgList(...), metadata !<variable>, metadata !DIExpression(...) ) -
support the initial expression operations required for computed addresses:
DW_OP_LLVM_argDW_OP_constuDW_OP_plusDW_OP_plus_uconstDW_OP_mulDW_OP_derefDW_OP_stack_value
-
reject invalid operand references and malformed multi-value locations
-
validate emitted IR with
llvm-as
Non-goals
This issue does not yet add Rust MIR ProjectionElem::Index translation.
Runtime-indexed array projections will be implemented separately on top of this infrastructure.
It also does not:
- migrate existing debug intrinsics to LLVM debug records
- add slice or subslice projections
- add fat-pointer projections
- add multiple runtime-index projections
- change existing single-value debug-location behavior
Acceptance criteria
- multi-value debug operands survive MIR-to-LLVM lowering in order
- typed debug expressions survive lowering unchanged
- LLVM export emits
DIArgList DW_OP_LLVM_argreferences are bounds-checked- generated multi-value debug IR parses successfully with
llvm-as - existing debug-info behavior remains unchanged
- relevant unit tests and workspace Clippy remain green
Activity
[-]Support multi-value debug locations for computed variable locations[/-][+]Support multi-value debug locations for computed variables[/+][-]Support multi-value debug locations for computed variables[/-][+]Support multi-value debug locations for runtime-computed variables[/+]