aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/deadcode.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2015-08-11 12:51:33 -0700
committerKeith Randall <khr@golang.org>2015-08-17 21:06:30 +0000
commit0b46b42943ee9d7ad4e9a19772d22468718173c9 (patch)
tree6e1a374e1ef13e8b88bf800833944afa8f3e7a15 /src/cmd/compile/internal/ssa/deadcode.go
parent759b9c3b80da47a8db59f015bfca551a2a15ae18 (diff)
downloadgo-0b46b42943ee9d7ad4e9a19772d22468718173c9.tar.gz
go-0b46b42943ee9d7ad4e9a19772d22468718173c9.zip
[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>
Diffstat (limited to 'src/cmd/compile/internal/ssa/deadcode.go')
-rw-r--r--src/cmd/compile/internal/ssa/deadcode.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/deadcode.go b/src/cmd/compile/internal/ssa/deadcode.go
index 109b3dd09f..8c306c8412 100644
--- a/src/cmd/compile/internal/ssa/deadcode.go
+++ b/src/cmd/compile/internal/ssa/deadcode.go
@@ -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