[dev.regabi] cmd/compile: cleanup preparing for concrete types, 2

Avoid using the same variable for two different concrete
Node types in other files (beyond walk). This will smooth the
introduction of specific constructors, replacing ir.Nod and friends.

Passes buildall w/ toolstash -cmp.

Replay of CL 275885, lost to the bad-merge history rewrite.

Change-Id: I0da89502a0bd636b8766f01b6f843c7821b3e9ab
Reviewed-on: https://go-review.googlesource.com/c/go/+/277955
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Russ Cox 2020-12-07 14:56:49 -05:00
parent fa06894b36
commit 5ae70b85c6
11 changed files with 126 additions and 191 deletions

View file

@ -819,12 +819,12 @@ func eqstring(s, t ir.Node) (eqlen, eqmem ir.Node) {
fn = substArgTypes(fn, types.Types[types.TUINT8], types.Types[types.TUINT8])
call := ir.Nod(ir.OCALL, fn, nil)
call.PtrList().Append(sptr, tptr, ir.Copy(slen))
call = typecheck(call, ctxExpr|ctxMultiOK)
call1 := typecheck(call, ctxExpr|ctxMultiOK)
cmp := ir.Nod(ir.OEQ, slen, tlen)
cmp = typecheck(cmp, ctxExpr)
cmp1 := typecheck(cmp, ctxExpr)
cmp.SetType(types.Types[types.TBOOL])
return cmp, call
return cmp1, call1
}
// eqinterface returns the nodes
@ -857,21 +857,19 @@ func eqinterface(s, t ir.Node) (eqtab, eqdata ir.Node) {
call := ir.Nod(ir.OCALL, fn, nil)
call.PtrList().Append(stab, sdata, tdata)
call = typecheck(call, ctxExpr|ctxMultiOK)
call1 := typecheck(call, ctxExpr|ctxMultiOK)
cmp := ir.Nod(ir.OEQ, stab, ttab)
cmp = typecheck(cmp, ctxExpr)
cmp.SetType(types.Types[types.TBOOL])
return cmp, call
cmp1 := typecheck(cmp, ctxExpr)
cmp1.SetType(types.Types[types.TBOOL])
return cmp1, call1
}
// eqmem returns the node
// memequal(&p.field, &q.field [, size])
func eqmem(p ir.Node, q ir.Node, field *types.Sym, size int64) ir.Node {
nx := nodAddr(nodSym(ir.OXDOT, p, field))
ny := nodAddr(nodSym(ir.OXDOT, q, field))
nx = typecheck(nx, ctxExpr)
ny = typecheck(ny, ctxExpr)
nx := typecheck(nodAddr(nodSym(ir.OXDOT, p, field)), ctxExpr)
ny := typecheck(nodAddr(nodSym(ir.OXDOT, q, field)), ctxExpr)
fn, needsize := eqmemfunc(size, nx.Type().Elem())
call := ir.Nod(ir.OCALL, fn, nil)