Commit 073d248b authored by Dave Cheney's avatar Dave Cheney

cmd/compile/internal/gc: make Nod private

Follow up to CL 29134. Generated with gofmt -r 'Nod -> nod', plus
three manual adjustments to the comments in syntax/parser.go

Change-Id: I02920f7ab10c70b6e850457b42d5fe35f1f3821a
Reviewed-on: https://go-review.googlesource.com/29136Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent bb12894d
......@@ -191,20 +191,20 @@ func genhash(sym *Sym, t *Type) {
markdcl()
// func sym(p *T, h uintptr) uintptr
fn := Nod(ODCLFUNC, nil, nil)
fn := nod(ODCLFUNC, nil, nil)
fn.Func.Nname = newname(sym)
fn.Func.Nname.Class = PFUNC
tfn := Nod(OTFUNC, nil, nil)
tfn := nod(OTFUNC, nil, nil)
fn.Func.Nname.Name.Param.Ntype = tfn
n := Nod(ODCLFIELD, newname(lookup("p")), typenod(ptrto(t)))
n := nod(ODCLFIELD, newname(lookup("p")), typenod(ptrto(t)))
tfn.List.Append(n)
np := n.Left
n = Nod(ODCLFIELD, newname(lookup("h")), typenod(Types[TUINTPTR]))
n = nod(ODCLFIELD, newname(lookup("h")), typenod(Types[TUINTPTR]))
tfn.List.Append(n)
nh := n.Left
n = Nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])) // return value
n = nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])) // return value
tfn.Rlist.Append(n)
funchdr(fn)
......@@ -223,7 +223,7 @@ func genhash(sym *Sym, t *Type) {
// pure memory.
hashel := hashfor(t.Elem())
n := Nod(ORANGE, nil, Nod(OIND, np, nil))
n := nod(ORANGE, nil, nod(OIND, np, nil))
ni := newname(lookup("i"))
ni.Type = Types[TINT]
n.List.Set1(ni)
......@@ -232,15 +232,15 @@ func genhash(sym *Sym, t *Type) {
ni = n.List.First()
// h = hashel(&p[i], h)
call := Nod(OCALL, hashel, nil)
call := nod(OCALL, hashel, nil)
nx := Nod(OINDEX, np, ni)
nx := nod(OINDEX, np, ni)
nx.Bounded = true
na := Nod(OADDR, nx, nil)
na := nod(OADDR, nx, nil)
na.Etype = 1 // no escape to heap
call.List.Append(na)
call.List.Append(nh)
n.Nbody.Append(Nod(OAS, nh, call))
n.Nbody.Append(nod(OAS, nh, call))
fn.Nbody.Append(n)
......@@ -259,13 +259,13 @@ func genhash(sym *Sym, t *Type) {
// Hash non-memory fields with appropriate hash function.
if !f.Type.IsRegularMemory() {
hashel := hashfor(f.Type)
call := Nod(OCALL, hashel, nil)
call := nod(OCALL, hashel, nil)
nx := nodSym(OXDOT, np, f.Sym) // TODO: fields from other packages?
na := Nod(OADDR, nx, nil)
na := nod(OADDR, nx, nil)
na.Etype = 1 // no escape to heap
call.List.Append(na)
call.List.Append(nh)
fn.Nbody.Append(Nod(OAS, nh, call))
fn.Nbody.Append(nod(OAS, nh, call))
i++
continue
}
......@@ -275,20 +275,20 @@ func genhash(sym *Sym, t *Type) {
// h = hashel(&p.first, size, h)
hashel := hashmem(f.Type)
call := Nod(OCALL, hashel, nil)
call := nod(OCALL, hashel, nil)
nx := nodSym(OXDOT, np, f.Sym) // TODO: fields from other packages?
na := Nod(OADDR, nx, nil)
na := nod(OADDR, nx, nil)
na.Etype = 1 // no escape to heap
call.List.Append(na)
call.List.Append(nh)
call.List.Append(nodintconst(size))
fn.Nbody.Append(Nod(OAS, nh, call))
fn.Nbody.Append(nod(OAS, nh, call))
i = next
}
}
r := Nod(ORETURN, nil, nil)
r := nod(ORETURN, nil, nil)
r.List.Append(nh)
fn.Nbody.Append(r)
......@@ -346,10 +346,10 @@ func hashfor(t *Type) *Node {
n := newname(sym)
n.Class = PFUNC
tfn := Nod(OTFUNC, nil, nil)
tfn.List.Append(Nod(ODCLFIELD, nil, typenod(ptrto(t))))
tfn.List.Append(Nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
tfn.Rlist.Append(Nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
tfn := nod(OTFUNC, nil, nil)
tfn.List.Append(nod(ODCLFIELD, nil, typenod(ptrto(t))))
tfn.List.Append(nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
tfn.Rlist.Append(nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
tfn = typecheck(tfn, Etype)
n.Type = tfn.Type
return n
......@@ -367,20 +367,20 @@ func geneq(sym *Sym, t *Type) {
markdcl()
// func sym(p, q *T) bool
fn := Nod(ODCLFUNC, nil, nil)
fn := nod(ODCLFUNC, nil, nil)
fn.Func.Nname = newname(sym)
fn.Func.Nname.Class = PFUNC
tfn := Nod(OTFUNC, nil, nil)
tfn := nod(OTFUNC, nil, nil)
fn.Func.Nname.Name.Param.Ntype = tfn
n := Nod(ODCLFIELD, newname(lookup("p")), typenod(ptrto(t)))
n := nod(ODCLFIELD, newname(lookup("p")), typenod(ptrto(t)))
tfn.List.Append(n)
np := n.Left
n = Nod(ODCLFIELD, newname(lookup("q")), typenod(ptrto(t)))
n = nod(ODCLFIELD, newname(lookup("q")), typenod(ptrto(t)))
tfn.List.Append(n)
nq := n.Left
n = Nod(ODCLFIELD, nil, typenod(Types[TBOOL]))
n = nod(ODCLFIELD, nil, typenod(Types[TBOOL]))
tfn.Rlist.Append(n)
funchdr(fn)
......@@ -399,7 +399,7 @@ func geneq(sym *Sym, t *Type) {
// pure memory. Even if we unrolled the range loop,
// each iteration would be a function call, so don't bother
// unrolling.
nrange := Nod(ORANGE, nil, Nod(OIND, np, nil))
nrange := nod(ORANGE, nil, nod(OIND, np, nil))
ni := newname(lookup("i"))
ni.Type = Types[TINT]
......@@ -409,22 +409,22 @@ func geneq(sym *Sym, t *Type) {
ni = nrange.List.First()
// if p[i] != q[i] { return false }
nx := Nod(OINDEX, np, ni)
nx := nod(OINDEX, np, ni)
nx.Bounded = true
ny := Nod(OINDEX, nq, ni)
ny := nod(OINDEX, nq, ni)
ny.Bounded = true
nif := Nod(OIF, nil, nil)
nif.Left = Nod(ONE, nx, ny)
r := Nod(ORETURN, nil, nil)
nif := nod(OIF, nil, nil)
nif.Left = nod(ONE, nx, ny)
r := nod(ORETURN, nil, nil)
r.List.Append(nodbool(false))
nif.Nbody.Append(r)
nrange.Nbody.Append(nif)
fn.Nbody.Append(nrange)
// return true
ret := Nod(ORETURN, nil, nil)
ret := nod(ORETURN, nil, nil)
ret.List.Append(nodbool(true))
fn.Nbody.Append(ret)
......@@ -435,7 +435,7 @@ func geneq(sym *Sym, t *Type) {
cond = n
return
}
cond = Nod(OANDAND, cond, n)
cond = nod(OANDAND, cond, n)
}
// Walk the struct using memequal for runs of AMEM
......@@ -477,7 +477,7 @@ func geneq(sym *Sym, t *Type) {
cond = nodbool(true)
}
ret := Nod(ORETURN, nil, nil)
ret := nod(ORETURN, nil, nil)
ret.List.Append(cond)
fn.Nbody.Append(ret)
}
......@@ -520,22 +520,22 @@ func geneq(sym *Sym, t *Type) {
func eqfield(p *Node, q *Node, field *Sym) *Node {
nx := nodSym(OXDOT, p, field)
ny := nodSym(OXDOT, q, field)
ne := Nod(OEQ, nx, ny)
ne := nod(OEQ, nx, ny)
return ne
}
// eqmem returns the node
// memequal(&p.field, &q.field [, size])
func eqmem(p *Node, q *Node, field *Sym, size int64) *Node {
nx := Nod(OADDR, nodSym(OXDOT, p, field), nil)
nx := nod(OADDR, nodSym(OXDOT, p, field), nil)
nx.Etype = 1 // does not escape
ny := Nod(OADDR, nodSym(OXDOT, q, field), nil)
ny := nod(OADDR, nodSym(OXDOT, q, field), nil)
ny.Etype = 1 // does not escape
nx = typecheck(nx, Erv)
ny = typecheck(ny, Erv)
fn, needsize := eqmemfunc(size, nx.Type.Elem())
call := Nod(OCALL, fn, nil)
call := nod(OCALL, fn, nil)
call.List.Append(nx)
call.List.Append(ny)
if needsize {
......
......@@ -187,7 +187,7 @@ func Import(in *bufio.Reader) {
// (not doing so can cause significant performance
// degradation due to unnecessary calls to empty
// functions).
body = []*Node{Nod(OEMPTY, nil, nil)}
body = []*Node{nod(OEMPTY, nil, nil)}
}
f.Func.Inl.Set(body)
funcbody(f)
......@@ -391,9 +391,9 @@ func (p *importer) newtyp(etype EType) *Type {
// importtype declares that pt, an imported named type, has underlying type t.
func (p *importer) importtype(pt, t *Type) {
if pt.Etype == TFORW {
n := pt.Nod
copytype(pt.Nod, t)
pt.Nod = n // unzero nod
n := pt.nod
copytype(pt.nod, t)
pt.nod = n // unzero nod
pt.Sym.Importdef = importpkg
pt.Sym.Lastlineno = lineno
declare(n, PEXTERN)
......@@ -574,7 +574,7 @@ func (p *importer) field() *Node {
var n *Node
if sym.Name != "" {
n = Nod(ODCLFIELD, newname(sym), typenod(typ))
n = nod(ODCLFIELD, newname(sym), typenod(typ))
} else {
// anonymous field - typ must be T or *T and T must be a type name
s := typ.Sym
......@@ -610,7 +610,7 @@ func (p *importer) method() *Node {
sym := p.fieldName()
params := p.paramList()
result := p.paramList()
return Nod(ODCLFIELD, newname(sym), typenod(functype(fakethis(), params, result)))
return nod(ODCLFIELD, newname(sym), typenod(functype(fakethis(), params, result)))
}
// parser.go:sym,hidden_importsym
......@@ -662,7 +662,7 @@ func (p *importer) param(named bool) *Node {
isddd = true
}
n := Nod(ODCLFIELD, nil, typenod(typ))
n := nod(ODCLFIELD, nil, typenod(typ))
n.Isddd = isddd
if named {
......@@ -804,7 +804,7 @@ func (p *importer) elemList() []*Node {
c := p.int()
list := make([]*Node, c)
for i := range list {
list[i] = Nod(OKEY, mkname(p.fieldSym()), p.expr())
list[i] = nod(OKEY, mkname(p.fieldSym()), p.expr())
}
return list
}
......@@ -839,11 +839,11 @@ func (p *importer) node() *Node {
// again. Re-introduce explicit uintptr(c) conversion.
// (issue 16317).
if typ.IsUnsafePtr() {
conv := Nod(OCALL, typenod(Types[TUINTPTR]), nil)
conv := nod(OCALL, typenod(Types[TUINTPTR]), nil)
conv.List.Set1(n)
n = conv
}
conv := Nod(OCALL, typenod(typ), nil)
conv := nod(OCALL, typenod(typ), nil)
conv.List.Set1(n)
n = conv
}
......@@ -872,16 +872,16 @@ func (p *importer) node() *Node {
if !p.bool() /* !implicit, i.e. '&' operator */ {
if n.Op == OCOMPLIT {
// Special case for &T{...}: turn into (*T){...}.
n.Right = Nod(OIND, n.Right, nil)
n.Right = nod(OIND, n.Right, nil)
n.Right.Implicit = true
} else {
n = Nod(OADDR, n, nil)
n = nod(OADDR, n, nil)
}
}
return n
case OSTRUCTLIT:
n := Nod(OCOMPLIT, nil, typenod(p.typ()))
n := nod(OCOMPLIT, nil, typenod(p.typ()))
n.List.Set(p.elemList()) // special handling of field names
return n
......@@ -889,13 +889,13 @@ func (p *importer) node() *Node {
// unreachable - mapped to case OCOMPLIT below by exporter
case OCOMPLIT:
n := Nod(OCOMPLIT, nil, typenod(p.typ()))
n := nod(OCOMPLIT, nil, typenod(p.typ()))
n.List.Set(p.exprList())
return n
case OKEY:
left, right := p.exprsOrNil()
return Nod(OKEY, left, right)
return nod(OKEY, left, right)
// case OCALLPART:
// unimplemented
......@@ -911,7 +911,7 @@ func (p *importer) node() *Node {
// unreachable - mapped to case ODOTTYPE below by exporter
case ODOTTYPE:
n := Nod(ODOTTYPE, p.expr(), nil)
n := nod(ODOTTYPE, p.expr(), nil)
if p.bool() {
n.Right = p.expr()
} else {
......@@ -923,10 +923,10 @@ func (p *importer) node() *Node {
// unreachable - mapped to cases below by exporter
case OINDEX:
return Nod(op, p.expr(), p.expr())
return nod(op, p.expr(), p.expr())
case OSLICE, OSLICE3:
n := Nod(op, p.expr(), nil)
n := nod(op, p.expr(), nil)
low, high := p.exprsOrNil()
var max *Node
if n.Op.IsSlice3() {
......@@ -939,7 +939,7 @@ func (p *importer) node() *Node {
// unreachable - mapped to OCONV case below by exporter
case OCONV:
n := Nod(OCALL, typenod(p.typ()), nil)
n := nod(OCALL, typenod(p.typ()), nil)
n.List.Set(p.exprList())
return n
......@@ -955,7 +955,7 @@ func (p *importer) node() *Node {
// unreachable - mapped to OCALL case below by exporter
case OCALL:
n := Nod(OCALL, p.expr(), nil)
n := nod(OCALL, p.expr(), nil)
n.List.Set(p.exprList())
n.Isddd = p.bool()
return n
......@@ -968,18 +968,18 @@ func (p *importer) node() *Node {
// unary expressions
case OPLUS, OMINUS, OADDR, OCOM, OIND, ONOT, ORECV:
return Nod(op, p.expr(), nil)
return nod(op, p.expr(), nil)
// binary expressions
case OADD, OAND, OANDAND, OANDNOT, ODIV, OEQ, OGE, OGT, OLE, OLT,
OLSH, OMOD, OMUL, ONE, OOR, OOROR, ORSH, OSEND, OSUB, OXOR:
return Nod(op, p.expr(), p.expr())
return nod(op, p.expr(), p.expr())
case OADDSTR:
list := p.exprList()
x := list[0]
for _, y := range list[1:] {
x = Nod(OADD, x, y)
x = nod(OADD, x, y)
}
return x
......@@ -988,7 +988,7 @@ func (p *importer) node() *Node {
case ODCLCONST:
// TODO(gri) these should not be exported in the first place
return Nod(OEMPTY, nil, nil)
return nod(OEMPTY, nil, nil)
// --------------------------------------------------------------------
// statements
......@@ -1009,10 +1009,10 @@ func (p *importer) node() *Node {
// unreachable - mapped to OAS case below by exporter
case OAS:
return Nod(OAS, p.expr(), p.expr())
return nod(OAS, p.expr(), p.expr())
case OASOP:
n := Nod(OASOP, nil, nil)
n := nod(OASOP, nil, nil)
n.Etype = EType(p.int())
n.Left = p.expr()
if !p.bool() {
......@@ -1027,13 +1027,13 @@ func (p *importer) node() *Node {
// unreachable - mapped to OAS2 case below by exporter
case OAS2:
n := Nod(OAS2, nil, nil)
n := nod(OAS2, nil, nil)
n.List.Set(p.exprList())
n.Rlist.Set(p.exprList())
return n
case ORETURN:
n := Nod(ORETURN, nil, nil)
n := nod(ORETURN, nil, nil)
n.List.Set(p.exprList())
return n
......@@ -1041,11 +1041,11 @@ func (p *importer) node() *Node {
// unreachable - generated by compiler for trampolin routines (not exported)
case OPROC, ODEFER:
return Nod(op, p.expr(), nil)
return nod(op, p.expr(), nil)
case OIF:
markdcl()
n := Nod(OIF, nil, nil)
n := nod(OIF, nil, nil)
n.Ninit.Set(p.stmtList())
n.Left = p.expr()
n.Nbody.Set(p.stmtList())
......@@ -1055,7 +1055,7 @@ func (p *importer) node() *Node {
case OFOR:
markdcl()
n := Nod(OFOR, nil, nil)
n := nod(OFOR, nil, nil)
n.Ninit.Set(p.stmtList())
n.Left, n.Right = p.exprsOrNil()
n.Nbody.Set(p.stmtList())
......@@ -1064,7 +1064,7 @@ func (p *importer) node() *Node {
case ORANGE:
markdcl()
n := Nod(ORANGE, nil, nil)
n := nod(ORANGE, nil, nil)
n.List.Set(p.stmtList())
n.Right = p.expr()
n.Nbody.Set(p.stmtList())
......@@ -1073,7 +1073,7 @@ func (p *importer) node() *Node {
case OSELECT, OSWITCH:
markdcl()
n := Nod(op, nil, nil)
n := nod(op, nil, nil)
n.Ninit.Set(p.stmtList())
n.Left, _ = p.exprsOrNil()
n.List.Set(p.stmtList())
......@@ -1085,7 +1085,7 @@ func (p *importer) node() *Node {
case OXCASE:
markdcl()
n := Nod(OXCASE, nil, nil)
n := nod(OXCASE, nil, nil)
n.Xoffset = int64(block)
n.List.Set(p.exprList())
// TODO(gri) eventually we must declare variables for type switch
......@@ -1098,7 +1098,7 @@ func (p *importer) node() *Node {
// unreachable - mapped to OXFALL case below by exporter
case OXFALL:
n := Nod(OXFALL, nil, nil)
n := nod(OXFALL, nil, nil)
n.Xoffset = int64(block)
return n
......@@ -1107,13 +1107,13 @@ func (p *importer) node() *Node {
if left != nil {
left = newname(left.Sym)
}
return Nod(op, left, nil)
return nod(op, left, nil)
// case OEMPTY:
// unreachable - not emitted by exporter
case OGOTO, OLABEL:
n := Nod(op, newname(p.expr().Sym), nil)
n := nod(op, newname(p.expr().Sym), nil)
n.Sym = dclstack // context, for goto restrictions
return n
......@@ -1128,7 +1128,7 @@ func (p *importer) node() *Node {
}
func builtinCall(op Op) *Node {
return Nod(OCALL, mkname(builtinpkg.Lookup(goopnames[op])), nil)
return nod(OCALL, mkname(builtinpkg.Lookup(goopnames[op])), nil)
}
func (p *importer) exprsOrNil() (a, b *Node) {
......
......@@ -10,7 +10,7 @@ import (
// function literals aka closures
func closurehdr(ntype *Node) {
n := Nod(OCLOSURE, nil, nil)
n := nod(OCLOSURE, nil, nil)
n.Func.Ntype = ntype
n.Func.Depth = funcdepth
n.Func.Outerfunc = Curfn
......@@ -32,7 +32,7 @@ func closurehdr(ntype *Node) {
if name != nil {
name = newname(name.Sym)
}
a := Nod(ODCLFIELD, name, n1.Right)
a := nod(ODCLFIELD, name, n1.Right)
a.Isddd = n1.Isddd
if name != nil {
name.Isddd = a.Isddd
......@@ -44,13 +44,13 @@ func closurehdr(ntype *Node) {
if name != nil {
name = newname(name.Sym)
}
ntype.Rlist.Append(Nod(ODCLFIELD, name, n2.Right))
ntype.Rlist.Append(nod(ODCLFIELD, name, n2.Right))
}
}
func closurebody(body []*Node) *Node {
if len(body) == 0 {
body = []*Node{Nod(OEMPTY, nil, nil)}
body = []*Node{nod(OEMPTY, nil, nil)}
}
func_ := Curfn
......@@ -202,13 +202,13 @@ func closurename(n *Node) *Sym {
func makeclosure(func_ *Node) *Node {
// wrap body in external function
// that begins by reading closure parameters.
xtype := Nod(OTFUNC, nil, nil)
xtype := nod(OTFUNC, nil, nil)
xtype.List.Set(func_.List.Slice())
xtype.Rlist.Set(func_.Rlist.Slice())
// create the function
xfunc := Nod(ODCLFUNC, nil, nil)
xfunc := nod(ODCLFUNC, nil, nil)
xfunc.Func.Nname = newfuncname(closurename(func_))
xfunc.Func.Nname.Sym.Flags |= SymExported // disable export
......@@ -274,7 +274,7 @@ func capturevars(xfunc *Node) {
v.Name.Byval = true
} else {
outermost.Addrtaken = true
outer = Nod(OADDR, outer, nil)
outer = nod(OADDR, outer, nil)
}
if Debug['m'] > 1 {
......@@ -378,7 +378,7 @@ func transformclosure(xfunc *Node) {
}
// cv refers to the field inside of closure OSTRUCTLIT.
cv := Nod(OCLOSUREVAR, nil, nil)
cv := nod(OCLOSUREVAR, nil, nil)
cv.Type = v.Type
if !v.Name.Byval {
......@@ -393,21 +393,21 @@ func transformclosure(xfunc *Node) {
v.Class = PAUTO
v.Ullman = 1
xfunc.Func.Dcl = append(xfunc.Func.Dcl, v)
body = append(body, Nod(OAS, v, cv))
body = append(body, nod(OAS, v, cv))
} else {
// Declare variable holding addresses taken from closure
// and initialize in entry prologue.
addr := newname(lookupf("&%s", v.Sym.Name))
addr.Name.Param.Ntype = Nod(OIND, typenod(v.Type), nil)
addr.Name.Param.Ntype = nod(OIND, typenod(v.Type), nil)
addr.Class = PAUTO
addr.Used = true
addr.Name.Curfn = xfunc
xfunc.Func.Dcl = append(xfunc.Func.Dcl, addr)
v.Name.Heapaddr = addr
if v.Name.Byval {
cv = Nod(OADDR, cv, nil)
cv = nod(OADDR, cv, nil)
}
body = append(body, Nod(OAS, addr, cv))
body = append(body, nod(OAS, addr, cv))
}
}
......@@ -474,27 +474,27 @@ func walkclosure(func_ *Node, init *Nodes) *Node {
// the struct is unnamed so that closures in multiple packages with the
// same struct type can share the descriptor.
typ := Nod(OTSTRUCT, nil, nil)
typ := nod(OTSTRUCT, nil, nil)
typ.List.Set1(Nod(ODCLFIELD, newname(lookup(".F")), typenod(Types[TUINTPTR])))
typ.List.Set1(nod(ODCLFIELD, newname(lookup(".F")), typenod(Types[TUINTPTR])))
for _, v := range func_.Func.Cvars.Slice() {
if v.Op == OXXX {
continue
}
typ1 := typenod(v.Type)
if !v.Name.Byval {
typ1 = Nod(OIND, typ1, nil)
typ1 = nod(OIND, typ1, nil)
}
typ.List.Append(Nod(ODCLFIELD, newname(v.Sym), typ1))
typ.List.Append(nod(ODCLFIELD, newname(v.Sym), typ1))
}
clos := Nod(OCOMPLIT, nil, Nod(OIND, typ, nil))
clos := nod(OCOMPLIT, nil, nod(OIND, typ, nil))
clos.Esc = func_.Esc
clos.Right.Implicit = true
clos.List.Set(append([]*Node{Nod(OCFUNC, func_.Func.Closure.Func.Nname, nil)}, func_.Func.Enter.Slice()...))
clos.List.Set(append([]*Node{nod(OCFUNC, func_.Func.Closure.Func.Nname, nil)}, func_.Func.Enter.Slice()...))
// Force type conversion from *struct to the func type.
clos = Nod(OCONVNOP, clos, nil)
clos = nod(OCONVNOP, clos, nil)
clos.Type = func_.Type
......@@ -573,18 +573,18 @@ func makepartialcall(fn *Node, t0 *Type, meth *Sym) *Node {
savecurfn := Curfn
Curfn = nil
xtype := Nod(OTFUNC, nil, nil)
xtype := nod(OTFUNC, nil, nil)
var l []*Node
var callargs []*Node
ddd := false
xfunc := Nod(ODCLFUNC, nil, nil)
xfunc := nod(ODCLFUNC, nil, nil)
Curfn = xfunc
for i, t := range t0.Params().Fields().Slice() {
n := newname(lookupN("a", i))
n.Class = PPARAM
xfunc.Func.Dcl = append(xfunc.Func.Dcl, n)
callargs = append(callargs, n)
fld := Nod(ODCLFIELD, n, typenod(t.Type))
fld := nod(ODCLFIELD, n, typenod(t.Type))
if t.Isddd {
fld.Isddd = true
ddd = true
......@@ -601,7 +601,7 @@ func makepartialcall(fn *Node, t0 *Type, meth *Sym) *Node {
n.Class = PPARAMOUT
xfunc.Func.Dcl = append(xfunc.Func.Dcl, n)
retargs = append(retargs, n)
l = append(l, Nod(ODCLFIELD, n, typenod(t.Type)))
l = append(l, nod(ODCLFIELD, n, typenod(t.Type)))
}
xtype.Rlist.Set(l)
......@@ -616,13 +616,13 @@ func makepartialcall(fn *Node, t0 *Type, meth *Sym) *Node {
// Declare and initialize variable holding receiver.
xfunc.Func.Needctxt = true
cv := Nod(OCLOSUREVAR, nil, nil)
cv := nod(OCLOSUREVAR, nil, nil)
cv.Xoffset = int64(Widthptr)
cv.Type = rcvrtype
if int(cv.Type.Align) > Widthptr {
cv.Xoffset = int64(cv.Type.Align)
}
ptr := Nod(ONAME, nil, nil)
ptr := nod(ONAME, nil, nil)
ptr.Sym = lookup("rcvr")
ptr.Class = PAUTO
ptr.Addable = true
......@@ -634,23 +634,23 @@ func makepartialcall(fn *Node, t0 *Type, meth *Sym) *Node {
var body []*Node
if rcvrtype.IsPtr() || rcvrtype.IsInterface() {
ptr.Name.Param.Ntype = typenod(rcvrtype)
body = append(body, Nod(OAS, ptr, cv))
body = append(body, nod(OAS, ptr, cv))
} else {
ptr.Name.Param.Ntype = typenod(ptrto(rcvrtype))
body = append(body, Nod(OAS, ptr, Nod(OADDR, cv, nil)))
body = append(body, nod(OAS, ptr, nod(OADDR, cv, nil)))
}
call := Nod(OCALL, nodSym(OXDOT, ptr, meth), nil)
call := nod(OCALL, nodSym(OXDOT, ptr, meth), nil)
call.List.Set(callargs)
call.Isddd = ddd
if t0.Results().NumFields() == 0 {
body = append(body, call)
} else {
n := Nod(OAS2, nil, nil)
n := nod(OAS2, nil, nil)
n.List.Set(retargs)
n.Rlist.Set1(call)
body = append(body, n)
n = Nod(ORETURN, nil, nil)
n = nod(ORETURN, nil, nil)
body = append(body, n)
}
......@@ -680,18 +680,18 @@ func walkpartialcall(n *Node, init *Nodes) *Node {
checknil(n.Left, init)
}
typ := Nod(OTSTRUCT, nil, nil)
typ.List.Set1(Nod(ODCLFIELD, newname(lookup("F")), typenod(Types[TUINTPTR])))
typ.List.Append(Nod(ODCLFIELD, newname(lookup("R")), typenod(n.Left.Type)))
typ := nod(OTSTRUCT, nil, nil)
typ.List.Set1(nod(ODCLFIELD, newname(lookup("F")), typenod(Types[TUINTPTR])))
typ.List.Append(nod(ODCLFIELD, newname(lookup("R")), typenod(n.Left.Type)))
clos := Nod(OCOMPLIT, nil, Nod(OIND, typ, nil))
clos := nod(OCOMPLIT, nil, nod(OIND, typ, nil))
clos.Esc = n.Esc
clos.Right.Implicit = true
clos.List.Set1(Nod(OCFUNC, n.Func.Nname, nil))
clos.List.Set1(nod(OCFUNC, n.Func.Nname, nil))
clos.List.Append(n.Left)
// Force type conversion from *struct to the func type.
clos = Nod(OCONVNOP, clos, nil)
clos = nod(OCONVNOP, clos, nil)
clos.Type = n.Type
......
......@@ -588,7 +588,7 @@ func Isconst(n *Node, ct Ctype) bool {
func saveorig(n *Node) *Node {
if n == n.Orig {
// duplicate node for n->orig.
n1 := Nod(OLITERAL, nil, nil)
n1 := nod(OLITERAL, nil, nil)
n.Orig = n1
*n1 = *n
......@@ -1227,7 +1227,7 @@ illegal:
}
func nodlit(v Val) *Node {
n := Nod(OLITERAL, nil, nil)
n := nod(OLITERAL, nil, nil)
n.SetVal(v)
switch v.Ctype() {
default:
......@@ -1254,7 +1254,7 @@ func nodcplxlit(r Val, i Val) *Node {
i = toflt(i)
c := new(Mpcplx)
n := Nod(OLITERAL, nil, nil)
n := nod(OLITERAL, nil, nil)
n.Type = Types[TIDEAL]
n.SetVal(Val{c})
......
......@@ -235,7 +235,7 @@ func variter(vl []*Node, t *Node, el []*Node) []*Node {
if len(el) == 1 && len(vl) > 1 {
e := el[0]
as2 := Nod(OAS2, nil, nil)
as2 := nod(OAS2, nil, nil)
as2.List.Set(vl)
as2.Rlist.Set1(e)
for _, v := range vl {
......@@ -244,7 +244,7 @@ func variter(vl []*Node, t *Node, el []*Node) []*Node {
v.Name.Param.Ntype = t
v.Name.Defn = as2
if funcdepth > 0 {
init = append(init, Nod(ODCL, v, nil))
init = append(init, nod(ODCL, v, nil))
}
}
......@@ -268,9 +268,9 @@ func variter(vl []*Node, t *Node, el []*Node) []*Node {
if e != nil || funcdepth > 0 || isblank(v) {
if funcdepth > 0 {
init = append(init, Nod(ODCL, v, nil))
init = append(init, nod(ODCL, v, nil))
}
e = Nod(OAS, v, e)
e = nod(OAS, v, e)
init = append(init, e)
if e.Right != nil {
v.Name.Defn = e
......@@ -317,7 +317,7 @@ func constiter(vl []*Node, t *Node, cl []*Node) []*Node {
v.Name.Param.Ntype = t
v.Name.Defn = c
vv = append(vv, Nod(ODCLCONST, v, nil))
vv = append(vv, nod(ODCLCONST, v, nil))
}
if len(clcopy) != 0 {
......@@ -333,7 +333,7 @@ func newname(s *Sym) *Node {
Fatalf("newname nil")
}
n := Nod(ONAME, nil, nil)
n := nod(ONAME, nil, nil)
n.Sym = s
n.Type = nil
n.Addable = true
......@@ -363,13 +363,13 @@ func typenod(t *Type) *Node {
// if we copied another type with *t = *u
// then t->nod might be out of date, so
// check t->nod->type too
if t.Nod == nil || t.Nod.Type != t {
t.Nod = Nod(OTYPE, nil, nil)
t.Nod.Type = t
t.Nod.Sym = t.Sym
if t.nod == nil || t.nod.Type != t {
t.nod = nod(OTYPE, nil, nil)
t.nod.Type = t
t.nod.Sym = t.Sym
}
return t.Nod
return t.nod
}
// oldname returns the Node that declares symbol s in the current scope.
......@@ -396,7 +396,7 @@ func oldname(s *Sym) *Node {
c := n.Name.Param.Innermost
if c == nil || c.Name.Funcdepth != funcdepth {
// Do not have a closure var for the active closure yet; make one.
c = Nod(ONAME, nil, nil)
c = nod(ONAME, nil, nil)
c.Sym = s
c.Class = PAUTOHEAP
c.setIsClosureVar(true)
......@@ -470,7 +470,7 @@ func colasdefn(left []*Node, defn *Node) {
n = newname(n.Sym)
declare(n, dclcontext)
n.Name.Defn = defn
defn.Ninit.Append(Nod(ODCL, n, nil))
defn.Ninit.Append(nod(ODCL, n, nil))
left[i] = n
}
......@@ -480,7 +480,7 @@ func colasdefn(left []*Node, defn *Node) {
}
func colas(left, right []*Node, lno int32) *Node {
n := Nod(OAS, nil, nil) // assume common case
n := nod(OAS, nil, nil) // assume common case
n.Colas = true
n.Lineno = lno // set before calling colasdefn for correct error line
colasdefn(left, n) // modifies left, call before using left[0] in common case
......@@ -713,7 +713,7 @@ func typedcl0(s *Sym) *Node {
func typedcl1(n *Node, t *Node, local bool) *Node {
n.Name.Param.Ntype = t
n.Local = local
return Nod(ODCLTYPE, n, nil)
return nod(ODCLTYPE, n, nil)
}
// structs, functions, and methods.
......@@ -991,13 +991,13 @@ func embedded(s *Sym, pkg *Pkg) *Node {
} else {
n = newname(Pkglookup(name, s.Pkg))
}
n = Nod(ODCLFIELD, n, oldname(s))
n = nod(ODCLFIELD, n, oldname(s))
n.Embedded = 1
return n
}
func fakethis() *Node {
n := Nod(ODCLFIELD, nil, typenod(ptrto(typ(TSTRUCT))))
n := nod(ODCLFIELD, nil, typenod(ptrto(typ(TSTRUCT))))
return n
}
......@@ -1215,7 +1215,7 @@ func addmethod(msym *Sym, t *Type, local, nointerface bool) {
}
}
n := Nod(ODCLFIELD, newname(msym), nil)
n := nod(ODCLFIELD, newname(msym), nil)
n.Type = t
for _, f := range mt.Methods().Slice() {
......
......@@ -910,7 +910,7 @@ func esc(e *EscState, n *Node, up *Node) {
}
a := v.Name.Defn
if !v.Name.Byval {
a = Nod(OADDR, a, nil)
a = nod(OADDR, a, nil)
a.Lineno = v.Lineno
e.nodeEscState(a).Escloopdepth = e.loopdepth
a = typecheck(a, Erv)
......@@ -1094,7 +1094,7 @@ func escassign(e *EscState, dst, src *Node, step *EscStep) {
case OCLOSURE:
// OCLOSURE is lowered to OPTRLIT,
// insert OADDR to account for the additional indirection.
a := Nod(OADDR, src, nil)
a := nod(OADDR, src, nil)
a.Lineno = src.Lineno
e.nodeEscState(a).Escloopdepth = e.nodeEscState(src).Escloopdepth
a.Type = ptrto(src.Type)
......@@ -1336,7 +1336,7 @@ func escassignDereference(e *EscState, dst *Node, src *Node, step *EscStep) {
// Because this is for purposes of escape accounting, not execution,
// some semantically dubious node combinations are (currently) possible.
func (e *EscState) addDereference(n *Node) *Node {
ind := Nod(OIND, n, nil)
ind := nod(OIND, n, nil)
e.nodeEscState(ind).Escloopdepth = e.nodeEscState(n).Escloopdepth
ind.Lineno = n.Lineno
t := n.Type
......@@ -1389,7 +1389,7 @@ func initEscretval(e *EscState, n *Node, fntype *Type) {
nE := e.nodeEscState(n)
nE.Escretval.Set(nil) // Suspect this is not nil for indirect calls.
for _, t := range fntype.Results().Fields().Slice() {
src := Nod(ONAME, nil, nil)
src := nod(ONAME, nil, nil)
buf := fmt.Sprintf(".out%d", i)
i++
src.Sym = lookup(buf)
......@@ -1500,7 +1500,7 @@ func esccall(e *EscState, n *Node, up *Node) {
src = lls[0]
if n2.Isddd && !n.Isddd {
// Introduce ODDDARG node to represent ... allocation.
src = Nod(ODDDARG, nil, nil)
src = nod(ODDDARG, nil, nil)
arr := typArray(n2.Type.Elem(), int64(len(lls)))
src.Type = ptrto(arr) // make pointer so it will be tracked
src.Lineno = n.Lineno
......@@ -1563,7 +1563,7 @@ func esccall(e *EscState, n *Node, up *Node) {
note = t.Note
if t.Isddd && !n.Isddd {
// Introduce ODDDARG node to represent ... allocation.
src = Nod(ODDDARG, nil, nil)
src = nod(ODDDARG, nil, nil)
src.Lineno = n.Lineno
arr := typArray(t.Type.Elem(), int64(len(lls)-i))
src.Type = ptrto(arr) // make pointer so it will be tracked
......
......@@ -130,7 +130,7 @@ func moveToHeap(n *Node) {
// Preserve a copy so we can still write code referring to the original,
// and substitute that copy into the function declaration list
// so that analyses of the local (on-stack) variables use it.
stackcopy := Nod(ONAME, nil, nil)
stackcopy := nod(ONAME, nil, nil)
stackcopy.Sym = n.Sym
stackcopy.Type = n.Type
stackcopy.Xoffset = n.Xoffset
......@@ -208,7 +208,7 @@ func tempname(nn *Node, t *Type) {
// a chance to registerizer them
s := lookupN("autotmp_", statuniqgen)
statuniqgen++
n := Nod(ONAME, nil, nil)
n := nod(ONAME, nil, nil)
n.Sym = s
s.Def = n
n.Type = t
......
......@@ -487,7 +487,7 @@ func nodarg(t interface{}, fp int) *Node {
funarg = t.StructType().Funarg
// Build fake variable name for whole arg struct.
n = Nod(ONAME, nil, nil)
n = nod(ONAME, nil, nil)
n.Sym = lookup(".args")
n.Type = t
first := t.Field(0)
......@@ -536,7 +536,7 @@ func nodarg(t interface{}, fp int) *Node {
// Build fake name for individual variable.
// This is safe because if there was a real declared name
// we'd have used it above.
n = Nod(ONAME, nil, nil)
n = nod(ONAME, nil, nil)
n.Type = t.Type
n.Sym = t.Sym
if t.Offset == BADWIDTH {
......
......@@ -107,34 +107,34 @@ func fninit(n []*Node) {
// (2)
Maxarg = 0
fn := Nod(ODCLFUNC, nil, nil)
fn := nod(ODCLFUNC, nil, nil)
initsym := lookup("init")
fn.Func.Nname = newname(initsym)
fn.Func.Nname.Name.Defn = fn
fn.Func.Nname.Name.Param.Ntype = Nod(OTFUNC, nil, nil)
fn.Func.Nname.Name.Param.Ntype = nod(OTFUNC, nil, nil)
declare(fn.Func.Nname, PFUNC)
funchdr(fn)
// (3)
a := Nod(OIF, nil, nil)
a.Left = Nod(OGT, gatevar, nodintconst(1))
a := nod(OIF, nil, nil)
a.Left = nod(OGT, gatevar, nodintconst(1))
a.Likely = 1
r = append(r, a)
// (3a)
a.Nbody.Set1(Nod(ORETURN, nil, nil))
a.Nbody.Set1(nod(ORETURN, nil, nil))
// (4)
b := Nod(OIF, nil, nil)
b.Left = Nod(OEQ, gatevar, nodintconst(1))
b := nod(OIF, nil, nil)
b.Left = nod(OEQ, gatevar, nodintconst(1))
// this actually isn't likely, but code layout is better
// like this: no JMP needed after the call.
b.Likely = 1
r = append(r, b)
// (4a)
b.Nbody.Set1(Nod(OCALL, syslook("throwinit"), nil))
b.Nbody.Set1(nod(OCALL, syslook("throwinit"), nil))
// (5)
a = Nod(OAS, gatevar, nodintconst(1))
a = nod(OAS, gatevar, nodintconst(1))
r = append(r, a)
......@@ -142,7 +142,7 @@ func fninit(n []*Node) {
for _, s := range initSyms {
if s.Def != nil && s != initsym {
// could check that it is fn of no args/returns
a = Nod(OCALL, s.Def, nil)
a = nod(OCALL, s.Def, nil)
r = append(r, a)
}
}
......@@ -157,17 +157,17 @@ func fninit(n []*Node) {
if s.Def == nil {
break
}
a = Nod(OCALL, s.Def, nil)
a = nod(OCALL, s.Def, nil)
r = append(r, a)
}
// (9)
a = Nod(OAS, gatevar, nodintconst(2))
a = nod(OAS, gatevar, nodintconst(2))
r = append(r, a)
// (10)
a = Nod(ORETURN, nil, nil)
a = nod(ORETURN, nil, nil)
r = append(r, a)
exportsym(fn.Func.Nname)
......
......@@ -592,7 +592,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
if ln.Op == ONAME {
ln.Name.Inlvar = typecheck(inlvar(ln), Erv)
if ln.Class == PPARAM || ln.Name.Param.Stackcopy != nil && ln.Name.Param.Stackcopy.Class == PPARAM {
ninit.Append(Nod(ODCL, ln.Name.Inlvar, nil))
ninit.Append(nod(ODCL, ln.Name.Inlvar, nil))
}
}
}
......@@ -610,7 +610,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
i++
}
ninit.Append(Nod(ODCL, m, nil))
ninit.Append(nod(ODCL, m, nil))
retvars = append(retvars, m)
}
......@@ -628,7 +628,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
if t == nil {
Fatalf("method call unknown receiver type: %+v", n)
}
as := Nod(OAS, tinlvar(t), n.Left.Left)
as := nod(OAS, tinlvar(t), n.Left.Left)
if as != nil {
as = typecheck(as, Etop)
ninit.Append(as)
......@@ -673,7 +673,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
}
// assign arguments to the parameters' temp names
as := Nod(OAS2, nil, nil)
as := nod(OAS2, nil, nil)
as.Rlist.Set(n.List.Slice())
li := 0
......@@ -763,15 +763,15 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
// turn the variadic args into a slice.
if variadic {
as = Nod(OAS, vararg, nil)
as = nod(OAS, vararg, nil)
if varargcount == 0 {
as.Right = nodnil()
as.Right.Type = varargtype
} else {
vararrtype := typArray(varargtype.Elem(), int64(varargcount))
as.Right = Nod(OCOMPLIT, nil, typenod(vararrtype))
as.Right = nod(OCOMPLIT, nil, typenod(vararrtype))
as.Right.List.Set(varargs)
as.Right = Nod(OSLICE, as.Right, nil)
as.Right = nod(OSLICE, as.Right, nil)
}
as = typecheck(as, Etop)
......@@ -780,7 +780,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
// zero the outparams
for _, n := range retvars {
as = Nod(OAS, n, nil)
as = nod(OAS, n, nil)
as = typecheck(as, Etop)
ninit.Append(as)
}
......@@ -797,7 +797,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
body := subst.list(fn.Func.Inl)
lab := Nod(OLABEL, retlabel, nil)
lab := nod(OLABEL, retlabel, nil)
lab.Used = true // avoid 'not used' when function doesn't have return
body = append(body, lab)
......@@ -805,7 +805,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
//dumplist("ninit post", ninit);
call := Nod(OINLCALL, nil, nil)
call := nod(OINLCALL, nil, nil)
call.Ninit.Set(ninit.Slice())
call.Nbody.Set(body)
......@@ -940,12 +940,12 @@ func (subst *inlsubst) node(n *Node) *Node {
// dump("Return before substitution", n);
case ORETURN:
m := Nod(OGOTO, subst.retlabel, nil)
m := nod(OGOTO, subst.retlabel, nil)
m.Ninit.Set(subst.list(n.Ninit))
if len(subst.retvars) != 0 && n.List.Len() != 0 {
as := Nod(OAS2, nil, nil)
as := nod(OAS2, nil, nil)
// Make a shallow copy of retvars.
// Otherwise OINLCALL.Rlist will be the same list,
......@@ -965,7 +965,7 @@ func (subst *inlsubst) node(n *Node) *Node {
return m
case OGOTO, OLABEL:
m := Nod(OXXX, nil, nil)
m := nod(OXXX, nil, nil)
*m = *n
m.Ninit.Set(nil)
p := fmt.Sprintf("%s·%d", n.Left.Sym.Name, inlgen)
......@@ -973,7 +973,7 @@ func (subst *inlsubst) node(n *Node) *Node {
return m
default:
m := Nod(OXXX, nil, nil)
m := nod(OXXX, nil, nil)
*m = *n
m.Ninit.Set(nil)
......
......@@ -405,7 +405,7 @@ func (p *noder) expr(expr syntax.Expr) *Node {
// Special case for &T{...}: turn into (*T){...}.
// TODO(mdempsky): Switch back to p.nod after we
// get rid of gcCompat.
x.Right = Nod(OIND, x.Right, nil)
x.Right = nod(OIND, x.Right, nil)
x.Right.Implicit = true
return x
}
......@@ -687,7 +687,7 @@ func (p *noder) body(body []syntax.Stmt) *Node {
l := p.bodyList(body)
if len(l) == 0 {
// TODO(mdempsky): Line number?
return Nod(OEMPTY, nil, nil)
return nod(OEMPTY, nil, nil)
}
return liststmt(l)
}
......@@ -973,7 +973,7 @@ func (p *noder) wrapname(n syntax.Node, x *Node) *Node {
}
func (p *noder) nod(orig syntax.Node, op Op, left, right *Node) *Node {
return p.setlineno(orig, Nod(op, left, right))
return p.setlineno(orig, nod(op, left, right))
}
func (p *noder) setlineno(src syntax.Node, dst *Node) *Node {
......
......@@ -62,7 +62,7 @@ func order(fn *Node) {
func ordertemp(t *Type, order *Order, clear bool) *Node {
var_ := temp(t)
if clear {
a := Nod(OAS, var_, nil)
a := nod(OAS, var_, nil)
a = typecheck(a, Etop)
order.out = append(order.out, a)
}
......@@ -85,7 +85,7 @@ func ordertemp(t *Type, order *Order, clear bool) *Node {
// to be filled in.)
func ordercopyexpr(n *Node, t *Type, order *Order, clear int) *Node {
var_ := ordertemp(t, order, clear != 0)
a := Nod(OAS, var_, n)
a := nod(OAS, var_, n)
a = typecheck(a, Etop)
order.out = append(order.out, a)
return var_
......@@ -222,11 +222,11 @@ func cleantempnopop(mark ordermarker, order *Order, out *[]*Node) {
if n.Name.Keepalive {
n.Name.Keepalive = false
n.Addrtaken = true // ensure SSA keeps the n variable
kill = Nod(OVARLIVE, n, nil)
kill = nod(OVARLIVE, n, nil)
kill = typecheck(kill, Etop)
*out = append(*out, kill)
}
kill = Nod(OVARKILL, n, nil)
kill = nod(OVARKILL, n, nil)
kill = typecheck(kill, Etop)
*out = append(*out, kill)
}
......@@ -336,7 +336,7 @@ func copyret(n *Node, order *Order) []*Node {
l2 = append(l2, tmp)
}
as := Nod(OAS2, nil, nil)
as := nod(OAS2, nil, nil)
as.List.Set(l1)
as.Rlist.Set1(n)
as = typecheck(as, Etop)
......@@ -431,7 +431,7 @@ func ordermapassign(n *Node, order *Order) {
if (n.Left.Op == OINDEXMAP || (needwritebarrier(n.Left, n.Right) && n.Left.Type.Width > int64(4*Widthptr))) && !isaddrokay(n.Right) {
m := n.Left
n.Left = ordertemp(m.Type, order, false)
a := Nod(OAS, m, n.Left)
a := nod(OAS, m, n.Left)
a = typecheck(a, Etop)
order.out = append(order.out, a)
}
......@@ -450,14 +450,14 @@ func ordermapassign(n *Node, order *Order) {
m.Right = ordercopyexpr(m.Right, m.Right.Type, order, 0)
}
n.List.SetIndex(i1, ordertemp(m.Type, order, false))
a = Nod(OAS, m, n.List.Index(i1))
a = nod(OAS, m, n.List.Index(i1))
a = typecheck(a, Etop)
post = append(post, a)
} else if instrumenting && n.Op == OAS2FUNC && !isblank(n.List.Index(i1)) {
m = n.List.Index(i1)
t := ordertemp(m.Type, order, false)
n.List.SetIndex(i1, t)
a = Nod(OAS, m, t)
a = nod(OAS, m, t)
a = typecheck(a, Etop)
post = append(post, a)
}
......@@ -530,7 +530,7 @@ func orderstmt(n *Node, order *Order) {
}
tmp1 = ordercopyexpr(tmp1, n.Left.Type, order, 0)
// TODO(marvin): Fix Node.EType type union.
n.Right = Nod(Op(n.Etype), tmp1, n.Right)
n.Right = nod(Op(n.Etype), tmp1, n.Right)
n.Right = typecheck(n.Right, Erv)
n.Right = orderexpr(n.Right, order, nil)
n.Etype = 0
......@@ -586,7 +586,7 @@ func orderstmt(n *Node, order *Order) {
order.out = append(order.out, n)
if tmp1 != nil {
r := Nod(OAS, n.List.First(), tmp1)
r := nod(OAS, n.List.First(), tmp1)
r = typecheck(r, Etop)
ordermapassign(r, order)
n.List.SetIndex(0, tmp1)
......@@ -611,7 +611,7 @@ func orderstmt(n *Node, order *Order) {
tmp1 := ordertemp(ch.Elem(), order, haspointers(ch.Elem()))
tmp2 := ordertemp(Types[TBOOL], order, false)
order.out = append(order.out, n)
r := Nod(OAS, n.List.First(), tmp1)
r := nod(OAS, n.List.First(), tmp1)
r = typecheck(r, Etop)
ordermapassign(r, order)
r = okas(n.List.Second(), tmp2)
......@@ -757,7 +757,7 @@ func orderstmt(n *Node, order *Order) {
r := n.Right
if r.Type.IsString() && r.Type != Types[TSTRING] {
r = Nod(OCONV, r, nil)
r = nod(OCONV, r, nil)
r.Type = Types[TSTRING]
r = typecheck(r, Erv)
}
......@@ -868,13 +868,13 @@ func orderstmt(n *Node, order *Order) {
tmp1 = r.Left
if r.Colas {
tmp2 = Nod(ODCL, tmp1, nil)
tmp2 = nod(ODCL, tmp1, nil)
tmp2 = typecheck(tmp2, Etop)
n2.Ninit.Append(tmp2)
}
r.Left = ordertemp(r.Right.Left.Type.Elem(), order, haspointers(r.Right.Left.Type.Elem()))
tmp2 = Nod(OAS, tmp1, r.Left)
tmp2 = nod(OAS, tmp1, r.Left)
tmp2 = typecheck(tmp2, Etop)
n2.Ninit.Append(tmp2)
}
......@@ -885,7 +885,7 @@ func orderstmt(n *Node, order *Order) {
if r.List.Len() != 0 {
tmp1 = r.List.First()
if r.Colas {
tmp2 = Nod(ODCL, tmp1, nil)
tmp2 = nod(ODCL, tmp1, nil)
tmp2 = typecheck(tmp2, Etop)
n2.Ninit.Append(tmp2)
}
......@@ -1221,5 +1221,5 @@ func okas(ok, val *Node) *Node {
if !isblank(ok) {
val = conv(val, ok.Type)
}
return Nod(OAS, ok, val)
return nod(OAS, ok, val)
}
This diff is collapsed.
......@@ -345,7 +345,7 @@ func compile(fn *Node) {
// add clearing of the output parameters
for _, t := range Curfn.Type.Results().Fields().Slice() {
if t.Nname != nil {
n := Nod(OAS, t.Nname, nil)
n := nod(OAS, t.Nname, nil)
n = typecheck(n, Etop)
Curfn.Nbody.Prepend(n)
}
......
......@@ -229,9 +229,9 @@ func instrumentnode(np **Node, init *Nodes, wr int, skip int) {
case OSPTR, OLEN, OCAP:
instrumentnode(&n.Left, init, 0, 0)
if n.Left.Type.IsMap() {
n1 := Nod(OCONVNOP, n.Left, nil)
n1 := nod(OCONVNOP, n.Left, nil)
n1.Type = ptrto(Types[TUINT8])
n1 = Nod(OIND, n1, nil)
n1 = nod(OIND, n1, nil)
n1 = typecheck(n1, Erv)
callinstr(&n1, init, 0, skip)
}
......@@ -578,7 +578,7 @@ func makeaddable(n *Node) {
}
func uintptraddr(n *Node) *Node {
r := Nod(OADDR, n, nil)
r := nod(OADDR, n, nil)
r.Bounded = true
r = conv(r, Types[TUNSAFEPTR])
r = conv(r, Types[TUINTPTR])
......@@ -586,13 +586,13 @@ func uintptraddr(n *Node) *Node {
}
func detachexpr(n *Node, init *Nodes) *Node {
addr := Nod(OADDR, n, nil)
addr := nod(OADDR, n, nil)
l := temp(ptrto(n.Type))
as := Nod(OAS, l, addr)
as := nod(OAS, l, addr)
as = typecheck(as, Etop)
as = walkexpr(as, init)
init.Append(as)
ind := Nod(OIND, l, nil)
ind := nod(OIND, l, nil)
ind = typecheck(ind, Erv)
ind = walkexpr(ind, init)
return ind
......@@ -638,7 +638,7 @@ func appendinit(np **Node, init Nodes) {
// There may be multiple refs to this node;
// introduce OCONVNOP to hold init list.
case ONAME, OLITERAL:
n = Nod(OCONVNOP, n, nil)
n = nod(OCONVNOP, n, nil)
n.Type = n.Left.Type
n.Typecheck = 1
......
......@@ -179,25 +179,25 @@ func walkrange(n *Node) {
hn := temp(Types[TINT])
var hp *Node
init = append(init, Nod(OAS, hv1, nil))
init = append(init, Nod(OAS, hn, Nod(OLEN, ha, nil)))
init = append(init, nod(OAS, hv1, nil))
init = append(init, nod(OAS, hn, nod(OLEN, ha, nil)))
if v2 != nil {
hp = temp(ptrto(n.Type.Elem()))
tmp := Nod(OINDEX, ha, nodintconst(0))
tmp := nod(OINDEX, ha, nodintconst(0))
tmp.Bounded = true
init = append(init, Nod(OAS, hp, Nod(OADDR, tmp, nil)))
init = append(init, nod(OAS, hp, nod(OADDR, tmp, nil)))
}
n.Left = Nod(OLT, hv1, hn)
n.Right = Nod(OAS, hv1, Nod(OADD, hv1, nodintconst(1)))
n.Left = nod(OLT, hv1, hn)
n.Right = nod(OAS, hv1, nod(OADD, hv1, nodintconst(1)))
if v1 == nil {
body = nil
} else if v2 == nil {
body = []*Node{Nod(OAS, v1, hv1)}
body = []*Node{nod(OAS, v1, hv1)}
} else {
a := Nod(OAS2, nil, nil)
a := nod(OAS2, nil, nil)
a.List.Set([]*Node{v1, v2})
a.Rlist.Set([]*Node{hv1, Nod(OIND, hp, nil)})
a.Rlist.Set([]*Node{hv1, nod(OIND, hp, nil)})
body = []*Node{a}
// Advance pointer as part of increment.
......@@ -208,13 +208,13 @@ func walkrange(n *Node) {
// Advancing during the increment ensures that the pointer p only points
// pass the end of the array during the final "p++; i++; if(i >= len(x)) break;",
// after which p is dead, so it cannot confuse the collector.
tmp := Nod(OADD, hp, nodintconst(t.Elem().Width))
tmp := nod(OADD, hp, nodintconst(t.Elem().Width))
tmp.Type = hp.Type
tmp.Typecheck = 1
tmp.Right.Type = Types[Tptr]
tmp.Right.Typecheck = 1
a = Nod(OAS, hp, tmp)
a = nod(OAS, hp, tmp)
a = typecheck(a, Etop)
n.Right.Ninit.Set1(a)
}
......@@ -234,23 +234,23 @@ func walkrange(n *Node) {
fn := syslook("mapiterinit")
fn = substArgTypes(fn, t.Key(), t.Val(), th)
init = append(init, mkcall1(fn, nil, nil, typename(t), ha, Nod(OADDR, hit, nil)))
n.Left = Nod(ONE, nodSym(ODOT, hit, keysym), nodnil())
init = append(init, mkcall1(fn, nil, nil, typename(t), ha, nod(OADDR, hit, nil)))
n.Left = nod(ONE, nodSym(ODOT, hit, keysym), nodnil())
fn = syslook("mapiternext")
fn = substArgTypes(fn, th)
n.Right = mkcall1(fn, nil, nil, Nod(OADDR, hit, nil))
n.Right = mkcall1(fn, nil, nil, nod(OADDR, hit, nil))
key := nodSym(ODOT, hit, keysym)
key = Nod(OIND, key, nil)
key = nod(OIND, key, nil)
if v1 == nil {
body = nil
} else if v2 == nil {
body = []*Node{Nod(OAS, v1, key)}
body = []*Node{nod(OAS, v1, key)}
} else {
val := nodSym(ODOT, hit, valsym)
val = Nod(OIND, val, nil)
a := Nod(OAS2, nil, nil)
val = nod(OIND, val, nil)
a := nod(OAS2, nil, nil)
a.List.Set([]*Node{v1, v2})
a.Rlist.Set([]*Node{key, val})
body = []*Node{a}
......@@ -265,25 +265,25 @@ func walkrange(n *Node) {
hv1 := temp(t.Elem())
hv1.Typecheck = 1
if haspointers(t.Elem()) {
init = append(init, Nod(OAS, hv1, nil))
init = append(init, nod(OAS, hv1, nil))
}
hb := temp(Types[TBOOL])
n.Left = Nod(ONE, hb, nodbool(false))
a := Nod(OAS2RECV, nil, nil)
n.Left = nod(ONE, hb, nodbool(false))
a := nod(OAS2RECV, nil, nil)
a.Typecheck = 1
a.List.Set([]*Node{hv1, hb})
a.Rlist.Set1(Nod(ORECV, ha, nil))
a.Rlist.Set1(nod(ORECV, ha, nil))
n.Left.Ninit.Set1(a)
if v1 == nil {
body = nil
} else {
body = []*Node{Nod(OAS, v1, hv1)}
body = []*Node{nod(OAS, v1, hv1)}
}
// Zero hv1. This prevents hv1 from being the sole, inaccessible
// reference to an otherwise GC-able value during the next channel receive.
// See issue 15281.
body = append(body, Nod(OAS, hv1, nil))
body = append(body, nod(OAS, hv1, nil))
case TSTRING:
// Transform string range statements like "for v1, v2 = range a" into
......@@ -308,30 +308,30 @@ func walkrange(n *Node) {
hv2 := temp(runetype)
// hv1 := 0
init = append(init, Nod(OAS, hv1, nil))
init = append(init, nod(OAS, hv1, nil))
// hv1 < len(ha)
n.Left = Nod(OLT, hv1, Nod(OLEN, ha, nil))
n.Left = nod(OLT, hv1, nod(OLEN, ha, nil))
if v1 != nil {
// v1 = hv1
body = append(body, Nod(OAS, v1, hv1))
body = append(body, nod(OAS, v1, hv1))
}
// hv2 := ha[hv1]
nind := Nod(OINDEX, ha, hv1)
nind := nod(OINDEX, ha, hv1)
nind.Bounded = true
body = append(body, Nod(OAS, hv2, conv(nind, runetype)))
body = append(body, nod(OAS, hv2, conv(nind, runetype)))
// if hv2 < utf8.RuneSelf
nif := Nod(OIF, nil, nil)
nif.Left = Nod(OLT, nind, nodintconst(utf8.RuneSelf))
nif := nod(OIF, nil, nil)
nif.Left = nod(OLT, nind, nodintconst(utf8.RuneSelf))
// hv1++
nif.Nbody.Set1(Nod(OAS, hv1, Nod(OADD, hv1, nodintconst(1))))
nif.Nbody.Set1(nod(OAS, hv1, nod(OADD, hv1, nodintconst(1))))
// } else {
eif := Nod(OAS2, nil, nil)
eif := nod(OAS2, nil, nil)
nif.Rlist.Set1(eif)
// hv2, hv1 = charntorune(ha, hv1)
......@@ -343,7 +343,7 @@ func walkrange(n *Node) {
if v2 != nil {
// v2 = hv2
body = append(body, Nod(OAS, v2, hv2))
body = append(body, nod(OAS, v2, hv2))
}
}
......@@ -403,25 +403,25 @@ func memclrrange(n, v1, v2, a *Node) bool {
n.Op = OIF
n.Nbody.Set(nil)
n.Left = Nod(ONE, Nod(OLEN, a, nil), nodintconst(0))
n.Left = nod(ONE, nod(OLEN, a, nil), nodintconst(0))
// hp = &a[0]
hp := temp(ptrto(Types[TUINT8]))
tmp := Nod(OINDEX, a, nodintconst(0))
tmp := nod(OINDEX, a, nodintconst(0))
tmp.Bounded = true
tmp = Nod(OADDR, tmp, nil)
tmp = Nod(OCONVNOP, tmp, nil)
tmp = nod(OADDR, tmp, nil)
tmp = nod(OCONVNOP, tmp, nil)
tmp.Type = ptrto(Types[TUINT8])
n.Nbody.Append(Nod(OAS, hp, tmp))
n.Nbody.Append(nod(OAS, hp, tmp))
// hn = len(a) * sizeof(elem(a))
hn := temp(Types[TUINTPTR])
tmp = Nod(OLEN, a, nil)
tmp = Nod(OMUL, tmp, nodintconst(elemsize))
tmp = nod(OLEN, a, nil)
tmp = nod(OMUL, tmp, nodintconst(elemsize))
tmp = conv(tmp, Types[TUINTPTR])
n.Nbody.Append(Nod(OAS, hn, tmp))
n.Nbody.Append(nod(OAS, hn, tmp))
// memclr(hp, hn)
fn := mkcall("memclr", nil, nil, hp, hn)
......@@ -429,7 +429,7 @@ func memclrrange(n, v1, v2, a *Node) bool {
n.Nbody.Append(fn)
// i = len(a) - 1
v1 = Nod(OAS, v1, Nod(OSUB, Nod(OLEN, a, nil), nodintconst(1)))
v1 = nod(OAS, v1, nod(OSUB, nod(OLEN, a, nil), nodintconst(1)))
n.Nbody.Append(v1)
......
......@@ -257,14 +257,14 @@ func hiter(t *Type) *Type {
func methodfunc(f *Type, receiver *Type) *Type {
var in []*Node
if receiver != nil {
d := Nod(ODCLFIELD, nil, nil)
d := nod(ODCLFIELD, nil, nil)
d.Type = receiver
in = append(in, d)
}
var d *Node
for _, t := range f.Params().Fields().Slice() {
d = Nod(ODCLFIELD, nil, nil)
d = nod(ODCLFIELD, nil, nil)
d.Type = t.Type
d.Isddd = t.Isddd
in = append(in, d)
......@@ -272,7 +272,7 @@ func methodfunc(f *Type, receiver *Type) *Type {
var out []*Node
for _, t := range f.Results().Fields().Slice() {
d = Nod(ODCLFIELD, nil, nil)
d = nod(ODCLFIELD, nil, nil)
d.Type = t.Type
out = append(out, d)
}
......@@ -971,7 +971,7 @@ func typenamesym(t *Type) *Sym {
func typename(t *Type) *Node {
s := typenamesym(t)
n := Nod(OADDR, s.Def, nil)
n := nod(OADDR, s.Def, nil)
n.Type = ptrto(s.Def.Type)
n.Addable = true
n.Ullman = 2
......@@ -994,7 +994,7 @@ func itabname(t, itype *Type) *Node {
itabs = append(itabs, itabEntry{t: t, itype: itype, sym: s})
}
n := Nod(OADDR, s.Def, nil)
n := nod(OADDR, s.Def, nil)
n.Type = ptrto(s.Def.Type)
n.Addable = true
n.Ullman = 2
......@@ -1467,7 +1467,7 @@ func dumptypestructs() {
// The latter is the type of an auto-generated wrapper.
dtypesym(ptrto(errortype))
dtypesym(functype(nil, []*Node{Nod(ODCLFIELD, nil, typenod(errortype))}, []*Node{Nod(ODCLFIELD, nil, typenod(Types[TSTRING]))}))
dtypesym(functype(nil, []*Node{nod(ODCLFIELD, nil, typenod(errortype))}, []*Node{nod(ODCLFIELD, nil, typenod(Types[TSTRING]))}))
// add paths for runtime and main, which 6l imports implicitly.
dimportpath(Runtimepkg)
......@@ -1769,7 +1769,7 @@ func zeroaddr(size int64) *Node {
x.Typecheck = 1
s.Def = x
}
z := Nod(OADDR, s.Def, nil)
z := nod(OADDR, s.Def, nil)
z.Type = ptrto(Types[TUINT8])
z.Addable = true
z.Typecheck = 1
......
......@@ -70,7 +70,7 @@ func typecheckselect(sel *Node) {
// convert <-c into OSELRECV(N, <-c)
case ORECV:
n = Nod(OSELRECV, nil, n)
n = nod(OSELRECV, nil, n)
n.Typecheck = 1
ncase.Left = n
......@@ -152,9 +152,9 @@ func walkselect(sel *Node) {
}
// if ch == nil { block() }; n;
a := Nod(OIF, nil, nil)
a := nod(OIF, nil, nil)
a.Left = Nod(OEQ, ch, nodnil())
a.Left = nod(OEQ, ch, nodnil())
var ln Nodes
ln.Set(l)
a.Nbody.Set1(mkcall("block", nil, &ln))
......@@ -179,7 +179,7 @@ func walkselect(sel *Node) {
}
switch n.Op {
case OSEND:
n.Right = Nod(OADDR, n.Right, nil)
n.Right = nod(OADDR, n.Right, nil)
n.Right = typecheck(n.Right, Erv)
case OSELRECV, OSELRECV2:
......@@ -187,14 +187,14 @@ func walkselect(sel *Node) {
n.Op = OSELRECV
}
if n.Op == OSELRECV2 {
n.List.SetIndex(0, Nod(OADDR, n.List.First(), nil))
n.List.SetIndex(0, nod(OADDR, n.List.First(), nil))
n.List.SetIndex(0, typecheck(n.List.Index(0), Erv))
}
if n.Left == nil {
n.Left = nodnil()
} else {
n.Left = Nod(OADDR, n.Left, nil)
n.Left = nod(OADDR, n.Left, nil)
n.Left = typecheck(n.Left, Erv)
}
}
......@@ -214,7 +214,7 @@ func walkselect(sel *Node) {
n := cas.Left
setlineno(n)
r := Nod(OIF, nil, nil)
r := nod(OIF, nil, nil)
r.Ninit.Set(cas.Ninit.Slice())
switch n.Op {
default:
......@@ -228,7 +228,7 @@ func walkselect(sel *Node) {
// if c != nil && selectnbrecv(&v, c) { body } else { default body }
case OSELRECV:
r = Nod(OIF, nil, nil)
r = nod(OIF, nil, nil)
r.Ninit.Set(cas.Ninit.Slice())
ch := n.Right.Left
......@@ -236,7 +236,7 @@ func walkselect(sel *Node) {
// if c != nil && selectnbrecv2(&v, c) { body } else { default body }
case OSELRECV2:
r = Nod(OIF, nil, nil)
r = nod(OIF, nil, nil)
r.Ninit.Set(cas.Ninit.Slice())
ch := n.Right.Left
......@@ -257,10 +257,10 @@ func walkselect(sel *Node) {
setlineno(sel)
selv = temp(selecttype(int32(sel.Xoffset)))
r = Nod(OAS, selv, nil)
r = nod(OAS, selv, nil)
r = typecheck(r, Etop)
init = append(init, r)
var_ = conv(conv(Nod(OADDR, selv, nil), Types[TUNSAFEPTR]), ptrto(Types[TUINT8]))
var_ = conv(conv(nod(OADDR, selv, nil), Types[TUNSAFEPTR]), ptrto(Types[TUINT8]))
r = mkcall("newselect", nil, nil, var_, nodintconst(selv.Type.Width), nodintconst(sel.Xoffset))
r = typecheck(r, Etop)
init = append(init, r)
......@@ -268,7 +268,7 @@ func walkselect(sel *Node) {
for _, cas := range sel.List.Slice() {
setlineno(cas)
n = cas.Left
r = Nod(OIF, nil, nil)
r = nod(OIF, nil, nil)
r.Ninit.Set(cas.Ninit.Slice())
cas.Ninit.Set(nil)
if n != nil {
......@@ -299,10 +299,10 @@ func walkselect(sel *Node) {
}
// selv is no longer alive after use.
r.Nbody.Append(Nod(OVARKILL, selv, nil))
r.Nbody.Append(nod(OVARKILL, selv, nil))
r.Nbody.AppendNodes(&cas.Nbody)
r.Nbody.Append(Nod(OBREAK, nil, nil))
r.Nbody.Append(nod(OBREAK, nil, nil))
init = append(init, r)
}
......@@ -323,29 +323,29 @@ func selecttype(size int32) *Type {
// TODO(dvyukov): it's possible to generate Scase only once
// and then cache; and also cache Select per size.
scase := Nod(OTSTRUCT, nil, nil)
scase.List.Append(Nod(ODCLFIELD, newname(lookup("elem")), typenod(ptrto(Types[TUINT8]))))
scase.List.Append(Nod(ODCLFIELD, newname(lookup("chan")), typenod(ptrto(Types[TUINT8]))))
scase.List.Append(Nod(ODCLFIELD, newname(lookup("pc")), typenod(Types[TUINTPTR])))
scase.List.Append(Nod(ODCLFIELD, newname(lookup("kind")), typenod(Types[TUINT16])))
scase.List.Append(Nod(ODCLFIELD, newname(lookup("so")), typenod(Types[TUINT16])))
scase.List.Append(Nod(ODCLFIELD, newname(lookup("receivedp")), typenod(ptrto(Types[TUINT8]))))
scase.List.Append(Nod(ODCLFIELD, newname(lookup("releasetime")), typenod(Types[TUINT64])))
scase := nod(OTSTRUCT, nil, nil)
scase.List.Append(nod(ODCLFIELD, newname(lookup("elem")), typenod(ptrto(Types[TUINT8]))))
scase.List.Append(nod(ODCLFIELD, newname(lookup("chan")), typenod(ptrto(Types[TUINT8]))))
scase.List.Append(nod(ODCLFIELD, newname(lookup("pc")), typenod(Types[TUINTPTR])))
scase.List.Append(nod(ODCLFIELD, newname(lookup("kind")), typenod(Types[TUINT16])))
scase.List.Append(nod(ODCLFIELD, newname(lookup("so")), typenod(Types[TUINT16])))
scase.List.Append(nod(ODCLFIELD, newname(lookup("receivedp")), typenod(ptrto(Types[TUINT8]))))
scase.List.Append(nod(ODCLFIELD, newname(lookup("releasetime")), typenod(Types[TUINT64])))
scase = typecheck(scase, Etype)
scase.Type.Noalg = true
scase.Type.Local = true
sel := Nod(OTSTRUCT, nil, nil)
sel.List.Append(Nod(ODCLFIELD, newname(lookup("tcase")), typenod(Types[TUINT16])))
sel.List.Append(Nod(ODCLFIELD, newname(lookup("ncase")), typenod(Types[TUINT16])))
sel.List.Append(Nod(ODCLFIELD, newname(lookup("pollorder")), typenod(ptrto(Types[TUINT8]))))
sel.List.Append(Nod(ODCLFIELD, newname(lookup("lockorder")), typenod(ptrto(Types[TUINT8]))))
arr := Nod(OTARRAY, nodintconst(int64(size)), scase)
sel.List.Append(Nod(ODCLFIELD, newname(lookup("scase")), arr))
arr = Nod(OTARRAY, nodintconst(int64(size)), typenod(Types[TUINT16]))
sel.List.Append(Nod(ODCLFIELD, newname(lookup("lockorderarr")), arr))
arr = Nod(OTARRAY, nodintconst(int64(size)), typenod(Types[TUINT16]))
sel.List.Append(Nod(ODCLFIELD, newname(lookup("pollorderarr")), arr))
sel := nod(OTSTRUCT, nil, nil)
sel.List.Append(nod(ODCLFIELD, newname(lookup("tcase")), typenod(Types[TUINT16])))
sel.List.Append(nod(ODCLFIELD, newname(lookup("ncase")), typenod(Types[TUINT16])))
sel.List.Append(nod(ODCLFIELD, newname(lookup("pollorder")), typenod(ptrto(Types[TUINT8]))))
sel.List.Append(nod(ODCLFIELD, newname(lookup("lockorder")), typenod(ptrto(Types[TUINT8]))))
arr := nod(OTARRAY, nodintconst(int64(size)), scase)
sel.List.Append(nod(ODCLFIELD, newname(lookup("scase")), arr))
arr = nod(OTARRAY, nodintconst(int64(size)), typenod(Types[TUINT16]))
sel.List.Append(nod(ODCLFIELD, newname(lookup("lockorderarr")), arr))
arr = nod(OTARRAY, nodintconst(int64(size)), typenod(Types[TUINT16]))
sel.List.Append(nod(ODCLFIELD, newname(lookup("pollorderarr")), arr))
sel = typecheck(sel, Etype)
sel.Type.Noalg = true
sel.Type.Local = true
......
This diff is collapsed.
......@@ -4721,7 +4721,7 @@ func (e *ssaExport) SplitStruct(name ssa.LocalSlot, i int) ssa.LocalSlot {
func (e *ssaExport) namedAuto(name string, typ ssa.Type) ssa.GCNode {
t := typ.(*Type)
s := &Sym{Name: name, Pkg: localpkg}
n := Nod(ONAME, nil, nil)
n := nod(ONAME, nil, nil)
s.Def = n
s.Def.Used = true
n.Sym = s
......
......@@ -350,7 +350,7 @@ func importdot(opkg *Pkg, pack *Node) {
}
}
func Nod(op Op, nleft *Node, nright *Node) *Node {
func nod(op Op, nleft *Node, nright *Node) *Node {
n := new(Node)
n.Op = op
n.Left = nleft
......@@ -384,7 +384,7 @@ func Nod(op Op, nleft *Node, nright *Node) *Node {
// nodSym makes a Node with Op op and with the Left field set to left
// and the Sym field set to sym. This is for ODOT and friends.
func nodSym(op Op, left *Node, sym *Sym) *Node {
n := Nod(op, left, nil)
n := nod(op, left, nil)
n.Sym = sym
return n
}
......@@ -393,7 +393,7 @@ func saveorignode(n *Node) {
if n.Orig != nil {
return
}
norig := Nod(n.Op, nil, nil)
norig := nod(n.Op, nil, nil)
*norig = *n
n.Orig = norig
}
......@@ -428,7 +428,7 @@ func (x methcmp) Less(i, j int) bool {
}
func nodintconst(v int64) *Node {
c := Nod(OLITERAL, nil, nil)
c := nod(OLITERAL, nil, nil)
c.Addable = true
c.SetVal(Val{new(Mpint)})
c.Val().U.(*Mpint).SetInt64(v)
......@@ -438,7 +438,7 @@ func nodintconst(v int64) *Node {
}
func nodfltconst(v *Mpflt) *Node {
c := Nod(OLITERAL, nil, nil)
c := nod(OLITERAL, nil, nil)
c.Addable = true
c.SetVal(Val{newMpflt()})
c.Val().U.(*Mpflt).Set(v)
......@@ -1000,7 +1000,7 @@ func assignconvfn(n *Node, t *Type, context func() string) *Node {
// if the next step is non-bool (like interface{}).
if n.Type == idealbool && !t.IsBoolean() {
if n.Op == ONAME || n.Op == OLITERAL {
r := Nod(OCONVNOP, n, nil)
r := nod(OCONVNOP, n, nil)
r.Type = Types[TBOOL]
r.Typecheck = 1
r.Implicit = true
......@@ -1019,7 +1019,7 @@ func assignconvfn(n *Node, t *Type, context func() string) *Node {
op = OCONV
}
r := Nod(op, n, nil)
r := nod(op, n, nil)
r.Type = t
r.Typecheck = 1
r.Implicit = true
......@@ -1064,7 +1064,7 @@ func (n *Node) SetSliceBounds(low, high, max *Node) {
Fatalf("SetSliceBounds %v given three bounds", n.Op)
}
if n.Right == nil {
n.Right = Nod(OKEY, low, high)
n.Right = nod(OKEY, low, high)
return
}
n.Right.Left = low
......@@ -1072,7 +1072,7 @@ func (n *Node) SetSliceBounds(low, high, max *Node) {
return
case OSLICE3, OSLICE3ARR:
if n.Right == nil {
n.Right = Nod(OKEY, low, Nod(OKEY, high, max))
n.Right = nod(OKEY, low, nod(OKEY, high, max))
}
n.Right.Left = low
n.Right.Right.Left = high
......@@ -1334,7 +1334,7 @@ func safeexpr(n *Node, init *Nodes) *Node {
if l == n.Left {
return n
}
r := Nod(OXXX, nil, nil)
r := nod(OXXX, nil, nil)
*r = *n
r.Left = l
r = typecheck(r, Erv)
......@@ -1346,7 +1346,7 @@ func safeexpr(n *Node, init *Nodes) *Node {
if l == n.Left {
return n
}
a := Nod(OXXX, nil, nil)
a := nod(OXXX, nil, nil)
*a = *n
a.Left = l
a = walkexpr(a, init)
......@@ -1358,7 +1358,7 @@ func safeexpr(n *Node, init *Nodes) *Node {
if l == n.Left && r == n.Right {
return n
}
a := Nod(OXXX, nil, nil)
a := nod(OXXX, nil, nil)
*a = *n
a.Left = l
a.Right = r
......@@ -1380,7 +1380,7 @@ func safeexpr(n *Node, init *Nodes) *Node {
func copyexpr(n *Node, t *Type, init *Nodes) *Node {
l := temp(t)
a := Nod(OAS, l, n)
a := nod(OAS, l, n)
a = typecheck(a, Etop)
a = walkexpr(a, init)
init.Append(a)
......@@ -1706,7 +1706,7 @@ func structargs(tl *Type, mustname bool) []*Node {
} else if t.Sym != nil {
n = newname(t.Sym)
}
a := Nod(ODCLFIELD, n, typenod(t.Type))
a := nod(ODCLFIELD, n, typenod(t.Type))
a.Isddd = t.Isddd
if n != nil {
n.Isddd = t.Isddd
......@@ -1758,12 +1758,12 @@ func genwrapper(rcvr *Type, method *Field, newnam *Sym, iface int) {
dclcontext = PEXTERN
markdcl()
this := Nod(ODCLFIELD, newname(lookup(".this")), typenod(rcvr))
this := nod(ODCLFIELD, newname(lookup(".this")), typenod(rcvr))
this.Left.Name.Param.Ntype = this.Right
in := structargs(method.Type.Params(), true)
out := structargs(method.Type.Results(), false)
t := Nod(OTFUNC, nil, nil)
t := nod(OTFUNC, nil, nil)
l := []*Node{this}
if iface != 0 && rcvr.Width < Types[Tptr].Width {
// Building method for interface table and receiver
......@@ -1772,14 +1772,14 @@ func genwrapper(rcvr *Type, method *Field, newnam *Sym, iface int) {
// Add a dummy padding argument after the
// receiver to make up the difference.
tpad := typArray(Types[TUINT8], Types[Tptr].Width-rcvr.Width)
pad := Nod(ODCLFIELD, newname(lookup(".pad")), typenod(tpad))
pad := nod(ODCLFIELD, newname(lookup(".pad")), typenod(tpad))
l = append(l, pad)
}
t.List.Set(append(l, in...))
t.Rlist.Set(out)
fn := Nod(ODCLFUNC, nil, nil)
fn := nod(ODCLFUNC, nil, nil)
fn.Func.Nname = newname(newnam)
fn.Func.Nname.Name.Defn = fn
fn.Func.Nname.Name.Param.Ntype = t
......@@ -1800,9 +1800,9 @@ func genwrapper(rcvr *Type, method *Field, newnam *Sym, iface int) {
// generate nil pointer check for better error
if rcvr.IsPtr() && rcvr.Elem() == methodrcvr {
// generating wrapper from *T to T.
n := Nod(OIF, nil, nil)
n := nod(OIF, nil, nil)
n.Left = Nod(OEQ, this.Left, nodnil())
n.Left = nod(OEQ, this.Left, nodnil())
// these strings are already in the reflect tables,
// so no space cost to use them here.
......@@ -1815,7 +1815,7 @@ func genwrapper(rcvr *Type, method *Field, newnam *Sym, iface int) {
l = append(l, nodlit(v))
v.U = method.Sym.Name
l = append(l, nodlit(v)) // method name
call := Nod(OCALL, syslook("panicwrap"), nil)
call := nod(OCALL, syslook("panicwrap"), nil)
call.List.Set(l)
n.Nbody.Set1(call)
fn.Nbody.Append(n)
......@@ -1835,21 +1835,21 @@ func genwrapper(rcvr *Type, method *Field, newnam *Sym, iface int) {
dot = dot.Left // skip final .M
// TODO(mdempsky): Remove dependency on dotlist.
if !dotlist[0].field.Type.IsPtr() {
dot = Nod(OADDR, dot, nil)
dot = nod(OADDR, dot, nil)
}
as := Nod(OAS, this.Left, Nod(OCONVNOP, dot, nil))
as := nod(OAS, this.Left, nod(OCONVNOP, dot, nil))
as.Right.Type = rcvr
fn.Nbody.Append(as)
n := Nod(ORETJMP, nil, nil)
n := nod(ORETJMP, nil, nil)
n.Left = newname(methodsym(method.Sym, methodrcvr, 0))
fn.Nbody.Append(n)
} else {
fn.Func.Wrapper = true // ignore frame for panic+recover matching
call := Nod(OCALL, dot, nil)
call := nod(OCALL, dot, nil)
call.List.Set(args)
call.Isddd = isddd
if method.Type.Results().NumFields() > 0 {
n := Nod(ORETURN, nil, nil)
n := nod(ORETURN, nil, nil)
n.List.Set1(call)
call = n
}
......@@ -1885,11 +1885,11 @@ func hashmem(t *Type) *Node {
n := newname(sym)
n.Class = PFUNC
tfn := Nod(OTFUNC, nil, nil)
tfn.List.Append(Nod(ODCLFIELD, nil, typenod(ptrto(t))))
tfn.List.Append(Nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
tfn.List.Append(Nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
tfn.Rlist.Append(Nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
tfn := nod(OTFUNC, nil, nil)
tfn.List.Append(nod(ODCLFIELD, nil, typenod(ptrto(t))))
tfn.List.Append(nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
tfn.List.Append(nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
tfn.Rlist.Append(nod(ODCLFIELD, nil, typenod(Types[TUINTPTR])))
tfn = typecheck(tfn, Etype)
n.Type = tfn.Type
return n
......@@ -2031,7 +2031,7 @@ func listtreecopy(l []*Node, lineno int32) []*Node {
}
func liststmt(l []*Node) *Node {
n := Nod(OBLOCK, nil, nil)
n := nod(OBLOCK, nil, nil)
n.List.Set(l)
if len(l) != 0 {
n.Lineno = l[0].Lineno
......@@ -2137,7 +2137,7 @@ func addinit(n *Node, init []*Node) *Node {
// There may be multiple refs to this node;
// introduce OCONVNOP to hold init list.
case ONAME, OLITERAL:
n = Nod(OCONVNOP, n, nil)
n = nod(OCONVNOP, n, nil)
n.Type = n.Left.Type
n.Typecheck = 1
}
......@@ -2198,11 +2198,11 @@ func isbadimport(path string) bool {
func checknil(x *Node, init *Nodes) {
x = walkexpr(x, nil) // caller has not done this yet
if x.Type.IsInterface() {
x = Nod(OITAB, x, nil)
x = nod(OITAB, x, nil)
x = typecheck(x, Erv)
}
n := Nod(OCHECKNIL, x, nil)
n := nod(OCHECKNIL, x, nil)
n.Typecheck = 1
init.Append(n)
}
......@@ -2254,7 +2254,7 @@ func ifaceData(n *Node, t *Type) *Node {
ptr.Type = ptrto(t)
ptr.Bounded = true
ptr.Typecheck = 1
ind := Nod(OIND, ptr, nil)
ind := nod(OIND, ptr, nil)
ind.Type = t
ind.Typecheck = 1
return ind
......
......@@ -247,7 +247,7 @@ func (s *exprSwitch) walk(sw *Node) {
s.exprname = cond
} else {
s.exprname = temp(cond.Type)
cas = []*Node{Nod(OAS, s.exprname, cond)}
cas = []*Node{nod(OAS, s.exprname, cond)}
typecheckslice(cas, Etop)
}
......@@ -295,26 +295,26 @@ func (s *exprSwitch) walkCases(cc []caseClause) *Node {
n := c.node
lno := setlineno(n)
a := Nod(OIF, nil, nil)
a := nod(OIF, nil, nil)
if rng := n.List.Slice(); rng != nil {
// Integer range.
// exprname is a temp or a constant,
// so it is safe to evaluate twice.
// In most cases, this conjunction will be
// rewritten by walkinrange into a single comparison.
low := Nod(OGE, s.exprname, rng[0])
high := Nod(OLE, s.exprname, rng[1])
a.Left = Nod(OANDAND, low, high)
low := nod(OGE, s.exprname, rng[0])
high := nod(OLE, s.exprname, rng[1])
a.Left = nod(OANDAND, low, high)
a.Left = typecheck(a.Left, Erv)
a.Left = walkexpr(a.Left, nil) // give walk the opportunity to optimize the range check
} else if (s.kind != switchKindTrue && s.kind != switchKindFalse) || assignop(n.Left.Type, s.exprname.Type, nil) == OCONVIFACE || assignop(s.exprname.Type, n.Left.Type, nil) == OCONVIFACE {
a.Left = Nod(OEQ, s.exprname, n.Left) // if name == val
a.Left = nod(OEQ, s.exprname, n.Left) // if name == val
a.Left = typecheck(a.Left, Erv)
} else if s.kind == switchKindTrue {
a.Left = n.Left // if val
} else {
// s.kind == switchKindFalse
a.Left = Nod(ONOT, n.Left, nil) // if !val
a.Left = nod(ONOT, n.Left, nil) // if !val
a.Left = typecheck(a.Left, Erv)
}
a.Nbody.Set1(n.Right) // goto l
......@@ -327,7 +327,7 @@ func (s *exprSwitch) walkCases(cc []caseClause) *Node {
// find the middle and recur
half := len(cc) / 2
a := Nod(OIF, nil, nil)
a := nod(OIF, nil, nil)
n := cc[half-1].node
var mid *Node
if rng := n.List.Slice(); rng != nil {
......@@ -335,12 +335,12 @@ func (s *exprSwitch) walkCases(cc []caseClause) *Node {
} else {
mid = n.Left
}
le := Nod(OLE, s.exprname, mid)
le := nod(OLE, s.exprname, mid)
if Isconst(mid, CTSTR) {
// Search by length and then by value; see caseClauseByConstVal.
lenlt := Nod(OLT, Nod(OLEN, s.exprname, nil), Nod(OLEN, mid, nil))
leneq := Nod(OEQ, Nod(OLEN, s.exprname, nil), Nod(OLEN, mid, nil))
a.Left = Nod(OOROR, lenlt, Nod(OANDAND, leneq, le))
lenlt := nod(OLT, nod(OLEN, s.exprname, nil), nod(OLEN, mid, nil))
leneq := nod(OEQ, nod(OLEN, s.exprname, nil), nod(OLEN, mid, nil))
a.Left = nod(OOROR, lenlt, nod(OANDAND, leneq, le))
} else {
a.Left = le
}
......@@ -363,7 +363,7 @@ func casebody(sw *Node, typeswvar *Node) {
var cas []*Node // cases
var stat []*Node // statements
var def *Node // defaults
br := Nod(OBREAK, nil, nil)
br := nod(OBREAK, nil, nil)
for i, n := range sw.List.Slice() {
setlineno(n)
......@@ -373,7 +373,7 @@ func casebody(sw *Node, typeswvar *Node) {
n.Op = OCASE
needvar := n.List.Len() != 1 || n.List.First().Op == OLITERAL
jmp := Nod(OGOTO, autolabel(".s"), nil)
jmp := nod(OGOTO, autolabel(".s"), nil)
switch n.List.Len() {
case 0:
// default
......@@ -394,7 +394,7 @@ func casebody(sw *Node, typeswvar *Node) {
if typeswvar != nil || sw.Left.Type.IsInterface() || !n.List.First().Type.IsInteger() || n.List.Len() < integerRangeMin {
// Can't use integer ranges. Expand each case into a separate node.
for _, n1 := range n.List.Slice() {
cas = append(cas, Nod(OCASE, n1, jmp))
cas = append(cas, nod(OCASE, n1, jmp))
}
break
}
......@@ -417,13 +417,13 @@ func casebody(sw *Node, typeswvar *Node) {
}
if end-beg >= integerRangeMin {
// Record range in List.
c := Nod(OCASE, nil, jmp)
c := nod(OCASE, nil, jmp)
c.List.Set2(search[beg], search[end-1])
cas = append(cas, c)
} else {
// Not large enough for range; record separately.
for _, n := range search[beg:end] {
cas = append(cas, Nod(OCASE, n, jmp))
cas = append(cas, nod(OCASE, n, jmp))
}
}
beg = end
......@@ -433,16 +433,16 @@ func casebody(sw *Node, typeswvar *Node) {
// Advance to next constant, adding individual non-constant
// or as-yet-unhandled constant cases as we go.
for ; j < len(s) && (j < run || !Isconst(s[j], CTINT)); j++ {
cas = append(cas, Nod(OCASE, s[j], jmp))
cas = append(cas, nod(OCASE, s[j], jmp))
}
}
}
stat = append(stat, Nod(OLABEL, jmp.Left, nil))
stat = append(stat, nod(OLABEL, jmp.Left, nil))
if typeswvar != nil && needvar && n.Rlist.Len() != 0 {
l := []*Node{
Nod(ODCL, n.Rlist.First(), nil),
Nod(OAS, n.Rlist.First(), typeswvar),
nod(ODCL, n.Rlist.First(), nil),
nod(OAS, n.Rlist.First(), typeswvar),
}
typecheckslice(l, Etop)
stat = append(stat, l...)
......@@ -502,7 +502,7 @@ func (s *exprSwitch) genCaseClauses(clauses []*Node) caseClauses {
}
if cc.defjmp == nil {
cc.defjmp = Nod(OBREAK, nil, nil)
cc.defjmp = nod(OBREAK, nil, nil)
}
// diagnose duplicate cases
......@@ -542,7 +542,7 @@ func (s *typeSwitch) genCaseClauses(clauses []*Node) caseClauses {
}
if cc.defjmp == nil {
cc.defjmp = Nod(OBREAK, nil, nil)
cc.defjmp = nod(OBREAK, nil, nil)
}
// diagnose duplicate cases
......@@ -689,7 +689,7 @@ func (s *typeSwitch) walk(sw *Node) {
// predeclare temporary variables and the boolean var
s.facename = temp(cond.Right.Type)
a := Nod(OAS, s.facename, cond.Right)
a := nod(OAS, s.facename, cond.Right)
a = typecheck(a, Etop)
cas = append(cas, a)
......@@ -714,21 +714,21 @@ func (s *typeSwitch) walk(sw *Node) {
// Use a similar strategy for non-empty interfaces.
// Get interface descriptor word.
typ := Nod(OITAB, s.facename, nil)
typ := nod(OITAB, s.facename, nil)
// Check for nil first.
i := Nod(OIF, nil, nil)
i.Left = Nod(OEQ, typ, nodnil())
i := nod(OIF, nil, nil)
i.Left = nod(OEQ, typ, nodnil())
if clauses.niljmp != nil {
// Do explicit nil case right here.
i.Nbody.Set1(clauses.niljmp)
} else {
// Jump to default case.
lbl := autolabel(".s")
i.Nbody.Set1(Nod(OGOTO, lbl, nil))
i.Nbody.Set1(nod(OGOTO, lbl, nil))
// Wrap default case with label.
blk := Nod(OBLOCK, nil, nil)
blk.List.Set([]*Node{Nod(OLABEL, lbl, nil), def})
blk := nod(OBLOCK, nil, nil)
blk.List.Set([]*Node{nod(OLABEL, lbl, nil), def})
def = blk
}
i.Left = typecheck(i.Left, Erv)
......@@ -744,7 +744,7 @@ func (s *typeSwitch) walk(sw *Node) {
h.Typecheck = 1
h.Xoffset = int64(2 * Widthptr) // offset of hash in runtime._type
h.Bounded = true // guaranteed not to fault
a = Nod(OAS, s.hashname, h)
a = nod(OAS, s.hashname, h)
a = typecheck(a, Etop)
cas = append(cas, a)
......@@ -816,21 +816,21 @@ func (s *typeSwitch) typeone(t *Node) *Node {
nblank = typecheck(nblank, Erv|Easgn)
} else {
name = t.Rlist.First()
init = []*Node{Nod(ODCL, name, nil)}
a := Nod(OAS, name, nil)
init = []*Node{nod(ODCL, name, nil)}
a := nod(OAS, name, nil)
a = typecheck(a, Etop)
init = append(init, a)
}
a := Nod(OAS2, nil, nil)
a := nod(OAS2, nil, nil)
a.List.Set([]*Node{name, s.okname}) // name, ok =
b := Nod(ODOTTYPE, s.facename, nil)
b := nod(ODOTTYPE, s.facename, nil)
b.Type = t.Left.Type // interface.(type)
a.Rlist.Set1(b)
a = typecheck(a, Etop)
init = append(init, a)
c := Nod(OIF, nil, nil)
c := nod(OIF, nil, nil)
c.Left = s.okname
c.Nbody.Set1(t.Right) // if ok { goto l }
......@@ -846,8 +846,8 @@ func (s *typeSwitch) walkCases(cc []caseClause) *Node {
if !c.isconst {
Fatalf("typeSwitch walkCases")
}
a := Nod(OIF, nil, nil)
a.Left = Nod(OEQ, s.hashname, nodintconst(int64(c.hash)))
a := nod(OIF, nil, nil)
a.Left = nod(OEQ, s.hashname, nodintconst(int64(c.hash)))
a.Left = typecheck(a.Left, Erv)
a.Nbody.Set1(n.Right)
cas = append(cas, a)
......@@ -857,8 +857,8 @@ func (s *typeSwitch) walkCases(cc []caseClause) *Node {
// find the middle and recur
half := len(cc) / 2
a := Nod(OIF, nil, nil)
a.Left = Nod(OLE, s.hashname, nodintconst(int64(cc[half-1].hash)))
a := nod(OIF, nil, nil)
a.Left = nod(OLE, s.hashname, nodintconst(int64(cc[half-1].hash)))
a.Left = typecheck(a.Left, Erv)
a.Nbody.Set1(s.walkCases(cc[:half]))
a.Rlist.Set1(s.walkCases(cc[half:]))
......
......@@ -33,8 +33,8 @@ func TestCaseClauseByConstVal(t *testing.T) {
{nodlit(Val{"abc"}), nodlit(Val{"xyz"})},
}
for i, test := range tests {
a := caseClause{node: Nod(OXXX, test.a, nil)}
b := caseClause{node: Nod(OXXX, test.b, nil)}
a := caseClause{node: nod(OXXX, test.a, nil)}
b := caseClause{node: nod(OXXX, test.b, nil)}
s := caseClauseByConstVal{a, b}
if less := s.Less(0, 1); !less {
t.Errorf("%d: caseClauseByConstVal(%v, %v) = false", i, test.a, test.b)
......
......@@ -143,7 +143,7 @@ type Type struct {
methods Fields
allMethods Fields
Nod *Node // canonical OTYPE node
nod *Node // canonical OTYPE node
Orig *Type // original type (type literal or predefined type)
Sym *Sym // symbol containing name, for named types
......
......@@ -618,7 +618,7 @@ OpSwitch:
dowidth(l.Type)
if r.Type.IsInterface() == l.Type.IsInterface() || l.Type.Width >= 1<<16 {
l = Nod(aop, l, nil)
l = nod(aop, l, nil)
l.Type = r.Type
l.Typecheck = 1
n.Left = l
......@@ -640,7 +640,7 @@ OpSwitch:
dowidth(r.Type)
if r.Type.IsInterface() == l.Type.IsInterface() || r.Type.Width >= 1<<16 {
r = Nod(aop, r, nil)
r = nod(aop, r, nil)
r.Type = l.Type
r.Typecheck = 1
n.Right = r
......@@ -1128,7 +1128,7 @@ OpSwitch:
return n
}
n.Left = Nod(OADDR, n.Left, nil)
n.Left = nod(OADDR, n.Left, nil)
n.Left.Implicit = true
n.Left = typecheck(n.Left, Erv)
l = n.Left
......@@ -1697,7 +1697,7 @@ OpSwitch:
switch n.Op {
case OCONVNOP:
if n.Left.Op == OLITERAL {
r := Nod(OXXX, nil, nil)
r := nod(OXXX, nil, nil)
n.Op = OCONV
n.Orig = r
*r = *n
......@@ -2260,7 +2260,7 @@ func implicitstar(n *Node) *Node {
if !t.IsArray() {
return n
}
n = Nod(OIND, n, nil)
n = nod(OIND, n, nil)
n.Implicit = true
n = typecheck(n, Erv)
return n
......@@ -2440,7 +2440,7 @@ func lookdot(n *Node, t *Type, dostrcmp int) *Field {
}
if t.IsInterface() {
if n.Left.Type.IsPtr() {
n.Left = Nod(OIND, n.Left, nil) // implicitstar
n.Left = nod(OIND, n.Left, nil) // implicitstar
n.Left.Implicit = true
n.Left = typecheck(n.Left, Erv)
}
......@@ -2462,11 +2462,11 @@ func lookdot(n *Node, t *Type, dostrcmp int) *Field {
if !eqtype(rcvr, tt) {
if rcvr.Etype == Tptr && eqtype(rcvr.Elem(), tt) {
checklvalue(n.Left, "call pointer method on")
n.Left = Nod(OADDR, n.Left, nil)
n.Left = nod(OADDR, n.Left, nil)
n.Left.Implicit = true
n.Left = typecheck(n.Left, Etype|Erv)
} else if tt.Etype == Tptr && rcvr.Etype != Tptr && eqtype(tt.Elem(), rcvr) {
n.Left = Nod(OIND, n.Left, nil)
n.Left = nod(OIND, n.Left, nil)
n.Left.Implicit = true
n.Left = typecheck(n.Left, Etype|Erv)
} else if tt.Etype == Tptr && tt.Elem().Etype == Tptr && eqtype(derefall(tt), derefall(rcvr)) {
......@@ -2476,7 +2476,7 @@ func lookdot(n *Node, t *Type, dostrcmp int) *Field {
if rcvr.Etype == Tptr && tt.Elem().Etype != Tptr {
break
}
n.Left = Nod(OIND, n.Left, nil)
n.Left = nod(OIND, n.Left, nil)
n.Left.Implicit = true
n.Left = typecheck(n.Left, Etype|Erv)
tt = tt.Elem()
......@@ -2849,7 +2849,7 @@ func typecheckcomplit(n *Node) *Node {
}
// Save original node (including n->right)
norig := Nod(n.Op, nil, nil)
norig := nod(n.Op, nil, nil)
*norig = *n
......@@ -2905,7 +2905,7 @@ func typecheckcomplit(n *Node) *Node {
l := n2
setlineno(l)
if l.Op != OKEY {
l = Nod(OKEY, nodintconst(int64(i)), l)
l = nod(OKEY, nodintconst(int64(i)), l)
l.Left.Type = Types[TINT]
l.Left.Typecheck = 1
n.List.SetIndex(i2, l)
......@@ -3009,7 +3009,7 @@ func typecheckcomplit(n *Node) *Node {
}
// No pushtype allowed here. Must name fields for that.
n1 = assignconv(n1, f.Type, "field value")
n1 = Nod(OKEY, newname(f.Sym), n1)
n1 = nod(OKEY, newname(f.Sym), n1)
n1.Left.Type = structkey
n1.Left.Xoffset = f.Offset
n1.Left.Typecheck = 1
......@@ -3089,7 +3089,7 @@ func typecheckcomplit(n *Node) *Node {
n.Orig = norig
if n.Type.IsPtr() {
n = Nod(OPTRLIT, n, nil)
n = nod(OPTRLIT, n, nil)
n.Typecheck = 1
n.Type = n.Left.Type
n.Left.Type = t
......@@ -3416,18 +3416,18 @@ func stringtoarraylit(n *Node) *Node {
if n.Type.Elem().Etype == TUINT8 {
// []byte
for i := 0; i < len(s); i++ {
l = append(l, Nod(OKEY, nodintconst(int64(i)), nodintconst(int64(s[0]))))
l = append(l, nod(OKEY, nodintconst(int64(i)), nodintconst(int64(s[0]))))
}
} else {
// []rune
i := 0
for _, r := range s {
l = append(l, Nod(OKEY, nodintconst(int64(i)), nodintconst(int64(r))))
l = append(l, nod(OKEY, nodintconst(int64(i)), nodintconst(int64(r))))
i++
}
}
nn := Nod(OCOMPLIT, nil, typenod(n.Type))
nn := nod(OCOMPLIT, nil, typenod(n.Type))
nn.List.Set(l)
nn = typecheck(nn, Erv)
return nn
......@@ -3444,7 +3444,7 @@ func domethod(n *Node) {
// type check failed; leave empty func
// TODO(mdempsky): Fix Type rekinding.
n.Type.Etype = TFUNC
n.Type.Nod = nil
n.Type.nod = nil
return
}
......@@ -3464,7 +3464,7 @@ func domethod(n *Node) {
// TODO(mdempsky): Fix Type rekinding.
*n.Type = *nt.Type
n.Type.Nod = nil
n.Type.nod = nil
checkwidth(n.Type)
}
......@@ -3497,7 +3497,7 @@ func copytype(n *Node, t *Type) {
}
t.methods = Fields{}
t.allMethods = Fields{}
t.Nod = nil
t.nod = nil
t.Deferwidth = false
// Update nodes waiting on this type.
......
......@@ -94,7 +94,7 @@ func lexinit() {
for _, s := range builtinFuncs {
// TODO(marvin): Fix Node.EType type union.
s2 := Pkglookup(s.name, builtinpkg)
s2.Def = Nod(ONAME, nil, nil)
s2.Def = nod(ONAME, nil, nil)
s2.Def.Sym = s2
s2.Def.Etype = EType(s.op)
}
......@@ -116,7 +116,7 @@ func lexinit() {
s = lookup("_")
s.Block = -100
s.Def = Nod(ONAME, nil, nil)
s.Def = nod(ONAME, nil, nil)
s.Def.Sym = s
Types[TBLANK] = typ(TBLANK)
s.Def.Type = Types[TBLANK]
......@@ -124,7 +124,7 @@ func lexinit() {
s = Pkglookup("_", builtinpkg)
s.Block = -100
s.Def = Nod(ONAME, nil, nil)
s.Def = nod(ONAME, nil, nil)
s.Def.Sym = s
Types[TBLANK] = typ(TBLANK)
s.Def.Type = Types[TBLANK]
......@@ -138,7 +138,7 @@ func lexinit() {
s.Def.Name = new(Name)
s = Pkglookup("iota", builtinpkg)
s.Def = Nod(OIOTA, nil, nil)
s.Def = nod(OIOTA, nil, nil)
s.Def.Sym = s
s.Def.Name = new(Name)
}
......@@ -457,7 +457,7 @@ func finishUniverse() {
s1.Block = s.Block
}
nodfp = Nod(ONAME, nil, nil)
nodfp = nod(ONAME, nil, nil)
nodfp.Type = Types[TINT32]
nodfp.Xoffset = 0
nodfp.Class = PPARAM
......
......@@ -104,7 +104,7 @@ ret:
var val Val
val.U = new(Mpint)
val.U.(*Mpint).SetInt64(v)
n := Nod(OLITERAL, nil, nil)
n := nod(OLITERAL, nil, nil)
n.Orig = nn
n.SetVal(val)
n.Type = Types[TUINTPTR]
......
This diff is collapsed.
......@@ -1854,7 +1854,7 @@ func (p *parser) commClause() *CommClause {
}
// TODO(gri) find a better solution
var missing_stmt Stmt = new(EmptyStmt) // = Nod(OXXX, nil, nil)
var missing_stmt Stmt = new(EmptyStmt) // = nod(OXXX, nil, nil)
// Statement =
// Declaration | LabeledStmt | SimpleStmt |
......@@ -1921,7 +1921,7 @@ func (p *parser) stmt() Stmt {
s.Tok = _Fallthrough
return s
// // will be converted to OFALL
// stmt := Nod(OXFALL, nil, nil)
// stmt := nod(OXFALL, nil, nil)
// stmt.Xoffset = int64(block)
// return stmt
......@@ -1946,7 +1946,7 @@ func (p *parser) stmt() Stmt {
s.Tok = _Goto
s.Label = p.name()
return s
// stmt := Nod(OGOTO, p.new_name(p.name()), nil)
// stmt := nod(OGOTO, p.new_name(p.name()), nil)
// stmt.Sym = dclstack // context, for goto restrictions
// return stmt
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment