diff options
author | David Chase <drchase@google.com> | 2018-07-03 11:34:38 -0400 |
---|---|---|
committer | David Chase <drchase@google.com> | 2018-07-12 18:45:31 +0000 |
commit | 0029cd479e344e0fa6930331cf86e6f985508163 (patch) | |
tree | 79e951dc80efaad1863fe4bfc08ca06e727804b7 /src/cmd/compile/internal/ssa/rewriteMIPS.go | |
parent | bb364d49a9db585534aac965d1068bee0bda3054 (diff) | |
download | go-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/rewriteMIPS.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/rewriteMIPS.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS.go b/src/cmd/compile/internal/ssa/rewriteMIPS.go index c101e91636..231949644e 100644 --- a/src/cmd/compile/internal/ssa/rewriteMIPS.go +++ b/src/cmd/compile/internal/ssa/rewriteMIPS.go @@ -213,6 +213,8 @@ func rewriteValueMIPS(v *Value) bool { return rewriteValueMIPS_OpLess8U_0(v) case OpLoad: return rewriteValueMIPS_OpLoad_0(v) + case OpLocalAddr: + return rewriteValueMIPS_OpLocalAddr_0(v) case OpLsh16x16: return rewriteValueMIPS_OpLsh16x16_0(v) case OpLsh16x32: @@ -2511,6 +2513,20 @@ func rewriteValueMIPS_OpLoad_0(v *Value) bool { } return false } +func rewriteValueMIPS_OpLocalAddr_0(v *Value) bool { + // match: (LocalAddr {sym} base _) + // cond: + // result: (MOVWaddr {sym} base) + for { + sym := v.Aux + _ = v.Args[1] + base := v.Args[0] + v.reset(OpMIPSMOVWaddr) + v.Aux = sym + v.AddArg(base) + return true + } +} func rewriteValueMIPS_OpLsh16x16_0(v *Value) bool { b := v.Block _ = b |