733 B
733 B
- Define how many physical regs are available, which are caller-saved and callee-saved
- Implement if-else and while statements
- Find out what use[B] and def[B] are for each block
- Define successors and predecessors of each block and make them accessible
- 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
function's reserved registers: EAX, ECX, EDX
return registers: int => EAX float => ST0