StrongerXi / soc

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

Fix arg temp immutability #38

Closed StrongerXi closed 3 years ago

StrongerXi commented 3 years ago

Issue

In X86, special purpose temps used for argument passing are mutable, thus we can't use them directly as argument temps inherited from Lir's function.

Solution

This ensures immutability of argument temps. Essentially, the argument passing temps are write-only after the initial loads. In fact, only special purpose temps (e.g., rax) are modifiable, but since they are generated by X86, we have the guarantee that all temps from Lir are immutable, i.e., all variables in source program are immutable.