feat/linear scan register allocator#376
Merged
Merged
Conversation
nahime0
commented
Jun 16, 2026
Member
- docs: rewrite eir-06 plan for full linear-scan register allocator
- feat(ir_passes): implement liveness analysis for EIR functions
- feat(ir_passes): build linear-order live intervals from liveness
- feat(ir_passes): linear-scan allocator core with int/float pools and spilling
- feat(codegen_ir): wire linear-scan allocator into EIR backend behind --regalloc
- docs: document linear-scan register allocation in the-ir.md
- fix(ir_passes): restrict x86_64 allocation pool to rbx
- docs: mark linear-scan register allocator complete in ROADMAP
…--regalloc Default to the linear-scan register allocator with callee-saved preservation; --regalloc=stack (or ELEPHC_REGALLOC=stack) selects the spill-everything fallback. Value-access chokepoints become allocation-aware, prologue/epilogue save and restore used callee-saved registers, and emit_reg_move handles GP<->FP moves. Full codegen suite passes under both modes on macOS aarch64.
r14/r15 are used as scratch by hand-written x86_64 runtime routines and shared heap-marker codegen without ABI-compliant save/restore, so values held there across calls get corrupted (observed as heap exhaustion in spread/variadic tests). Only rbx is reliably preserved. Full codegen suite now passes on Linux x86_64, Linux aarch64, and macOS aarch64.
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.