Skip to content

Document the RWM pipeline passes#92

Open
leonardoalt wants to merge 10 commits intomainfrom
update-docs-rwm-pipeline
Open

Document the RWM pipeline passes#92
leonardoalt wants to merge 10 commits intomainfrom
update-docs-rwm-pipeline

Conversation

@leonardoalt
Copy link
Copy Markdown
Member

Summary

  • Add detailed markdown documentation for each pass in the read-write registers pipeline: liveness analysis, register allocation, flattening (with parallel copy sequencing), and jump removal
  • Add a pipeline overview document (PIPELINE.md) with an ASCII stage diagram linking to all pass docs

Test plan

  • Review documentation accuracy against source code
  • Verify all internal cross-references between documents are correct

🤖 Generated with Claude Code

Add comprehensive markdown documentation for each pass in the
read-write registers pipeline: liveness analysis, register allocation,
flattening (including parallel copy sequencing), and jump removal.
Also add a pipeline overview document linking them together.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lvella
Copy link
Copy Markdown
Member

lvella commented Feb 11, 2026

Why only RWM passes gets documented?

@lvella
Copy link
Copy Markdown
Member

lvella commented Feb 11, 2026

I am still reviewing the text, but this is very prone to become stale...

@leonardoalt
Copy link
Copy Markdown
Member Author

Why only RWM passes gets documented?

Because it's the main backend atm

Comment thread src/loader/rwm/FLATTENING.md Outdated
Comment thread src/loader/rwm/FLATTENING.md Outdated
Comment on lines +111 to +116
### Correctness Guarantee

Every destination register appears exactly once (precondition). The algorithm
produces a valid sequential ordering that achieves the same effect as executing all
copies simultaneously. At most one temporary register is needed, and it is avoided
entirely when the copy graph is acyclic or has trees attached to cycles.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is superfluous since no proof is provided.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's still useful as a document about what's supposed to be guaranteed?

Comment thread src/loader/rwm/FLATTENING.md Outdated
Comment thread src/loader/rwm/JUMP_REMOVAL.md Outdated
Comment thread src/loader/rwm/JUMP_REMOVAL.md Outdated
Comment thread src/loader/rwm/REGISTER_ALLOCATION.md Outdated
Comment thread src/loader/rwm/REGISTER_ALLOCATION.md Outdated
Comment thread src/loader/rwm/REGISTER_ALLOCATION.md Outdated
@lvella
Copy link
Copy Markdown
Member

lvella commented Feb 12, 2026

Why only RWM passes gets documented?

Because it's the main backend atm

But the common passes are also part of RWM.

Co-authored-by: Lucas Clemente Vella <lvella@powdrlabs.com>
@leonardoalt
Copy link
Copy Markdown
Member Author

I am still reviewing the text, but this is very prone to become stale...

we can keep update it once in a while

@leonardoalt
Copy link
Copy Markdown
Member Author

But the common passes are also part of RWM.

Let's add that too then.

leonardoalt and others added 8 commits February 20, 2026 15:13
Co-authored-by: Lucas Clemente Vella <lvella@powdrlabs.com>
Co-authored-by: Lucas Clemente Vella <lvella@powdrlabs.com>
Co-authored-by: Lucas Clemente Vella <lvella@powdrlabs.com>
Co-authored-by: Lucas Clemente Vella <lvella@powdrlabs.com>
Co-authored-by: Lucas Clemente Vella <lvella@powdrlabs.com>
Co-authored-by: Lucas Clemente Vella <lvella@powdrlabs.com>
Co-authored-by: Lucas Clemente Vella <lvella@powdrlabs.com>
Add documentation for each pass in the shared frontend pipeline,
following the same style as the existing RWM pipeline docs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lvella lvella self-assigned this Feb 25, 2026
Comment on lines +118 to +120
- Break targets are resolved relative to frame boundaries, not block nesting.
This is important because the backends allocate registers per-frame (per
function or per loop body), not per-block.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't understand this paragraph. I suggest removing it.

Comment on lines +41 to +42
The pass simulates WASM execution using two structures that track where each
value lives:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The pass simulates WASM execution using two structures that track where each
value lives:
The pass statically resolves the WASM stack evolution using two structures that
track where each value lives:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants