summaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/gc/select.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/gc/select.go')
-rw-r--r--src/cmd/compile/internal/gc/select.go36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/cmd/compile/internal/gc/select.go b/src/cmd/compile/internal/gc/select.go
index 974c4b254e..be2f688eb9 100644
--- a/src/cmd/compile/internal/gc/select.go
+++ b/src/cmd/compile/internal/gc/select.go
@@ -33,7 +33,7 @@ func typecheckselect(sel *ir.SelectStmt) {
ncase.SetLeft(n)
ncase.PtrList().Set(nil)
oselrecv2 := func(dst, recv ir.Node, colas bool) {
- n := ir.NodAt(n.Pos(), ir.OSELRECV2, nil, nil)
+ n := ir.NewAssignListStmt(n.Pos(), ir.OSELRECV2, nil, nil)
n.PtrList().Set2(dst, ir.BlankNode)
n.PtrRlist().Set1(recv)
n.SetColas(colas)
@@ -145,7 +145,7 @@ func walkselectcases(cases ir.Nodes) []ir.Node {
}
l = append(l, cas.Body().Slice()...)
- l = append(l, ir.Nod(ir.OBREAK, nil, nil))
+ l = append(l, ir.NewBranchStmt(base.Pos, ir.OBREAK, nil))
return l
}
@@ -182,7 +182,7 @@ func walkselectcases(cases ir.Nodes) []ir.Node {
n := cas.Left()
setlineno(n)
- r := ir.Nod(ir.OIF, nil, nil)
+ r := ir.NewIfStmt(base.Pos, nil, nil, nil)
r.PtrInit().Set(cas.Init().Slice())
var call ir.Node
switch n.Op() {
@@ -215,7 +215,7 @@ func walkselectcases(cases ir.Nodes) []ir.Node {
r.SetLeft(typecheck(call, ctxExpr))
r.PtrBody().Set(cas.Body().Slice())
r.PtrRlist().Set(append(dflt.Init().Slice(), dflt.Body().Slice()...))
- return []ir.Node{r, ir.Nod(ir.OBREAK, nil, nil)}
+ return []ir.Node{r, ir.NewBranchStmt(base.Pos, ir.OBREAK, nil)}
}
if dflt != nil {
@@ -229,7 +229,7 @@ func walkselectcases(cases ir.Nodes) []ir.Node {
// generate sel-struct
base.Pos = sellineno
selv := temp(types.NewArray(scasetype(), int64(ncas)))
- init = append(init, typecheck(ir.Nod(ir.OAS, selv, nil), ctxStmt))
+ init = append(init, typecheck(ir.NewAssignStmt(base.Pos, selv, nil), ctxStmt))
// No initialization for order; runtime.selectgo is responsible for that.
order := temp(types.NewArray(types.Types[types.TUINT16], 2*int64(ncas)))
@@ -237,7 +237,7 @@ func walkselectcases(cases ir.Nodes) []ir.Node {
var pc0, pcs ir.Node
if base.Flag.Race {
pcs = temp(types.NewArray(types.Types[types.TUINTPTR], int64(ncas)))
- pc0 = typecheck(nodAddr(ir.Nod(ir.OINDEX, pcs, nodintconst(0))), ctxExpr)
+ pc0 = typecheck(nodAddr(ir.NewIndexExpr(base.Pos, pcs, nodintconst(0))), ctxExpr)
} else {
pc0 = nodnil()
}
@@ -276,7 +276,7 @@ func walkselectcases(cases ir.Nodes) []ir.Node {
casorder[i] = cas
setField := func(f string, val ir.Node) {
- r := ir.Nod(ir.OAS, nodSym(ir.ODOT, ir.Nod(ir.OINDEX, selv, nodintconst(int64(i))), lookup(f)), val)
+ r := ir.NewAssignStmt(base.Pos, ir.NewSelectorExpr(base.Pos, ir.ODOT, ir.NewIndexExpr(base.Pos, selv, nodintconst(int64(i))), lookup(f)), val)
init = append(init, typecheck(r, ctxStmt))
}
@@ -290,7 +290,7 @@ func walkselectcases(cases ir.Nodes) []ir.Node {
// TODO(mdempsky): There should be a cleaner way to
// handle this.
if base.Flag.Race {
- r := mkcall("selectsetpc", nil, nil, nodAddr(ir.Nod(ir.OINDEX, pcs, nodintconst(int64(i)))))
+ r := mkcall("selectsetpc", nil, nil, nodAddr(ir.NewIndexExpr(base.Pos, pcs, nodintconst(int64(i)))))
init = append(init, r)
}
}
@@ -302,17 +302,17 @@ func walkselectcases(cases ir.Nodes) []ir.Node {
base.Pos = sellineno
chosen := temp(types.Types[types.TINT])
recvOK := temp(types.Types[types.TBOOL])
- r := ir.Nod(ir.OAS2, nil, nil)
+ r := ir.NewAssignListStmt(base.Pos, ir.OAS2, nil, nil)
r.PtrList().Set2(chosen, recvOK)
fn := syslook("selectgo")
r.PtrRlist().Set1(mkcall1(fn, fn.Type().Results(), nil, bytePtrToIndex(selv, 0), bytePtrToIndex(order, 0), pc0, nodintconst(int64(nsends)), nodintconst(int64(nrecvs)), nodbool(dflt == nil)))
init = append(init, typecheck(r, ctxStmt))
// selv and order are no longer alive after selectgo.
- init = append(init, ir.Nod(ir.OVARKILL, selv, nil))
- init = append(init, ir.Nod(ir.OVARKILL, order, nil))
+ init = append(init, ir.NewUnaryExpr(base.Pos, ir.OVARKILL, selv))
+ init = append(init, ir.NewUnaryExpr(base.Pos, ir.OVARKILL, order))
if base.Flag.Race {
- init = append(init, ir.Nod(ir.OVARKILL, pcs, nil))
+ init = append(init, ir.NewUnaryExpr(base.Pos, ir.OVARKILL, pcs))
}
// dispatch cases
@@ -320,27 +320,27 @@ func walkselectcases(cases ir.Nodes) []ir.Node {
cond = typecheck(cond, ctxExpr)
cond = defaultlit(cond, nil)
- r := ir.Nod(ir.OIF, cond, nil)
+ r := ir.NewIfStmt(base.Pos, cond, nil, nil)
if n := cas.Left(); n != nil && n.Op() == ir.OSELRECV2 {
if !ir.IsBlank(n.List().Second()) {
- x := ir.Nod(ir.OAS, n.List().Second(), recvOK)
+ x := ir.NewAssignStmt(base.Pos, n.List().Second(), recvOK)
r.PtrBody().Append(typecheck(x, ctxStmt))
}
}
r.PtrBody().AppendNodes(cas.PtrBody())
- r.PtrBody().Append(ir.Nod(ir.OBREAK, nil, nil))
+ r.PtrBody().Append(ir.NewBranchStmt(base.Pos, ir.OBREAK, nil))
init = append(init, r)
}
if dflt != nil {
setlineno(dflt)
- dispatch(ir.Nod(ir.OLT, chosen, nodintconst(0)), dflt)
+ dispatch(ir.NewBinaryExpr(base.Pos, ir.OLT, chosen, nodintconst(0)), dflt)
}
for i, cas := range casorder {
setlineno(cas)
- dispatch(ir.Nod(ir.OEQ, chosen, nodintconst(int64(i))), cas)
+ dispatch(ir.NewBinaryExpr(base.Pos, ir.OEQ, chosen, nodintconst(int64(i))), cas)
}
return init
@@ -348,7 +348,7 @@ func walkselectcases(cases ir.Nodes) []ir.Node {
// bytePtrToIndex returns a Node representing "(*byte)(&n[i])".
func bytePtrToIndex(n ir.Node, i int64) ir.Node {
- s := nodAddr(ir.Nod(ir.OINDEX, n, nodintconst(i)))
+ s := nodAddr(ir.NewIndexExpr(base.Pos, n, nodintconst(i)))
t := types.NewPtr(types.Types[types.TUINT8])
return convnop(s, t)
}