by UniQP · 10y ago · 0 comments
I missed some references to corresponding papers in the source code. For instance, is the register allocator an implementation of "Linear Scan Register Allocation on SSA Form" [2]?
Also some facts mention in comments [3] are a bit scary but I guess this will be resolved over time.
[1] http://pp.ipd.kit.edu/firm/
[2] http://www.christianwimmer.at/Publications/Wimmer10a/Wimmer1...
[3] https://github.com/golang/go/blob/master/src/cmd/compile/int...
It happens that LLVM does instruction selection and scheduling on SSA but not regalloc (it does phi elimination before regalloc, though uses ssa based liveness info in regalloc)
My take: Who cares? If someone wants to make register allocation SSA based, and demonstrates code or speed or maintenance or whatever benefits, great.
There are theoretical benefits, but in practice, LLVM does pretty well with it's current scheme.
Because of this, it's not really near the top of any todo list, nor should it be.
libfirm never goes out of SSA (since it uses a graph-based representation it's simply impossible: the data dependency edges need one target). It converts the programm to CSSA and assigns the same register to all phi operands. When finally emitting the program, phi nodes emit nothing.
I think having a decoupled spilling phase is nice feature of the SSA-based scheme. However, I don't say that LLVM (or GCC) should switch to the SSA-based scheme. I just appreciate that the Go compiler switched to the SSA-based scheme, because it may bring some new insights to the research community.