mirror of
https://github.com/golang/go
synced 2024-11-18 18:04:46 -07:00
cmd/compile: rewrite dec rules to use typed aux field
Passes toolstash-check -all. Change-Id: Ia73233c2269017a5802df821ea2ca138c16a94ee Reviewed-on: https://go-review.googlesource.com/c/go/+/229519 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Munday <mike.munday@ibm.com>
This commit is contained in:
parent
7f0c479fff
commit
917aa72c14
@ -8,56 +8,56 @@
|
||||
// pass which handles phis of these types.
|
||||
|
||||
// complex ops
|
||||
(ComplexReal (ComplexMake real _ )) -> real
|
||||
(ComplexImag (ComplexMake _ imag )) -> imag
|
||||
(ComplexReal (ComplexMake real _ )) => real
|
||||
(ComplexImag (ComplexMake _ imag )) => imag
|
||||
|
||||
(Load <t> ptr mem) && t.IsComplex() && t.Size() == 8 ->
|
||||
(Load <t> ptr mem) && t.IsComplex() && t.Size() == 8 =>
|
||||
(ComplexMake
|
||||
(Load <typ.Float32> ptr mem)
|
||||
(Load <typ.Float32>
|
||||
(OffPtr <typ.Float32Ptr> [4] ptr)
|
||||
mem)
|
||||
)
|
||||
(Store {t} dst (ComplexMake real imag) mem) && t.(*types.Type).Size() == 8 ->
|
||||
(Store {t} dst (ComplexMake real imag) mem) && t.Size() == 8 =>
|
||||
(Store {typ.Float32}
|
||||
(OffPtr <typ.Float32Ptr> [4] dst)
|
||||
imag
|
||||
(Store {typ.Float32} dst real mem))
|
||||
(Load <t> ptr mem) && t.IsComplex() && t.Size() == 16 ->
|
||||
(Load <t> ptr mem) && t.IsComplex() && t.Size() == 16 =>
|
||||
(ComplexMake
|
||||
(Load <typ.Float64> ptr mem)
|
||||
(Load <typ.Float64>
|
||||
(OffPtr <typ.Float64Ptr> [8] ptr)
|
||||
mem)
|
||||
)
|
||||
(Store {t} dst (ComplexMake real imag) mem) && t.(*types.Type).Size() == 16 ->
|
||||
(Store {t} dst (ComplexMake real imag) mem) && t.Size() == 16 =>
|
||||
(Store {typ.Float64}
|
||||
(OffPtr <typ.Float64Ptr> [8] dst)
|
||||
imag
|
||||
(Store {typ.Float64} dst real mem))
|
||||
|
||||
// string ops
|
||||
(StringPtr (StringMake ptr _)) -> ptr
|
||||
(StringLen (StringMake _ len)) -> len
|
||||
(StringPtr (StringMake ptr _)) => ptr
|
||||
(StringLen (StringMake _ len)) => len
|
||||
|
||||
(Load <t> ptr mem) && t.IsString() ->
|
||||
(Load <t> ptr mem) && t.IsString() =>
|
||||
(StringMake
|
||||
(Load <typ.BytePtr> ptr mem)
|
||||
(Load <typ.Int>
|
||||
(OffPtr <typ.IntPtr> [config.PtrSize] ptr)
|
||||
mem))
|
||||
(Store dst (StringMake ptr len) mem) ->
|
||||
(Store dst (StringMake ptr len) mem) =>
|
||||
(Store {typ.Int}
|
||||
(OffPtr <typ.IntPtr> [config.PtrSize] dst)
|
||||
len
|
||||
(Store {typ.BytePtr} dst ptr mem))
|
||||
|
||||
// slice ops
|
||||
(SlicePtr (SliceMake ptr _ _ )) -> ptr
|
||||
(SliceLen (SliceMake _ len _)) -> len
|
||||
(SliceCap (SliceMake _ _ cap)) -> cap
|
||||
(SlicePtr (SliceMake ptr _ _ )) => ptr
|
||||
(SliceLen (SliceMake _ len _)) => len
|
||||
(SliceCap (SliceMake _ _ cap)) => cap
|
||||
|
||||
(Load <t> ptr mem) && t.IsSlice() ->
|
||||
(Load <t> ptr mem) && t.IsSlice() =>
|
||||
(SliceMake
|
||||
(Load <t.Elem().PtrTo()> ptr mem)
|
||||
(Load <typ.Int>
|
||||
@ -66,7 +66,7 @@
|
||||
(Load <typ.Int>
|
||||
(OffPtr <typ.IntPtr> [2*config.PtrSize] ptr)
|
||||
mem))
|
||||
(Store dst (SliceMake ptr len cap) mem) ->
|
||||
(Store dst (SliceMake ptr len cap) mem) =>
|
||||
(Store {typ.Int}
|
||||
(OffPtr <typ.IntPtr> [2*config.PtrSize] dst)
|
||||
cap
|
||||
@ -76,16 +76,16 @@
|
||||
(Store {typ.BytePtr} dst ptr mem)))
|
||||
|
||||
// interface ops
|
||||
(ITab (IMake itab _)) -> itab
|
||||
(IData (IMake _ data)) -> data
|
||||
(ITab (IMake itab _)) => itab
|
||||
(IData (IMake _ data)) => data
|
||||
|
||||
(Load <t> ptr mem) && t.IsInterface() ->
|
||||
(Load <t> ptr mem) && t.IsInterface() =>
|
||||
(IMake
|
||||
(Load <typ.Uintptr> ptr mem)
|
||||
(Load <typ.BytePtr>
|
||||
(OffPtr <typ.BytePtrPtr> [config.PtrSize] ptr)
|
||||
mem))
|
||||
(Store dst (IMake itab data) mem) ->
|
||||
(Store dst (IMake itab data) mem) =>
|
||||
(Store {typ.BytePtr}
|
||||
(OffPtr <typ.BytePtrPtr> [config.PtrSize] dst)
|
||||
data
|
||||
|
@ -109,7 +109,7 @@ func rewriteValuedec_OpLoad(v *Value) bool {
|
||||
v0.AddArg2(ptr, mem)
|
||||
v1 := b.NewValue0(v.Pos, OpLoad, typ.Float32)
|
||||
v2 := b.NewValue0(v.Pos, OpOffPtr, typ.Float32Ptr)
|
||||
v2.AuxInt = 4
|
||||
v2.AuxInt = int64ToAuxInt(4)
|
||||
v2.AddArg(ptr)
|
||||
v1.AddArg2(v2, mem)
|
||||
v.AddArg2(v0, v1)
|
||||
@ -130,7 +130,7 @@ func rewriteValuedec_OpLoad(v *Value) bool {
|
||||
v0.AddArg2(ptr, mem)
|
||||
v1 := b.NewValue0(v.Pos, OpLoad, typ.Float64)
|
||||
v2 := b.NewValue0(v.Pos, OpOffPtr, typ.Float64Ptr)
|
||||
v2.AuxInt = 8
|
||||
v2.AuxInt = int64ToAuxInt(8)
|
||||
v2.AddArg(ptr)
|
||||
v1.AddArg2(v2, mem)
|
||||
v.AddArg2(v0, v1)
|
||||
@ -151,7 +151,7 @@ func rewriteValuedec_OpLoad(v *Value) bool {
|
||||
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.AuxInt = int64ToAuxInt(config.PtrSize)
|
||||
v2.AddArg(ptr)
|
||||
v1.AddArg2(v2, mem)
|
||||
v.AddArg2(v0, v1)
|
||||
@ -172,12 +172,12 @@ func rewriteValuedec_OpLoad(v *Value) bool {
|
||||
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.AuxInt = int64ToAuxInt(config.PtrSize)
|
||||
v2.AddArg(ptr)
|
||||
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.AuxInt = int64ToAuxInt(2 * config.PtrSize)
|
||||
v4.AddArg(ptr)
|
||||
v3.AddArg2(v4, mem)
|
||||
v.AddArg3(v0, v1, v3)
|
||||
@ -198,7 +198,7 @@ func rewriteValuedec_OpLoad(v *Value) bool {
|
||||
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.AuxInt = int64ToAuxInt(config.PtrSize)
|
||||
v2.AddArg(ptr)
|
||||
v1.AddArg2(v2, mem)
|
||||
v.AddArg2(v0, v1)
|
||||
@ -256,10 +256,10 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
config := b.Func.Config
|
||||
typ := &b.Func.Config.Types
|
||||
// match: (Store {t} dst (ComplexMake real imag) mem)
|
||||
// cond: t.(*types.Type).Size() == 8
|
||||
// cond: t.Size() == 8
|
||||
// result: (Store {typ.Float32} (OffPtr <typ.Float32Ptr> [4] dst) imag (Store {typ.Float32} dst real mem))
|
||||
for {
|
||||
t := v.Aux
|
||||
t := auxToType(v.Aux)
|
||||
dst := v_0
|
||||
if v_1.Op != OpComplexMake {
|
||||
break
|
||||
@ -267,25 +267,25 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
imag := v_1.Args[1]
|
||||
real := v_1.Args[0]
|
||||
mem := v_2
|
||||
if !(t.(*types.Type).Size() == 8) {
|
||||
if !(t.Size() == 8) {
|
||||
break
|
||||
}
|
||||
v.reset(OpStore)
|
||||
v.Aux = typ.Float32
|
||||
v.Aux = typeToAux(typ.Float32)
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, typ.Float32Ptr)
|
||||
v0.AuxInt = 4
|
||||
v0.AuxInt = int64ToAuxInt(4)
|
||||
v0.AddArg(dst)
|
||||
v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v1.Aux = typ.Float32
|
||||
v1.Aux = typeToAux(typ.Float32)
|
||||
v1.AddArg3(dst, real, mem)
|
||||
v.AddArg3(v0, imag, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Store {t} dst (ComplexMake real imag) mem)
|
||||
// cond: t.(*types.Type).Size() == 16
|
||||
// cond: t.Size() == 16
|
||||
// result: (Store {typ.Float64} (OffPtr <typ.Float64Ptr> [8] dst) imag (Store {typ.Float64} dst real mem))
|
||||
for {
|
||||
t := v.Aux
|
||||
t := auxToType(v.Aux)
|
||||
dst := v_0
|
||||
if v_1.Op != OpComplexMake {
|
||||
break
|
||||
@ -293,16 +293,16 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
imag := v_1.Args[1]
|
||||
real := v_1.Args[0]
|
||||
mem := v_2
|
||||
if !(t.(*types.Type).Size() == 16) {
|
||||
if !(t.Size() == 16) {
|
||||
break
|
||||
}
|
||||
v.reset(OpStore)
|
||||
v.Aux = typ.Float64
|
||||
v.Aux = typeToAux(typ.Float64)
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, typ.Float64Ptr)
|
||||
v0.AuxInt = 8
|
||||
v0.AuxInt = int64ToAuxInt(8)
|
||||
v0.AddArg(dst)
|
||||
v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v1.Aux = typ.Float64
|
||||
v1.Aux = typeToAux(typ.Float64)
|
||||
v1.AddArg3(dst, real, mem)
|
||||
v.AddArg3(v0, imag, v1)
|
||||
return true
|
||||
@ -318,12 +318,12 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
ptr := v_1.Args[0]
|
||||
mem := v_2
|
||||
v.reset(OpStore)
|
||||
v.Aux = typ.Int
|
||||
v.Aux = typeToAux(typ.Int)
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
|
||||
v0.AuxInt = config.PtrSize
|
||||
v0.AuxInt = int64ToAuxInt(config.PtrSize)
|
||||
v0.AddArg(dst)
|
||||
v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v1.Aux = typ.BytePtr
|
||||
v1.Aux = typeToAux(typ.BytePtr)
|
||||
v1.AddArg3(dst, ptr, mem)
|
||||
v.AddArg3(v0, len, v1)
|
||||
return true
|
||||
@ -340,17 +340,17 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
len := v_1.Args[1]
|
||||
mem := v_2
|
||||
v.reset(OpStore)
|
||||
v.Aux = typ.Int
|
||||
v.Aux = typeToAux(typ.Int)
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
|
||||
v0.AuxInt = 2 * config.PtrSize
|
||||
v0.AuxInt = int64ToAuxInt(2 * config.PtrSize)
|
||||
v0.AddArg(dst)
|
||||
v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v1.Aux = typ.Int
|
||||
v1.Aux = typeToAux(typ.Int)
|
||||
v2 := b.NewValue0(v.Pos, OpOffPtr, typ.IntPtr)
|
||||
v2.AuxInt = config.PtrSize
|
||||
v2.AuxInt = int64ToAuxInt(config.PtrSize)
|
||||
v2.AddArg(dst)
|
||||
v3 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v3.Aux = typ.BytePtr
|
||||
v3.Aux = typeToAux(typ.BytePtr)
|
||||
v3.AddArg3(dst, ptr, mem)
|
||||
v1.AddArg3(v2, len, v3)
|
||||
v.AddArg3(v0, cap, v1)
|
||||
@ -367,12 +367,12 @@ func rewriteValuedec_OpStore(v *Value) bool {
|
||||
itab := v_1.Args[0]
|
||||
mem := v_2
|
||||
v.reset(OpStore)
|
||||
v.Aux = typ.BytePtr
|
||||
v.Aux = typeToAux(typ.BytePtr)
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, typ.BytePtrPtr)
|
||||
v0.AuxInt = config.PtrSize
|
||||
v0.AuxInt = int64ToAuxInt(config.PtrSize)
|
||||
v0.AddArg(dst)
|
||||
v1 := b.NewValue0(v.Pos, OpStore, types.TypeMem)
|
||||
v1.Aux = typ.Uintptr
|
||||
v1.Aux = typeToAux(typ.Uintptr)
|
||||
v1.AddArg3(dst, itab, mem)
|
||||
v.AddArg3(v0, data, v1)
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user