StrongerXi / soc

Compiler for a subset of OCaml
1 stars 0 forks source link

Simplify reg alloc #50

Closed StrongerXi closed 3 years ago

StrongerXi commented 3 years ago

Context: #45

Register allocator doesn't need to know about caller/callee-saved regs and call instruction.

Think about what a call instruction does (ignoring the control flow and operations in callee)

If we encode that in Vasm, register allocator automatically ensures that temps that live across a call instruction must be spilled or assigned to callee-saved regs, because caller-saved regs are written to in the call instruction (it will force spilling or any temp assigned to caller-saved reg).

This enables a much cleaner design.