aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/rewriteMIPS64.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2018-07-03 11:34:38 -0400
committerDavid Chase <drchase@google.com>2018-07-12 18:45:31 +0000
commit0029cd479e344e0fa6930331cf86e6f985508163 (patch)
tree79e951dc80efaad1863fe4bfc08ca06e727804b7 /src/cmd/compile/internal/ssa/rewriteMIPS64.go
parentbb364d49a9db585534aac965d1068bee0bda3054 (diff)
downloadgo-0029cd479e344e0fa6930331cf86e6f985508163.tar.gz
go-0029cd479e344e0fa6930331cf86e6f985508163.zip
cmd/compile: add LocalAddr that takes SP,mem operands
Lack of a well-defined order between VarDef and related address operations sometimes causes problems with store order and write barrier transformations; glitches in the order are made irreparable (by later optimizations) if the two parts of the glitch straddle a split in the original block caused by insertion of a write barrier diamond. Fix this by creating a LocalAddr for addresses of locals (what VarDef matters for) that takes a memory input to help make the order explicit. Addr is modified to only be legal for SB operand, so there is no overlap between Addr and LocalAddr uses (there may be some downstream cleanup from this). Changes to generic.rules and rewrite.go ensure that codegen tests continue to pass; CSE of LocalAddr is impaired, not quite sure of the cost. Fixes #26105. Change-Id: Id4192b4440aa4e9d7ba54a465c456df9b530b515 Reviewed-on: https://go-review.googlesource.com/122483 Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/rewriteMIPS64.go')
-rw-r--r--src/cmd/compile/internal/ssa/rewriteMIPS64.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS64.go b/src/cmd/compile/internal/ssa/rewriteMIPS64.go
index 084463a10f..9cd0050e26 100644
--- a/src/cmd/compile/internal/ssa/rewriteMIPS64.go
+++ b/src/cmd/compile/internal/ssa/rewriteMIPS64.go
@@ -253,6 +253,8 @@ func rewriteValueMIPS64(v *Value) bool {
return rewriteValueMIPS64_OpLess8U_0(v)
case OpLoad:
return rewriteValueMIPS64_OpLoad_0(v)
+ case OpLocalAddr:
+ return rewriteValueMIPS64_OpLocalAddr_0(v)
case OpLsh16x16:
return rewriteValueMIPS64_OpLsh16x16_0(v)
case OpLsh16x32:
@@ -2924,6 +2926,20 @@ func rewriteValueMIPS64_OpLoad_0(v *Value) bool {
}
return false
}
+func rewriteValueMIPS64_OpLocalAddr_0(v *Value) bool {
+ // match: (LocalAddr {sym} base _)
+ // cond:
+ // result: (MOVVaddr {sym} base)
+ for {
+ sym := v.Aux
+ _ = v.Args[1]
+ base := v.Args[0]
+ v.reset(OpMIPS64MOVVaddr)
+ v.Aux = sym
+ v.AddArg(base)
+ return true
+ }
+}
func rewriteValueMIPS64_OpLsh16x16_0(v *Value) bool {
b := v.Block
_ = b