Sounio Compiler MIR
Overview
Make safe, SSA-aware performance improvements in MIR without breaking semantics.
Workflow
1) Orient in the MIR stack
- •Read
docs/MIR_OPTIMIZATION_STRATEGY.mdfor the intended pass roadmap. - •Use
references/mir-navigation.mdto jump to the right module quickly.
2) When editing an existing pass (e.g., CSE)
- •Confirm effect/purity assumptions:
- •Treat
Call/CallIndirectas effectful unless proven pure. - •Treat
Loadas unsafe for CSE without alias info (current CSE is conservative).
- •Treat
- •Preserve SSA invariants (or mark
preserves_ssa()false and re-establish SSA).
3) When adding a new MIR pass
- •Implement the pass under
compiler/src/mir/optimization/. - •Export it in
compiler/src/mir/optimization/mod.rs. - •Register it in
compiler/src/mir/optimization/pass_manager.rsif it’s in the default pipeline. - •Add focused unit tests close to the pass (see existing pass tests).
References
- •MIR map + entry points:
references/mir-navigation.md - •New-pass checklist:
references/pass-checklist.md