aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/rewriteWasm.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2019-10-30 10:29:47 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2020-03-02 16:24:47 +0000
commitd7c073ecbfc3ecc506bfc753b271973b47f8bc15 (patch)
tree758702abba542e9b9c72a178e8ec34954e136fe5 /src/cmd/compile/internal/ssa/rewriteWasm.go
parentab7ecea0c8dff908dfcad8c9091b71c6051bb94a (diff)
downloadgo-d7c073ecbfc3ecc506bfc753b271973b47f8bc15.tar.gz
go-d7c073ecbfc3ecc506bfc753b271973b47f8bc15.zip
cmd/compile: add specialized Value reset for OpCopy
This: * Simplifies and shortens the generated code for rewrite rules. * Shrinks cmd/compile by 86k (0.4%) and makes it easier to compile. * Removes the stmt boundary code wrangling from Value.reset, in favor of doing it in the one place where it actually does some work, namely the writebarrier pass. (This was ascertained by inspecting the code for cases in which notStmtBoundary values were generated.) Passes toolstash-check -all. Change-Id: I25671d4c4bbd772f235195d11da090878ea2cc07 Reviewed-on: https://go-review.googlesource.com/c/go/+/221421 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/rewriteWasm.go')
-rw-r--r--src/cmd/compile/internal/ssa/rewriteWasm.go60
1 files changed, 15 insertions, 45 deletions
diff --git a/src/cmd/compile/internal/ssa/rewriteWasm.go b/src/cmd/compile/internal/ssa/rewriteWasm.go
index 81acd7e7c4..4b100b6c32 100644
--- a/src/cmd/compile/internal/ssa/rewriteWasm.go
+++ b/src/cmd/compile/internal/ssa/rewriteWasm.go
@@ -1853,9 +1853,7 @@ func rewriteValueWasm_OpMove(v *Value) bool {
break
}
mem := v_2
- v.reset(OpCopy)
- v.Type = mem.Type
- v.AddArg(mem)
+ v.copyOf(mem)
return true
}
// match: (Move [1] dst src mem)
@@ -3099,9 +3097,7 @@ func rewriteValueWasm_OpSignExt16to32(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (SignExt16to32 x)
@@ -3143,9 +3139,7 @@ func rewriteValueWasm_OpSignExt16to64(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (SignExt16to64 x)
@@ -3187,9 +3181,7 @@ func rewriteValueWasm_OpSignExt32to64(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (SignExt32to64 x)
@@ -3231,9 +3223,7 @@ func rewriteValueWasm_OpSignExt8to16(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (SignExt8to16 x)
@@ -3275,9 +3265,7 @@ func rewriteValueWasm_OpSignExt8to32(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (SignExt8to32 x)
@@ -3319,9 +3307,7 @@ func rewriteValueWasm_OpSignExt8to64(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (SignExt8to64 x)
@@ -3596,9 +3582,7 @@ func rewriteValueWasm_OpWasmI64AddConst(v *Value) bool {
break
}
x := v_0
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (I64AddConst [off] (LoweredAddr {sym} [off2] base))
@@ -4350,9 +4334,7 @@ func rewriteValueWasm_OpZero(v *Value) bool {
break
}
mem := v_1
- v.reset(OpCopy)
- v.Type = mem.Type
- v.AddArg(mem)
+ v.copyOf(mem)
return true
}
// match: (Zero [1] destptr mem)
@@ -4610,9 +4592,7 @@ func rewriteValueWasm_OpZeroExt16to32(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (ZeroExt16to32 x)
@@ -4638,9 +4618,7 @@ func rewriteValueWasm_OpZeroExt16to64(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (ZeroExt16to64 x)
@@ -4666,9 +4644,7 @@ func rewriteValueWasm_OpZeroExt32to64(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (ZeroExt32to64 x)
@@ -4694,9 +4670,7 @@ func rewriteValueWasm_OpZeroExt8to16(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (ZeroExt8to16 x)
@@ -4722,9 +4696,7 @@ func rewriteValueWasm_OpZeroExt8to32(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (ZeroExt8to32 x)
@@ -4750,9 +4722,7 @@ func rewriteValueWasm_OpZeroExt8to64(v *Value) bool {
break
}
_ = x.Args[1]
- v.reset(OpCopy)
- v.Type = x.Type
- v.AddArg(x)
+ v.copyOf(x)
return true
}
// match: (ZeroExt8to64 x)