Summary
Preserve Forth source locations on MLIR ops through translation and conversion so compile failures and debug dumps point at the offending word/line, not only opaque lowered IR.
Motivation
The parser has SMLoc / emitErrorAt for many syntax and control-flow errors. After lowering, pipeline failures and miscompiles are harder to attribute: stack/MemRef ops often lack useful FusedLoc / file-line mapping back to the .forth line.
For a stack language, “which word under/overflowed or lowered wrong?” is essential DX.
Proposed work
- Attach
FileLineColLoc (or equivalent) to every emitted forth.* op at parse time
- Ensure conversion patterns propagate locations to new arith/memref/gpu ops (
rewriter uses op.getLoc() consistently — audit and fix gaps)
warpforthc dumps: --debug-ir-after=convert-forth-to-memref style using standard MLIR pass instrumentation
- Optional: print caret diagnostics for pipeline failures when locations remain
Acceptance criteria
Related
Summary
Preserve Forth source locations on MLIR ops through translation and conversion so compile failures and debug dumps point at the offending word/line, not only opaque lowered IR.
Motivation
The parser has
SMLoc/emitErrorAtfor many syntax and control-flow errors. After lowering, pipeline failures and miscompiles are harder to attribute: stack/MemRef ops often lack usefulFusedLoc/ file-line mapping back to the.forthline.For a stack language, “which word under/overflowed or lowered wrong?” is essential DX.
Proposed work
FileLineColLoc(or equivalent) to every emittedforth.*op at parse timerewriterusesop.getLoc()consistently — audit and fix gaps)warpforthcdumps:--debug-ir-after=convert-forth-to-memrefstyle using standard MLIR pass instrumentationAcceptance criteria
loc(in dump if stable)warpforthcsupports IR dumping at stage boundaries (pass manager cl options wired or documented)Related