Implement initial spilling algorithm for RISC-V#5775
Draft
anominos wants to merge 27 commits into
Draft
Conversation
cf6e2af to
f45777d
Compare
- load/store/alloca ops with stackptrtype
- allows from xdsl.dialects import riscv; riscv.stack.AllocaOp
f45777d to
7a4f8ce
Compare
superlopuh
reviewed
Apr 14, 2026
Riscv stack dialect
2addb72 to
58c057c
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5775 +/- ##
==========================================
+ Coverage 86.39% 86.54% +0.14%
==========================================
Files 421 425 +4
Lines 60923 61713 +790
Branches 6991 7081 +90
==========================================
+ Hits 52637 53412 +775
- Misses 6706 6711 +5
- Partials 1580 1590 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR, we add a pass that performs register spilling within a basic block for the RISC-V dialect.
We first perform a liveness analysis on the block, maintaining a live set at each operation, and inserting custom spill and load ops where necessary. Then we convert the custom spills and loads into the corresponding RISC-V memory ops in a second pass.
This PR assumes all values are 32 bit integers and does not implement any spilling heuristics.