Commit e79c2382 authored by Cuong Manh Le's avatar Cuong Manh Le Committed by Matthew Dempsky

cmd/compile: move OAS2 to its own case in order

Change-Id: Id0f4955588ae8027a24465b456c90d0543d60db2
Reviewed-on: https://go-review.googlesource.com/c/go/+/200581
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent ba6aeb6c
...@@ -513,26 +513,6 @@ func (o *Order) stmt(n *Node) { ...@@ -513,26 +513,6 @@ func (o *Order) stmt(n *Node) {
o.mapAssign(n) o.mapAssign(n)
o.cleanTemp(t) o.cleanTemp(t)
case OAS2,
OCLOSE,
OCOPY,
OPRINT,
OPRINTN,
ORECOVER,
ORECV:
t := o.markTemp()
n.Left = o.expr(n.Left, nil)
n.Right = o.expr(n.Right, nil)
o.exprList(n.List)
o.exprList(n.Rlist)
switch n.Op {
case OAS2:
o.mapAssign(n)
default:
o.out = append(o.out, n)
}
o.cleanTemp(t)
case OASOP: case OASOP:
t := o.markTemp() t := o.markTemp()
n.Left = o.expr(n.Left, nil) n.Left = o.expr(n.Left, nil)
...@@ -562,6 +542,13 @@ func (o *Order) stmt(n *Node) { ...@@ -562,6 +542,13 @@ func (o *Order) stmt(n *Node) {
o.mapAssign(n) o.mapAssign(n)
o.cleanTemp(t) o.cleanTemp(t)
case OAS2:
t := o.markTemp()
o.exprList(n.List)
o.exprList(n.Rlist)
o.mapAssign(n)
o.cleanTemp(t)
// Special: avoid copy of func call n.Right // Special: avoid copy of func call n.Right
case OAS2FUNC: case OAS2FUNC:
t := o.markTemp() t := o.markTemp()
...@@ -620,6 +607,20 @@ func (o *Order) stmt(n *Node) { ...@@ -620,6 +607,20 @@ func (o *Order) stmt(n *Node) {
o.out = append(o.out, n) o.out = append(o.out, n)
o.cleanTemp(t) o.cleanTemp(t)
case OCLOSE,
OCOPY,
OPRINT,
OPRINTN,
ORECOVER,
ORECV:
t := o.markTemp()
n.Left = o.expr(n.Left, nil)
n.Right = o.expr(n.Right, nil)
o.exprList(n.List)
o.exprList(n.Rlist)
o.out = append(o.out, n)
o.cleanTemp(t)
// Special: order arguments to inner call but not call itself. // Special: order arguments to inner call but not call itself.
case ODEFER, OGO: case ODEFER, OGO:
t := o.markTemp() t := o.markTemp()
......
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