[dev.ssa] cmd/compile/internal/ssa: New register allocator

Implement a global (whole function) register allocator.
This replaces the local (per basic block) register allocator.

Clobbering of registers by instructions is handled properly.
A separate change will add the correct clobbers to all the instructions.

Change-Id: I38ce4dc7dccb8303c1c0e0295fe70247b0a3f2ea
Reviewed-on: https://go-review.googlesource.com/13622
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Todd Neal <todd@tneal.org>
This commit is contained in:
Keith Randall 2015-08-11 12:51:33 -07:00
parent 759b9c3b80
commit 0b46b42943
12 changed files with 1447 additions and 750 deletions

View file

@ -59,6 +59,14 @@ func findlive(f *Func) (reachable []bool, live []bool) {
// deadcode removes dead code from f.
func deadcode(f *Func) {
// deadcode after regalloc is forbidden for now. Regalloc
// doesn't quite generate legal SSA which will lead to some
// required moves being eliminated. See the comment at the
// top of regalloc.go for details.
if f.RegAlloc != nil {
f.Fatalf("deadcode after regalloc")
}
reachable, live := findlive(f)
// Remove dead values from blocks' value list. Return dead