Commit 0b647ffb authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/compile: combine walkexpr cases

The type switch in walkexpr is giant.
Shrink it a little by coalescing identical cases
and removing some vertical whitespace.

No functional changes.

Passes toolstash-check.

Change-Id: I7f7efb4faae1f8657dfafac04585172f99d8b37d
Reviewed-on: https://go-review.googlesource.com/38652
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 2c50bffe
...@@ -498,24 +498,15 @@ opswitch: ...@@ -498,24 +498,15 @@ opswitch:
Dump("walk", n) Dump("walk", n)
Fatalf("walkexpr: switch 1 unknown op %+S", n) Fatalf("walkexpr: switch 1 unknown op %+S", n)
case OTYPE, case OTYPE, ONONAME, OINDREGSP, OEMPTY, OGETG:
ONONAME,
OINDREGSP,
OEMPTY,
OGETG:
case ONOT, case ONOT, OMINUS, OPLUS, OCOM, OREAL, OIMAG, ODOTMETH, ODOTINTER,
OMINUS, OIND, OSPTR, OITAB, OIDATA, ODOTTYPE, ODOTTYPE2, OADDR:
OPLUS,
OCOM,
OREAL,
OIMAG,
ODOTMETH,
ODOTINTER:
n.Left = walkexpr(n.Left, init) n.Left = walkexpr(n.Left, init)
case OIND: case OEFACE, OAND, OSUB, OMUL, OLT, OLE, OGE, OGT, OADD, OOR, OXOR:
n.Left = walkexpr(n.Left, init) n.Left = walkexpr(n.Left, init)
n.Right = walkexpr(n.Right, init)
case ODOT: case ODOT:
usefield(n) usefield(n)
...@@ -532,13 +523,6 @@ opswitch: ...@@ -532,13 +523,6 @@ opswitch:
n.Left = walkexpr(n.Left, init) n.Left = walkexpr(n.Left, init)
case OEFACE:
n.Left = walkexpr(n.Left, init)
n.Right = walkexpr(n.Right, init)
case OSPTR, OITAB, OIDATA:
n.Left = walkexpr(n.Left, init)
case OLEN, OCAP: case OLEN, OCAP:
n.Left = walkexpr(n.Left, init) n.Left = walkexpr(n.Left, init)
...@@ -564,19 +548,6 @@ opswitch: ...@@ -564,19 +548,6 @@ opswitch:
Warn("shift bounds check elided") Warn("shift bounds check elided")
} }
case OAND,
OSUB,
OMUL,
OLT,
OLE,
OGE,
OGT,
OADD,
OOR,
OXOR:
n.Left = walkexpr(n.Left, init)
n.Right = walkexpr(n.Right, init)
case OCOMPLEX: case OCOMPLEX:
// Use results from call expression as arguments for complex. // Use results from call expression as arguments for complex.
if n.Left == nil && n.Right == nil { if n.Left == nil && n.Right == nil {
...@@ -622,13 +593,7 @@ opswitch: ...@@ -622,13 +593,7 @@ opswitch:
case ORECOVER: case ORECOVER:
n = mkcall("gorecover", n.Type, init, nod(OADDR, nodfp, nil)) n = mkcall("gorecover", n.Type, init, nod(OADDR, nodfp, nil))
case OLITERAL: case OLITERAL, OCLOSUREVAR, OCFUNC, ONAME:
n.SetAddable(true)
case OCLOSUREVAR, OCFUNC:
n.SetAddable(true)
case ONAME:
n.SetAddable(true) n.SetAddable(true)
case OCALLINTER: case OCALLINTER:
...@@ -794,7 +759,7 @@ opswitch: ...@@ -794,7 +759,7 @@ opswitch:
n = nod(OAS, ok, call) n = nod(OAS, ok, call)
n = typecheck(n, Etop) n = typecheck(n, Etop)
// a,b = m[i]; // a,b = m[i]
case OAS2MAPR: case OAS2MAPR:
init.AppendNodes(&n.Ninit) init.AppendNodes(&n.Ninit)
...@@ -874,9 +839,6 @@ opswitch: ...@@ -874,9 +839,6 @@ opswitch:
e := n.Rlist.First() // i.(T) e := n.Rlist.First() // i.(T)
e.Left = walkexpr(e.Left, init) e.Left = walkexpr(e.Left, init)
case ODOTTYPE, ODOTTYPE2:
n.Left = walkexpr(n.Left, init)
case OCONVIFACE: case OCONVIFACE:
n.Left = walkexpr(n.Left, init) n.Left = walkexpr(n.Left, init)
...@@ -1242,9 +1204,6 @@ opswitch: ...@@ -1242,9 +1204,6 @@ opswitch:
n = reduceSlice(n) n = reduceSlice(n)
} }
case OADDR:
n.Left = walkexpr(n.Left, init)
case ONEW: case ONEW:
if n.Esc == EscNone { if n.Esc == EscNone {
if n.Type.Elem().Width >= 1<<16 { if n.Type.Elem().Width >= 1<<16 {
......
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