aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/flagalloc.go
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2016-01-22 13:44:58 -0800
committerKeith Randall <khr@golang.org>2016-01-26 17:40:22 +0000
commit7b773946c09e075ed50c49e76e08f61c16616ee4 (patch)
tree05792f94cb8138779bd8ceadf019a6518770aff0 /src/cmd/compile/internal/ssa/flagalloc.go
parent733bf6ef67013b8410c51a72697c6fbff53ad30d (diff)
downloadgo-7b773946c09e075ed50c49e76e08f61c16616ee4.tar.gz
go-7b773946c09e075ed50c49e76e08f61c16616ee4.zip
[dev.ssa] cmd/compile: disable xor clearing when flags must be preserved
The x86 backend automatically rewrites MOV $0, AX to XOR AX, AX. That rewrite isn't ok when the flags register is live across the MOV. Keep track of which moves care about preserving flags, then disable this rewrite for them. On x86, Prog.Mark was being used to hold the length of the instruction. We already store that in Prog.Isize, so no need to store it in Prog.Mark also. This frees up Prog.Mark to hold a bitmask on x86 just like all the other architectures. Update #12405 Change-Id: Ibad8a8f41fc6222bec1e4904221887d3cc3ca029 Reviewed-on: https://go-review.googlesource.com/18861 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/flagalloc.go')
-rw-r--r--src/cmd/compile/internal/ssa/flagalloc.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/flagalloc.go b/src/cmd/compile/internal/ssa/flagalloc.go
index c088158057..f4e289e782 100644
--- a/src/cmd/compile/internal/ssa/flagalloc.go
+++ b/src/cmd/compile/internal/ssa/flagalloc.go
@@ -120,4 +120,9 @@ func flagalloc(f *Func) {
// standard regs, and it runs next.)
}
}
+
+ // Save live flag state for later.
+ for _, b := range f.Blocks {
+ b.FlagsLiveAtEnd = end[b.ID] != nil
+ }
}