(Const(8|16|32) [val]) => (MOVWconst [int32(val)])
(Const(32|64)F [val]) => (MOV(F|D)const [float64(val)])
(ConstNil) => (MOVWconst [0])
-(ConstBool [b]) => (MOVWconst [b2i32(b)])
+(ConstBool [t]) => (MOVWconst [b2i32(t)])
// truncations
// Because we ignore high parts of registers, truncates are just copies.
(Const(64|32|16|8) [val]) => (MOVDconst [int64(val)])
(Const(32F|64F) [val]) => (FMOV(S|D)const [float64(val)])
(ConstNil) => (MOVDconst [0])
-(ConstBool [b]) => (MOVDconst [b2i(b)])
+(ConstBool [t]) => (MOVDconst [b2i(t)])
(Slicemask <t> x) => (SRAconst (NEG <t> x) [63])
(Const(32|16|8) [val]) => (MOVWconst [int32(val)])
(Const(32|64)F ...) => (MOV(F|D)const ...)
(ConstNil) => (MOVWconst [0])
-(ConstBool [b]) => (MOVWconst [b2i32(b)])
+(ConstBool [t]) => (MOVWconst [b2i32(t)])
// truncations
// Because we ignore high parts of registers, truncates are just copies.
(Const(64|32|16|8) [val]) => (MOVVconst [int64(val)])
(Const(32|64)F [val]) => (MOV(F|D)const [float64(val)])
(ConstNil) => (MOVVconst [0])
-(ConstBool [b]) => (MOVVconst [int64(b2i(b))])
+(ConstBool [t]) => (MOVVconst [int64(b2i(t))])
(Slicemask <t> x) => (SRAVconst (NEGV <t> x) [63])
(Const(64|32|16|8) [val]) => (MOVDconst [int64(val)])
(Const(32|64)F ...) => (FMOV(S|D)const ...)
(ConstNil) => (MOVDconst [0])
-(ConstBool [b]) => (MOVDconst [b2i(b)])
+(ConstBool [t]) => (MOVDconst [b2i(t)])
// Constant folding
(FABS (FMOVDconst [x])) => (FMOVDconst [math.Abs(x)])
(Const(64|32|16|8) [val]) => (MOVDconst [int64(val)])
(Const(32|64)F ...) => (FMOV(S|D)const ...)
(ConstNil) => (MOVDconst [0])
-(ConstBool [b]) => (MOVDconst [b2i(b)])
+(ConstBool [t]) => (MOVDconst [b2i(t)])
// Lowering calls
(StaticCall ...) => (CALLstatic ...)
=> mem
// Collapse OffPtr
-(OffPtr (OffPtr p [b]) [a]) => (OffPtr p [a+b])
+(OffPtr (OffPtr p [y]) [x]) => (OffPtr p [x+y])
(OffPtr p [0]) && v.Type.Compare(p.Type) == types.CMPeq => p
// indexing operations
f0 mem))))
// Putting struct{*byte} and similar into direct interfaces.
-(IMake typ (StructMake1 val)) => (IMake typ val)
+(IMake _typ (StructMake1 val)) => (IMake _typ val)
(StructSelect [0] (IData x)) => (IData x)
// un-SSAable values use mem->mem copies
(Store dst (ArrayMake1 e) mem) => (Store {e.Type} dst e mem)
// Putting [1]*byte and similar into direct interfaces.
-(IMake typ (ArrayMake1 val)) => (IMake typ val)
+(IMake _typ (ArrayMake1 val)) => (IMake _typ val)
(ArraySelect [0] (IData x)) => (IData x)
// string ops
(Sqrt (Const64F [c])) && !math.IsNaN(math.Sqrt(c)) => (Const64F [math.Sqrt(c)])
// for rewriting results of some late-expanded rewrites (below)
-(SelectN [0] (MakeResult a ___)) => a
-(SelectN [1] (MakeResult a b ___)) => b
-(SelectN [2] (MakeResult a b c ___)) => c
+(SelectN [0] (MakeResult x ___)) => x
+(SelectN [1] (MakeResult x y ___)) => y
+(SelectN [2] (MakeResult x y z ___)) => z
// for late-expanded calls, recognize newobject and remove zeroing and nilchecks
(Zero (SelectN [0] call:(StaticLECall _ _)) mem:(SelectN [1] call))
// Evaluate constant address comparisons.
(EqPtr x x) => (ConstBool [true])
(NeqPtr x x) => (ConstBool [false])
-(EqPtr (Addr {a} _) (Addr {b} _)) => (ConstBool [a == b])
-(EqPtr (Addr {a} _) (OffPtr [o] (Addr {b} _))) => (ConstBool [a == b && o == 0])
-(EqPtr (OffPtr [o1] (Addr {a} _)) (OffPtr [o2] (Addr {b} _))) => (ConstBool [a == b && o1 == o2])
-(NeqPtr (Addr {a} _) (Addr {b} _)) => (ConstBool [a != b])
-(NeqPtr (Addr {a} _) (OffPtr [o] (Addr {b} _))) => (ConstBool [a != b || o != 0])
-(NeqPtr (OffPtr [o1] (Addr {a} _)) (OffPtr [o2] (Addr {b} _))) => (ConstBool [a != b || o1 != o2])
-(EqPtr (LocalAddr {a} _ _) (LocalAddr {b} _ _)) => (ConstBool [a == b])
-(EqPtr (LocalAddr {a} _ _) (OffPtr [o] (LocalAddr {b} _ _))) => (ConstBool [a == b && o == 0])
-(EqPtr (OffPtr [o1] (LocalAddr {a} _ _)) (OffPtr [o2] (LocalAddr {b} _ _))) => (ConstBool [a == b && o1 == o2])
-(NeqPtr (LocalAddr {a} _ _) (LocalAddr {b} _ _)) => (ConstBool [a != b])
-(NeqPtr (LocalAddr {a} _ _) (OffPtr [o] (LocalAddr {b} _ _))) => (ConstBool [a != b || o != 0])
-(NeqPtr (OffPtr [o1] (LocalAddr {a} _ _)) (OffPtr [o2] (LocalAddr {b} _ _))) => (ConstBool [a != b || o1 != o2])
+(EqPtr (Addr {x} _) (Addr {y} _)) => (ConstBool [x == y])
+(EqPtr (Addr {x} _) (OffPtr [o] (Addr {y} _))) => (ConstBool [x == y && o == 0])
+(EqPtr (OffPtr [o1] (Addr {x} _)) (OffPtr [o2] (Addr {y} _))) => (ConstBool [x == y && o1 == o2])
+(NeqPtr (Addr {x} _) (Addr {y} _)) => (ConstBool [x != y])
+(NeqPtr (Addr {x} _) (OffPtr [o] (Addr {y} _))) => (ConstBool [x != y || o != 0])
+(NeqPtr (OffPtr [o1] (Addr {x} _)) (OffPtr [o2] (Addr {y} _))) => (ConstBool [x != y || o1 != o2])
+(EqPtr (LocalAddr {x} _ _) (LocalAddr {y} _ _)) => (ConstBool [x == y])
+(EqPtr (LocalAddr {x} _ _) (OffPtr [o] (LocalAddr {y} _ _))) => (ConstBool [x == y && o == 0])
+(EqPtr (OffPtr [o1] (LocalAddr {x} _ _)) (OffPtr [o2] (LocalAddr {y} _ _))) => (ConstBool [x == y && o1 == o2])
+(NeqPtr (LocalAddr {x} _ _) (LocalAddr {y} _ _)) => (ConstBool [x != y])
+(NeqPtr (LocalAddr {x} _ _) (OffPtr [o] (LocalAddr {y} _ _))) => (ConstBool [x != y || o != 0])
+(NeqPtr (OffPtr [o1] (LocalAddr {x} _ _)) (OffPtr [o2] (LocalAddr {y} _ _))) => (ConstBool [x != y || o1 != o2])
(EqPtr (OffPtr [o1] p1) p2) && isSamePtr(p1, p2) => (ConstBool [o1 == 0])
(NeqPtr (OffPtr [o1] p1) p2) && isSamePtr(p1, p2) => (ConstBool [o1 != 0])
(EqPtr (OffPtr [o1] p1) (OffPtr [o2] p2)) && isSamePtr(p1, p2) => (ConstBool [o1 == o2])
Suffix: fmt.Sprintf("_%s", op),
ArgLen: opByName(arch, op).argLength,
}
- fn.add(declf("b", "v.Block"))
- fn.add(declf("config", "b.Func.Config"))
- fn.add(declf("fe", "b.Func.fe"))
- fn.add(declf("typ", "&b.Func.Config.Types"))
+ fn.add(declReserved("b", "v.Block"))
+ fn.add(declReserved("config", "b.Func.Config"))
+ fn.add(declReserved("fe", "b.Func.fe"))
+ fn.add(declReserved("typ", "&b.Func.Config.Types"))
for _, rule := range rules {
if rr != nil && !rr.CanFail {
log.Fatalf("unconditional rule %s is followed by other rules", rr.Match)
// Generate block rewrite function. There are only a few block types
// so we can make this one function with a switch.
fn = &Func{Kind: "Block"}
- fn.add(declf("config", "b.Func.Config"))
- fn.add(declf("typ", "&b.Func.Config.Types"))
+ fn.add(declReserved("config", "b.Func.Config"))
+ fn.add(declReserved("typ", "&b.Func.Config.Types"))
sw = &Switch{Expr: exprf("b.Kind")}
ops = ops[:0]
return file.Decls[0].(*ast.FuncDecl).Body.List[0]
}
-// declf constructs a simple "name := value" declaration, using exprf for its
-// value.
-func declf(name, format string, a ...interface{}) *Declare {
+var reservedNames = map[string]bool{
+ "v": true, // Values[i], etc
+ "b": true, // v.Block
+ "config": true, // b.Func.Config
+ "fe": true, // b.Func.fe
+ "typ": true, // &b.Func.Config.Types
+}
+
+// declf constructs a simple "name := value" declaration,
+// using exprf for its value.
+//
+// name must not be one of reservedNames.
+// This helps prevent unintended shadowing and name clashes.
+// To declare a reserved name, use declReserved.
+func declf(loc, name, format string, a ...interface{}) *Declare {
+ if reservedNames[name] {
+ log.Fatalf("rule %s uses the reserved name %s", loc, name)
+ }
return &Declare{name, exprf(format, a...)}
}
+// declReserved is like declf, but the name must be one of reservedNames.
+// Calls to declReserved should generally be static and top-level.
+func declReserved(name, value string) *Declare {
+ if !reservedNames[name] {
+ panic(fmt.Sprintf("declReserved call does not use a reserved name: %q", name))
+ }
+ return &Declare{name, exprf(value)}
+}
+
// breakf constructs a simple "if cond { break }" statement, using exprf for its
// condition.
func breakf(format string, a ...interface{}) *CondBreak {
if vname == "" {
vname = fmt.Sprintf("v_%v", i)
}
- rr.add(declf(vname, cname))
+ rr.add(declf(rr.Loc, vname, cname))
p, op := genMatch0(rr, arch, expr, vname, nil, false) // TODO: pass non-nil cnt?
if op != "" {
check := fmt.Sprintf("%s.Op == %s", cname, op)
}
pos[i] = p
} else {
- rr.add(declf(arg, cname))
+ rr.add(declf(rr.Loc, arg, cname))
pos[i] = arg + ".Pos"
}
}
if !token.IsIdentifier(e.name) || rr.declared(e.name) {
rr.add(breakf("%sTo%s(b.%s) != %s", unTitle(e.field), title(e.dclType), e.field, e.name))
} else {
- rr.add(declf(e.name, "%sTo%s(b.%s)", unTitle(e.field), title(e.dclType), e.field))
+ rr.add(declf(rr.Loc, e.name, "%sTo%s(b.%s)", unTitle(e.field), title(e.dclType), e.field))
}
}
if rr.Cond != "" {
} else {
switch e.field {
case "Aux":
- rr.add(declf(e.name, "auxTo%s(%s.%s)", title(e.dclType), v, e.field))
+ rr.add(declf(rr.Loc, e.name, "auxTo%s(%s.%s)", title(e.dclType), v, e.field))
case "AuxInt":
- rr.add(declf(e.name, "auxIntTo%s(%s.%s)", title(e.dclType), v, e.field))
+ rr.add(declf(rr.Loc, e.name, "auxIntTo%s(%s.%s)", title(e.dclType), v, e.field))
case "Type":
- rr.add(declf(e.name, "%s.%s", v, e.field))
+ rr.add(declf(rr.Loc, e.name, "%s.%s", v, e.field))
}
}
}
continue
}
if !rr.declared(a) && token.IsIdentifier(a) && !(commutative && len(args) == 2) {
- rr.add(declf(a, "%s.Args[%d]", v, n))
+ rr.add(declf(rr.Loc, a, "%s.Args[%d]", v, n))
// delete the last argument so it is not reprocessed
args = args[:n]
} else {
if commutative && !pregenTop {
for i := 0; i <= 1; i++ {
vname := fmt.Sprintf("%s_%d", v, i)
- rr.add(declf(vname, "%s.Args[%d]", v, i))
+ rr.add(declf(rr.Loc, vname, "%s.Args[%d]", v, i))
}
}
if commutative {
rr.add(breakf("%s != %s", arg, rhs))
} else {
if arg != rhs {
- rr.add(declf(arg, "%s", rhs))
+ rr.add(declf(rr.Loc, arg, "%s", rhs))
}
}
continue
}
if argname != rhs {
- rr.add(declf(argname, "%s", rhs))
+ rr.add(declf(rr.Loc, argname, "%s", rhs))
}
bexpr := exprf("%s.Op != addLater", argname)
rr.add(&CondBreak{Cond: bexpr})
v = resname
}
rr.Alloc++
- rr.add(declf(v, "b.NewValue0(%s, Op%s%s, %s)", pos, oparch, op.name, typ))
+ rr.add(declf(rr.Loc, v, "b.NewValue0(%s, Op%s%s, %s)", pos, oparch, op.name, typ))
if move && top {
// Rewrite original into a copy
rr.add(stmtf("v.copyOf(%s)", v))
}
}
func rewriteValueARM_OpConstBool(v *Value) bool {
- // match: (ConstBool [b])
- // result: (MOVWconst [b2i32(b)])
+ // match: (ConstBool [t])
+ // result: (MOVWconst [b2i32(t)])
for {
- b := auxIntToBool(v.AuxInt)
+ t := auxIntToBool(v.AuxInt)
v.reset(OpARMMOVWconst)
- v.AuxInt = int32ToAuxInt(b2i32(b))
+ v.AuxInt = int32ToAuxInt(b2i32(t))
return true
}
}
}
}
func rewriteValueARM64_OpConstBool(v *Value) bool {
- // match: (ConstBool [b])
- // result: (MOVDconst [b2i(b)])
+ // match: (ConstBool [t])
+ // result: (MOVDconst [b2i(t)])
for {
- b := auxIntToBool(v.AuxInt)
+ t := auxIntToBool(v.AuxInt)
v.reset(OpARM64MOVDconst)
- v.AuxInt = int64ToAuxInt(b2i(b))
+ v.AuxInt = int64ToAuxInt(b2i(t))
return true
}
}
}
}
func rewriteValueMIPS_OpConstBool(v *Value) bool {
- // match: (ConstBool [b])
- // result: (MOVWconst [b2i32(b)])
+ // match: (ConstBool [t])
+ // result: (MOVWconst [b2i32(t)])
for {
- b := auxIntToBool(v.AuxInt)
+ t := auxIntToBool(v.AuxInt)
v.reset(OpMIPSMOVWconst)
- v.AuxInt = int32ToAuxInt(b2i32(b))
+ v.AuxInt = int32ToAuxInt(b2i32(t))
return true
}
}
}
}
func rewriteValueMIPS64_OpConstBool(v *Value) bool {
- // match: (ConstBool [b])
- // result: (MOVVconst [int64(b2i(b))])
+ // match: (ConstBool [t])
+ // result: (MOVVconst [int64(b2i(t))])
for {
- b := auxIntToBool(v.AuxInt)
+ t := auxIntToBool(v.AuxInt)
v.reset(OpMIPS64MOVVconst)
- v.AuxInt = int64ToAuxInt(int64(b2i(b)))
+ v.AuxInt = int64ToAuxInt(int64(b2i(t)))
return true
}
}
}
}
func rewriteValuePPC64_OpConstBool(v *Value) bool {
- // match: (ConstBool [b])
- // result: (MOVDconst [b2i(b)])
+ // match: (ConstBool [t])
+ // result: (MOVDconst [b2i(t)])
for {
- b := auxIntToBool(v.AuxInt)
+ t := auxIntToBool(v.AuxInt)
v.reset(OpPPC64MOVDconst)
- v.AuxInt = int64ToAuxInt(b2i(b))
+ v.AuxInt = int64ToAuxInt(b2i(t))
return true
}
}
}
}
func rewriteValueS390X_OpConstBool(v *Value) bool {
- // match: (ConstBool [b])
- // result: (MOVDconst [b2i(b)])
+ // match: (ConstBool [t])
+ // result: (MOVDconst [b2i(t)])
for {
- b := auxIntToBool(v.AuxInt)
+ t := auxIntToBool(v.AuxInt)
v.reset(OpS390XMOVDconst)
- v.AuxInt = int64ToAuxInt(b2i(b))
+ v.AuxInt = int64ToAuxInt(b2i(t))
return true
}
}
v.AuxInt = boolToAuxInt(true)
return true
}
- // match: (EqPtr (Addr {a} _) (Addr {b} _))
- // result: (ConstBool [a == b])
+ // match: (EqPtr (Addr {x} _) (Addr {y} _))
+ // result: (ConstBool [x == y])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpAddr {
continue
}
- a := auxToSym(v_0.Aux)
+ x := auxToSym(v_0.Aux)
if v_1.Op != OpAddr {
continue
}
- b := auxToSym(v_1.Aux)
+ y := auxToSym(v_1.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a == b)
+ v.AuxInt = boolToAuxInt(x == y)
return true
}
break
}
- // match: (EqPtr (Addr {a} _) (OffPtr [o] (Addr {b} _)))
- // result: (ConstBool [a == b && o == 0])
+ // match: (EqPtr (Addr {x} _) (OffPtr [o] (Addr {y} _)))
+ // result: (ConstBool [x == y && o == 0])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpAddr {
continue
}
- a := auxToSym(v_0.Aux)
+ x := auxToSym(v_0.Aux)
if v_1.Op != OpOffPtr {
continue
}
if v_1_0.Op != OpAddr {
continue
}
- b := auxToSym(v_1_0.Aux)
+ y := auxToSym(v_1_0.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a == b && o == 0)
+ v.AuxInt = boolToAuxInt(x == y && o == 0)
return true
}
break
}
- // match: (EqPtr (OffPtr [o1] (Addr {a} _)) (OffPtr [o2] (Addr {b} _)))
- // result: (ConstBool [a == b && o1 == o2])
+ // match: (EqPtr (OffPtr [o1] (Addr {x} _)) (OffPtr [o2] (Addr {y} _)))
+ // result: (ConstBool [x == y && o1 == o2])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpOffPtr {
if v_0_0.Op != OpAddr {
continue
}
- a := auxToSym(v_0_0.Aux)
+ x := auxToSym(v_0_0.Aux)
if v_1.Op != OpOffPtr {
continue
}
if v_1_0.Op != OpAddr {
continue
}
- b := auxToSym(v_1_0.Aux)
+ y := auxToSym(v_1_0.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a == b && o1 == o2)
+ v.AuxInt = boolToAuxInt(x == y && o1 == o2)
return true
}
break
}
- // match: (EqPtr (LocalAddr {a} _ _) (LocalAddr {b} _ _))
- // result: (ConstBool [a == b])
+ // match: (EqPtr (LocalAddr {x} _ _) (LocalAddr {y} _ _))
+ // result: (ConstBool [x == y])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpLocalAddr {
continue
}
- a := auxToSym(v_0.Aux)
+ x := auxToSym(v_0.Aux)
if v_1.Op != OpLocalAddr {
continue
}
- b := auxToSym(v_1.Aux)
+ y := auxToSym(v_1.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a == b)
+ v.AuxInt = boolToAuxInt(x == y)
return true
}
break
}
- // match: (EqPtr (LocalAddr {a} _ _) (OffPtr [o] (LocalAddr {b} _ _)))
- // result: (ConstBool [a == b && o == 0])
+ // match: (EqPtr (LocalAddr {x} _ _) (OffPtr [o] (LocalAddr {y} _ _)))
+ // result: (ConstBool [x == y && o == 0])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpLocalAddr {
continue
}
- a := auxToSym(v_0.Aux)
+ x := auxToSym(v_0.Aux)
if v_1.Op != OpOffPtr {
continue
}
if v_1_0.Op != OpLocalAddr {
continue
}
- b := auxToSym(v_1_0.Aux)
+ y := auxToSym(v_1_0.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a == b && o == 0)
+ v.AuxInt = boolToAuxInt(x == y && o == 0)
return true
}
break
}
- // match: (EqPtr (OffPtr [o1] (LocalAddr {a} _ _)) (OffPtr [o2] (LocalAddr {b} _ _)))
- // result: (ConstBool [a == b && o1 == o2])
+ // match: (EqPtr (OffPtr [o1] (LocalAddr {x} _ _)) (OffPtr [o2] (LocalAddr {y} _ _)))
+ // result: (ConstBool [x == y && o1 == o2])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpOffPtr {
if v_0_0.Op != OpLocalAddr {
continue
}
- a := auxToSym(v_0_0.Aux)
+ x := auxToSym(v_0_0.Aux)
if v_1.Op != OpOffPtr {
continue
}
if v_1_0.Op != OpLocalAddr {
continue
}
- b := auxToSym(v_1_0.Aux)
+ y := auxToSym(v_1_0.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a == b && o1 == o2)
+ v.AuxInt = boolToAuxInt(x == y && o1 == o2)
return true
}
break
func rewriteValuegeneric_OpIMake(v *Value) bool {
v_1 := v.Args[1]
v_0 := v.Args[0]
- // match: (IMake typ (StructMake1 val))
- // result: (IMake typ val)
+ // match: (IMake _typ (StructMake1 val))
+ // result: (IMake _typ val)
for {
- typ := v_0
+ _typ := v_0
if v_1.Op != OpStructMake1 {
break
}
val := v_1.Args[0]
v.reset(OpIMake)
- v.AddArg2(typ, val)
+ v.AddArg2(_typ, val)
return true
}
- // match: (IMake typ (ArrayMake1 val))
- // result: (IMake typ val)
+ // match: (IMake _typ (ArrayMake1 val))
+ // result: (IMake _typ val)
for {
- typ := v_0
+ _typ := v_0
if v_1.Op != OpArrayMake1 {
break
}
val := v_1.Args[0]
v.reset(OpIMake)
- v.AddArg2(typ, val)
+ v.AddArg2(_typ, val)
return true
}
return false
v.AuxInt = boolToAuxInt(false)
return true
}
- // match: (NeqPtr (Addr {a} _) (Addr {b} _))
- // result: (ConstBool [a != b])
+ // match: (NeqPtr (Addr {x} _) (Addr {y} _))
+ // result: (ConstBool [x != y])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpAddr {
continue
}
- a := auxToSym(v_0.Aux)
+ x := auxToSym(v_0.Aux)
if v_1.Op != OpAddr {
continue
}
- b := auxToSym(v_1.Aux)
+ y := auxToSym(v_1.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a != b)
+ v.AuxInt = boolToAuxInt(x != y)
return true
}
break
}
- // match: (NeqPtr (Addr {a} _) (OffPtr [o] (Addr {b} _)))
- // result: (ConstBool [a != b || o != 0])
+ // match: (NeqPtr (Addr {x} _) (OffPtr [o] (Addr {y} _)))
+ // result: (ConstBool [x != y || o != 0])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpAddr {
continue
}
- a := auxToSym(v_0.Aux)
+ x := auxToSym(v_0.Aux)
if v_1.Op != OpOffPtr {
continue
}
if v_1_0.Op != OpAddr {
continue
}
- b := auxToSym(v_1_0.Aux)
+ y := auxToSym(v_1_0.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a != b || o != 0)
+ v.AuxInt = boolToAuxInt(x != y || o != 0)
return true
}
break
}
- // match: (NeqPtr (OffPtr [o1] (Addr {a} _)) (OffPtr [o2] (Addr {b} _)))
- // result: (ConstBool [a != b || o1 != o2])
+ // match: (NeqPtr (OffPtr [o1] (Addr {x} _)) (OffPtr [o2] (Addr {y} _)))
+ // result: (ConstBool [x != y || o1 != o2])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpOffPtr {
if v_0_0.Op != OpAddr {
continue
}
- a := auxToSym(v_0_0.Aux)
+ x := auxToSym(v_0_0.Aux)
if v_1.Op != OpOffPtr {
continue
}
if v_1_0.Op != OpAddr {
continue
}
- b := auxToSym(v_1_0.Aux)
+ y := auxToSym(v_1_0.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a != b || o1 != o2)
+ v.AuxInt = boolToAuxInt(x != y || o1 != o2)
return true
}
break
}
- // match: (NeqPtr (LocalAddr {a} _ _) (LocalAddr {b} _ _))
- // result: (ConstBool [a != b])
+ // match: (NeqPtr (LocalAddr {x} _ _) (LocalAddr {y} _ _))
+ // result: (ConstBool [x != y])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpLocalAddr {
continue
}
- a := auxToSym(v_0.Aux)
+ x := auxToSym(v_0.Aux)
if v_1.Op != OpLocalAddr {
continue
}
- b := auxToSym(v_1.Aux)
+ y := auxToSym(v_1.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a != b)
+ v.AuxInt = boolToAuxInt(x != y)
return true
}
break
}
- // match: (NeqPtr (LocalAddr {a} _ _) (OffPtr [o] (LocalAddr {b} _ _)))
- // result: (ConstBool [a != b || o != 0])
+ // match: (NeqPtr (LocalAddr {x} _ _) (OffPtr [o] (LocalAddr {y} _ _)))
+ // result: (ConstBool [x != y || o != 0])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpLocalAddr {
continue
}
- a := auxToSym(v_0.Aux)
+ x := auxToSym(v_0.Aux)
if v_1.Op != OpOffPtr {
continue
}
if v_1_0.Op != OpLocalAddr {
continue
}
- b := auxToSym(v_1_0.Aux)
+ y := auxToSym(v_1_0.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a != b || o != 0)
+ v.AuxInt = boolToAuxInt(x != y || o != 0)
return true
}
break
}
- // match: (NeqPtr (OffPtr [o1] (LocalAddr {a} _ _)) (OffPtr [o2] (LocalAddr {b} _ _)))
- // result: (ConstBool [a != b || o1 != o2])
+ // match: (NeqPtr (OffPtr [o1] (LocalAddr {x} _ _)) (OffPtr [o2] (LocalAddr {y} _ _)))
+ // result: (ConstBool [x != y || o1 != o2])
for {
for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
if v_0.Op != OpOffPtr {
if v_0_0.Op != OpLocalAddr {
continue
}
- a := auxToSym(v_0_0.Aux)
+ x := auxToSym(v_0_0.Aux)
if v_1.Op != OpOffPtr {
continue
}
if v_1_0.Op != OpLocalAddr {
continue
}
- b := auxToSym(v_1_0.Aux)
+ y := auxToSym(v_1_0.Aux)
v.reset(OpConstBool)
- v.AuxInt = boolToAuxInt(a != b || o1 != o2)
+ v.AuxInt = boolToAuxInt(x != y || o1 != o2)
return true
}
break
}
func rewriteValuegeneric_OpOffPtr(v *Value) bool {
v_0 := v.Args[0]
- // match: (OffPtr (OffPtr p [b]) [a])
- // result: (OffPtr p [a+b])
+ // match: (OffPtr (OffPtr p [y]) [x])
+ // result: (OffPtr p [x+y])
for {
- a := auxIntToInt64(v.AuxInt)
+ x := auxIntToInt64(v.AuxInt)
if v_0.Op != OpOffPtr {
break
}
- b := auxIntToInt64(v_0.AuxInt)
+ y := auxIntToInt64(v_0.AuxInt)
p := v_0.Args[0]
v.reset(OpOffPtr)
- v.AuxInt = int64ToAuxInt(a + b)
+ v.AuxInt = int64ToAuxInt(x + y)
v.AddArg(p)
return true
}
v_0 := v.Args[0]
b := v.Block
config := b.Func.Config
- // match: (SelectN [0] (MakeResult a ___))
- // result: a
+ // match: (SelectN [0] (MakeResult x ___))
+ // result: x
for {
if auxIntToInt64(v.AuxInt) != 0 || v_0.Op != OpMakeResult || len(v_0.Args) < 1 {
break
}
- a := v_0.Args[0]
- v.copyOf(a)
+ x := v_0.Args[0]
+ v.copyOf(x)
return true
}
- // match: (SelectN [1] (MakeResult a b ___))
- // result: b
+ // match: (SelectN [1] (MakeResult x y ___))
+ // result: y
for {
if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpMakeResult || len(v_0.Args) < 2 {
break
}
- b := v_0.Args[1]
- v.copyOf(b)
+ y := v_0.Args[1]
+ v.copyOf(y)
return true
}
- // match: (SelectN [2] (MakeResult a b c ___))
- // result: c
+ // match: (SelectN [2] (MakeResult x y z ___))
+ // result: z
for {
if auxIntToInt64(v.AuxInt) != 2 || v_0.Op != OpMakeResult || len(v_0.Args) < 3 {
break
}
- c := v_0.Args[2]
- v.copyOf(c)
+ z := v_0.Args[2]
+ v.copyOf(z)
return true
}
// match: (SelectN [0] call:(StaticCall {sym} s1:(Store _ (Const64 [sz]) s2:(Store _ src s3:(Store {t} _ dst mem)))))