2015-06-06 16:03:33 -07:00
|
|
|
// autogenerated from gen/generic.rules: do not edit!
|
|
|
|
|
// generated with: cd gen; go run *.go
|
|
|
|
|
package ssa
|
|
|
|
|
|
2015-08-28 14:24:10 -04:00
|
|
|
import "math"
|
|
|
|
|
|
|
|
|
|
var _ = math.MinInt8 // in case not otherwise used
|
2015-06-06 16:03:33 -07:00
|
|
|
func rewriteValuegeneric(v *Value, config *Config) bool {
|
|
|
|
|
switch v.Op {
|
2015-11-02 21:28:13 -08:00
|
|
|
case OpAdd16:
|
|
|
|
|
return rewriteValuegeneric_OpAdd16(v, config)
|
|
|
|
|
case OpAdd32:
|
|
|
|
|
return rewriteValuegeneric_OpAdd32(v, config)
|
2015-07-19 15:48:20 -07:00
|
|
|
case OpAdd64:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpAdd64(v, config)
|
2015-11-02 21:28:13 -08:00
|
|
|
case OpAdd8:
|
|
|
|
|
return rewriteValuegeneric_OpAdd8(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpAnd16:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpAnd16(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpAnd32:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpAnd32(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpAnd64:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpAnd64(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpAnd8:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpAnd8(v, config)
|
2015-11-02 08:10:26 -08:00
|
|
|
case OpArg:
|
|
|
|
|
return rewriteValuegeneric_OpArg(v, config)
|
2015-06-06 16:03:33 -07:00
|
|
|
case OpArrayIndex:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpArrayIndex(v, config)
|
2015-07-30 16:02:24 -04:00
|
|
|
case OpCom16:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpCom16(v, config)
|
2015-07-30 16:02:24 -04:00
|
|
|
case OpCom32:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpCom32(v, config)
|
2015-07-30 16:02:24 -04:00
|
|
|
case OpCom64:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpCom64(v, config)
|
2015-07-30 16:02:24 -04:00
|
|
|
case OpCom8:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpCom8(v, config)
|
2015-08-28 14:24:10 -04:00
|
|
|
case OpComplexImag:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpComplexImag(v, config)
|
2015-08-28 14:24:10 -04:00
|
|
|
case OpComplexReal:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpComplexReal(v, config)
|
2015-08-18 10:26:28 -07:00
|
|
|
case OpConstInterface:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpConstInterface(v, config)
|
2015-08-18 10:26:28 -07:00
|
|
|
case OpConstSlice:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpConstSlice(v, config)
|
2015-07-28 14:19:20 -07:00
|
|
|
case OpConstString:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpConstString(v, config)
|
2015-10-23 14:08:50 -07:00
|
|
|
case OpConvert:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpConvert(v, config)
|
2015-07-31 12:32:22 +02:00
|
|
|
case OpEq16:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpEq16(v, config)
|
2015-07-31 12:32:22 +02:00
|
|
|
case OpEq32:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpEq32(v, config)
|
2015-07-31 12:32:22 +02:00
|
|
|
case OpEq64:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpEq64(v, config)
|
2015-07-31 12:32:22 +02:00
|
|
|
case OpEq8:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpEq8(v, config)
|
2015-09-10 13:53:27 -07:00
|
|
|
case OpEqInter:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpEqInter(v, config)
|
2015-08-30 21:19:20 -05:00
|
|
|
case OpEqPtr:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpEqPtr(v, config)
|
2015-09-10 13:53:27 -07:00
|
|
|
case OpEqSlice:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpEqSlice(v, config)
|
2015-10-27 17:46:53 -05:00
|
|
|
case OpGeq16:
|
|
|
|
|
return rewriteValuegeneric_OpGeq16(v, config)
|
|
|
|
|
case OpGeq16U:
|
|
|
|
|
return rewriteValuegeneric_OpGeq16U(v, config)
|
|
|
|
|
case OpGeq32:
|
|
|
|
|
return rewriteValuegeneric_OpGeq32(v, config)
|
|
|
|
|
case OpGeq32U:
|
|
|
|
|
return rewriteValuegeneric_OpGeq32U(v, config)
|
|
|
|
|
case OpGeq64:
|
|
|
|
|
return rewriteValuegeneric_OpGeq64(v, config)
|
|
|
|
|
case OpGeq64U:
|
|
|
|
|
return rewriteValuegeneric_OpGeq64U(v, config)
|
|
|
|
|
case OpGeq8:
|
|
|
|
|
return rewriteValuegeneric_OpGeq8(v, config)
|
|
|
|
|
case OpGeq8U:
|
|
|
|
|
return rewriteValuegeneric_OpGeq8U(v, config)
|
|
|
|
|
case OpGreater16:
|
|
|
|
|
return rewriteValuegeneric_OpGreater16(v, config)
|
|
|
|
|
case OpGreater16U:
|
|
|
|
|
return rewriteValuegeneric_OpGreater16U(v, config)
|
|
|
|
|
case OpGreater32:
|
|
|
|
|
return rewriteValuegeneric_OpGreater32(v, config)
|
|
|
|
|
case OpGreater32U:
|
|
|
|
|
return rewriteValuegeneric_OpGreater32U(v, config)
|
|
|
|
|
case OpGreater64:
|
|
|
|
|
return rewriteValuegeneric_OpGreater64(v, config)
|
|
|
|
|
case OpGreater64U:
|
|
|
|
|
return rewriteValuegeneric_OpGreater64U(v, config)
|
|
|
|
|
case OpGreater8:
|
|
|
|
|
return rewriteValuegeneric_OpGreater8(v, config)
|
|
|
|
|
case OpGreater8U:
|
|
|
|
|
return rewriteValuegeneric_OpGreater8U(v, config)
|
2015-08-18 10:26:28 -07:00
|
|
|
case OpIData:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpIData(v, config)
|
2015-08-18 10:26:28 -07:00
|
|
|
case OpITab:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpITab(v, config)
|
2015-06-06 16:03:33 -07:00
|
|
|
case OpIsInBounds:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpIsInBounds(v, config)
|
2015-11-02 21:28:13 -08:00
|
|
|
case OpIsSliceInBounds:
|
|
|
|
|
return rewriteValuegeneric_OpIsSliceInBounds(v, config)
|
2015-10-27 17:46:53 -05:00
|
|
|
case OpLeq16:
|
|
|
|
|
return rewriteValuegeneric_OpLeq16(v, config)
|
|
|
|
|
case OpLeq16U:
|
|
|
|
|
return rewriteValuegeneric_OpLeq16U(v, config)
|
|
|
|
|
case OpLeq32:
|
|
|
|
|
return rewriteValuegeneric_OpLeq32(v, config)
|
|
|
|
|
case OpLeq32U:
|
|
|
|
|
return rewriteValuegeneric_OpLeq32U(v, config)
|
|
|
|
|
case OpLeq64:
|
|
|
|
|
return rewriteValuegeneric_OpLeq64(v, config)
|
|
|
|
|
case OpLeq64U:
|
|
|
|
|
return rewriteValuegeneric_OpLeq64U(v, config)
|
|
|
|
|
case OpLeq8:
|
|
|
|
|
return rewriteValuegeneric_OpLeq8(v, config)
|
|
|
|
|
case OpLeq8U:
|
|
|
|
|
return rewriteValuegeneric_OpLeq8U(v, config)
|
|
|
|
|
case OpLess16:
|
|
|
|
|
return rewriteValuegeneric_OpLess16(v, config)
|
|
|
|
|
case OpLess16U:
|
|
|
|
|
return rewriteValuegeneric_OpLess16U(v, config)
|
|
|
|
|
case OpLess32:
|
|
|
|
|
return rewriteValuegeneric_OpLess32(v, config)
|
|
|
|
|
case OpLess32U:
|
|
|
|
|
return rewriteValuegeneric_OpLess32U(v, config)
|
|
|
|
|
case OpLess64:
|
|
|
|
|
return rewriteValuegeneric_OpLess64(v, config)
|
|
|
|
|
case OpLess64U:
|
|
|
|
|
return rewriteValuegeneric_OpLess64U(v, config)
|
|
|
|
|
case OpLess8:
|
|
|
|
|
return rewriteValuegeneric_OpLess8(v, config)
|
|
|
|
|
case OpLess8U:
|
|
|
|
|
return rewriteValuegeneric_OpLess8U(v, config)
|
2015-06-06 16:03:33 -07:00
|
|
|
case OpLoad:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpLoad(v, config)
|
2015-11-02 21:28:13 -08:00
|
|
|
case OpMul16:
|
|
|
|
|
return rewriteValuegeneric_OpMul16(v, config)
|
|
|
|
|
case OpMul32:
|
|
|
|
|
return rewriteValuegeneric_OpMul32(v, config)
|
2015-07-22 13:46:15 -07:00
|
|
|
case OpMul64:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpMul64(v, config)
|
2015-11-02 21:28:13 -08:00
|
|
|
case OpMul8:
|
|
|
|
|
return rewriteValuegeneric_OpMul8(v, config)
|
2015-07-31 12:32:22 +02:00
|
|
|
case OpNeq16:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpNeq16(v, config)
|
2015-07-31 12:32:22 +02:00
|
|
|
case OpNeq32:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpNeq32(v, config)
|
2015-07-31 12:32:22 +02:00
|
|
|
case OpNeq64:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpNeq64(v, config)
|
2015-07-31 12:32:22 +02:00
|
|
|
case OpNeq8:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpNeq8(v, config)
|
2015-09-10 13:53:27 -07:00
|
|
|
case OpNeqInter:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpNeqInter(v, config)
|
2015-08-30 21:19:20 -05:00
|
|
|
case OpNeqPtr:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpNeqPtr(v, config)
|
2015-09-10 13:53:27 -07:00
|
|
|
case OpNeqSlice:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpNeqSlice(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpOr16:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpOr16(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpOr32:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpOr32(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpOr64:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpOr64(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpOr8:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpOr8(v, config)
|
2015-06-06 16:03:33 -07:00
|
|
|
case OpPtrIndex:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpPtrIndex(v, config)
|
2015-06-06 16:03:33 -07:00
|
|
|
case OpSliceCap:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpSliceCap(v, config)
|
2015-06-06 16:03:33 -07:00
|
|
|
case OpSliceLen:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpSliceLen(v, config)
|
2015-06-06 16:03:33 -07:00
|
|
|
case OpSlicePtr:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpSlicePtr(v, config)
|
2015-06-06 16:03:33 -07:00
|
|
|
case OpStore:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpStore(v, config)
|
2015-06-06 16:03:33 -07:00
|
|
|
case OpStringLen:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpStringLen(v, config)
|
2015-06-06 16:03:33 -07:00
|
|
|
case OpStringPtr:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpStringPtr(v, config)
|
2015-07-15 21:33:49 -07:00
|
|
|
case OpStructSelect:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpStructSelect(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpSub16:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpSub16(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpSub32:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpSub32(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpSub64:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpSub64(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpSub8:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpSub8(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpXor16:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpXor16(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpXor32:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpXor32(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpXor64:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpXor64(v, config)
|
2015-08-14 12:59:33 +02:00
|
|
|
case OpXor8:
|
2015-10-26 21:49:31 -07:00
|
|
|
return rewriteValuegeneric_OpXor8(v, config)
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-11-02 21:28:13 -08:00
|
|
|
func rewriteValuegeneric_OpAdd16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Add16 (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const16 [c+d])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end359c546ef662b7990116329cb30d6892
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end359c546ef662b7990116329cb30d6892
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConst16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c + d
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end359c546ef662b7990116329cb30d6892
|
|
|
|
|
end359c546ef662b7990116329cb30d6892:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Add16 x (Const16 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst16
|
|
|
|
|
// result: (Add16 (Const16 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end89b69a89778f375b0ebbc683b0c63176
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst16) {
|
|
|
|
|
goto end89b69a89778f375b0ebbc683b0c63176
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpAdd16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end89b69a89778f375b0ebbc683b0c63176
|
|
|
|
|
end89b69a89778f375b0ebbc683b0c63176:
|
2015-11-02 21:28:13 -08:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpAdd32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Add32 (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const32 [c+d])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto enda3edaa9a512bd1d7a95f002c890bfb88
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto enda3edaa9a512bd1d7a95f002c890bfb88
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConst32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c + d
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto enda3edaa9a512bd1d7a95f002c890bfb88
|
|
|
|
|
enda3edaa9a512bd1d7a95f002c890bfb88:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Add32 x (Const32 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst32
|
|
|
|
|
// result: (Add32 (Const32 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end28a8c474bfa6968950dce0ed73b14a0b
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst32) {
|
|
|
|
|
goto end28a8c474bfa6968950dce0ed73b14a0b
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpAdd32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end28a8c474bfa6968950dce0ed73b14a0b
|
|
|
|
|
end28a8c474bfa6968950dce0ed73b14a0b:
|
2015-11-02 21:28:13 -08:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-26 21:49:31 -07:00
|
|
|
func rewriteValuegeneric_OpAdd64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Add64 (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const64 [c+d])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end8c46df6f85a11cb1d594076b0e467908
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end8c46df6f85a11cb1d594076b0e467908
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConst64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c + d
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end8c46df6f85a11cb1d594076b0e467908
|
|
|
|
|
end8c46df6f85a11cb1d594076b0e467908:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Add64 x (Const64 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst64
|
|
|
|
|
// result: (Add64 (Const64 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end39caa6cf1044f5c47ddbeb062d1a13bd
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst64) {
|
|
|
|
|
goto end39caa6cf1044f5c47ddbeb062d1a13bd
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpAdd64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end39caa6cf1044f5c47ddbeb062d1a13bd
|
|
|
|
|
end39caa6cf1044f5c47ddbeb062d1a13bd:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-11-02 21:28:13 -08:00
|
|
|
func rewriteValuegeneric_OpAdd8(v *Value, config *Config) bool {
|
2015-10-26 21:49:31 -07:00
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-11-02 21:28:13 -08:00
|
|
|
// match: (Add8 (Const8 [c]) (Const8 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-11-02 21:28:13 -08:00
|
|
|
// result: (Const8 [c+d])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-11-02 21:28:13 -08:00
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto end60c66721511a442aade8e4da2fb326bd
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
2015-11-02 21:28:13 -08:00
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto end60c66721511a442aade8e4da2fb326bd
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
2015-11-02 21:28:13 -08:00
|
|
|
v.Op = OpConst8
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c + d
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-02 21:28:13 -08:00
|
|
|
goto end60c66721511a442aade8e4da2fb326bd
|
|
|
|
|
end60c66721511a442aade8e4da2fb326bd:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Add8 x (Const8 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst8
|
|
|
|
|
// result: (Add8 (Const8 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto end8c2901b8d12fa5c37f190783b4db8df5
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst8) {
|
|
|
|
|
goto end8c2901b8d12fa5c37f190783b4db8df5
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpAdd8
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end8c2901b8d12fa5c37f190783b4db8df5
|
|
|
|
|
end8c2901b8d12fa5c37f190783b4db8df5:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpAnd16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (And16 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end69ed6ee2a4fb0491b56c17f3c1926b10
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end69ed6ee2a4fb0491b56c17f3c1926b10
|
|
|
|
|
end69ed6ee2a4fb0491b56c17f3c1926b10:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpAnd32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (And32 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto endbbe8c3c5b2ca8f013aa178d856f3a99c
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endbbe8c3c5b2ca8f013aa178d856f3a99c
|
|
|
|
|
endbbe8c3c5b2ca8f013aa178d856f3a99c:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpAnd64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (And64 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto endc9736bf24d2e5cd8d662e1bcf3164640
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endc9736bf24d2e5cd8d662e1bcf3164640
|
|
|
|
|
endc9736bf24d2e5cd8d662e1bcf3164640:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpAnd8(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (And8 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto endeaf127389bd0d4b0e0e297830f8f463b
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endeaf127389bd0d4b0e0e297830f8f463b
|
|
|
|
|
endeaf127389bd0d4b0e0e297830f8f463b:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-11-02 08:10:26 -08:00
|
|
|
func rewriteValuegeneric_OpArg(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Arg {n} [off])
|
|
|
|
|
// cond: v.Type.IsString()
|
|
|
|
|
// result: (StringMake (Arg <config.fe.TypeBytePtr()> {n} [off]) (Arg <config.fe.TypeInt()> {n} [off+config.PtrSize]))
|
|
|
|
|
{
|
|
|
|
|
n := v.Aux
|
|
|
|
|
off := v.AuxInt
|
|
|
|
|
if !(v.Type.IsString()) {
|
|
|
|
|
goto end939d3f946bf61eb85b46b374e7afa9e9
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStringMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v0.Aux = n
|
|
|
|
|
v0.AuxInt = off
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeInt()
|
|
|
|
|
v1.Aux = n
|
|
|
|
|
v1.AuxInt = off + config.PtrSize
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end939d3f946bf61eb85b46b374e7afa9e9
|
|
|
|
|
end939d3f946bf61eb85b46b374e7afa9e9:
|
|
|
|
|
;
|
|
|
|
|
// match: (Arg {n} [off])
|
|
|
|
|
// cond: v.Type.IsSlice()
|
|
|
|
|
// result: (SliceMake (Arg <config.fe.TypeBytePtr()> {n} [off]) (Arg <config.fe.TypeInt()> {n} [off+config.PtrSize]) (Arg <config.fe.TypeInt()> {n} [off+2*config.PtrSize]))
|
|
|
|
|
{
|
|
|
|
|
n := v.Aux
|
|
|
|
|
off := v.AuxInt
|
|
|
|
|
if !(v.Type.IsSlice()) {
|
|
|
|
|
goto endab4b93ad3b1cf55e5bf25d1fd9cd498e
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpSliceMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v0.Aux = n
|
|
|
|
|
v0.AuxInt = off
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeInt()
|
|
|
|
|
v1.Aux = n
|
|
|
|
|
v1.AuxInt = off + config.PtrSize
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v2.Type = config.fe.TypeInt()
|
|
|
|
|
v2.Aux = n
|
|
|
|
|
v2.AuxInt = off + 2*config.PtrSize
|
|
|
|
|
v.AddArg(v2)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endab4b93ad3b1cf55e5bf25d1fd9cd498e
|
|
|
|
|
endab4b93ad3b1cf55e5bf25d1fd9cd498e:
|
|
|
|
|
;
|
|
|
|
|
// match: (Arg {n} [off])
|
|
|
|
|
// cond: v.Type.IsInterface()
|
|
|
|
|
// result: (IMake (Arg <config.fe.TypeBytePtr()> {n} [off]) (Arg <config.fe.TypeBytePtr()> {n} [off+config.PtrSize]))
|
|
|
|
|
{
|
|
|
|
|
n := v.Aux
|
|
|
|
|
off := v.AuxInt
|
|
|
|
|
if !(v.Type.IsInterface()) {
|
|
|
|
|
goto end851de8e588a39e81b4e2aef06566bf3e
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpIMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v0.Aux = n
|
|
|
|
|
v0.AuxInt = off
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v1.Aux = n
|
|
|
|
|
v1.AuxInt = off + config.PtrSize
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end851de8e588a39e81b4e2aef06566bf3e
|
|
|
|
|
end851de8e588a39e81b4e2aef06566bf3e:
|
|
|
|
|
;
|
|
|
|
|
// match: (Arg {n} [off])
|
|
|
|
|
// cond: v.Type.IsComplex() && v.Type.Size() == 16
|
|
|
|
|
// result: (ComplexMake (Arg <config.fe.TypeFloat64()> {n} [off]) (Arg <config.fe.TypeFloat64()> {n} [off+8]))
|
|
|
|
|
{
|
|
|
|
|
n := v.Aux
|
|
|
|
|
off := v.AuxInt
|
|
|
|
|
if !(v.Type.IsComplex() && v.Type.Size() == 16) {
|
|
|
|
|
goto end0988fc6a62c810b2f4976cb6cf44387f
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpComplexMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeFloat64()
|
|
|
|
|
v0.Aux = n
|
|
|
|
|
v0.AuxInt = off
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeFloat64()
|
|
|
|
|
v1.Aux = n
|
|
|
|
|
v1.AuxInt = off + 8
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0988fc6a62c810b2f4976cb6cf44387f
|
|
|
|
|
end0988fc6a62c810b2f4976cb6cf44387f:
|
|
|
|
|
;
|
|
|
|
|
// match: (Arg {n} [off])
|
|
|
|
|
// cond: v.Type.IsComplex() && v.Type.Size() == 8
|
|
|
|
|
// result: (ComplexMake (Arg <config.fe.TypeFloat32()> {n} [off]) (Arg <config.fe.TypeFloat32()> {n} [off+4]))
|
|
|
|
|
{
|
|
|
|
|
n := v.Aux
|
|
|
|
|
off := v.AuxInt
|
|
|
|
|
if !(v.Type.IsComplex() && v.Type.Size() == 8) {
|
|
|
|
|
goto enda348e93e0036873dd7089a2939c22e3e
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpComplexMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeFloat32()
|
|
|
|
|
v0.Aux = n
|
|
|
|
|
v0.AuxInt = off
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeFloat32()
|
|
|
|
|
v1.Aux = n
|
|
|
|
|
v1.AuxInt = off + 4
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto enda348e93e0036873dd7089a2939c22e3e
|
|
|
|
|
enda348e93e0036873dd7089a2939c22e3e:
|
2016-01-11 21:05:33 -08:00
|
|
|
;
|
|
|
|
|
// match: (Arg <t>)
|
|
|
|
|
// cond: t.IsStruct() && t.NumFields() == 0 && config.fe.CanSSA(t)
|
|
|
|
|
// result: (StructMake0)
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
if !(t.IsStruct() && t.NumFields() == 0 && config.fe.CanSSA(t)) {
|
|
|
|
|
goto ende233eeefa826638b0e541bcca531d701
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStructMake0
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto ende233eeefa826638b0e541bcca531d701
|
|
|
|
|
ende233eeefa826638b0e541bcca531d701:
|
|
|
|
|
;
|
|
|
|
|
// match: (Arg <t> {n} [off])
|
|
|
|
|
// cond: t.IsStruct() && t.NumFields() == 1 && config.fe.CanSSA(t)
|
|
|
|
|
// result: (StructMake1 (Arg <t.FieldType(0)> {n} [off+t.FieldOff(0)]))
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
n := v.Aux
|
|
|
|
|
off := v.AuxInt
|
|
|
|
|
if !(t.IsStruct() && t.NumFields() == 1 && config.fe.CanSSA(t)) {
|
|
|
|
|
goto ende953e77a0617051dd3f7ad4d58c9ab37
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStructMake1
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(0)
|
|
|
|
|
v0.Aux = n
|
|
|
|
|
v0.AuxInt = off + t.FieldOff(0)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto ende953e77a0617051dd3f7ad4d58c9ab37
|
|
|
|
|
ende953e77a0617051dd3f7ad4d58c9ab37:
|
|
|
|
|
;
|
|
|
|
|
// match: (Arg <t> {n} [off])
|
|
|
|
|
// cond: t.IsStruct() && t.NumFields() == 2 && config.fe.CanSSA(t)
|
|
|
|
|
// result: (StructMake2 (Arg <t.FieldType(0)> {n} [off+t.FieldOff(0)]) (Arg <t.FieldType(1)> {n} [off+t.FieldOff(1)]))
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
n := v.Aux
|
|
|
|
|
off := v.AuxInt
|
|
|
|
|
if !(t.IsStruct() && t.NumFields() == 2 && config.fe.CanSSA(t)) {
|
|
|
|
|
goto end9a008048978aabad9de0723212e60631
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStructMake2
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(0)
|
|
|
|
|
v0.Aux = n
|
|
|
|
|
v0.AuxInt = off + t.FieldOff(0)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v1.Type = t.FieldType(1)
|
|
|
|
|
v1.Aux = n
|
|
|
|
|
v1.AuxInt = off + t.FieldOff(1)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end9a008048978aabad9de0723212e60631
|
|
|
|
|
end9a008048978aabad9de0723212e60631:
|
|
|
|
|
;
|
|
|
|
|
// match: (Arg <t> {n} [off])
|
|
|
|
|
// cond: t.IsStruct() && t.NumFields() == 3 && config.fe.CanSSA(t)
|
|
|
|
|
// result: (StructMake3 (Arg <t.FieldType(0)> {n} [off+t.FieldOff(0)]) (Arg <t.FieldType(1)> {n} [off+t.FieldOff(1)]) (Arg <t.FieldType(2)> {n} [off+t.FieldOff(2)]))
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
n := v.Aux
|
|
|
|
|
off := v.AuxInt
|
|
|
|
|
if !(t.IsStruct() && t.NumFields() == 3 && config.fe.CanSSA(t)) {
|
|
|
|
|
goto end0196e61dbeebc6402f3aa1e9a182210b
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStructMake3
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(0)
|
|
|
|
|
v0.Aux = n
|
|
|
|
|
v0.AuxInt = off + t.FieldOff(0)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v1.Type = t.FieldType(1)
|
|
|
|
|
v1.Aux = n
|
|
|
|
|
v1.AuxInt = off + t.FieldOff(1)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v2.Type = t.FieldType(2)
|
|
|
|
|
v2.Aux = n
|
|
|
|
|
v2.AuxInt = off + t.FieldOff(2)
|
|
|
|
|
v.AddArg(v2)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0196e61dbeebc6402f3aa1e9a182210b
|
|
|
|
|
end0196e61dbeebc6402f3aa1e9a182210b:
|
|
|
|
|
;
|
|
|
|
|
// match: (Arg <t> {n} [off])
|
|
|
|
|
// cond: t.IsStruct() && t.NumFields() == 4 && config.fe.CanSSA(t)
|
|
|
|
|
// result: (StructMake4 (Arg <t.FieldType(0)> {n} [off+t.FieldOff(0)]) (Arg <t.FieldType(1)> {n} [off+t.FieldOff(1)]) (Arg <t.FieldType(2)> {n} [off+t.FieldOff(2)]) (Arg <t.FieldType(3)> {n} [off+t.FieldOff(3)]))
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
n := v.Aux
|
|
|
|
|
off := v.AuxInt
|
|
|
|
|
if !(t.IsStruct() && t.NumFields() == 4 && config.fe.CanSSA(t)) {
|
|
|
|
|
goto end6bc133c93e50cb14c2e6cc9401850738
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStructMake4
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(0)
|
|
|
|
|
v0.Aux = n
|
|
|
|
|
v0.AuxInt = off + t.FieldOff(0)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v1.Type = t.FieldType(1)
|
|
|
|
|
v1.Aux = n
|
|
|
|
|
v1.AuxInt = off + t.FieldOff(1)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v2.Type = t.FieldType(2)
|
|
|
|
|
v2.Aux = n
|
|
|
|
|
v2.AuxInt = off + t.FieldOff(2)
|
|
|
|
|
v.AddArg(v2)
|
|
|
|
|
v3 := b.NewValue0(v.Line, OpArg, TypeInvalid)
|
|
|
|
|
v3.Type = t.FieldType(3)
|
|
|
|
|
v3.Aux = n
|
|
|
|
|
v3.AuxInt = off + t.FieldOff(3)
|
|
|
|
|
v.AddArg(v3)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end6bc133c93e50cb14c2e6cc9401850738
|
|
|
|
|
end6bc133c93e50cb14c2e6cc9401850738:
|
2015-11-02 08:10:26 -08:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-26 21:49:31 -07:00
|
|
|
func rewriteValuegeneric_OpArrayIndex(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (ArrayIndex (Load ptr mem) idx)
|
|
|
|
|
// cond: b == v.Args[0].Block
|
|
|
|
|
// result: (Load (PtrIndex <v.Type.PtrTo()> ptr idx) mem)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpLoad {
|
|
|
|
|
goto end68b373270d9d605c420497edefaa71df
|
|
|
|
|
}
|
|
|
|
|
ptr := v.Args[0].Args[0]
|
|
|
|
|
mem := v.Args[0].Args[1]
|
|
|
|
|
idx := v.Args[1]
|
|
|
|
|
if !(b == v.Args[0].Block) {
|
|
|
|
|
goto end68b373270d9d605c420497edefaa71df
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpLoad
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpPtrIndex, TypeInvalid)
|
|
|
|
|
v0.Type = v.Type.PtrTo()
|
|
|
|
|
v0.AddArg(ptr)
|
|
|
|
|
v0.AddArg(idx)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(mem)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end68b373270d9d605c420497edefaa71df
|
|
|
|
|
end68b373270d9d605c420497edefaa71df:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpCom16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Com16 (Com16 x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpCom16 {
|
|
|
|
|
goto end1ea17710dd4dd7ba4e710e0e4c7b5a56
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end1ea17710dd4dd7ba4e710e0e4c7b5a56
|
|
|
|
|
end1ea17710dd4dd7ba4e710e0e4c7b5a56:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpCom32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Com32 (Com32 x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpCom32 {
|
|
|
|
|
goto end9a04ed536496e292c27bef4414128cbf
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end9a04ed536496e292c27bef4414128cbf
|
|
|
|
|
end9a04ed536496e292c27bef4414128cbf:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpCom64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Com64 (Com64 x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpCom64 {
|
|
|
|
|
goto ended44e29d5968f0f7b86972b7bf417ab3
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto ended44e29d5968f0f7b86972b7bf417ab3
|
|
|
|
|
ended44e29d5968f0f7b86972b7bf417ab3:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpCom8(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Com8 (Com8 x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpCom8 {
|
|
|
|
|
goto end4d92ff3ba567d9afd38fc9ca113602ad
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end4d92ff3ba567d9afd38fc9ca113602ad
|
|
|
|
|
end4d92ff3ba567d9afd38fc9ca113602ad:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpComplexImag(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (ComplexImag (ComplexMake _ imag ))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: imag
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpComplexMake {
|
|
|
|
|
goto endec3009fd8727d03002021997936e091f
|
|
|
|
|
}
|
|
|
|
|
imag := v.Args[0].Args[1]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = imag.Type
|
|
|
|
|
v.AddArg(imag)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endec3009fd8727d03002021997936e091f
|
|
|
|
|
endec3009fd8727d03002021997936e091f:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpComplexReal(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (ComplexReal (ComplexMake real _ ))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: real
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpComplexMake {
|
|
|
|
|
goto end8db3e16bd59af1adaa4b734c8adcc71d
|
|
|
|
|
}
|
|
|
|
|
real := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = real.Type
|
|
|
|
|
v.AddArg(real)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end8db3e16bd59af1adaa4b734c8adcc71d
|
|
|
|
|
end8db3e16bd59af1adaa4b734c8adcc71d:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpConstInterface(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (ConstInterface)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (IMake (ConstNil <config.fe.TypeBytePtr()>) (ConstNil <config.fe.TypeBytePtr()>))
|
|
|
|
|
{
|
|
|
|
|
v.Op = OpIMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConstNil, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpConstNil, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0367bd8f20a320cc41568f2b28657f6b
|
|
|
|
|
end0367bd8f20a320cc41568f2b28657f6b:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpConstSlice(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (ConstSlice)
|
2015-11-02 21:28:13 -08:00
|
|
|
// cond: config.PtrSize == 4
|
|
|
|
|
// result: (SliceMake (ConstNil <config.fe.TypeBytePtr()>) (Const32 <config.fe.TypeInt()> [0]) (Const32 <config.fe.TypeInt()> [0]))
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-11-02 21:28:13 -08:00
|
|
|
if !(config.PtrSize == 4) {
|
|
|
|
|
goto end9ba6baf9c7247b1f5ba4099c0c3910ce
|
|
|
|
|
}
|
2015-10-26 21:49:31 -07:00
|
|
|
v.Op = OpSliceMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConstNil, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v.AddArg(v0)
|
2015-11-02 21:28:13 -08:00
|
|
|
v1 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeInt()
|
2015-10-26 21:49:31 -07:00
|
|
|
v1.AuxInt = 0
|
|
|
|
|
v.AddArg(v1)
|
2015-11-02 21:28:13 -08:00
|
|
|
v2 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v2.Type = config.fe.TypeInt()
|
2015-10-26 21:49:31 -07:00
|
|
|
v2.AuxInt = 0
|
|
|
|
|
v.AddArg(v2)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-02 21:28:13 -08:00
|
|
|
goto end9ba6baf9c7247b1f5ba4099c0c3910ce
|
|
|
|
|
end9ba6baf9c7247b1f5ba4099c0c3910ce:
|
|
|
|
|
;
|
|
|
|
|
// match: (ConstSlice)
|
|
|
|
|
// cond: config.PtrSize == 8
|
|
|
|
|
// result: (SliceMake (ConstNil <config.fe.TypeBytePtr()>) (Const64 <config.fe.TypeInt()> [0]) (Const64 <config.fe.TypeInt()> [0]))
|
|
|
|
|
{
|
|
|
|
|
if !(config.PtrSize == 8) {
|
|
|
|
|
goto endabee2aa6bd3e3261628f677221ad2640
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpSliceMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConstNil, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeInt()
|
|
|
|
|
v1.AuxInt = 0
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v2.Type = config.fe.TypeInt()
|
|
|
|
|
v2.AuxInt = 0
|
|
|
|
|
v.AddArg(v2)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endabee2aa6bd3e3261628f677221ad2640
|
|
|
|
|
endabee2aa6bd3e3261628f677221ad2640:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpConstString(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (ConstString {s})
|
2015-11-09 20:54:34 -08:00
|
|
|
// cond: config.PtrSize == 4 && s.(string) == ""
|
|
|
|
|
// result: (StringMake (ConstNil) (Const32 <config.fe.TypeInt()> [0]))
|
|
|
|
|
{
|
|
|
|
|
s := v.Aux
|
|
|
|
|
if !(config.PtrSize == 4 && s.(string) == "") {
|
|
|
|
|
goto end85d5f388ba947643af63cdc68c1155a5
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStringMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConstNil, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeInt()
|
|
|
|
|
v1.AuxInt = 0
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end85d5f388ba947643af63cdc68c1155a5
|
|
|
|
|
end85d5f388ba947643af63cdc68c1155a5:
|
|
|
|
|
;
|
|
|
|
|
// match: (ConstString {s})
|
|
|
|
|
// cond: config.PtrSize == 8 && s.(string) == ""
|
|
|
|
|
// result: (StringMake (ConstNil) (Const64 <config.fe.TypeInt()> [0]))
|
|
|
|
|
{
|
|
|
|
|
s := v.Aux
|
|
|
|
|
if !(config.PtrSize == 8 && s.(string) == "") {
|
|
|
|
|
goto endc807259a5ed2760fbbd3dc7386641343
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStringMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConstNil, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeInt()
|
|
|
|
|
v1.AuxInt = 0
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endc807259a5ed2760fbbd3dc7386641343
|
|
|
|
|
endc807259a5ed2760fbbd3dc7386641343:
|
|
|
|
|
;
|
|
|
|
|
// match: (ConstString {s})
|
|
|
|
|
// cond: config.PtrSize == 4 && s.(string) != ""
|
2015-11-02 21:28:13 -08:00
|
|
|
// result: (StringMake (Addr <config.fe.TypeBytePtr()> {config.fe.StringData(s.(string))} (SB)) (Const32 <config.fe.TypeInt()> [int64(len(s.(string)))]))
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
|
|
|
|
s := v.Aux
|
2015-11-09 20:54:34 -08:00
|
|
|
if !(config.PtrSize == 4 && s.(string) != "") {
|
|
|
|
|
goto end107a700a4519d18f418602421444ddb6
|
2015-11-02 21:28:13 -08:00
|
|
|
}
|
2015-10-26 21:49:31 -07:00
|
|
|
v.Op = OpStringMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpAddr, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v0.Aux = config.fe.StringData(s.(string))
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpSB, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeUintptr()
|
|
|
|
|
v0.AddArg(v1)
|
|
|
|
|
v.AddArg(v0)
|
2015-11-02 21:28:13 -08:00
|
|
|
v2 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v2.Type = config.fe.TypeInt()
|
2015-10-26 21:49:31 -07:00
|
|
|
v2.AuxInt = int64(len(s.(string)))
|
|
|
|
|
v.AddArg(v2)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-09 20:54:34 -08:00
|
|
|
goto end107a700a4519d18f418602421444ddb6
|
|
|
|
|
end107a700a4519d18f418602421444ddb6:
|
2015-11-02 21:28:13 -08:00
|
|
|
;
|
|
|
|
|
// match: (ConstString {s})
|
2015-11-09 20:54:34 -08:00
|
|
|
// cond: config.PtrSize == 8 && s.(string) != ""
|
2015-11-02 21:28:13 -08:00
|
|
|
// result: (StringMake (Addr <config.fe.TypeBytePtr()> {config.fe.StringData(s.(string))} (SB)) (Const64 <config.fe.TypeInt()> [int64(len(s.(string)))]))
|
|
|
|
|
{
|
|
|
|
|
s := v.Aux
|
2015-11-09 20:54:34 -08:00
|
|
|
if !(config.PtrSize == 8 && s.(string) != "") {
|
|
|
|
|
goto end7ce9db29d17866f26d21e6e12f442e54
|
2015-11-02 21:28:13 -08:00
|
|
|
}
|
|
|
|
|
v.Op = OpStringMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpAddr, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v0.Aux = config.fe.StringData(s.(string))
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpSB, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeUintptr()
|
|
|
|
|
v0.AddArg(v1)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v2.Type = config.fe.TypeInt()
|
|
|
|
|
v2.AuxInt = int64(len(s.(string)))
|
|
|
|
|
v.AddArg(v2)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-09 20:54:34 -08:00
|
|
|
goto end7ce9db29d17866f26d21e6e12f442e54
|
|
|
|
|
end7ce9db29d17866f26d21e6e12f442e54:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpConvert(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-11-10 15:35:36 -08:00
|
|
|
// match: (Convert (Add64 (Convert ptr mem) off) mem)
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
|
|
|
|
// result: (Add64 ptr off)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpAdd64 {
|
2015-11-10 15:35:36 -08:00
|
|
|
goto endbbc9f1666b4d39a130e1b86f109e7c1b
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
if v.Args[0].Args[0].Op != OpConvert {
|
2015-11-10 15:35:36 -08:00
|
|
|
goto endbbc9f1666b4d39a130e1b86f109e7c1b
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
ptr := v.Args[0].Args[0].Args[0]
|
2015-11-10 15:35:36 -08:00
|
|
|
mem := v.Args[0].Args[0].Args[1]
|
2015-10-26 21:49:31 -07:00
|
|
|
off := v.Args[0].Args[1]
|
2015-11-10 15:35:36 -08:00
|
|
|
if v.Args[1] != mem {
|
|
|
|
|
goto endbbc9f1666b4d39a130e1b86f109e7c1b
|
|
|
|
|
}
|
2015-10-26 21:49:31 -07:00
|
|
|
v.Op = OpAdd64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AddArg(ptr)
|
|
|
|
|
v.AddArg(off)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-10 15:35:36 -08:00
|
|
|
goto endbbc9f1666b4d39a130e1b86f109e7c1b
|
|
|
|
|
endbbc9f1666b4d39a130e1b86f109e7c1b:
|
|
|
|
|
;
|
|
|
|
|
// match: (Convert (Convert ptr mem) mem)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: ptr
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConvert {
|
|
|
|
|
goto end98c5e0ca257eb216989171786f91b42d
|
|
|
|
|
}
|
|
|
|
|
ptr := v.Args[0].Args[0]
|
|
|
|
|
mem := v.Args[0].Args[1]
|
|
|
|
|
if v.Args[1] != mem {
|
|
|
|
|
goto end98c5e0ca257eb216989171786f91b42d
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = ptr.Type
|
|
|
|
|
v.AddArg(ptr)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end98c5e0ca257eb216989171786f91b42d
|
|
|
|
|
end98c5e0ca257eb216989171786f91b42d:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpEq16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Eq16 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [1])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end0c0fe5fdfba3821add3448fd3f1fc6b7
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 1
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0c0fe5fdfba3821add3448fd3f1fc6b7
|
|
|
|
|
end0c0fe5fdfba3821add3448fd3f1fc6b7:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Eq16 (Const16 <t> [c]) (Add16 (Const16 <t> [d]) x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Eq16 (Const16 <t> [c-d]) x)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end79c830afa265161fc0f0532c4c4e7f50
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[0].Type
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpAdd16 {
|
|
|
|
|
goto end79c830afa265161fc0f0532c4c4e7f50
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Op != OpConst16 {
|
|
|
|
|
goto end79c830afa265161fc0f0532c4c4e7f50
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Type != v.Args[0].Type {
|
|
|
|
|
goto end79c830afa265161fc0f0532c4c4e7f50
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].Args[0].AuxInt
|
|
|
|
|
x := v.Args[1].Args[1]
|
|
|
|
|
v.Op = OpEq16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c - d
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end79c830afa265161fc0f0532c4c4e7f50
|
|
|
|
|
end79c830afa265161fc0f0532c4c4e7f50:
|
|
|
|
|
;
|
|
|
|
|
// match: (Eq16 x (Const16 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst16
|
|
|
|
|
// result: (Eq16 (Const16 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end5d89fe1eeb145f14e11578f41282c904
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst16) {
|
|
|
|
|
goto end5d89fe1eeb145f14e11578f41282c904
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpEq16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end5d89fe1eeb145f14e11578f41282c904
|
|
|
|
|
end5d89fe1eeb145f14e11578f41282c904:
|
2015-10-27 17:46:53 -05:00
|
|
|
;
|
|
|
|
|
// match: (Eq16 (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int16(c) == int16(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end4532e1d01c10d8906fe1da14f9dfaa88
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end4532e1d01c10d8906fe1da14f9dfaa88
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int16(c) == int16(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end4532e1d01c10d8906fe1da14f9dfaa88
|
|
|
|
|
end4532e1d01c10d8906fe1da14f9dfaa88:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpEq32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Eq32 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [1])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end6da547ec4ee93d787434f3bda873e4a0
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 1
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end6da547ec4ee93d787434f3bda873e4a0
|
|
|
|
|
end6da547ec4ee93d787434f3bda873e4a0:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Eq32 (Const32 <t> [c]) (Add32 (Const32 <t> [d]) x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Eq32 (Const32 <t> [c-d]) x)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end1a69730a32c6e432784dcdf643320ecd
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[0].Type
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpAdd32 {
|
|
|
|
|
goto end1a69730a32c6e432784dcdf643320ecd
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Op != OpConst32 {
|
|
|
|
|
goto end1a69730a32c6e432784dcdf643320ecd
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Type != v.Args[0].Type {
|
|
|
|
|
goto end1a69730a32c6e432784dcdf643320ecd
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].Args[0].AuxInt
|
|
|
|
|
x := v.Args[1].Args[1]
|
|
|
|
|
v.Op = OpEq32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c - d
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end1a69730a32c6e432784dcdf643320ecd
|
|
|
|
|
end1a69730a32c6e432784dcdf643320ecd:
|
|
|
|
|
;
|
|
|
|
|
// match: (Eq32 x (Const32 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst32
|
|
|
|
|
// result: (Eq32 (Const32 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end0ca4ef4cf416ec3083d38667e263cf45
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst32) {
|
|
|
|
|
goto end0ca4ef4cf416ec3083d38667e263cf45
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpEq32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0ca4ef4cf416ec3083d38667e263cf45
|
|
|
|
|
end0ca4ef4cf416ec3083d38667e263cf45:
|
2015-10-27 17:46:53 -05:00
|
|
|
;
|
|
|
|
|
// match: (Eq32 (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int32(c) == int32(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end00a2464e02c9ca00e8d0077acacbb5ad
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end00a2464e02c9ca00e8d0077acacbb5ad
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int32(c) == int32(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end00a2464e02c9ca00e8d0077acacbb5ad
|
|
|
|
|
end00a2464e02c9ca00e8d0077acacbb5ad:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpEq64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Eq64 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [1])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto endb1d471cc503ba8bb05440f01dbf33d81
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 1
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endb1d471cc503ba8bb05440f01dbf33d81
|
|
|
|
|
endb1d471cc503ba8bb05440f01dbf33d81:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Eq64 (Const64 <t> [c]) (Add64 (Const64 <t> [d]) x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Eq64 (Const64 <t> [c-d]) x)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto endffd67f3b83f6972cd459153d318f714d
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[0].Type
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpAdd64 {
|
|
|
|
|
goto endffd67f3b83f6972cd459153d318f714d
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Op != OpConst64 {
|
|
|
|
|
goto endffd67f3b83f6972cd459153d318f714d
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Type != v.Args[0].Type {
|
|
|
|
|
goto endffd67f3b83f6972cd459153d318f714d
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].Args[0].AuxInt
|
|
|
|
|
x := v.Args[1].Args[1]
|
|
|
|
|
v.Op = OpEq64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c - d
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endffd67f3b83f6972cd459153d318f714d
|
|
|
|
|
endffd67f3b83f6972cd459153d318f714d:
|
|
|
|
|
;
|
|
|
|
|
// match: (Eq64 x (Const64 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst64
|
|
|
|
|
// result: (Eq64 (Const64 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto endc2ecf8254dc736e97c5815362d0b477d
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst64) {
|
|
|
|
|
goto endc2ecf8254dc736e97c5815362d0b477d
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpEq64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endc2ecf8254dc736e97c5815362d0b477d
|
|
|
|
|
endc2ecf8254dc736e97c5815362d0b477d:
|
2015-10-27 17:46:53 -05:00
|
|
|
;
|
|
|
|
|
// match: (Eq64 (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int64(c) == int64(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end405568a707dbbc86432e91f4ce7d97d7
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end405568a707dbbc86432e91f4ce7d97d7
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int64(c) == int64(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end405568a707dbbc86432e91f4ce7d97d7
|
|
|
|
|
end405568a707dbbc86432e91f4ce7d97d7:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpEq8(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Eq8 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [1])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto enda66da0d3e7e51624ee46527727c48a9a
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 1
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto enda66da0d3e7e51624ee46527727c48a9a
|
|
|
|
|
enda66da0d3e7e51624ee46527727c48a9a:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Eq8 (Const8 <t> [c]) (Add8 (Const8 <t> [d]) x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Eq8 (Const8 <t> [c-d]) x)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto end6912961350bb485f56ef176522aa683b
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[0].Type
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpAdd8 {
|
|
|
|
|
goto end6912961350bb485f56ef176522aa683b
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Op != OpConst8 {
|
|
|
|
|
goto end6912961350bb485f56ef176522aa683b
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Type != v.Args[0].Type {
|
|
|
|
|
goto end6912961350bb485f56ef176522aa683b
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].Args[0].AuxInt
|
|
|
|
|
x := v.Args[1].Args[1]
|
|
|
|
|
v.Op = OpEq8
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c - d
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end6912961350bb485f56ef176522aa683b
|
|
|
|
|
end6912961350bb485f56ef176522aa683b:
|
|
|
|
|
;
|
|
|
|
|
// match: (Eq8 x (Const8 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst8
|
|
|
|
|
// result: (Eq8 (Const8 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto end70d0b569427b24e7a912a1aa8fab3b20
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst8) {
|
|
|
|
|
goto end70d0b569427b24e7a912a1aa8fab3b20
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpEq8
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end70d0b569427b24e7a912a1aa8fab3b20
|
|
|
|
|
end70d0b569427b24e7a912a1aa8fab3b20:
|
2015-10-27 17:46:53 -05:00
|
|
|
;
|
|
|
|
|
// match: (Eq8 (Const8 [c]) (Const8 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int8(c) == int8(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto endd49f3700ba2d1e500d3ab4fa34fd090d
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto endd49f3700ba2d1e500d3ab4fa34fd090d
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int8(c) == int8(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endd49f3700ba2d1e500d3ab4fa34fd090d
|
|
|
|
|
endd49f3700ba2d1e500d3ab4fa34fd090d:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpEqInter(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (EqInter x y)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (EqPtr (ITab x) (ITab y))
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
y := v.Args[1]
|
|
|
|
|
v.Op = OpEqPtr
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpITab, TypeInvalid)
|
|
|
|
|
v0.AddArg(x)
|
2015-11-02 21:28:13 -08:00
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpITab, TypeInvalid)
|
|
|
|
|
v1.AddArg(y)
|
2015-11-02 21:28:13 -08:00
|
|
|
v1.Type = config.fe.TypeBytePtr()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end1cc40483caab33ece971ab7e6c8fdfca
|
|
|
|
|
end1cc40483caab33ece971ab7e6c8fdfca:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpEqPtr(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (EqPtr p (ConstNil))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Not (IsNonNil p))
|
|
|
|
|
{
|
|
|
|
|
p := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConstNil {
|
|
|
|
|
goto ende701cdb6a2c1fff4d4b283b7f8f6178b
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpNot
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpIsNonNil, TypeInvalid)
|
|
|
|
|
v0.AddArg(p)
|
|
|
|
|
v0.Type = config.fe.TypeBool()
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto ende701cdb6a2c1fff4d4b283b7f8f6178b
|
|
|
|
|
ende701cdb6a2c1fff4d4b283b7f8f6178b:
|
|
|
|
|
;
|
|
|
|
|
// match: (EqPtr (ConstNil) p)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Not (IsNonNil p))
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConstNil {
|
|
|
|
|
goto end7cdc0d5c38fbffe6287c8928803b038e
|
|
|
|
|
}
|
|
|
|
|
p := v.Args[1]
|
|
|
|
|
v.Op = OpNot
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpIsNonNil, TypeInvalid)
|
|
|
|
|
v0.AddArg(p)
|
|
|
|
|
v0.Type = config.fe.TypeBool()
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end7cdc0d5c38fbffe6287c8928803b038e
|
|
|
|
|
end7cdc0d5c38fbffe6287c8928803b038e:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpEqSlice(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (EqSlice x y)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (EqPtr (SlicePtr x) (SlicePtr y))
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
y := v.Args[1]
|
|
|
|
|
v.Op = OpEqPtr
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpSlicePtr, TypeInvalid)
|
|
|
|
|
v0.AddArg(x)
|
2015-11-02 21:28:13 -08:00
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpSlicePtr, TypeInvalid)
|
|
|
|
|
v1.AddArg(y)
|
2015-11-02 21:28:13 -08:00
|
|
|
v1.Type = config.fe.TypeBytePtr()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end9cd53ca57ee90aa09c54f8071c8e8769
|
|
|
|
|
end9cd53ca57ee90aa09c54f8071c8e8769:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGeq16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Geq16 (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int16(c) >= int16(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto endbac100e9f1065e7d2ff863951f686f4b
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto endbac100e9f1065e7d2ff863951f686f4b
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int16(c) >= int16(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endbac100e9f1065e7d2ff863951f686f4b
|
|
|
|
|
endbac100e9f1065e7d2ff863951f686f4b:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGeq16U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Geq16U (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint16(c) >= uint16(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end11c6acbc5827fc9508424b0ffcf98b34
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end11c6acbc5827fc9508424b0ffcf98b34
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(uint16(c) >= uint16(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end11c6acbc5827fc9508424b0ffcf98b34
|
|
|
|
|
end11c6acbc5827fc9508424b0ffcf98b34:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGeq32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Geq32 (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int32(c) >= int32(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end89ced97524ac75045911ca7cf6d44b28
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end89ced97524ac75045911ca7cf6d44b28
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int32(c) >= int32(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end89ced97524ac75045911ca7cf6d44b28
|
|
|
|
|
end89ced97524ac75045911ca7cf6d44b28:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGeq32U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Geq32U (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint32(c) >= uint32(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end92fbe85c7bbbf0db287932822bdde991
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end92fbe85c7bbbf0db287932822bdde991
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(uint32(c) >= uint32(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end92fbe85c7bbbf0db287932822bdde991
|
|
|
|
|
end92fbe85c7bbbf0db287932822bdde991:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGeq64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Geq64 (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int64(c) >= int64(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end08a5a4bff12a346befe05ad561b080ac
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end08a5a4bff12a346befe05ad561b080ac
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int64(c) >= int64(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end08a5a4bff12a346befe05ad561b080ac
|
|
|
|
|
end08a5a4bff12a346befe05ad561b080ac:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGeq64U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Geq64U (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint64(c) >= uint64(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto endd72c497b6cc2b01d43a39ec12d5010b3
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto endd72c497b6cc2b01d43a39ec12d5010b3
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(uint64(c) >= uint64(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endd72c497b6cc2b01d43a39ec12d5010b3
|
|
|
|
|
endd72c497b6cc2b01d43a39ec12d5010b3:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGeq8(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Geq8 (Const8 [c]) (Const8 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int8(c) >= int8(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto endea141068e84038c63cbdd87a8cb227d7
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto endea141068e84038c63cbdd87a8cb227d7
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int8(c) >= int8(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endea141068e84038c63cbdd87a8cb227d7
|
|
|
|
|
endea141068e84038c63cbdd87a8cb227d7:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGeq8U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Geq8U (Const8 [c]) (Const8 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint8(c) >= uint8(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto end47c128ccdc54151a243c5856b0c52ef1
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto end47c128ccdc54151a243c5856b0c52ef1
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(uint8(c) >= uint8(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end47c128ccdc54151a243c5856b0c52ef1
|
|
|
|
|
end47c128ccdc54151a243c5856b0c52ef1:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGreater16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Greater16 (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int16(c) > int16(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end390bae49463ace4d703dd24e18920f66
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end390bae49463ace4d703dd24e18920f66
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int16(c) > int16(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end390bae49463ace4d703dd24e18920f66
|
|
|
|
|
end390bae49463ace4d703dd24e18920f66:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGreater16U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Greater16U (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint16(c) > uint16(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end89ba3caf5c156fa6d908ac04c058187b
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end89ba3caf5c156fa6d908ac04c058187b
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(uint16(c) > uint16(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end89ba3caf5c156fa6d908ac04c058187b
|
|
|
|
|
end89ba3caf5c156fa6d908ac04c058187b:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGreater32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Greater32 (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int32(c) > int32(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end86482a9dc6439e8470da5352dd74d68d
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end86482a9dc6439e8470da5352dd74d68d
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int32(c) > int32(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end86482a9dc6439e8470da5352dd74d68d
|
|
|
|
|
end86482a9dc6439e8470da5352dd74d68d:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGreater32U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Greater32U (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint32(c) > uint32(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end1bf3f05c1e3599a969b8be1f5f6949e4
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end1bf3f05c1e3599a969b8be1f5f6949e4
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(uint32(c) > uint32(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end1bf3f05c1e3599a969b8be1f5f6949e4
|
|
|
|
|
end1bf3f05c1e3599a969b8be1f5f6949e4:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGreater64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Greater64 (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int64(c) > int64(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end96a82e893fda4882f23b6bab5f7fbff7
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end96a82e893fda4882f23b6bab5f7fbff7
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int64(c) > int64(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end96a82e893fda4882f23b6bab5f7fbff7
|
|
|
|
|
end96a82e893fda4882f23b6bab5f7fbff7:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGreater64U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Greater64U (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint64(c) > uint64(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end2d8f5ad85fbffeb92af985a888f6fa69
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end2d8f5ad85fbffeb92af985a888f6fa69
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(uint64(c) > uint64(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end2d8f5ad85fbffeb92af985a888f6fa69
|
|
|
|
|
end2d8f5ad85fbffeb92af985a888f6fa69:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGreater8(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Greater8 (Const8 [c]) (Const8 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int8(c) > int8(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto ende221967c7516b7749109cf8343fe9c83
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto ende221967c7516b7749109cf8343fe9c83
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int8(c) > int8(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto ende221967c7516b7749109cf8343fe9c83
|
|
|
|
|
ende221967c7516b7749109cf8343fe9c83:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpGreater8U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Greater8U (Const8 [c]) (Const8 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint8(c) > uint8(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto enda9398c8188156dd46689fa2939147525
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto enda9398c8188156dd46689fa2939147525
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(uint8(c) > uint8(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto enda9398c8188156dd46689fa2939147525
|
|
|
|
|
enda9398c8188156dd46689fa2939147525:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpIData(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (IData (IMake _ data))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: data
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpIMake {
|
|
|
|
|
goto endbfa1bb944cdc07933effb16a35152e12
|
|
|
|
|
}
|
|
|
|
|
data := v.Args[0].Args[1]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = data.Type
|
|
|
|
|
v.AddArg(data)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endbfa1bb944cdc07933effb16a35152e12
|
|
|
|
|
endbfa1bb944cdc07933effb16a35152e12:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpITab(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (ITab (IMake itab _))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: itab
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpIMake {
|
|
|
|
|
goto endfcbb9414a776ff9c8512da3e0f4d8fbd
|
|
|
|
|
}
|
|
|
|
|
itab := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = itab.Type
|
|
|
|
|
v.AddArg(itab)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endfcbb9414a776ff9c8512da3e0f4d8fbd
|
|
|
|
|
endfcbb9414a776ff9c8512da3e0f4d8fbd:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpIsInBounds(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (IsInBounds (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(inBounds32(c,d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto endf0a2ecfe84b293de6ff0919e45d19d9d
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto endf0a2ecfe84b293de6ff0919e45d19d9d
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(inBounds32(c, d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endf0a2ecfe84b293de6ff0919e45d19d9d
|
|
|
|
|
endf0a2ecfe84b293de6ff0919e45d19d9d:
|
|
|
|
|
;
|
|
|
|
|
// match: (IsInBounds (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(inBounds64(c,d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end4b406f402c135f50f71effcc904ecb2b
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end4b406f402c135f50f71effcc904ecb2b
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(inBounds64(c, d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end4b406f402c135f50f71effcc904ecb2b
|
|
|
|
|
end4b406f402c135f50f71effcc904ecb2b:
|
|
|
|
|
;
|
2015-11-02 21:28:13 -08:00
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpIsSliceInBounds(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (IsSliceInBounds (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(sliceInBounds32(c,d))])
|
2015-10-27 17:46:53 -05:00
|
|
|
{
|
2015-11-02 21:28:13 -08:00
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end5e84a230c28cac987437cfed8f432cc3
|
2015-10-27 17:46:53 -05:00
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
2015-11-02 21:28:13 -08:00
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end5e84a230c28cac987437cfed8f432cc3
|
2015-10-27 17:46:53 -05:00
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-11-02 21:28:13 -08:00
|
|
|
v.AuxInt = b2i(sliceInBounds32(c, d))
|
2015-10-27 17:46:53 -05:00
|
|
|
return true
|
|
|
|
|
}
|
2015-11-02 21:28:13 -08:00
|
|
|
goto end5e84a230c28cac987437cfed8f432cc3
|
|
|
|
|
end5e84a230c28cac987437cfed8f432cc3:
|
2015-10-27 17:46:53 -05:00
|
|
|
;
|
2015-11-02 21:28:13 -08:00
|
|
|
// match: (IsSliceInBounds (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(sliceInBounds64(c,d))])
|
2015-10-27 17:46:53 -05:00
|
|
|
{
|
2015-11-02 21:28:13 -08:00
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end3880a6fe20ad4152e98f76d84da233a7
|
2015-10-27 17:46:53 -05:00
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
2015-11-02 21:28:13 -08:00
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end3880a6fe20ad4152e98f76d84da233a7
|
2015-10-27 17:46:53 -05:00
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-11-02 21:28:13 -08:00
|
|
|
v.AuxInt = b2i(sliceInBounds64(c, d))
|
2015-10-27 17:46:53 -05:00
|
|
|
return true
|
|
|
|
|
}
|
2015-11-02 21:28:13 -08:00
|
|
|
goto end3880a6fe20ad4152e98f76d84da233a7
|
|
|
|
|
end3880a6fe20ad4152e98f76d84da233a7:
|
2015-10-27 17:46:53 -05:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpLeq16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Leq16 (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int16(c) <= int16(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end76b1c51f9b7cd7ee2f75b9f7057569de
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end76b1c51f9b7cd7ee2f75b9f7057569de
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int16(c) <= int16(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end76b1c51f9b7cd7ee2f75b9f7057569de
|
|
|
|
|
end76b1c51f9b7cd7ee2f75b9f7057569de:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpLeq16U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Leq16U (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint16(c) <= uint16(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto endf010fdf7f2c438ec18c33f493dd062aa
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto endf010fdf7f2c438ec18c33f493dd062aa
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(uint16(c) <= uint16(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endf010fdf7f2c438ec18c33f493dd062aa
|
|
|
|
|
endf010fdf7f2c438ec18c33f493dd062aa:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpLeq32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Leq32 (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int32(c) <= int32(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end6c7d61cfd188680bea8a5e23f08ca1de
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end6c7d61cfd188680bea8a5e23f08ca1de
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int32(c) <= int32(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end6c7d61cfd188680bea8a5e23f08ca1de
|
|
|
|
|
end6c7d61cfd188680bea8a5e23f08ca1de:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpLeq32U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Leq32U (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint32(c) <= uint32(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end4363555333511ee9b649b36f1a0ba34e
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end4363555333511ee9b649b36f1a0ba34e
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(uint32(c) <= uint32(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end4363555333511ee9b649b36f1a0ba34e
|
|
|
|
|
end4363555333511ee9b649b36f1a0ba34e:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
func rewriteValuegeneric_OpLeq64(v *Value, config *Config) bool {
|
2015-10-26 21:49:31 -07:00
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-10-27 17:46:53 -05:00
|
|
|
// match: (Leq64 (Const64 [c]) (Const64 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-10-27 17:46:53 -05:00
|
|
|
// result: (ConstBool [b2i(int64(c) <= int64(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto enddc865cd7ac2093abc7617bedbf371c22
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto enddc865cd7ac2093abc7617bedbf371c22
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
d := v.Args[1].AuxInt
|
2015-10-26 21:49:31 -07:00
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(int64(c) <= int64(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto enddc865cd7ac2093abc7617bedbf371c22
|
|
|
|
|
enddc865cd7ac2093abc7617bedbf371c22:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
func rewriteValuegeneric_OpLeq64U(v *Value, config *Config) bool {
|
2015-10-26 21:49:31 -07:00
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-10-27 17:46:53 -05:00
|
|
|
// match: (Leq64U (Const64 [c]) (Const64 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-10-27 17:46:53 -05:00
|
|
|
// result: (ConstBool [b2i(uint64(c) <= uint64(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end412eadb168738ba92f3f0705d4495305
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end412eadb168738ba92f3f0705d4495305
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
d := v.Args[1].AuxInt
|
2015-10-26 21:49:31 -07:00
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(uint64(c) <= uint64(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto end412eadb168738ba92f3f0705d4495305
|
|
|
|
|
end412eadb168738ba92f3f0705d4495305:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
func rewriteValuegeneric_OpLeq8(v *Value, config *Config) bool {
|
2015-10-26 21:49:31 -07:00
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-10-27 17:46:53 -05:00
|
|
|
// match: (Leq8 (Const8 [c]) (Const8 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-10-27 17:46:53 -05:00
|
|
|
// result: (ConstBool [b2i(int8(c) <= int8(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto endb5a459da8e18c40abc0c7a20e71d0187
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto endb5a459da8e18c40abc0c7a20e71d0187
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(int8(c) <= int8(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto endb5a459da8e18c40abc0c7a20e71d0187
|
|
|
|
|
endb5a459da8e18c40abc0c7a20e71d0187:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
func rewriteValuegeneric_OpLeq8U(v *Value, config *Config) bool {
|
2015-10-26 21:49:31 -07:00
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-10-27 17:46:53 -05:00
|
|
|
// match: (Leq8U (Const8 [c]) (Const8 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-10-27 17:46:53 -05:00
|
|
|
// result: (ConstBool [b2i(uint8(c) <= uint8(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto endd6622d55fcdf3fa7b08e7511cd3b7d85
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto endd6622d55fcdf3fa7b08e7511cd3b7d85
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(uint8(c) <= uint8(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto endd6622d55fcdf3fa7b08e7511cd3b7d85
|
|
|
|
|
endd6622d55fcdf3fa7b08e7511cd3b7d85:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
2015-10-27 17:46:53 -05:00
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpLess16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Less16 (Const16 [c]) (Const16 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-10-27 17:46:53 -05:00
|
|
|
// result: (ConstBool [b2i(int16(c) < int16(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end0dc915d089f05e79589ebb5c498cc360
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end0dc915d089f05e79589ebb5c498cc360
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(int16(c) < int16(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto end0dc915d089f05e79589ebb5c498cc360
|
|
|
|
|
end0dc915d089f05e79589ebb5c498cc360:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
func rewriteValuegeneric_OpLess16U(v *Value, config *Config) bool {
|
2015-10-26 21:49:31 -07:00
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-10-27 17:46:53 -05:00
|
|
|
// match: (Less16U (Const16 [c]) (Const16 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-10-27 17:46:53 -05:00
|
|
|
// result: (ConstBool [b2i(uint16(c) < uint16(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto endd2bb8249443788690946fc184631a00a
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto endd2bb8249443788690946fc184631a00a
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(uint16(c) < uint16(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto endd2bb8249443788690946fc184631a00a
|
|
|
|
|
endd2bb8249443788690946fc184631a00a:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
func rewriteValuegeneric_OpLess32(v *Value, config *Config) bool {
|
2015-10-26 21:49:31 -07:00
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-10-27 17:46:53 -05:00
|
|
|
// match: (Less32 (Const32 [c]) (Const32 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-10-27 17:46:53 -05:00
|
|
|
// result: (ConstBool [b2i(int32(c) < int32(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto endc86f65e499688809d414f03539bec5bf
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto endc86f65e499688809d414f03539bec5bf
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(int32(c) < int32(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto endc86f65e499688809d414f03539bec5bf
|
|
|
|
|
endc86f65e499688809d414f03539bec5bf:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
func rewriteValuegeneric_OpLess32U(v *Value, config *Config) bool {
|
2015-10-26 21:49:31 -07:00
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-10-27 17:46:53 -05:00
|
|
|
// match: (Less32U (Const32 [c]) (Const32 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-10-27 17:46:53 -05:00
|
|
|
// result: (ConstBool [b2i(uint32(c) < uint32(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end2cc68b5247b1afb90a9d3923b28ff247
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end2cc68b5247b1afb90a9d3923b28ff247
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(uint32(c) < uint32(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto end2cc68b5247b1afb90a9d3923b28ff247
|
|
|
|
|
end2cc68b5247b1afb90a9d3923b28ff247:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
func rewriteValuegeneric_OpLess64(v *Value, config *Config) bool {
|
2015-10-26 21:49:31 -07:00
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-10-27 17:46:53 -05:00
|
|
|
// match: (Less64 (Const64 [c]) (Const64 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-10-27 17:46:53 -05:00
|
|
|
// result: (ConstBool [b2i(int64(c) < int64(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end505de73cd15125dbb59b05d8975d3128
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end505de73cd15125dbb59b05d8975d3128
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(int64(c) < int64(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto end505de73cd15125dbb59b05d8975d3128
|
|
|
|
|
end505de73cd15125dbb59b05d8975d3128:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
2015-10-27 17:46:53 -05:00
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpLess64U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Less64U (Const64 [c]) (Const64 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-10-27 17:46:53 -05:00
|
|
|
// result: (ConstBool [b2i(uint64(c) < uint64(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
2015-10-27 17:46:53 -05:00
|
|
|
goto endeb249ef36416cd1abf4f807026c059cd
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
2015-10-27 17:46:53 -05:00
|
|
|
goto endeb249ef36416cd1abf4f807026c059cd
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(uint64(c) < uint64(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto endeb249ef36416cd1abf4f807026c059cd
|
|
|
|
|
endeb249ef36416cd1abf4f807026c059cd:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
2015-10-27 17:46:53 -05:00
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpLess8(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Less8 (Const8 [c]) (Const8 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int8(c) < int8(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto endef134de03bc8537ac1f38d5eccff7673
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto endef134de03bc8537ac1f38d5eccff7673
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(int8(c) < int8(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto endef134de03bc8537ac1f38d5eccff7673
|
|
|
|
|
endef134de03bc8537ac1f38d5eccff7673:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
2015-10-27 17:46:53 -05:00
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpLess8U(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Less8U (Const8 [c]) (Const8 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(uint8(c) < uint8(d))])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto end263ecdc279924bff8771dd1ac3f42222
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
2015-10-27 17:46:53 -05:00
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto end263ecdc279924bff8771dd1ac3f42222
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
2015-10-27 17:46:53 -05:00
|
|
|
v.AuxInt = b2i(uint8(c) < uint8(d))
|
2015-10-26 21:49:31 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-27 17:46:53 -05:00
|
|
|
goto end263ecdc279924bff8771dd1ac3f42222
|
|
|
|
|
end263ecdc279924bff8771dd1ac3f42222:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpLoad(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2016-01-11 21:05:33 -08:00
|
|
|
// match: (Load <t> _ _)
|
|
|
|
|
// cond: t.IsStruct() && t.NumFields() == 0 && config.fe.CanSSA(t)
|
|
|
|
|
// result: (StructMake0)
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
if !(t.IsStruct() && t.NumFields() == 0 && config.fe.CanSSA(t)) {
|
|
|
|
|
goto end8d25f5c949948132921b6be29ede6bde
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStructMake0
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end8d25f5c949948132921b6be29ede6bde
|
|
|
|
|
end8d25f5c949948132921b6be29ede6bde:
|
|
|
|
|
;
|
|
|
|
|
// match: (Load <t> ptr mem)
|
|
|
|
|
// cond: t.IsStruct() && t.NumFields() == 1 && config.fe.CanSSA(t)
|
|
|
|
|
// result: (StructMake1 (Load <t.FieldType(0)> ptr mem))
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
mem := v.Args[1]
|
|
|
|
|
if !(t.IsStruct() && t.NumFields() == 1 && config.fe.CanSSA(t)) {
|
|
|
|
|
goto endfe908e5a8617dd39df2f9b2b92e93ae5
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStructMake1
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(0)
|
|
|
|
|
v0.AddArg(ptr)
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endfe908e5a8617dd39df2f9b2b92e93ae5
|
|
|
|
|
endfe908e5a8617dd39df2f9b2b92e93ae5:
|
|
|
|
|
;
|
|
|
|
|
// match: (Load <t> ptr mem)
|
|
|
|
|
// cond: t.IsStruct() && t.NumFields() == 2 && config.fe.CanSSA(t)
|
|
|
|
|
// result: (StructMake2 (Load <t.FieldType(0)> ptr mem) (Load <t.FieldType(1)> (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] ptr) mem))
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
mem := v.Args[1]
|
|
|
|
|
if !(t.IsStruct() && t.NumFields() == 2 && config.fe.CanSSA(t)) {
|
|
|
|
|
goto end20e20e64004b765012cfb80c575ef27b
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStructMake2
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(0)
|
|
|
|
|
v0.AddArg(ptr)
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v1.Type = t.FieldType(1)
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v2.Type = t.FieldType(1).PtrTo()
|
|
|
|
|
v2.AuxInt = t.FieldOff(1)
|
|
|
|
|
v2.AddArg(ptr)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end20e20e64004b765012cfb80c575ef27b
|
|
|
|
|
end20e20e64004b765012cfb80c575ef27b:
|
|
|
|
|
;
|
|
|
|
|
// match: (Load <t> ptr mem)
|
|
|
|
|
// cond: t.IsStruct() && t.NumFields() == 3 && config.fe.CanSSA(t)
|
|
|
|
|
// result: (StructMake3 (Load <t.FieldType(0)> ptr mem) (Load <t.FieldType(1)> (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] ptr) mem) (Load <t.FieldType(2)> (OffPtr <t.FieldType(2).PtrTo()> [t.FieldOff(2)] ptr) mem))
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
mem := v.Args[1]
|
|
|
|
|
if !(t.IsStruct() && t.NumFields() == 3 && config.fe.CanSSA(t)) {
|
|
|
|
|
goto ende612bf71067ed67541735cdc8b5a3288
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStructMake3
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(0)
|
|
|
|
|
v0.AddArg(ptr)
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v1.Type = t.FieldType(1)
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v2.Type = t.FieldType(1).PtrTo()
|
|
|
|
|
v2.AuxInt = t.FieldOff(1)
|
|
|
|
|
v2.AddArg(ptr)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
v3 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v3.Type = t.FieldType(2)
|
|
|
|
|
v4 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v4.Type = t.FieldType(2).PtrTo()
|
|
|
|
|
v4.AuxInt = t.FieldOff(2)
|
|
|
|
|
v4.AddArg(ptr)
|
|
|
|
|
v3.AddArg(v4)
|
|
|
|
|
v3.AddArg(mem)
|
|
|
|
|
v.AddArg(v3)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto ende612bf71067ed67541735cdc8b5a3288
|
|
|
|
|
ende612bf71067ed67541735cdc8b5a3288:
|
|
|
|
|
;
|
|
|
|
|
// match: (Load <t> ptr mem)
|
|
|
|
|
// cond: t.IsStruct() && t.NumFields() == 4 && config.fe.CanSSA(t)
|
|
|
|
|
// result: (StructMake4 (Load <t.FieldType(0)> ptr mem) (Load <t.FieldType(1)> (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] ptr) mem) (Load <t.FieldType(2)> (OffPtr <t.FieldType(2).PtrTo()> [t.FieldOff(2)] ptr) mem) (Load <t.FieldType(3)> (OffPtr <t.FieldType(3).PtrTo()> [t.FieldOff(3)] ptr) mem))
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
mem := v.Args[1]
|
|
|
|
|
if !(t.IsStruct() && t.NumFields() == 4 && config.fe.CanSSA(t)) {
|
|
|
|
|
goto end46c66c64d9030f2cc9a7a767f67953d1
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpStructMake4
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(0)
|
|
|
|
|
v0.AddArg(ptr)
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v1.Type = t.FieldType(1)
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v2.Type = t.FieldType(1).PtrTo()
|
|
|
|
|
v2.AuxInt = t.FieldOff(1)
|
|
|
|
|
v2.AddArg(ptr)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
v3 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v3.Type = t.FieldType(2)
|
|
|
|
|
v4 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v4.Type = t.FieldType(2).PtrTo()
|
|
|
|
|
v4.AuxInt = t.FieldOff(2)
|
|
|
|
|
v4.AddArg(ptr)
|
|
|
|
|
v3.AddArg(v4)
|
|
|
|
|
v3.AddArg(mem)
|
|
|
|
|
v.AddArg(v3)
|
|
|
|
|
v5 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v5.Type = t.FieldType(3)
|
|
|
|
|
v6 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v6.Type = t.FieldType(3).PtrTo()
|
|
|
|
|
v6.AuxInt = t.FieldOff(3)
|
|
|
|
|
v6.AddArg(ptr)
|
|
|
|
|
v5.AddArg(v6)
|
|
|
|
|
v5.AddArg(mem)
|
|
|
|
|
v.AddArg(v5)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end46c66c64d9030f2cc9a7a767f67953d1
|
|
|
|
|
end46c66c64d9030f2cc9a7a767f67953d1:
|
|
|
|
|
;
|
2015-10-26 21:49:31 -07:00
|
|
|
// match: (Load <t> ptr mem)
|
|
|
|
|
// cond: t.IsComplex() && t.Size() == 8
|
|
|
|
|
// result: (ComplexMake (Load <config.fe.TypeFloat32()> ptr mem) (Load <config.fe.TypeFloat32()> (OffPtr <config.fe.TypeFloat32().PtrTo()> [4] ptr) mem) )
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
mem := v.Args[1]
|
|
|
|
|
if !(t.IsComplex() && t.Size() == 8) {
|
|
|
|
|
goto end665854b31b828893d90b36bb462ff381
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpComplexMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeFloat32()
|
|
|
|
|
v0.AddArg(ptr)
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeFloat32()
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v2.Type = config.fe.TypeFloat32().PtrTo()
|
|
|
|
|
v2.AuxInt = 4
|
|
|
|
|
v2.AddArg(ptr)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end665854b31b828893d90b36bb462ff381
|
|
|
|
|
end665854b31b828893d90b36bb462ff381:
|
|
|
|
|
;
|
|
|
|
|
// match: (Load <t> ptr mem)
|
|
|
|
|
// cond: t.IsComplex() && t.Size() == 16
|
|
|
|
|
// result: (ComplexMake (Load <config.fe.TypeFloat64()> ptr mem) (Load <config.fe.TypeFloat64()> (OffPtr <config.fe.TypeFloat64().PtrTo()> [8] ptr) mem) )
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
mem := v.Args[1]
|
|
|
|
|
if !(t.IsComplex() && t.Size() == 16) {
|
|
|
|
|
goto end1b106f89e0e3e26c613b957a7c98d8ad
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpComplexMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeFloat64()
|
|
|
|
|
v0.AddArg(ptr)
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeFloat64()
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v2.Type = config.fe.TypeFloat64().PtrTo()
|
|
|
|
|
v2.AuxInt = 8
|
|
|
|
|
v2.AddArg(ptr)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end1b106f89e0e3e26c613b957a7c98d8ad
|
|
|
|
|
end1b106f89e0e3e26c613b957a7c98d8ad:
|
|
|
|
|
;
|
|
|
|
|
// match: (Load <t> ptr mem)
|
|
|
|
|
// cond: t.IsString()
|
2015-11-02 08:10:26 -08:00
|
|
|
// result: (StringMake (Load <config.fe.TypeBytePtr()> ptr mem) (Load <config.fe.TypeInt()> (OffPtr <config.fe.TypeInt().PtrTo()> [config.PtrSize] ptr) mem))
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
mem := v.Args[1]
|
|
|
|
|
if !(t.IsString()) {
|
2015-11-02 08:10:26 -08:00
|
|
|
goto enddd15a6f3d53a6ce7a19d4e181dd1c13a
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
v.Op = OpStringMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v0.AddArg(ptr)
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
2015-11-02 08:10:26 -08:00
|
|
|
v1.Type = config.fe.TypeInt()
|
2015-10-26 21:49:31 -07:00
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
2015-11-02 08:10:26 -08:00
|
|
|
v2.Type = config.fe.TypeInt().PtrTo()
|
2015-10-26 21:49:31 -07:00
|
|
|
v2.AuxInt = config.PtrSize
|
|
|
|
|
v2.AddArg(ptr)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-02 08:10:26 -08:00
|
|
|
goto enddd15a6f3d53a6ce7a19d4e181dd1c13a
|
|
|
|
|
enddd15a6f3d53a6ce7a19d4e181dd1c13a:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
// match: (Load <t> ptr mem)
|
|
|
|
|
// cond: t.IsSlice()
|
2015-11-02 08:10:26 -08:00
|
|
|
// result: (SliceMake (Load <config.fe.TypeBytePtr()> ptr mem) (Load <config.fe.TypeInt()> (OffPtr <config.fe.TypeInt().PtrTo()> [config.PtrSize] ptr) mem) (Load <config.fe.TypeInt()> (OffPtr <config.fe.TypeInt().PtrTo()> [2*config.PtrSize] ptr) mem))
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
mem := v.Args[1]
|
|
|
|
|
if !(t.IsSlice()) {
|
2015-11-02 08:10:26 -08:00
|
|
|
goto end65e8b0055aa7491b9b6066d9fe1b2c13
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
v.Op = OpSliceMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v0.AddArg(ptr)
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
2015-11-02 08:10:26 -08:00
|
|
|
v1.Type = config.fe.TypeInt()
|
2015-10-26 21:49:31 -07:00
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
2015-11-02 08:10:26 -08:00
|
|
|
v2.Type = config.fe.TypeInt().PtrTo()
|
2015-10-26 21:49:31 -07:00
|
|
|
v2.AuxInt = config.PtrSize
|
|
|
|
|
v2.AddArg(ptr)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
v3 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
2015-11-02 08:10:26 -08:00
|
|
|
v3.Type = config.fe.TypeInt()
|
2015-10-26 21:49:31 -07:00
|
|
|
v4 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
2015-11-02 08:10:26 -08:00
|
|
|
v4.Type = config.fe.TypeInt().PtrTo()
|
2015-10-26 21:49:31 -07:00
|
|
|
v4.AuxInt = 2 * config.PtrSize
|
|
|
|
|
v4.AddArg(ptr)
|
|
|
|
|
v3.AddArg(v4)
|
|
|
|
|
v3.AddArg(mem)
|
|
|
|
|
v.AddArg(v3)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-02 08:10:26 -08:00
|
|
|
goto end65e8b0055aa7491b9b6066d9fe1b2c13
|
|
|
|
|
end65e8b0055aa7491b9b6066d9fe1b2c13:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
// match: (Load <t> ptr mem)
|
|
|
|
|
// cond: t.IsInterface()
|
|
|
|
|
// result: (IMake (Load <config.fe.TypeBytePtr()> ptr mem) (Load <config.fe.TypeBytePtr()> (OffPtr <config.fe.TypeBytePtr().PtrTo()> [config.PtrSize] ptr) mem))
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
mem := v.Args[1]
|
|
|
|
|
if !(t.IsInterface()) {
|
|
|
|
|
goto end12671c83ebe3ccbc8e53383765ee7675
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpIMake
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v0.AddArg(ptr)
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeBytePtr()
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v2.Type = config.fe.TypeBytePtr().PtrTo()
|
|
|
|
|
v2.AuxInt = config.PtrSize
|
|
|
|
|
v2.AddArg(ptr)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end12671c83ebe3ccbc8e53383765ee7675
|
|
|
|
|
end12671c83ebe3ccbc8e53383765ee7675:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-11-02 21:28:13 -08:00
|
|
|
func rewriteValuegeneric_OpMul16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Mul16 (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const16 [c*d])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto ende8dd468add3015aea24531cf3c89ccb7
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto ende8dd468add3015aea24531cf3c89ccb7
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConst16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c * d
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto ende8dd468add3015aea24531cf3c89ccb7
|
|
|
|
|
ende8dd468add3015aea24531cf3c89ccb7:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpMul32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Mul32 (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const32 [c*d])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end60b4523099fa7b55e2e872e05bd497a7
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end60b4523099fa7b55e2e872e05bd497a7
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConst32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c * d
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end60b4523099fa7b55e2e872e05bd497a7
|
|
|
|
|
end60b4523099fa7b55e2e872e05bd497a7:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-10-26 21:49:31 -07:00
|
|
|
func rewriteValuegeneric_OpMul64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Mul64 (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const64 [c*d])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end7aea1048b5d1230974b97f17238380ae
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end7aea1048b5d1230974b97f17238380ae
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConst64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c * d
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end7aea1048b5d1230974b97f17238380ae
|
|
|
|
|
end7aea1048b5d1230974b97f17238380ae:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
2015-11-02 21:28:13 -08:00
|
|
|
func rewriteValuegeneric_OpMul8(v *Value, config *Config) bool {
|
2015-10-26 21:49:31 -07:00
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-11-02 21:28:13 -08:00
|
|
|
// match: (Mul8 (Const8 [c]) (Const8 [d]))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2015-11-02 21:28:13 -08:00
|
|
|
// result: (Const8 [c*d])
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2015-11-02 21:28:13 -08:00
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto end2f1952fd654c4a62ff00511041728809
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
2015-11-02 21:28:13 -08:00
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto end2f1952fd654c4a62ff00511041728809
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
2015-11-02 21:28:13 -08:00
|
|
|
v.Op = OpConst8
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c * d
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-02 21:28:13 -08:00
|
|
|
goto end2f1952fd654c4a62ff00511041728809
|
|
|
|
|
end2f1952fd654c4a62ff00511041728809:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpNeq16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Neq16 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto ende76a50b524aeb16c7aeccf5f5cc60c06
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto ende76a50b524aeb16c7aeccf5f5cc60c06
|
|
|
|
|
ende76a50b524aeb16c7aeccf5f5cc60c06:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Neq16 (Const16 <t> [c]) (Add16 (Const16 <t> [d]) x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Neq16 (Const16 <t> [c-d]) x)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end552011bd97e6f92ebc2672aa1843eadd
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[0].Type
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpAdd16 {
|
|
|
|
|
goto end552011bd97e6f92ebc2672aa1843eadd
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Op != OpConst16 {
|
|
|
|
|
goto end552011bd97e6f92ebc2672aa1843eadd
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Type != v.Args[0].Type {
|
|
|
|
|
goto end552011bd97e6f92ebc2672aa1843eadd
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].Args[0].AuxInt
|
|
|
|
|
x := v.Args[1].Args[1]
|
|
|
|
|
v.Op = OpNeq16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c - d
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end552011bd97e6f92ebc2672aa1843eadd
|
|
|
|
|
end552011bd97e6f92ebc2672aa1843eadd:
|
|
|
|
|
;
|
|
|
|
|
// match: (Neq16 x (Const16 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst16
|
|
|
|
|
// result: (Neq16 (Const16 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end0e45958f29e87997f632248aa9ee97e0
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst16) {
|
|
|
|
|
goto end0e45958f29e87997f632248aa9ee97e0
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpNeq16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0e45958f29e87997f632248aa9ee97e0
|
|
|
|
|
end0e45958f29e87997f632248aa9ee97e0:
|
2015-10-27 17:46:53 -05:00
|
|
|
;
|
|
|
|
|
// match: (Neq16 (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int16(c) != int16(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end6302c9b645bb191982d28c2f846904d6
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end6302c9b645bb191982d28c2f846904d6
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int16(c) != int16(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end6302c9b645bb191982d28c2f846904d6
|
|
|
|
|
end6302c9b645bb191982d28c2f846904d6:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpNeq32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Neq32 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end3713a608cffd29b40ff7c3b3f2585cbb
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end3713a608cffd29b40ff7c3b3f2585cbb
|
|
|
|
|
end3713a608cffd29b40ff7c3b3f2585cbb:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Neq32 (Const32 <t> [c]) (Add32 (Const32 <t> [d]) x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Neq32 (Const32 <t> [c-d]) x)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end93fc3b4a3639b965b414891111b16245
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[0].Type
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpAdd32 {
|
|
|
|
|
goto end93fc3b4a3639b965b414891111b16245
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Op != OpConst32 {
|
|
|
|
|
goto end93fc3b4a3639b965b414891111b16245
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Type != v.Args[0].Type {
|
|
|
|
|
goto end93fc3b4a3639b965b414891111b16245
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].Args[0].AuxInt
|
|
|
|
|
x := v.Args[1].Args[1]
|
|
|
|
|
v.Op = OpNeq32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c - d
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end93fc3b4a3639b965b414891111b16245
|
|
|
|
|
end93fc3b4a3639b965b414891111b16245:
|
|
|
|
|
;
|
|
|
|
|
// match: (Neq32 x (Const32 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst32
|
|
|
|
|
// result: (Neq32 (Const32 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end5376f9ab90e282450f49011d0e0ce236
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst32) {
|
|
|
|
|
goto end5376f9ab90e282450f49011d0e0ce236
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpNeq32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end5376f9ab90e282450f49011d0e0ce236
|
|
|
|
|
end5376f9ab90e282450f49011d0e0ce236:
|
2015-10-27 17:46:53 -05:00
|
|
|
;
|
|
|
|
|
// match: (Neq32 (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int32(c) != int32(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto endf9f3d0814854d2d0879d331e9bdfcae2
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto endf9f3d0814854d2d0879d331e9bdfcae2
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int32(c) != int32(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endf9f3d0814854d2d0879d331e9bdfcae2
|
|
|
|
|
endf9f3d0814854d2d0879d331e9bdfcae2:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpNeq64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Neq64 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end3601ad382705ea12b79d2008c1e5725c
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end3601ad382705ea12b79d2008c1e5725c
|
|
|
|
|
end3601ad382705ea12b79d2008c1e5725c:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Neq64 (Const64 <t> [c]) (Add64 (Const64 <t> [d]) x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Neq64 (Const64 <t> [c-d]) x)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto enda3d39cad13a557a2aa6d086f43596c1b
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[0].Type
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpAdd64 {
|
|
|
|
|
goto enda3d39cad13a557a2aa6d086f43596c1b
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Op != OpConst64 {
|
|
|
|
|
goto enda3d39cad13a557a2aa6d086f43596c1b
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Type != v.Args[0].Type {
|
|
|
|
|
goto enda3d39cad13a557a2aa6d086f43596c1b
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].Args[0].AuxInt
|
|
|
|
|
x := v.Args[1].Args[1]
|
|
|
|
|
v.Op = OpNeq64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c - d
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto enda3d39cad13a557a2aa6d086f43596c1b
|
|
|
|
|
enda3d39cad13a557a2aa6d086f43596c1b:
|
|
|
|
|
;
|
|
|
|
|
// match: (Neq64 x (Const64 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst64
|
|
|
|
|
// result: (Neq64 (Const64 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end0936a57de20373ca6cacb9506ddde708
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst64) {
|
|
|
|
|
goto end0936a57de20373ca6cacb9506ddde708
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpNeq64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0936a57de20373ca6cacb9506ddde708
|
|
|
|
|
end0936a57de20373ca6cacb9506ddde708:
|
2015-10-27 17:46:53 -05:00
|
|
|
;
|
|
|
|
|
// match: (Neq64 (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int64(c) != int64(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto endf07433ecd3c150b1b75e943aa44a7203
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto endf07433ecd3c150b1b75e943aa44a7203
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int64(c) != int64(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endf07433ecd3c150b1b75e943aa44a7203
|
|
|
|
|
endf07433ecd3c150b1b75e943aa44a7203:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpNeq8(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Neq8 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end09a0deaf3c42627d0d2d3efa96e30745
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end09a0deaf3c42627d0d2d3efa96e30745
|
|
|
|
|
end09a0deaf3c42627d0d2d3efa96e30745:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Neq8 (Const8 <t> [c]) (Add8 (Const8 <t> [d]) x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Neq8 (Const8 <t> [c-d]) x)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto endc8f853c610c460c887cbfdca958e3691
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[0].Type
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpAdd8 {
|
|
|
|
|
goto endc8f853c610c460c887cbfdca958e3691
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Op != OpConst8 {
|
|
|
|
|
goto endc8f853c610c460c887cbfdca958e3691
|
|
|
|
|
}
|
|
|
|
|
if v.Args[1].Args[0].Type != v.Args[0].Type {
|
|
|
|
|
goto endc8f853c610c460c887cbfdca958e3691
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].Args[0].AuxInt
|
|
|
|
|
x := v.Args[1].Args[1]
|
|
|
|
|
v.Op = OpNeq8
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c - d
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endc8f853c610c460c887cbfdca958e3691
|
|
|
|
|
endc8f853c610c460c887cbfdca958e3691:
|
|
|
|
|
;
|
|
|
|
|
// match: (Neq8 x (Const8 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst8
|
|
|
|
|
// result: (Neq8 (Const8 <t> [c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto end04dc0ae2b08cf0447b50e5b8ef469252
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst8) {
|
|
|
|
|
goto end04dc0ae2b08cf0447b50e5b8ef469252
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpNeq8
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end04dc0ae2b08cf0447b50e5b8ef469252
|
|
|
|
|
end04dc0ae2b08cf0447b50e5b8ef469252:
|
2015-10-27 17:46:53 -05:00
|
|
|
;
|
|
|
|
|
// match: (Neq8 (Const8 [c]) (Const8 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (ConstBool [b2i(int8(c) != int8(d))])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto end72ebdaf2de9b3aa57cf0cb8e068b5f9c
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto end72ebdaf2de9b3aa57cf0cb8e068b5f9c
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConstBool
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = b2i(int8(c) != int8(d))
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end72ebdaf2de9b3aa57cf0cb8e068b5f9c
|
|
|
|
|
end72ebdaf2de9b3aa57cf0cb8e068b5f9c:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpNeqInter(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (NeqInter x y)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (NeqPtr (ITab x) (ITab y))
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
y := v.Args[1]
|
|
|
|
|
v.Op = OpNeqPtr
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpITab, TypeInvalid)
|
|
|
|
|
v0.AddArg(x)
|
2015-11-02 21:28:13 -08:00
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpITab, TypeInvalid)
|
|
|
|
|
v1.AddArg(y)
|
2015-11-02 21:28:13 -08:00
|
|
|
v1.Type = config.fe.TypeBytePtr()
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end17b2333bf57e9fe81a671be02f9c4c14
|
|
|
|
|
end17b2333bf57e9fe81a671be02f9c4c14:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpNeqPtr(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (NeqPtr p (ConstNil))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (IsNonNil p)
|
|
|
|
|
{
|
|
|
|
|
p := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConstNil {
|
|
|
|
|
goto endba798520b4d41172b110347158c44791
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpIsNonNil
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AddArg(p)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endba798520b4d41172b110347158c44791
|
|
|
|
|
endba798520b4d41172b110347158c44791:
|
|
|
|
|
;
|
|
|
|
|
// match: (NeqPtr (ConstNil) p)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (IsNonNil p)
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConstNil {
|
|
|
|
|
goto enddd95e9c3606d9fd48034f1a703561e45
|
|
|
|
|
}
|
|
|
|
|
p := v.Args[1]
|
|
|
|
|
v.Op = OpIsNonNil
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AddArg(p)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto enddd95e9c3606d9fd48034f1a703561e45
|
|
|
|
|
enddd95e9c3606d9fd48034f1a703561e45:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpNeqSlice(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (NeqSlice x y)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (NeqPtr (SlicePtr x) (SlicePtr y))
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
y := v.Args[1]
|
|
|
|
|
v.Op = OpNeqPtr
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpSlicePtr, TypeInvalid)
|
|
|
|
|
v0.AddArg(x)
|
2015-11-02 21:28:13 -08:00
|
|
|
v0.Type = config.fe.TypeBytePtr()
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AddArg(v0)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpSlicePtr, TypeInvalid)
|
|
|
|
|
v1.AddArg(y)
|
2015-11-02 21:28:13 -08:00
|
|
|
v1.Type = config.fe.TypeBytePtr()
|
2015-10-26 21:49:31 -07:00
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endc6bc83c506e491236ca66ea1081231a2
|
|
|
|
|
endc6bc83c506e491236ca66ea1081231a2:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpOr16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Or16 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end47a2f25fd31a76807aced3e2b126acdc
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end47a2f25fd31a76807aced3e2b126acdc
|
|
|
|
|
end47a2f25fd31a76807aced3e2b126acdc:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpOr32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Or32 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end231e283e568e90bd9a3e6a4fa328c8a4
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end231e283e568e90bd9a3e6a4fa328c8a4
|
|
|
|
|
end231e283e568e90bd9a3e6a4fa328c8a4:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpOr64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Or64 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end6b0efc212016dc97d0e3939db04c81d9
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end6b0efc212016dc97d0e3939db04c81d9
|
|
|
|
|
end6b0efc212016dc97d0e3939db04c81d9:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpOr8(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Or8 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end05295dbfafd6869af79b4daee9fda000
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end05295dbfafd6869af79b4daee9fda000
|
|
|
|
|
end05295dbfafd6869af79b4daee9fda000:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpPtrIndex(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (PtrIndex <t> ptr idx)
|
2015-11-02 21:28:13 -08:00
|
|
|
// cond: config.PtrSize == 4
|
|
|
|
|
// result: (AddPtr ptr (Mul32 <config.fe.TypeInt()> idx (Const32 <config.fe.TypeInt()> [t.Elem().Size()])))
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
idx := v.Args[1]
|
2015-11-02 21:28:13 -08:00
|
|
|
if !(config.PtrSize == 4) {
|
|
|
|
|
goto endd902622aaa1e7545b5a2a0c08b47d287
|
|
|
|
|
}
|
2015-10-26 21:49:31 -07:00
|
|
|
v.Op = OpAddPtr
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AddArg(ptr)
|
2015-11-02 21:28:13 -08:00
|
|
|
v0 := b.NewValue0(v.Line, OpMul32, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeInt()
|
2015-10-26 21:49:31 -07:00
|
|
|
v0.AddArg(idx)
|
2015-11-02 21:28:13 -08:00
|
|
|
v1 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeInt()
|
2015-10-26 21:49:31 -07:00
|
|
|
v1.AuxInt = t.Elem().Size()
|
|
|
|
|
v0.AddArg(v1)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-02 21:28:13 -08:00
|
|
|
goto endd902622aaa1e7545b5a2a0c08b47d287
|
|
|
|
|
endd902622aaa1e7545b5a2a0c08b47d287:
|
|
|
|
|
;
|
|
|
|
|
// match: (PtrIndex <t> ptr idx)
|
|
|
|
|
// cond: config.PtrSize == 8
|
|
|
|
|
// result: (AddPtr ptr (Mul64 <config.fe.TypeInt()> idx (Const64 <config.fe.TypeInt()> [t.Elem().Size()])))
|
|
|
|
|
{
|
|
|
|
|
t := v.Type
|
|
|
|
|
ptr := v.Args[0]
|
|
|
|
|
idx := v.Args[1]
|
|
|
|
|
if !(config.PtrSize == 8) {
|
|
|
|
|
goto end47a5f1d1b158914fa383de024bbe3b08
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpAddPtr
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AddArg(ptr)
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpMul64, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeInt()
|
|
|
|
|
v0.AddArg(idx)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v1.Type = config.fe.TypeInt()
|
|
|
|
|
v1.AuxInt = t.Elem().Size()
|
|
|
|
|
v0.AddArg(v1)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end47a5f1d1b158914fa383de024bbe3b08
|
|
|
|
|
end47a5f1d1b158914fa383de024bbe3b08:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpSliceCap(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (SliceCap (SliceMake _ _ cap))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: cap
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpSliceMake {
|
|
|
|
|
goto end1bd11616743632b33b410964667fb3c6
|
|
|
|
|
}
|
|
|
|
|
cap := v.Args[0].Args[2]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = cap.Type
|
|
|
|
|
v.AddArg(cap)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end1bd11616743632b33b410964667fb3c6
|
|
|
|
|
end1bd11616743632b33b410964667fb3c6:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpSliceLen(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (SliceLen (SliceMake _ len _))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: len
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpSliceMake {
|
|
|
|
|
goto endebb2090199d13e4c2ae52fb3e778f7fd
|
|
|
|
|
}
|
|
|
|
|
len := v.Args[0].Args[1]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = len.Type
|
|
|
|
|
v.AddArg(len)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endebb2090199d13e4c2ae52fb3e778f7fd
|
|
|
|
|
endebb2090199d13e4c2ae52fb3e778f7fd:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpSlicePtr(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (SlicePtr (SliceMake ptr _ _ ))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: ptr
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpSliceMake {
|
|
|
|
|
goto end526acc0a705137a5d25577499206720b
|
|
|
|
|
}
|
|
|
|
|
ptr := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = ptr.Type
|
|
|
|
|
v.AddArg(ptr)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end526acc0a705137a5d25577499206720b
|
|
|
|
|
end526acc0a705137a5d25577499206720b:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpStore(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2016-01-11 21:05:33 -08:00
|
|
|
// match: (Store _ (StructMake0) mem)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: mem
|
|
|
|
|
{
|
|
|
|
|
if v.Args[1].Op != OpStructMake0 {
|
|
|
|
|
goto endd4f364b0adfc229d8c200af183d4c808
|
|
|
|
|
}
|
|
|
|
|
mem := v.Args[2]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = mem.Type
|
|
|
|
|
v.AddArg(mem)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endd4f364b0adfc229d8c200af183d4c808
|
|
|
|
|
endd4f364b0adfc229d8c200af183d4c808:
|
|
|
|
|
;
|
|
|
|
|
// match: (Store dst (StructMake1 <t> f0) mem)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Store [t.FieldType(0).Size()] dst f0 mem)
|
|
|
|
|
{
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpStructMake1 {
|
|
|
|
|
goto end2cff6d06f4440132f48ca374b6b1e9d8
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
f0 := v.Args[1].Args[0]
|
|
|
|
|
mem := v.Args[2]
|
|
|
|
|
v.Op = OpStore
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = t.FieldType(0).Size()
|
|
|
|
|
v.AddArg(dst)
|
|
|
|
|
v.AddArg(f0)
|
|
|
|
|
v.AddArg(mem)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end2cff6d06f4440132f48ca374b6b1e9d8
|
|
|
|
|
end2cff6d06f4440132f48ca374b6b1e9d8:
|
|
|
|
|
;
|
|
|
|
|
// match: (Store dst (StructMake2 <t> f0 f1) mem)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Store [t.FieldType(1).Size()] (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] dst) f1 (Store [t.FieldType(0).Size()] dst f0 mem))
|
|
|
|
|
{
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpStructMake2 {
|
|
|
|
|
goto end4e8ede6cc575a287795971da6b637973
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
f0 := v.Args[1].Args[0]
|
|
|
|
|
f1 := v.Args[1].Args[1]
|
|
|
|
|
mem := v.Args[2]
|
|
|
|
|
v.Op = OpStore
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = t.FieldType(1).Size()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(1).PtrTo()
|
|
|
|
|
v0.AuxInt = t.FieldOff(1)
|
|
|
|
|
v0.AddArg(dst)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(f1)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v1.AuxInt = t.FieldType(0).Size()
|
|
|
|
|
v1.AddArg(dst)
|
|
|
|
|
v1.AddArg(f0)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v1.Type = TypeMem
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end4e8ede6cc575a287795971da6b637973
|
|
|
|
|
end4e8ede6cc575a287795971da6b637973:
|
|
|
|
|
;
|
|
|
|
|
// match: (Store dst (StructMake3 <t> f0 f1 f2) mem)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Store [t.FieldType(2).Size()] (OffPtr <t.FieldType(2).PtrTo()> [t.FieldOff(2)] dst) f2 (Store [t.FieldType(1).Size()] (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] dst) f1 (Store [t.FieldType(0).Size()] dst f0 mem)))
|
|
|
|
|
{
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpStructMake3 {
|
|
|
|
|
goto end6ad675267724a87c8f852dd1e185e911
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
f0 := v.Args[1].Args[0]
|
|
|
|
|
f1 := v.Args[1].Args[1]
|
|
|
|
|
f2 := v.Args[1].Args[2]
|
|
|
|
|
mem := v.Args[2]
|
|
|
|
|
v.Op = OpStore
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = t.FieldType(2).Size()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(2).PtrTo()
|
|
|
|
|
v0.AuxInt = t.FieldOff(2)
|
|
|
|
|
v0.AddArg(dst)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(f2)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v1.AuxInt = t.FieldType(1).Size()
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v2.Type = t.FieldType(1).PtrTo()
|
|
|
|
|
v2.AuxInt = t.FieldOff(1)
|
|
|
|
|
v2.AddArg(dst)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(f1)
|
|
|
|
|
v3 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v3.AuxInt = t.FieldType(0).Size()
|
|
|
|
|
v3.AddArg(dst)
|
|
|
|
|
v3.AddArg(f0)
|
|
|
|
|
v3.AddArg(mem)
|
|
|
|
|
v3.Type = TypeMem
|
|
|
|
|
v1.AddArg(v3)
|
|
|
|
|
v1.Type = TypeMem
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end6ad675267724a87c8f852dd1e185e911
|
|
|
|
|
end6ad675267724a87c8f852dd1e185e911:
|
|
|
|
|
;
|
|
|
|
|
// match: (Store dst (StructMake4 <t> f0 f1 f2 f3) mem)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Store [t.FieldType(3).Size()] (OffPtr <t.FieldType(3).PtrTo()> [t.FieldOff(3)] dst) f3 (Store [t.FieldType(2).Size()] (OffPtr <t.FieldType(2).PtrTo()> [t.FieldOff(2)] dst) f2 (Store [t.FieldType(1).Size()] (OffPtr <t.FieldType(1).PtrTo()> [t.FieldOff(1)] dst) f1 (Store [t.FieldType(0).Size()] dst f0 mem))))
|
|
|
|
|
{
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpStructMake4 {
|
|
|
|
|
goto end7ea91abd44794f7653374502a5a405ea
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
f0 := v.Args[1].Args[0]
|
|
|
|
|
f1 := v.Args[1].Args[1]
|
|
|
|
|
f2 := v.Args[1].Args[2]
|
|
|
|
|
f3 := v.Args[1].Args[3]
|
|
|
|
|
mem := v.Args[2]
|
|
|
|
|
v.Op = OpStore
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = t.FieldType(3).Size()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v0.Type = t.FieldType(3).PtrTo()
|
|
|
|
|
v0.AuxInt = t.FieldOff(3)
|
|
|
|
|
v0.AddArg(dst)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(f3)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v1.AuxInt = t.FieldType(2).Size()
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v2.Type = t.FieldType(2).PtrTo()
|
|
|
|
|
v2.AuxInt = t.FieldOff(2)
|
|
|
|
|
v2.AddArg(dst)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(f2)
|
|
|
|
|
v3 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v3.AuxInt = t.FieldType(1).Size()
|
|
|
|
|
v4 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v4.Type = t.FieldType(1).PtrTo()
|
|
|
|
|
v4.AuxInt = t.FieldOff(1)
|
|
|
|
|
v4.AddArg(dst)
|
|
|
|
|
v3.AddArg(v4)
|
|
|
|
|
v3.AddArg(f1)
|
|
|
|
|
v5 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v5.AuxInt = t.FieldType(0).Size()
|
|
|
|
|
v5.AddArg(dst)
|
|
|
|
|
v5.AddArg(f0)
|
|
|
|
|
v5.AddArg(mem)
|
|
|
|
|
v5.Type = TypeMem
|
|
|
|
|
v3.AddArg(v5)
|
|
|
|
|
v3.Type = TypeMem
|
|
|
|
|
v1.AddArg(v3)
|
|
|
|
|
v1.Type = TypeMem
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end7ea91abd44794f7653374502a5a405ea
|
|
|
|
|
end7ea91abd44794f7653374502a5a405ea:
|
|
|
|
|
;
|
2015-10-26 21:49:31 -07:00
|
|
|
// match: (Store [8] dst (ComplexMake real imag) mem)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Store [4] (OffPtr <config.fe.TypeFloat32().PtrTo()> [4] dst) imag (Store [4] dst real mem))
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 8 {
|
|
|
|
|
goto endced898cb0a165662afe48ea44ad3318a
|
|
|
|
|
}
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpComplexMake {
|
|
|
|
|
goto endced898cb0a165662afe48ea44ad3318a
|
|
|
|
|
}
|
|
|
|
|
real := v.Args[1].Args[0]
|
|
|
|
|
imag := v.Args[1].Args[1]
|
|
|
|
|
mem := v.Args[2]
|
|
|
|
|
v.Op = OpStore
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 4
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeFloat32().PtrTo()
|
|
|
|
|
v0.AuxInt = 4
|
|
|
|
|
v0.AddArg(dst)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(imag)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v1.AuxInt = 4
|
|
|
|
|
v1.AddArg(dst)
|
|
|
|
|
v1.AddArg(real)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v1.Type = TypeMem
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endced898cb0a165662afe48ea44ad3318a
|
|
|
|
|
endced898cb0a165662afe48ea44ad3318a:
|
|
|
|
|
;
|
|
|
|
|
// match: (Store [16] dst (ComplexMake real imag) mem)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Store [8] (OffPtr <config.fe.TypeFloat64().PtrTo()> [8] dst) imag (Store [8] dst real mem))
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 16 {
|
|
|
|
|
goto end3851a482d7bd37a93c4d81581e85b3ab
|
|
|
|
|
}
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpComplexMake {
|
|
|
|
|
goto end3851a482d7bd37a93c4d81581e85b3ab
|
|
|
|
|
}
|
|
|
|
|
real := v.Args[1].Args[0]
|
|
|
|
|
imag := v.Args[1].Args[1]
|
|
|
|
|
mem := v.Args[2]
|
|
|
|
|
v.Op = OpStore
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 8
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeFloat64().PtrTo()
|
|
|
|
|
v0.AuxInt = 8
|
|
|
|
|
v0.AddArg(dst)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(imag)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v1.AuxInt = 8
|
|
|
|
|
v1.AddArg(dst)
|
|
|
|
|
v1.AddArg(real)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v1.Type = TypeMem
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end3851a482d7bd37a93c4d81581e85b3ab
|
|
|
|
|
end3851a482d7bd37a93c4d81581e85b3ab:
|
|
|
|
|
;
|
|
|
|
|
// match: (Store [2*config.PtrSize] dst (StringMake ptr len) mem)
|
|
|
|
|
// cond:
|
2015-11-02 08:10:26 -08:00
|
|
|
// result: (Store [config.PtrSize] (OffPtr <config.fe.TypeInt().PtrTo()> [config.PtrSize] dst) len (Store [config.PtrSize] dst ptr mem))
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
|
|
|
|
if v.AuxInt != 2*config.PtrSize {
|
2015-11-02 08:10:26 -08:00
|
|
|
goto endd3a6ecebdad5899570a79fe5c62f34f1
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpStringMake {
|
2015-11-02 08:10:26 -08:00
|
|
|
goto endd3a6ecebdad5899570a79fe5c62f34f1
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
ptr := v.Args[1].Args[0]
|
|
|
|
|
len := v.Args[1].Args[1]
|
|
|
|
|
mem := v.Args[2]
|
|
|
|
|
v.Op = OpStore
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = config.PtrSize
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
2015-11-02 08:10:26 -08:00
|
|
|
v0.Type = config.fe.TypeInt().PtrTo()
|
2015-10-26 21:49:31 -07:00
|
|
|
v0.AuxInt = config.PtrSize
|
|
|
|
|
v0.AddArg(dst)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(len)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v1.AuxInt = config.PtrSize
|
|
|
|
|
v1.AddArg(dst)
|
|
|
|
|
v1.AddArg(ptr)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v1.Type = TypeMem
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-02 08:10:26 -08:00
|
|
|
goto endd3a6ecebdad5899570a79fe5c62f34f1
|
|
|
|
|
endd3a6ecebdad5899570a79fe5c62f34f1:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
// match: (Store [3*config.PtrSize] dst (SliceMake ptr len cap) mem)
|
|
|
|
|
// cond:
|
2015-11-02 08:10:26 -08:00
|
|
|
// result: (Store [config.PtrSize] (OffPtr <config.fe.TypeInt().PtrTo()> [2*config.PtrSize] dst) cap (Store [config.PtrSize] (OffPtr <config.fe.TypeInt().PtrTo()> [config.PtrSize] dst) len (Store [config.PtrSize] dst ptr mem)))
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
|
|
|
|
if v.AuxInt != 3*config.PtrSize {
|
2015-11-02 08:10:26 -08:00
|
|
|
goto endd5cc8c3dad7d24c845b0b88fc51487ae
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpSliceMake {
|
2015-11-02 08:10:26 -08:00
|
|
|
goto endd5cc8c3dad7d24c845b0b88fc51487ae
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
|
|
|
|
ptr := v.Args[1].Args[0]
|
|
|
|
|
len := v.Args[1].Args[1]
|
|
|
|
|
cap := v.Args[1].Args[2]
|
|
|
|
|
mem := v.Args[2]
|
|
|
|
|
v.Op = OpStore
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = config.PtrSize
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
2015-11-02 08:10:26 -08:00
|
|
|
v0.Type = config.fe.TypeInt().PtrTo()
|
2015-10-26 21:49:31 -07:00
|
|
|
v0.AuxInt = 2 * config.PtrSize
|
|
|
|
|
v0.AddArg(dst)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(cap)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v1.AuxInt = config.PtrSize
|
|
|
|
|
v2 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
2015-11-02 08:10:26 -08:00
|
|
|
v2.Type = config.fe.TypeInt().PtrTo()
|
2015-10-26 21:49:31 -07:00
|
|
|
v2.AuxInt = config.PtrSize
|
|
|
|
|
v2.AddArg(dst)
|
|
|
|
|
v1.AddArg(v2)
|
|
|
|
|
v1.AddArg(len)
|
|
|
|
|
v3 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v3.AuxInt = config.PtrSize
|
|
|
|
|
v3.AddArg(dst)
|
|
|
|
|
v3.AddArg(ptr)
|
|
|
|
|
v3.AddArg(mem)
|
|
|
|
|
v3.Type = TypeMem
|
|
|
|
|
v1.AddArg(v3)
|
|
|
|
|
v1.Type = TypeMem
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2015-11-02 08:10:26 -08:00
|
|
|
goto endd5cc8c3dad7d24c845b0b88fc51487ae
|
|
|
|
|
endd5cc8c3dad7d24c845b0b88fc51487ae:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
// match: (Store [2*config.PtrSize] dst (IMake itab data) mem)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Store [config.PtrSize] (OffPtr <config.fe.TypeBytePtr().PtrTo()> [config.PtrSize] dst) data (Store [config.PtrSize] dst itab mem))
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 2*config.PtrSize {
|
|
|
|
|
goto endaa801a871178ae3256b3f6f5d9f13514
|
|
|
|
|
}
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpIMake {
|
|
|
|
|
goto endaa801a871178ae3256b3f6f5d9f13514
|
|
|
|
|
}
|
|
|
|
|
itab := v.Args[1].Args[0]
|
|
|
|
|
data := v.Args[1].Args[1]
|
|
|
|
|
mem := v.Args[2]
|
|
|
|
|
v.Op = OpStore
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = config.PtrSize
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v0.Type = config.fe.TypeBytePtr().PtrTo()
|
|
|
|
|
v0.AuxInt = config.PtrSize
|
|
|
|
|
v0.AddArg(dst)
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(data)
|
|
|
|
|
v1 := b.NewValue0(v.Line, OpStore, TypeInvalid)
|
|
|
|
|
v1.AuxInt = config.PtrSize
|
|
|
|
|
v1.AddArg(dst)
|
|
|
|
|
v1.AddArg(itab)
|
|
|
|
|
v1.AddArg(mem)
|
|
|
|
|
v1.Type = TypeMem
|
|
|
|
|
v.AddArg(v1)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endaa801a871178ae3256b3f6f5d9f13514
|
|
|
|
|
endaa801a871178ae3256b3f6f5d9f13514:
|
|
|
|
|
;
|
|
|
|
|
// match: (Store [size] dst (Load <t> src mem) mem)
|
|
|
|
|
// cond: !config.fe.CanSSA(t)
|
|
|
|
|
// result: (Move [size] dst src mem)
|
|
|
|
|
{
|
|
|
|
|
size := v.AuxInt
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpLoad {
|
|
|
|
|
goto end45295326269ba18413dceb7b608a0b9d
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
src := v.Args[1].Args[0]
|
|
|
|
|
mem := v.Args[1].Args[1]
|
|
|
|
|
if v.Args[2] != mem {
|
|
|
|
|
goto end45295326269ba18413dceb7b608a0b9d
|
|
|
|
|
}
|
|
|
|
|
if !(!config.fe.CanSSA(t)) {
|
|
|
|
|
goto end45295326269ba18413dceb7b608a0b9d
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpMove
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = size
|
|
|
|
|
v.AddArg(dst)
|
|
|
|
|
v.AddArg(src)
|
|
|
|
|
v.AddArg(mem)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end45295326269ba18413dceb7b608a0b9d
|
|
|
|
|
end45295326269ba18413dceb7b608a0b9d:
|
|
|
|
|
;
|
|
|
|
|
// match: (Store [size] dst (Load <t> src mem) (VarDef {x} mem))
|
|
|
|
|
// cond: !config.fe.CanSSA(t)
|
|
|
|
|
// result: (Move [size] dst src (VarDef {x} mem))
|
|
|
|
|
{
|
|
|
|
|
size := v.AuxInt
|
|
|
|
|
dst := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpLoad {
|
|
|
|
|
goto end7f3cc0baffb82ba3ee879599b189a512
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
src := v.Args[1].Args[0]
|
|
|
|
|
mem := v.Args[1].Args[1]
|
|
|
|
|
if v.Args[2].Op != OpVarDef {
|
|
|
|
|
goto end7f3cc0baffb82ba3ee879599b189a512
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[2].Aux
|
|
|
|
|
if v.Args[2].Args[0] != mem {
|
|
|
|
|
goto end7f3cc0baffb82ba3ee879599b189a512
|
|
|
|
|
}
|
|
|
|
|
if !(!config.fe.CanSSA(t)) {
|
|
|
|
|
goto end7f3cc0baffb82ba3ee879599b189a512
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpMove
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = size
|
|
|
|
|
v.AddArg(dst)
|
|
|
|
|
v.AddArg(src)
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpVarDef, TypeInvalid)
|
|
|
|
|
v0.Aux = x
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
v0.Type = TypeMem
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end7f3cc0baffb82ba3ee879599b189a512
|
|
|
|
|
end7f3cc0baffb82ba3ee879599b189a512:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpStringLen(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (StringLen (StringMake _ len))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: len
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpStringMake {
|
|
|
|
|
goto end0d922460b7e5ca88324034f4bd6c027c
|
|
|
|
|
}
|
|
|
|
|
len := v.Args[0].Args[1]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = len.Type
|
|
|
|
|
v.AddArg(len)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0d922460b7e5ca88324034f4bd6c027c
|
|
|
|
|
end0d922460b7e5ca88324034f4bd6c027c:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpStringPtr(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (StringPtr (StringMake ptr _))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: ptr
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpStringMake {
|
|
|
|
|
goto end061edc5d85c73ad909089af2556d9380
|
|
|
|
|
}
|
|
|
|
|
ptr := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = ptr.Type
|
|
|
|
|
v.AddArg(ptr)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end061edc5d85c73ad909089af2556d9380
|
|
|
|
|
end061edc5d85c73ad909089af2556d9380:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpStructSelect(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2016-01-11 21:05:33 -08:00
|
|
|
// match: (StructSelect (StructMake1 x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpStructMake1 {
|
|
|
|
|
goto end17af582e7eba5216b4a51fe6c9206d3c
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end17af582e7eba5216b4a51fe6c9206d3c
|
|
|
|
|
end17af582e7eba5216b4a51fe6c9206d3c:
|
|
|
|
|
;
|
|
|
|
|
// match: (StructSelect [0] (StructMake2 x _))
|
2015-10-26 21:49:31 -07:00
|
|
|
// cond:
|
2016-01-11 21:05:33 -08:00
|
|
|
// result: x
|
2015-10-26 21:49:31 -07:00
|
|
|
{
|
2016-01-11 21:05:33 -08:00
|
|
|
if v.AuxInt != 0 {
|
|
|
|
|
goto end355cfff99c8e9af975c3ae450d49b7f9
|
|
|
|
|
}
|
|
|
|
|
if v.Args[0].Op != OpStructMake2 {
|
|
|
|
|
goto end355cfff99c8e9af975c3ae450d49b7f9
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end355cfff99c8e9af975c3ae450d49b7f9
|
|
|
|
|
end355cfff99c8e9af975c3ae450d49b7f9:
|
|
|
|
|
;
|
|
|
|
|
// match: (StructSelect [1] (StructMake2 _ x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 1 {
|
|
|
|
|
goto end69baa65e494ef9ae154e0943b53734f9
|
|
|
|
|
}
|
|
|
|
|
if v.Args[0].Op != OpStructMake2 {
|
|
|
|
|
goto end69baa65e494ef9ae154e0943b53734f9
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[1]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end69baa65e494ef9ae154e0943b53734f9
|
|
|
|
|
end69baa65e494ef9ae154e0943b53734f9:
|
|
|
|
|
;
|
|
|
|
|
// match: (StructSelect [0] (StructMake3 x _ _))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 0 {
|
|
|
|
|
goto endb0d98e2c46bb51c9abd4c3543392e0ec
|
|
|
|
|
}
|
|
|
|
|
if v.Args[0].Op != OpStructMake3 {
|
|
|
|
|
goto endb0d98e2c46bb51c9abd4c3543392e0ec
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endb0d98e2c46bb51c9abd4c3543392e0ec
|
|
|
|
|
endb0d98e2c46bb51c9abd4c3543392e0ec:
|
|
|
|
|
;
|
|
|
|
|
// match: (StructSelect [1] (StructMake3 _ x _))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 1 {
|
|
|
|
|
goto end2e40457286d26c2f14ad4fd127946773
|
|
|
|
|
}
|
|
|
|
|
if v.Args[0].Op != OpStructMake3 {
|
|
|
|
|
goto end2e40457286d26c2f14ad4fd127946773
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[1]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end2e40457286d26c2f14ad4fd127946773
|
|
|
|
|
end2e40457286d26c2f14ad4fd127946773:
|
|
|
|
|
;
|
|
|
|
|
// match: (StructSelect [2] (StructMake3 _ _ x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 2 {
|
|
|
|
|
goto end3e3b96ad431206175d002ece87aa1409
|
|
|
|
|
}
|
|
|
|
|
if v.Args[0].Op != OpStructMake3 {
|
|
|
|
|
goto end3e3b96ad431206175d002ece87aa1409
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[2]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end3e3b96ad431206175d002ece87aa1409
|
|
|
|
|
end3e3b96ad431206175d002ece87aa1409:
|
|
|
|
|
;
|
|
|
|
|
// match: (StructSelect [0] (StructMake4 x _ _ _))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 0 {
|
|
|
|
|
goto end09f8a1ffa3d8c3124bc6d4083b941108
|
|
|
|
|
}
|
|
|
|
|
if v.Args[0].Op != OpStructMake4 {
|
|
|
|
|
goto end09f8a1ffa3d8c3124bc6d4083b941108
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end09f8a1ffa3d8c3124bc6d4083b941108
|
|
|
|
|
end09f8a1ffa3d8c3124bc6d4083b941108:
|
|
|
|
|
;
|
|
|
|
|
// match: (StructSelect [1] (StructMake4 _ x _ _))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 1 {
|
|
|
|
|
goto endd3ef25e605a927e9251be6d9221f4acf
|
|
|
|
|
}
|
|
|
|
|
if v.Args[0].Op != OpStructMake4 {
|
|
|
|
|
goto endd3ef25e605a927e9251be6d9221f4acf
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[1]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endd3ef25e605a927e9251be6d9221f4acf
|
|
|
|
|
endd3ef25e605a927e9251be6d9221f4acf:
|
|
|
|
|
;
|
|
|
|
|
// match: (StructSelect [2] (StructMake4 _ _ x _))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 2 {
|
|
|
|
|
goto end0438e22cc8f41123fa42009a81ee723a
|
|
|
|
|
}
|
|
|
|
|
if v.Args[0].Op != OpStructMake4 {
|
|
|
|
|
goto end0438e22cc8f41123fa42009a81ee723a
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[2]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0438e22cc8f41123fa42009a81ee723a
|
|
|
|
|
end0438e22cc8f41123fa42009a81ee723a:
|
|
|
|
|
;
|
|
|
|
|
// match: (StructSelect [3] (StructMake4 _ _ _ x))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.AuxInt != 3 {
|
|
|
|
|
goto end56a7c7781fee35eeff0a3652dc206012
|
|
|
|
|
}
|
|
|
|
|
if v.Args[0].Op != OpStructMake4 {
|
|
|
|
|
goto end56a7c7781fee35eeff0a3652dc206012
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[3]
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end56a7c7781fee35eeff0a3652dc206012
|
|
|
|
|
end56a7c7781fee35eeff0a3652dc206012:
|
|
|
|
|
;
|
|
|
|
|
// match: (StructSelect [i] (Load <t> ptr mem))
|
|
|
|
|
// cond: !config.fe.CanSSA(t)
|
|
|
|
|
// result: @v.Args[0].Block (Load <v.Type> (OffPtr <v.Type.PtrTo()> [t.FieldOff(i)] ptr) mem)
|
|
|
|
|
{
|
|
|
|
|
i := v.AuxInt
|
2015-10-26 21:49:31 -07:00
|
|
|
if v.Args[0].Op != OpLoad {
|
2016-01-11 21:05:33 -08:00
|
|
|
goto end2afd47b4fcaaab7a73325bd8a75e3e8e
|
2015-10-26 21:49:31 -07:00
|
|
|
}
|
2016-01-11 21:05:33 -08:00
|
|
|
t := v.Args[0].Type
|
2015-10-26 21:49:31 -07:00
|
|
|
ptr := v.Args[0].Args[0]
|
|
|
|
|
mem := v.Args[0].Args[1]
|
2016-01-11 21:05:33 -08:00
|
|
|
if !(!config.fe.CanSSA(t)) {
|
|
|
|
|
goto end2afd47b4fcaaab7a73325bd8a75e3e8e
|
|
|
|
|
}
|
2015-10-26 21:49:31 -07:00
|
|
|
v0 := v.Args[0].Block.NewValue0(v.Line, OpLoad, TypeInvalid)
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v0.Type = v.Type
|
|
|
|
|
v1 := v.Args[0].Block.NewValue0(v.Line, OpOffPtr, TypeInvalid)
|
|
|
|
|
v1.Type = v.Type.PtrTo()
|
2016-01-11 21:05:33 -08:00
|
|
|
v1.AuxInt = t.FieldOff(i)
|
2015-10-26 21:49:31 -07:00
|
|
|
v1.AddArg(ptr)
|
|
|
|
|
v0.AddArg(v1)
|
|
|
|
|
v0.AddArg(mem)
|
|
|
|
|
return true
|
|
|
|
|
}
|
2016-01-11 21:05:33 -08:00
|
|
|
goto end2afd47b4fcaaab7a73325bd8a75e3e8e
|
|
|
|
|
end2afd47b4fcaaab7a73325bd8a75e3e8e:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpSub16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-11-02 21:28:13 -08:00
|
|
|
// match: (Sub16 (Const16 [c]) (Const16 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const16 [c-d])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst16 {
|
|
|
|
|
goto end5c6fab95c9dbeff5973119096bfd4e78
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end5c6fab95c9dbeff5973119096bfd4e78
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConst16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c - d
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end5c6fab95c9dbeff5973119096bfd4e78
|
|
|
|
|
end5c6fab95c9dbeff5973119096bfd4e78:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Sub16 x (Const16 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst16
|
|
|
|
|
// result: (Add16 (Const16 <t> [-c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst16 {
|
|
|
|
|
goto end493545258a8e7e79d005b34c712ddd0c
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst16) {
|
|
|
|
|
goto end493545258a8e7e79d005b34c712ddd0c
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpAdd16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst16, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = -c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end493545258a8e7e79d005b34c712ddd0c
|
|
|
|
|
end493545258a8e7e79d005b34c712ddd0c:
|
2015-11-02 21:28:13 -08:00
|
|
|
;
|
2015-10-26 21:49:31 -07:00
|
|
|
// match: (Sub16 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const16 [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end83da541391be564f2a08464e674a49e7
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConst16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end83da541391be564f2a08464e674a49e7
|
|
|
|
|
end83da541391be564f2a08464e674a49e7:
|
2015-11-09 20:54:34 -08:00
|
|
|
;
|
|
|
|
|
// match: (Sub16 (Add16 x y) x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: y
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpAdd16 {
|
|
|
|
|
goto end0dd8f250c457b9c005ecbed59fc2e758
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
y := v.Args[0].Args[1]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end0dd8f250c457b9c005ecbed59fc2e758
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = y.Type
|
|
|
|
|
v.AddArg(y)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0dd8f250c457b9c005ecbed59fc2e758
|
|
|
|
|
end0dd8f250c457b9c005ecbed59fc2e758:
|
|
|
|
|
;
|
|
|
|
|
// match: (Sub16 (Add16 x y) y)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpAdd16 {
|
|
|
|
|
goto end01c8db2e0bce69e048cf79f3bdc82b9b
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
y := v.Args[0].Args[1]
|
|
|
|
|
if v.Args[1] != y {
|
|
|
|
|
goto end01c8db2e0bce69e048cf79f3bdc82b9b
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end01c8db2e0bce69e048cf79f3bdc82b9b
|
|
|
|
|
end01c8db2e0bce69e048cf79f3bdc82b9b:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpSub32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-11-02 21:28:13 -08:00
|
|
|
// match: (Sub32 (Const32 [c]) (Const32 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const32 [c-d])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst32 {
|
|
|
|
|
goto end7623799db780e1bcc42c6ea0df9c49d3
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end7623799db780e1bcc42c6ea0df9c49d3
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConst32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c - d
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end7623799db780e1bcc42c6ea0df9c49d3
|
|
|
|
|
end7623799db780e1bcc42c6ea0df9c49d3:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Sub32 x (Const32 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst32
|
|
|
|
|
// result: (Add32 (Const32 <t> [-c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst32 {
|
|
|
|
|
goto end391e2f2ba8c7502b62c0153ec69c4fbd
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst32) {
|
|
|
|
|
goto end391e2f2ba8c7502b62c0153ec69c4fbd
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpAdd32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst32, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = -c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end391e2f2ba8c7502b62c0153ec69c4fbd
|
|
|
|
|
end391e2f2ba8c7502b62c0153ec69c4fbd:
|
2015-11-02 21:28:13 -08:00
|
|
|
;
|
2015-10-26 21:49:31 -07:00
|
|
|
// match: (Sub32 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const32 [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto enda747581e798f199e07f4ad69747cd069
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConst32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto enda747581e798f199e07f4ad69747cd069
|
|
|
|
|
enda747581e798f199e07f4ad69747cd069:
|
2015-11-09 20:54:34 -08:00
|
|
|
;
|
|
|
|
|
// match: (Sub32 (Add32 x y) x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: y
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpAdd32 {
|
|
|
|
|
goto end70c1e60e58a6c106d060f10cd3f179ea
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
y := v.Args[0].Args[1]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end70c1e60e58a6c106d060f10cd3f179ea
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = y.Type
|
|
|
|
|
v.AddArg(y)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end70c1e60e58a6c106d060f10cd3f179ea
|
|
|
|
|
end70c1e60e58a6c106d060f10cd3f179ea:
|
|
|
|
|
;
|
|
|
|
|
// match: (Sub32 (Add32 x y) y)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpAdd32 {
|
|
|
|
|
goto end20e42db178ec4f423cc56a991863a4a2
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
y := v.Args[0].Args[1]
|
|
|
|
|
if v.Args[1] != y {
|
|
|
|
|
goto end20e42db178ec4f423cc56a991863a4a2
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end20e42db178ec4f423cc56a991863a4a2
|
|
|
|
|
end20e42db178ec4f423cc56a991863a4a2:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpSub64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-11-02 21:28:13 -08:00
|
|
|
// match: (Sub64 (Const64 [c]) (Const64 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const64 [c-d])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst64 {
|
|
|
|
|
goto end5a84a285ff0ff48b8ad3c64b15e3459f
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto end5a84a285ff0ff48b8ad3c64b15e3459f
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConst64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c - d
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end5a84a285ff0ff48b8ad3c64b15e3459f
|
|
|
|
|
end5a84a285ff0ff48b8ad3c64b15e3459f:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Sub64 x (Const64 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst64
|
|
|
|
|
// result: (Add64 (Const64 <t> [-c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst64 {
|
|
|
|
|
goto enda80d30f6794bcf02cd4442b238f68333
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst64) {
|
|
|
|
|
goto enda80d30f6794bcf02cd4442b238f68333
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpAdd64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst64, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = -c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto enda80d30f6794bcf02cd4442b238f68333
|
|
|
|
|
enda80d30f6794bcf02cd4442b238f68333:
|
2015-11-02 21:28:13 -08:00
|
|
|
;
|
2015-10-26 21:49:31 -07:00
|
|
|
// match: (Sub64 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const64 [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end0387dc2b7bbe57d4aa54eab5d959da4b
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConst64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0387dc2b7bbe57d4aa54eab5d959da4b
|
|
|
|
|
end0387dc2b7bbe57d4aa54eab5d959da4b:
|
2015-11-09 20:54:34 -08:00
|
|
|
;
|
|
|
|
|
// match: (Sub64 (Add64 x y) x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: y
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpAdd64 {
|
|
|
|
|
goto end7d177451cf8959cb781f52d5ded46fff
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
y := v.Args[0].Args[1]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end7d177451cf8959cb781f52d5ded46fff
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = y.Type
|
|
|
|
|
v.AddArg(y)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end7d177451cf8959cb781f52d5ded46fff
|
|
|
|
|
end7d177451cf8959cb781f52d5ded46fff:
|
|
|
|
|
;
|
|
|
|
|
// match: (Sub64 (Add64 x y) y)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpAdd64 {
|
|
|
|
|
goto end6ea8172b21100cfe3dc86b7a850fbe97
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
y := v.Args[0].Args[1]
|
|
|
|
|
if v.Args[1] != y {
|
|
|
|
|
goto end6ea8172b21100cfe3dc86b7a850fbe97
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end6ea8172b21100cfe3dc86b7a850fbe97
|
|
|
|
|
end6ea8172b21100cfe3dc86b7a850fbe97:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpSub8(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
2015-11-02 21:28:13 -08:00
|
|
|
// match: (Sub8 (Const8 [c]) (Const8 [d]))
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const8 [c-d])
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpConst8 {
|
|
|
|
|
goto endc00ea11c7535529e211710574f5cff24
|
|
|
|
|
}
|
|
|
|
|
c := v.Args[0].AuxInt
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto endc00ea11c7535529e211710574f5cff24
|
|
|
|
|
}
|
|
|
|
|
d := v.Args[1].AuxInt
|
|
|
|
|
v.Op = OpConst8
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = c - d
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endc00ea11c7535529e211710574f5cff24
|
|
|
|
|
endc00ea11c7535529e211710574f5cff24:
|
2016-02-03 19:43:46 +01:00
|
|
|
;
|
|
|
|
|
// match: (Sub8 x (Const8 <t> [c]))
|
|
|
|
|
// cond: x.Op != OpConst8
|
|
|
|
|
// result: (Add8 (Const8 <t> [-c]) x)
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1].Op != OpConst8 {
|
|
|
|
|
goto end0bfab5b6f1037e55dc049b79e2636678
|
|
|
|
|
}
|
|
|
|
|
t := v.Args[1].Type
|
|
|
|
|
c := v.Args[1].AuxInt
|
|
|
|
|
if !(x.Op != OpConst8) {
|
|
|
|
|
goto end0bfab5b6f1037e55dc049b79e2636678
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpAdd8
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v0 := b.NewValue0(v.Line, OpConst8, TypeInvalid)
|
|
|
|
|
v0.Type = t
|
|
|
|
|
v0.AuxInt = -c
|
|
|
|
|
v.AddArg(v0)
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end0bfab5b6f1037e55dc049b79e2636678
|
|
|
|
|
end0bfab5b6f1037e55dc049b79e2636678:
|
2015-11-02 21:28:13 -08:00
|
|
|
;
|
2015-10-26 21:49:31 -07:00
|
|
|
// match: (Sub8 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const8 [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end4e2ee15ef17611919a1a6b5f80bbfe18
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConst8
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end4e2ee15ef17611919a1a6b5f80bbfe18
|
|
|
|
|
end4e2ee15ef17611919a1a6b5f80bbfe18:
|
2015-11-09 20:54:34 -08:00
|
|
|
;
|
|
|
|
|
// match: (Sub8 (Add8 x y) x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: y
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpAdd8 {
|
|
|
|
|
goto endd79d561e14dc3d11da4c3bb20270b541
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
y := v.Args[0].Args[1]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto endd79d561e14dc3d11da4c3bb20270b541
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = y.Type
|
|
|
|
|
v.AddArg(y)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endd79d561e14dc3d11da4c3bb20270b541
|
|
|
|
|
endd79d561e14dc3d11da4c3bb20270b541:
|
|
|
|
|
;
|
|
|
|
|
// match: (Sub8 (Add8 x y) y)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: x
|
|
|
|
|
{
|
|
|
|
|
if v.Args[0].Op != OpAdd8 {
|
|
|
|
|
goto endcb7111b11d6d068c97026a97ecff8248
|
|
|
|
|
}
|
|
|
|
|
x := v.Args[0].Args[0]
|
|
|
|
|
y := v.Args[0].Args[1]
|
|
|
|
|
if v.Args[1] != y {
|
|
|
|
|
goto endcb7111b11d6d068c97026a97ecff8248
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpCopy
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.Type = x.Type
|
|
|
|
|
v.AddArg(x)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endcb7111b11d6d068c97026a97ecff8248
|
|
|
|
|
endcb7111b11d6d068c97026a97ecff8248:
|
2015-10-26 21:49:31 -07:00
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpXor16(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Xor16 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const16 [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end5733ceb1903b8140248d8e2cac02fefe
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConst16
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end5733ceb1903b8140248d8e2cac02fefe
|
|
|
|
|
end5733ceb1903b8140248d8e2cac02fefe:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpXor32(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Xor32 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const32 [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end268ca02df6515d648e0bfb4e90981d25
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConst32
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto end268ca02df6515d648e0bfb4e90981d25
|
|
|
|
|
end268ca02df6515d648e0bfb4e90981d25:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpXor64(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Xor64 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const64 [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto endaf44e7f9fc58af30df69070953fb45ce
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConst64
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endaf44e7f9fc58af30df69070953fb45ce
|
|
|
|
|
endaf44e7f9fc58af30df69070953fb45ce:
|
|
|
|
|
;
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteValuegeneric_OpXor8(v *Value, config *Config) bool {
|
|
|
|
|
b := v.Block
|
|
|
|
|
_ = b
|
|
|
|
|
// match: (Xor8 x x)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (Const8 [0])
|
|
|
|
|
{
|
|
|
|
|
x := v.Args[0]
|
|
|
|
|
if v.Args[1] != x {
|
|
|
|
|
goto end949b3a60b7d181688e6f79f93c782fc8
|
|
|
|
|
}
|
|
|
|
|
v.Op = OpConst8
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
v.Aux = nil
|
|
|
|
|
v.resetArgs()
|
|
|
|
|
v.AuxInt = 0
|
|
|
|
|
return true
|
2015-06-06 16:03:33 -07:00
|
|
|
}
|
2015-10-26 21:49:31 -07:00
|
|
|
goto end949b3a60b7d181688e6f79f93c782fc8
|
|
|
|
|
end949b3a60b7d181688e6f79f93c782fc8:
|
|
|
|
|
;
|
2015-06-06 16:03:33 -07:00
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
func rewriteBlockgeneric(b *Block) bool {
|
|
|
|
|
switch b.Kind {
|
2015-10-23 19:12:49 -07:00
|
|
|
case BlockCheck:
|
|
|
|
|
// match: (Check (NilCheck (GetG _) _) next)
|
2015-08-12 11:22:16 -07:00
|
|
|
// cond:
|
2015-10-23 19:12:49 -07:00
|
|
|
// result: (Plain nil next)
|
2015-08-12 11:22:16 -07:00
|
|
|
{
|
|
|
|
|
v := b.Control
|
2015-10-23 19:12:49 -07:00
|
|
|
if v.Op != OpNilCheck {
|
|
|
|
|
goto end6e20d932d6961903b0dcf16eac513826
|
2015-08-12 11:22:16 -07:00
|
|
|
}
|
|
|
|
|
if v.Args[0].Op != OpGetG {
|
2015-10-23 19:12:49 -07:00
|
|
|
goto end6e20d932d6961903b0dcf16eac513826
|
2015-08-12 11:22:16 -07:00
|
|
|
}
|
2015-10-23 19:12:49 -07:00
|
|
|
next := b.Succs[0]
|
|
|
|
|
b.Kind = BlockPlain
|
2015-08-12 11:22:16 -07:00
|
|
|
b.Control = nil
|
2015-10-23 19:12:49 -07:00
|
|
|
b.Succs[0] = next
|
|
|
|
|
b.Likely = BranchUnknown
|
2015-08-12 11:22:16 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-10-23 19:12:49 -07:00
|
|
|
goto end6e20d932d6961903b0dcf16eac513826
|
|
|
|
|
end6e20d932d6961903b0dcf16eac513826:
|
2015-08-12 11:22:16 -07:00
|
|
|
;
|
2015-10-23 19:12:49 -07:00
|
|
|
case BlockIf:
|
2015-07-23 18:44:09 -05:00
|
|
|
// match: (If (Not cond) yes no)
|
|
|
|
|
// cond:
|
|
|
|
|
// result: (If cond no yes)
|
|
|
|
|
{
|
|
|
|
|
v := b.Control
|
|
|
|
|
if v.Op != OpNot {
|
|
|
|
|
goto endebe19c1c3c3bec068cdb2dd29ef57f96
|
|
|
|
|
}
|
|
|
|
|
cond := v.Args[0]
|
|
|
|
|
yes := b.Succs[0]
|
|
|
|
|
no := b.Succs[1]
|
|
|
|
|
b.Kind = BlockIf
|
|
|
|
|
b.Control = cond
|
|
|
|
|
b.Succs[0] = no
|
|
|
|
|
b.Succs[1] = yes
|
2015-08-11 17:28:56 -07:00
|
|
|
b.Likely *= -1
|
2015-07-23 18:44:09 -05:00
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
goto endebe19c1c3c3bec068cdb2dd29ef57f96
|
|
|
|
|
endebe19c1c3c3bec068cdb2dd29ef57f96:
|
|
|
|
|
;
|
2015-09-03 18:24:22 -05:00
|
|
|
// match: (If (ConstBool [c]) yes no)
|
|
|
|
|
// cond: c == 1
|
2015-08-28 16:45:17 -07:00
|
|
|
// result: (First nil yes no)
|
2015-06-06 16:03:33 -07:00
|
|
|
{
|
|
|
|
|
v := b.Control
|
2015-07-28 14:19:20 -07:00
|
|
|
if v.Op != OpConstBool {
|
2015-09-03 18:24:22 -05:00
|
|
|
goto endc58ecbb85af78c0d58bb232ca86b67a4
|
2015-06-06 16:03:33 -07:00
|
|
|
}
|
2015-09-03 18:24:22 -05:00
|
|
|
c := v.AuxInt
|
2015-06-06 16:03:33 -07:00
|
|
|
yes := b.Succs[0]
|
|
|
|
|
no := b.Succs[1]
|
2015-09-03 18:24:22 -05:00
|
|
|
if !(c == 1) {
|
|
|
|
|
goto endc58ecbb85af78c0d58bb232ca86b67a4
|
2015-06-06 16:03:33 -07:00
|
|
|
}
|
2015-08-28 16:45:17 -07:00
|
|
|
b.Kind = BlockFirst
|
2015-06-06 16:03:33 -07:00
|
|
|
b.Control = nil
|
|
|
|
|
b.Succs[0] = yes
|
2015-08-28 16:45:17 -07:00
|
|
|
b.Succs[1] = no
|
2015-06-06 16:03:33 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-09-03 18:24:22 -05:00
|
|
|
goto endc58ecbb85af78c0d58bb232ca86b67a4
|
|
|
|
|
endc58ecbb85af78c0d58bb232ca86b67a4:
|
2015-06-06 16:03:33 -07:00
|
|
|
;
|
2015-09-03 18:24:22 -05:00
|
|
|
// match: (If (ConstBool [c]) yes no)
|
|
|
|
|
// cond: c == 0
|
2015-08-28 16:45:17 -07:00
|
|
|
// result: (First nil no yes)
|
2015-06-06 16:03:33 -07:00
|
|
|
{
|
|
|
|
|
v := b.Control
|
2015-07-28 14:19:20 -07:00
|
|
|
if v.Op != OpConstBool {
|
2015-09-03 18:24:22 -05:00
|
|
|
goto end4c3e297e275dd7e2e67f8ccd348c4bb5
|
2015-06-06 16:03:33 -07:00
|
|
|
}
|
2015-09-03 18:24:22 -05:00
|
|
|
c := v.AuxInt
|
2015-06-06 16:03:33 -07:00
|
|
|
yes := b.Succs[0]
|
|
|
|
|
no := b.Succs[1]
|
2015-09-03 18:24:22 -05:00
|
|
|
if !(c == 0) {
|
|
|
|
|
goto end4c3e297e275dd7e2e67f8ccd348c4bb5
|
2015-06-06 16:03:33 -07:00
|
|
|
}
|
2015-08-28 16:45:17 -07:00
|
|
|
b.Kind = BlockFirst
|
2015-06-06 16:03:33 -07:00
|
|
|
b.Control = nil
|
|
|
|
|
b.Succs[0] = no
|
2015-08-28 16:45:17 -07:00
|
|
|
b.Succs[1] = yes
|
|
|
|
|
b.Likely *= -1
|
2015-06-06 16:03:33 -07:00
|
|
|
return true
|
|
|
|
|
}
|
2015-09-03 18:24:22 -05:00
|
|
|
goto end4c3e297e275dd7e2e67f8ccd348c4bb5
|
|
|
|
|
end4c3e297e275dd7e2e67f8ccd348c4bb5:
|
2015-06-06 16:03:33 -07:00
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|