mirror of
https://github.com/golang/go
synced 2024-11-17 15:54:39 -07:00
cmd/compile: add specialized AddArgN functions for rewrite rules
This shrinks the compiler without impacting performance. (The performance-sensitive part of rewrite rules is the non-match case.) Passes toolstash-check -all. Executable size: file before after Δ % compile 20356168 20163960 -192208 -0.944% total 115599376 115407168 -192208 -0.166% Text size: file before after Δ % cmd/compile/internal/ssa.s 3928309 3778774 -149535 -3.807% total 18862943 18713408 -149535 -0.793% Memory allocated compiling package SSA: SSA 12.7M ± 0% 12.5M ± 0% -1.74% (p=0.008 n=5+5) Compiler speed impact: name old time/op new time/op delta Template 211ms ± 1% 211ms ± 2% ~ (p=0.832 n=49+49) Unicode 82.8ms ± 2% 83.2ms ± 2% +0.44% (p=0.022 n=46+49) GoTypes 726ms ± 1% 728ms ± 2% ~ (p=0.076 n=46+48) Compiler 3.39s ± 2% 3.40s ± 2% ~ (p=0.633 n=48+49) SSA 7.71s ± 1% 7.65s ± 1% -0.78% (p=0.000 n=45+44) Flate 134ms ± 1% 134ms ± 1% ~ (p=0.195 n=50+49) GoParser 167ms ± 1% 167ms ± 1% ~ (p=0.390 n=47+47) Reflect 453ms ± 3% 452ms ± 2% ~ (p=0.492 n=48+49) Tar 184ms ± 3% 184ms ± 2% ~ (p=0.862 n=50+48) XML 248ms ± 2% 248ms ± 2% ~ (p=0.096 n=49+47) [Geo mean] 415ms 415ms -0.03% name old user-time/op new user-time/op delta Template 273ms ± 1% 273ms ± 2% ~ (p=0.711 n=48+48) Unicode 117ms ± 6% 117ms ± 5% ~ (p=0.633 n=50+50) GoTypes 972ms ± 2% 974ms ± 1% +0.29% (p=0.016 n=47+49) Compiler 4.46s ± 6% 4.51s ± 6% ~ (p=0.093 n=50+50) SSA 10.4s ± 1% 10.3s ± 2% -0.94% (p=0.000 n=45+50) Flate 166ms ± 2% 167ms ± 2% ~ (p=0.148 n=49+48) GoParser 202ms ± 1% 202ms ± 2% -0.28% (p=0.014 n=47+49) Reflect 594ms ± 2% 594ms ± 2% ~ (p=0.717 n=48+49) Tar 224ms ± 2% 224ms ± 2% ~ (p=0.805 n=50+49) XML 311ms ± 1% 310ms ± 1% ~ (p=0.177 n=49+48) [Geo mean] 537ms 537ms +0.01% Change-Id: I562b9f349b34ddcff01771769e6dbbc80604da7a Reviewed-on: https://go-review.googlesource.com/c/go/+/221237 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
a908e09a34
commit
7913f7dfcf
@ -1134,11 +1134,21 @@ func genResult0(rr *RuleRewrite, arch arch, result string, top, move bool, pos s
|
||||
if aux != "" {
|
||||
rr.add(stmtf("%s.Aux = %s", v, aux))
|
||||
}
|
||||
for _, arg := range args {
|
||||
all := new(strings.Builder)
|
||||
for i, arg := range args {
|
||||
x := genResult0(rr, arch, arg, false, move, pos)
|
||||
rr.add(stmtf("%s.AddArg(%s)", v, x))
|
||||
if i > 0 {
|
||||
all.WriteString(", ")
|
||||
}
|
||||
all.WriteString(x)
|
||||
}
|
||||
switch len(args) {
|
||||
case 0:
|
||||
case 1:
|
||||
rr.add(stmtf("%s.AddArg(%s)", v, all.String()))
|
||||
default:
|
||||
rr.add(stmtf("%s.AddArg%d(%s)", v, len(args), all.String()))
|
||||
}
|
||||
|
||||
return v
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -37,8 +37,7 @@ func rewriteValue386splitload_Op386CMPBconstload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8)
|
||||
v0.AuxInt = offOnly(vo)
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
@ -61,10 +60,8 @@ func rewriteValue386splitload_Op386CMPBload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(x)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg2(v0, x)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -85,8 +82,7 @@ func rewriteValue386splitload_Op386CMPLconstload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
|
||||
v0.AuxInt = offOnly(vo)
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
@ -109,10 +105,8 @@ func rewriteValue386splitload_Op386CMPLload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(x)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg2(v0, x)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -133,8 +127,7 @@ func rewriteValue386splitload_Op386CMPWconstload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16)
|
||||
v0.AuxInt = offOnly(vo)
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
@ -157,10 +150,8 @@ func rewriteValue386splitload_Op386CMPWload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(x)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg2(v0, x)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,8 +41,7 @@ func rewriteValueAMD64splitload_OpAMD64CMPBconstload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpAMD64MOVBload, typ.UInt8)
|
||||
v0.AuxInt = offOnly(vo)
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
@ -65,10 +64,8 @@ func rewriteValueAMD64splitload_OpAMD64CMPBload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpAMD64MOVBload, typ.UInt8)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(x)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg2(v0, x)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -89,8 +86,7 @@ func rewriteValueAMD64splitload_OpAMD64CMPLconstload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
|
||||
v0.AuxInt = offOnly(vo)
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
@ -113,10 +109,8 @@ func rewriteValueAMD64splitload_OpAMD64CMPLload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpAMD64MOVLload, typ.UInt32)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(x)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg2(v0, x)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -137,8 +131,7 @@ func rewriteValueAMD64splitload_OpAMD64CMPQconstload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpAMD64MOVQload, typ.UInt64)
|
||||
v0.AuxInt = offOnly(vo)
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
@ -161,10 +154,8 @@ func rewriteValueAMD64splitload_OpAMD64CMPQload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpAMD64MOVQload, typ.UInt64)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(x)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg2(v0, x)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -185,8 +176,7 @@ func rewriteValueAMD64splitload_OpAMD64CMPWconstload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
|
||||
v0.AuxInt = offOnly(vo)
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg(v0)
|
||||
return true
|
||||
}
|
||||
@ -209,10 +199,8 @@ func rewriteValueAMD64splitload_OpAMD64CMPWload(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpAMD64MOVWload, typ.UInt16)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = sym
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(x)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v.AddArg2(v0, x)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -116,16 +116,13 @@ func rewriteValuedec_OpLoad(v *Value) bool {
|
||||
}
|
||||
v.reset(OpComplexMake)
|
||||
v0 := b.NewValue0(v.Pos, OpLoad, typ.Float32)
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v1 := b.NewValue0(v.Pos, OpLoad, typ.Float32)
|
||||
v2 := b.NewValue0(v.Pos, OpOffPtr, typ.Float32Ptr)
|
||||
v2.AuxInt = 4
|
||||
v2.AddArg(ptr)
|
||||
v1.AddArg(v2)
|
||||
v1.AddArg(mem)
|
||||
v.AddArg(v1)
|
||||
v1.AddArg2(v2, mem)
|
||||
v.AddArg2(v0, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Load <t> ptr mem)
|
||||
@ -140,16 +137,13 @@ func rewriteValuedec_OpLoad(v *Value) bool {
|
||||
}
|
||||
v.reset(OpComplexMake)
|
||||
v0 := b.NewValue0(v.Pos, OpLoad, typ.Float64)
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v1 := b.NewValue0(v.Pos, OpLoad, typ.Float64)
|
||||
v2 := b.NewValue0(v.Pos, OpOffPtr, typ.Float64Ptr)
|
||||
v2.AuxInt = 8
|
||||
v2.AddArg(ptr)
|
||||
v1.AddArg(v2)
|
||||
v1.AddArg(mem)
|
||||
v.AddArg(v1)
|
||||
v1.AddArg2(v2, mem)
|
||||
v.AddArg2(v0, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Load <t> ptr mem)
|
||||
@ -164,16 +158,13 @@ func rewriteValuedec_OpLoad(v *Value) bool {
|
||||
}
|
||||
v.reset(OpStringMake)
|
||||
v0 := b.NewValue0(v.Pos, OpLoad, typ.BytePtr)
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v1 := b.NewValue0(v.Pos, OpLoad, typ.Int)
|
||||
v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
|
||||
v2.AuxInt = config.PtrSize
|
||||
v2.AddArg(ptr)
|
||||
v1.AddArg(v2)
|
||||
v1.AddArg(mem)
|
||||
v.AddArg(v1)
|
||||
v1.AddArg2(v2, mem)
|
||||
v.AddArg2(v0, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Load <t> ptr mem)
|
||||
@ -188,23 +179,18 @@ func rewriteValuedec_OpLoad(v *Value) bool {
|
||||
}
|
||||
v.reset(OpSliceMake)
|
||||
v0 := b.NewValue0(v.Pos, OpLoad, t.Elem().PtrTo())
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v1 := b.NewValue0(v.Pos, OpLoad, typ.Int)
|
||||
v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
|
||||
v2.AuxInt = config.PtrSize
|
||||
v2.AddArg(ptr)
|
||||
v1.AddArg(v2)
|
||||
v1.AddArg(mem)
|
||||
v.AddArg(v1)
|
||||
v1.AddArg2(v2, mem)
|
||||
v3 := b.NewValue0(v.Pos, OpLoad, typ.Int)
|
||||
v4 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
|
||||
v4.AuxInt = 2 * config.PtrSize
|
||||
v4.AddArg(ptr)
|
||||
v3.AddArg(v4)
|
||||
v3.AddArg(mem)
|
||||
v.AddArg(v3)
|
||||
v3.AddArg2(v4, mem)
|
||||
v.AddArg3(v0, v1, v3)
|
||||
return true
|
||||
}
|
||||
// match: (Load <t> ptr mem)
|
||||
@ -219,16 +205,13 @@ func rewriteValuedec_OpLoad(v *Value) bool {
|
||||
}
|
||||
v.reset(OpIMake)
|
||||
v0 := b.NewValue0(v.Pos, OpLoad, typ.Uintptr)
|
||||
v0.AddArg(ptr)
|
||||
v0.AddArg(mem)
|
||||
v.AddArg(v0)
|
||||
v0.AddArg2(ptr, mem)
|
||||
v1 := b.NewValue0(v.Pos, OpLoad, typ.BytePtr)
|
||||
v2 := b.NewValue0(v.Pos, OpOffPtr, typ.BytePtrPtr)
|
||||
v2.AuxInt = config.PtrSize
|
||||
v2.AddArg(ptr)
|
||||
v1.AddArg(v2)
|
||||
v1.AddArg(mem)
|
||||
v.AddArg(v1)
|
||||
v1.AddArg2(v2, mem)
|
||||
v.AddArg2(v0, v1)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -310,14 +293,10 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, typ.Float32Ptr)
|
||||
v0.AuxInt = 4
|
||||
v0.AddArg(dst)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(imag)
|
||||
v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v1.Aux = typ.Float32
|
||||
v1.AddArg(dst)
|
||||
v1.AddArg(real)
|
||||
v1.AddArg(mem)
|
||||
v.AddArg(v1)
|
||||
v1.AddArg3(dst, real, mem)
|
||||
v.AddArg3(v0, imag, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Store {t} dst (ComplexMake real imag) mem)
|
||||
@ -340,14 +319,10 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, typ.Float64Ptr)
|
||||
v0.AuxInt = 8
|
||||
v0.AddArg(dst)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(imag)
|
||||
v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v1.Aux = typ.Float64
|
||||
v1.AddArg(dst)
|
||||
v1.AddArg(real)
|
||||
v1.AddArg(mem)
|
||||
v.AddArg(v1)
|
||||
v1.AddArg3(dst, real, mem)
|
||||
v.AddArg3(v0, imag, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Store dst (StringMake ptr len) mem)
|
||||
@ -365,14 +340,10 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
|
||||
v0.AuxInt = config.PtrSize
|
||||
v0.AddArg(dst)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(len)
|
||||
v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v1.Aux = typ.BytePtr
|
||||
v1.AddArg(dst)
|
||||
v1.AddArg(ptr)
|
||||
v1.AddArg(mem)
|
||||
v.AddArg(v1)
|
||||
v1.AddArg3(dst, ptr, mem)
|
||||
v.AddArg3(v0, len, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Store dst (SliceMake ptr len cap) mem)
|
||||
@ -391,22 +362,16 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
|
||||
v0.AuxInt = 2 * config.PtrSize
|
||||
v0.AddArg(dst)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(cap)
|
||||
v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v1.Aux = typ.Int
|
||||
v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
|
||||
v2.AuxInt = config.PtrSize
|
||||
v2.AddArg(dst)
|
||||
v1.AddArg(v2)
|
||||
v1.AddArg(len)
|
||||
v3 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v3.Aux = typ.BytePtr
|
||||
v3.AddArg(dst)
|
||||
v3.AddArg(ptr)
|
||||
v3.AddArg(mem)
|
||||
v1.AddArg(v3)
|
||||
v.AddArg(v1)
|
||||
v3.AddArg3(dst, ptr, mem)
|
||||
v1.AddArg3(v2, len, v3)
|
||||
v.AddArg3(v0, cap, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Store dst (IMake itab data) mem)
|
||||
@ -424,14 +389,10 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, typ.BytePtrPtr)
|
||||
v0.AuxInt = config.PtrSize
|
||||
v0.AddArg(dst)
|
||||
v.AddArg(v0)
|
||||
v.AddArg(data)
|
||||
v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v1.Aux = typ.Uintptr
|
||||
v1.AddArg(dst)
|
||||
v1.AddArg(itab)
|
||||
v1.AddArg(mem)
|
||||
v.AddArg(v1)
|
||||
v1.AddArg3(dst, itab, mem)
|
||||
v.AddArg3(v0, data, v1)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -28,11 +28,10 @@ func rewriteValuedecArgs_OpArg(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpArg, typ.BytePtr)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = n
|
||||
v.AddArg(v0)
|
||||
v1 := b.NewValue0(v.Pos, OpArg, typ.Int)
|
||||
v1.AuxInt = off + config.PtrSize
|
||||
v1.Aux = n
|
||||
v.AddArg(v1)
|
||||
v.AddArg2(v0, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Arg {n} [off])
|
||||
@ -48,15 +47,13 @@ func rewriteValuedecArgs_OpArg(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpArg, v.Type.Elem().PtrTo())
|
||||
v0.AuxInt = off
|
||||
v0.Aux = n
|
||||
v.AddArg(v0)
|
||||
v1 := b.NewValue0(v.Pos, OpArg, typ.Int)
|
||||
v1.AuxInt = off + config.PtrSize
|
||||
v1.Aux = n
|
||||
v.AddArg(v1)
|
||||
v2 := b.NewValue0(v.Pos, OpArg, typ.Int)
|
||||
v2.AuxInt = off + 2*config.PtrSize
|
||||
v2.Aux = n
|
||||
v.AddArg(v2)
|
||||
v.AddArg3(v0, v1, v2)
|
||||
return true
|
||||
}
|
||||
// match: (Arg {n} [off])
|
||||
@ -72,11 +69,10 @@ func rewriteValuedecArgs_OpArg(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpArg, typ.Uintptr)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = n
|
||||
v.AddArg(v0)
|
||||
v1 := b.NewValue0(v.Pos, OpArg, typ.BytePtr)
|
||||
v1.AuxInt = off + config.PtrSize
|
||||
v1.Aux = n
|
||||
v.AddArg(v1)
|
||||
v.AddArg2(v0, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Arg {n} [off])
|
||||
@ -92,11 +88,10 @@ func rewriteValuedecArgs_OpArg(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpArg, typ.Float64)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = n
|
||||
v.AddArg(v0)
|
||||
v1 := b.NewValue0(v.Pos, OpArg, typ.Float64)
|
||||
v1.AuxInt = off + 8
|
||||
v1.Aux = n
|
||||
v.AddArg(v1)
|
||||
v.AddArg2(v0, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Arg {n} [off])
|
||||
@ -112,11 +107,10 @@ func rewriteValuedecArgs_OpArg(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpArg, typ.Float32)
|
||||
v0.AuxInt = off
|
||||
v0.Aux = n
|
||||
v.AddArg(v0)
|
||||
v1 := b.NewValue0(v.Pos, OpArg, typ.Float32)
|
||||
v1.AuxInt = off + 4
|
||||
v1.Aux = n
|
||||
v.AddArg(v1)
|
||||
v.AddArg2(v0, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Arg <t>)
|
||||
@ -161,11 +155,10 @@ func rewriteValuedecArgs_OpArg(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
|
||||
v0.AuxInt = off + t.FieldOff(0)
|
||||
v0.Aux = n
|
||||
v.AddArg(v0)
|
||||
v1 := b.NewValue0(v.Pos, OpArg, t.FieldType(1))
|
||||
v1.AuxInt = off + t.FieldOff(1)
|
||||
v1.Aux = n
|
||||
v.AddArg(v1)
|
||||
v.AddArg2(v0, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Arg <t> {n} [off])
|
||||
@ -182,15 +175,13 @@ func rewriteValuedecArgs_OpArg(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
|
||||
v0.AuxInt = off + t.FieldOff(0)
|
||||
v0.Aux = n
|
||||
v.AddArg(v0)
|
||||
v1 := b.NewValue0(v.Pos, OpArg, t.FieldType(1))
|
||||
v1.AuxInt = off + t.FieldOff(1)
|
||||
v1.Aux = n
|
||||
v.AddArg(v1)
|
||||
v2 := b.NewValue0(v.Pos, OpArg, t.FieldType(2))
|
||||
v2.AuxInt = off + t.FieldOff(2)
|
||||
v2.Aux = n
|
||||
v.AddArg(v2)
|
||||
v.AddArg3(v0, v1, v2)
|
||||
return true
|
||||
}
|
||||
// match: (Arg <t> {n} [off])
|
||||
@ -207,19 +198,16 @@ func rewriteValuedecArgs_OpArg(v *Value) bool {
|
||||
v0 := b.NewValue0(v.Pos, OpArg, t.FieldType(0))
|
||||
v0.AuxInt = off + t.FieldOff(0)
|
||||
v0.Aux = n
|
||||
v.AddArg(v0)
|
||||
v1 := b.NewValue0(v.Pos, OpArg, t.FieldType(1))
|
||||
v1.AuxInt = off + t.FieldOff(1)
|
||||
v1.Aux = n
|
||||
v.AddArg(v1)
|
||||
v2 := b.NewValue0(v.Pos, OpArg, t.FieldType(2))
|
||||
v2.AuxInt = off + t.FieldOff(2)
|
||||
v2.Aux = n
|
||||
v.AddArg(v2)
|
||||
v3 := b.NewValue0(v.Pos, OpArg, t.FieldType(3))
|
||||
v3.AuxInt = off + t.FieldOff(3)
|
||||
v3.Aux = n
|
||||
v.AddArg(v3)
|
||||
v.AddArg4(v0, v1, v2, v3)
|
||||
return true
|
||||
}
|
||||
// match: (Arg <t>)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -218,6 +218,58 @@ func (v *Value) AddArg(w *Value) {
|
||||
v.Args = append(v.Args, w)
|
||||
w.Uses++
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func (v *Value) AddArg2(w1, w2 *Value) {
|
||||
if v.Args == nil {
|
||||
v.resetArgs() // use argstorage
|
||||
}
|
||||
v.Args = append(v.Args, w1, w2)
|
||||
w1.Uses++
|
||||
w2.Uses++
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func (v *Value) AddArg3(w1, w2, w3 *Value) {
|
||||
if v.Args == nil {
|
||||
v.resetArgs() // use argstorage
|
||||
}
|
||||
v.Args = append(v.Args, w1, w2, w3)
|
||||
w1.Uses++
|
||||
w2.Uses++
|
||||
w3.Uses++
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func (v *Value) AddArg4(w1, w2, w3, w4 *Value) {
|
||||
v.Args = append(v.Args, w1, w2, w3, w4)
|
||||
w1.Uses++
|
||||
w2.Uses++
|
||||
w3.Uses++
|
||||
w4.Uses++
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func (v *Value) AddArg5(w1, w2, w3, w4, w5 *Value) {
|
||||
v.Args = append(v.Args, w1, w2, w3, w4, w5)
|
||||
w1.Uses++
|
||||
w2.Uses++
|
||||
w3.Uses++
|
||||
w4.Uses++
|
||||
w5.Uses++
|
||||
}
|
||||
|
||||
//go:noinline
|
||||
func (v *Value) AddArg6(w1, w2, w3, w4, w5, w6 *Value) {
|
||||
v.Args = append(v.Args, w1, w2, w3, w4, w5, w6)
|
||||
w1.Uses++
|
||||
w2.Uses++
|
||||
w3.Uses++
|
||||
w4.Uses++
|
||||
w5.Uses++
|
||||
w6.Uses++
|
||||
}
|
||||
|
||||
func (v *Value) AddArgs(a ...*Value) {
|
||||
if v.Args == nil {
|
||||
v.resetArgs() // use argstorage
|
||||
|
Loading…
Reference in New Issue
Block a user