-
Notifications
You must be signed in to change notification settings - Fork 98
MIR Codegen: Phi Elimination Pass #695
Copy link
Copy link
Open
Labels
A-codegenArea: code generation and MIRArea: code generation and MIRC-enhancementCategory: an issue proposing an enhancement or a PR with oneCategory: an issue proposing an enhancement or a PR with oneE-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
Metadata
Metadata
Assignees
Labels
A-codegenArea: code generation and MIRArea: code generation and MIRC-enhancementCategory: an issue proposing an enhancement or a PR with oneCategory: an issue proposing an enhancement or a PR with oneE-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.Call for participation: Medium difficulty. Experience needed to fix: Intermediate.
Summary
Remove phi nodes from SSA MIR and convert to an assignment form suitable for stack allocation, using parallel copy insertion and coalescing.
Parent issue: #687
Context
SSA form uses φ (phi) nodes to merge values at control flow join points. The EVM has no direct equivalent—we need to convert phis into explicit move/copy instructions inserted at block boundaries.
Example:
Tasks
Parallel copy insertion
P:phi_result := incoming_from_PP(before terminator)Parallel copy resolution
Moveinstructionsa, b = b, aneeds a temp)Phi removal
Patterns to follow
From Sonatina:
From Venom:
Acceptance Criteria
Phiinstructions post-passEstimated Complexity
Medium - Well-understood algorithm, but cycle handling requires care
Dependencies