Added experimental register allocator (behind -ra flag) - #2
Open
vhelin wants to merge 19 commits into
Open
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Join-spill generation currently fails before spill offsets exist, and additional build, path-selection, and documentation issues remain.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds an experimental Z80 register allocator behind -ra, including spill handling, build integration, documentation, and extensive SMS regression coverage.
Changes:
- Implements register allocation, target policies, spills, reloads, and allocator CLI flags.
- Adds broad byte-level and diagnostic allocator tests.
- Updates build projects and test-runner path handling.
File summaries
| File | Description |
|---|---|
compiler/{register_allocator,z80_register_spill}.{c,h} |
Implements allocator core and Z80 spill support. |
compiler/{main,pass_4,pass_5,pass_6_z80,il,tac}.{c,h} |
Integrates allocation into compilation and code generation. |
compiler/{CMakeLists.txt,smakefile} |
Adds allocator sources to builds. |
windows/Compiler/Compiler.vcxproj* |
Adds allocator files to Visual Studio. |
tests/z80/sms/allocator_*/{makefile,main.ssc} |
Adds allocator regression and byte-output tests. |
tests/z80/sms/{calculations-1,calculations-2,move_sprite,change_colors}/* |
Exercises allocator behavior in larger programs. |
run_tests.sh |
Expands binary-path discovery. |
.gitignore |
Tracks test makefiles. |
README.md |
Documents the experimental feature. |
Review details
- Files reviewed: 294/406 changed files
- Comments generated: 3
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🔵 Needs a closer look
The extensive compiler backend, control-flow, spilling, and generated-code changes require final human validation across supported build environments.
Review details
- Files reviewed: 293/407 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # README.md # run_tests_with_sanitizers.sh
Co-authored-by: Cursor <cursoragent@cursor.com>
…ns, and keep multi-latch loops ambiguous. Restore the run_tests.sh execute bit and force LF on nameless test makefiles so Windows checkouts stay executable and Unix-text. Co-authored-by: Cursor <cursoragent@cursor.com>
CFG fallthrough after asm now reaches those writes; treating them like ineligible reads dropped the ARRAY_WRITE reload and failed every pipeline on allocator_ra_struct_pointer_increment. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
No description provided.