feat: plan for register allocation + temp fix for 'E' not being printed

This commit is contained in:
2025-12-26 22:15:54 +01:00
parent 7f73b742c2
commit 3b8dfc4dae
3 changed files with 71 additions and 25 deletions

20
TODO.md Normal file
View File

@@ -0,0 +1,20 @@
0. Define how many physical regs are available, which are caller-saved and callee-saved
1. Implement if-else and while statements
2. Find out what use[B] and def[B] are for each block
3. Define successors and predecessors of each block and make them accessible
4. Compute liveIn[B] and liveOut[B] for each block
Classic equations:
liveIn[B] = use[B] (liveOut[B] - def[B])
liveOut[B] = liveIn[S] for S in succ[B]
5. Linear scan register allocation
- Instruction numbering + per-instruction liveness
- Live intervals
- Linear scan allocator with ~6 fake regs
- Spill to stack slots
- Add “CALL clobbers regs” rule