Commit c3dfad5d authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: change Oconv to take an Op parameter

Eliminates type conversions in a bunch of Oconv(int(n.Op), ...) calls.

Notably, this identified a misuse of Oconv in amd64/gsubr.go to try to
print an assembly instruction op instead of a compiler node op.

Change-Id: I93b5aa49fe14a5eaf868b05426d3b8cd8ab52bc5
Reviewed-on: https://go-review.googlesource.com/20298
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 0de0cafb
...@@ -722,7 +722,7 @@ func optoas(op gc.Op, t *gc.Type) int { ...@@ -722,7 +722,7 @@ func optoas(op gc.Op, t *gc.Type) int {
a := obj.AXXX a := obj.AXXX
switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) { switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) {
default: default:
gc.Fatalf("optoas: no entry %v-%v", gc.Oconv(int(op), 0), t) gc.Fatalf("optoas: no entry %v-%v", gc.Oconv(op, 0), t)
case OADDR_ | gc.TPTR32: case OADDR_ | gc.TPTR32:
a = x86.ALEAL a = x86.ALEAL
...@@ -1264,7 +1264,7 @@ func jmptoset(jmp int) int { ...@@ -1264,7 +1264,7 @@ func jmptoset(jmp int) int {
case x86.AJPS: case x86.AJPS:
return x86.ASETPS return x86.ASETPS
} }
gc.Fatalf("jmptoset: no entry for %v", gc.Oconv(jmp, 0)) gc.Fatalf("jmptoset: no entry for %v", jmp)
panic("unreachable") panic("unreachable")
} }
......
...@@ -19,7 +19,7 @@ func cgen64(n *gc.Node, res *gc.Node) { ...@@ -19,7 +19,7 @@ func cgen64(n *gc.Node, res *gc.Node) {
if res.Op != gc.OINDREG && res.Op != gc.ONAME { if res.Op != gc.OINDREG && res.Op != gc.ONAME {
gc.Dump("n", n) gc.Dump("n", n)
gc.Dump("res", res) gc.Dump("res", res)
gc.Fatalf("cgen64 %v of %v", gc.Oconv(int(n.Op), 0), gc.Oconv(int(res.Op), 0)) gc.Fatalf("cgen64 %v of %v", gc.Oconv(n.Op, 0), gc.Oconv(res.Op, 0))
} }
l := n.Left l := n.Left
...@@ -35,7 +35,7 @@ func cgen64(n *gc.Node, res *gc.Node) { ...@@ -35,7 +35,7 @@ func cgen64(n *gc.Node, res *gc.Node) {
split64(l, &lo1, &hi1) split64(l, &lo1, &hi1)
switch n.Op { switch n.Op {
default: default:
gc.Fatalf("cgen64 %v", gc.Oconv(int(n.Op), 0)) gc.Fatalf("cgen64 %v", gc.Oconv(n.Op, 0))
case gc.OMINUS: case gc.OMINUS:
var lo2 gc.Node var lo2 gc.Node
...@@ -793,7 +793,7 @@ func cmp64(nl *gc.Node, nr *gc.Node, op gc.Op, likely int, to *obj.Prog) { ...@@ -793,7 +793,7 @@ func cmp64(nl *gc.Node, nr *gc.Node, op gc.Op, likely int, to *obj.Prog) {
var br *obj.Prog var br *obj.Prog
switch op { switch op {
default: default:
gc.Fatalf("cmp64 %v %v", gc.Oconv(int(op), 0), t) gc.Fatalf("cmp64 %v %v", gc.Oconv(op, 0), t)
// cmp hi // cmp hi
// bne L // bne L
......
...@@ -719,7 +719,7 @@ func raddr(n *gc.Node, p *obj.Prog) { ...@@ -719,7 +719,7 @@ func raddr(n *gc.Node, p *obj.Prog) {
gc.Naddr(&a, n) gc.Naddr(&a, n)
if a.Type != obj.TYPE_REG { if a.Type != obj.TYPE_REG {
if n != nil { if n != nil {
gc.Fatalf("bad in raddr: %v", gc.Oconv(int(n.Op), 0)) gc.Fatalf("bad in raddr: %v", gc.Oconv(n.Op, 0))
} else { } else {
gc.Fatalf("bad in raddr: <null>") gc.Fatalf("bad in raddr: <null>")
} }
...@@ -790,7 +790,7 @@ func optoas(op gc.Op, t *gc.Type) int { ...@@ -790,7 +790,7 @@ func optoas(op gc.Op, t *gc.Type) int {
a := obj.AXXX a := obj.AXXX
switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) { switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) {
default: default:
gc.Fatalf("optoas: no entry %v-%v etype %v simtype %v", gc.Oconv(int(op), 0), t, gc.Types[t.Etype], gc.Types[gc.Simtype[t.Etype]]) gc.Fatalf("optoas: no entry %v-%v etype %v simtype %v", gc.Oconv(op, 0), t, gc.Types[t.Etype], gc.Types[gc.Simtype[t.Etype]])
/* case CASE(OADDR, TPTR32): /* case CASE(OADDR, TPTR32):
a = ALEAL; a = ALEAL;
......
...@@ -567,7 +567,7 @@ func raddr(n *gc.Node, p *obj.Prog) { ...@@ -567,7 +567,7 @@ func raddr(n *gc.Node, p *obj.Prog) {
gc.Naddr(&a, n) gc.Naddr(&a, n)
if a.Type != obj.TYPE_REG { if a.Type != obj.TYPE_REG {
if n != nil { if n != nil {
gc.Fatalf("bad in raddr: %v", gc.Oconv(int(n.Op), 0)) gc.Fatalf("bad in raddr: %v", gc.Oconv(n.Op, 0))
} else { } else {
gc.Fatalf("bad in raddr: <null>") gc.Fatalf("bad in raddr: <null>")
} }
...@@ -579,7 +579,7 @@ func raddr(n *gc.Node, p *obj.Prog) { ...@@ -579,7 +579,7 @@ func raddr(n *gc.Node, p *obj.Prog) {
func gcmp(as int, lhs *gc.Node, rhs *gc.Node) *obj.Prog { func gcmp(as int, lhs *gc.Node, rhs *gc.Node) *obj.Prog {
if lhs.Op != gc.OREGISTER { if lhs.Op != gc.OREGISTER {
gc.Fatalf("bad operands to gcmp: %v %v", gc.Oconv(int(lhs.Op), 0), gc.Oconv(int(rhs.Op), 0)) gc.Fatalf("bad operands to gcmp: %v %v", gc.Oconv(lhs.Op, 0), gc.Oconv(rhs.Op, 0))
} }
p := rawgins(as, rhs, nil) p := rawgins(as, rhs, nil)
...@@ -622,7 +622,7 @@ func optoas(op gc.Op, t *gc.Type) int { ...@@ -622,7 +622,7 @@ func optoas(op gc.Op, t *gc.Type) int {
a := int(obj.AXXX) a := int(obj.AXXX)
switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) { switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) {
default: default:
gc.Fatalf("optoas: no entry for op=%v type=%v", gc.Oconv(int(op), 0), t) gc.Fatalf("optoas: no entry for op=%v type=%v", gc.Oconv(op, 0), t)
case OEQ_ | gc.TBOOL, case OEQ_ | gc.TBOOL,
OEQ_ | gc.TINT8, OEQ_ | gc.TINT8,
......
...@@ -221,7 +221,7 @@ func Export(out *obj.Biobuf, trace bool) int { ...@@ -221,7 +221,7 @@ func Export(out *obj.Biobuf, trace bool) int {
types = append(types, t) types = append(types, t)
default: default:
Fatalf("exporter: unexpected export symbol: %v %v", Oconv(int(n.Op), 0), sym) Fatalf("exporter: unexpected export symbol: %v %v", Oconv(n.Op, 0), sym)
} }
} }
} }
......
...@@ -1792,7 +1792,7 @@ func bgenx(n, res *Node, wantTrue bool, likely int, to *obj.Prog) { ...@@ -1792,7 +1792,7 @@ func bgenx(n, res *Node, wantTrue bool, likely int, to *obj.Prog) {
} }
if n.Type.Etype != TBOOL { if n.Type.Etype != TBOOL {
Fatalf("bgen: bad type %v for %v", n.Type, Oconv(int(n.Op), 0)) Fatalf("bgen: bad type %v for %v", n.Type, Oconv(n.Op, 0))
} }
for n.Op == OCONVNOP { for n.Op == OCONVNOP {
...@@ -2439,12 +2439,12 @@ func Ginscall(f *Node, proc int) { ...@@ -2439,12 +2439,12 @@ func Ginscall(f *Node, proc int) {
func cgen_callinter(n *Node, res *Node, proc int) { func cgen_callinter(n *Node, res *Node, proc int) {
i := n.Left i := n.Left
if i.Op != ODOTINTER { if i.Op != ODOTINTER {
Fatalf("cgen_callinter: not ODOTINTER %v", Oconv(int(i.Op), 0)) Fatalf("cgen_callinter: not ODOTINTER %v", Oconv(i.Op, 0))
} }
f := i.Right // field f := i.Right // field
if f.Op != ONAME { if f.Op != ONAME {
Fatalf("cgen_callinter: not ONAME %v", Oconv(int(f.Op), 0)) Fatalf("cgen_callinter: not ONAME %v", Oconv(f.Op, 0))
} }
i = i.Left // interface i = i.Left // interface
......
...@@ -648,7 +648,7 @@ func evconst(n *Node) { ...@@ -648,7 +648,7 @@ func evconst(n *Node) {
switch uint32(n.Op)<<16 | uint32(v.Ctype()) { switch uint32(n.Op)<<16 | uint32(v.Ctype()) {
default: default:
if n.Diag == 0 { if n.Diag == 0 {
Yyerror("illegal constant expression %v %v", Oconv(int(n.Op), 0), nl.Type) Yyerror("illegal constant expression %v %v", Oconv(n.Op, 0), nl.Type)
n.Diag = 1 n.Diag = 1
} }
return return
...@@ -1135,7 +1135,7 @@ setfalse: ...@@ -1135,7 +1135,7 @@ setfalse:
illegal: illegal:
if n.Diag == 0 { if n.Diag == 0 {
Yyerror("illegal constant expression: %v %v %v", nl.Type, Oconv(int(n.Op), 0), nr.Type) Yyerror("illegal constant expression: %v %v %v", nl.Type, Oconv(n.Op, 0), nr.Type)
n.Diag = 1 n.Diag = 1
} }
} }
......
...@@ -398,7 +398,7 @@ func Complexgen(n *Node, res *Node) { ...@@ -398,7 +398,7 @@ func Complexgen(n *Node, res *Node) {
switch n.Op { switch n.Op {
default: default:
Dump("complexgen: unknown op", n) Dump("complexgen: unknown op", n)
Fatalf("complexgen: unknown op %v", Oconv(int(n.Op), 0)) Fatalf("complexgen: unknown op %v", Oconv(n.Op, 0))
case ODOT, case ODOT,
ODOTPTR, ODOTPTR,
...@@ -457,7 +457,7 @@ func Complexgen(n *Node, res *Node) { ...@@ -457,7 +457,7 @@ func Complexgen(n *Node, res *Node) {
switch n.Op { switch n.Op {
default: default:
Fatalf("complexgen: unknown op %v", Oconv(int(n.Op), 0)) Fatalf("complexgen: unknown op %v", Oconv(n.Op, 0))
case OCONV: case OCONV:
Complexmove(nl, res) Complexmove(nl, res)
......
...@@ -564,7 +564,7 @@ func funchdr(n *Node) { ...@@ -564,7 +564,7 @@ func funchdr(n *Node) {
func funcargs(nt *Node) { func funcargs(nt *Node) {
if nt.Op != OTFUNC { if nt.Op != OTFUNC {
Fatalf("funcargs %v", Oconv(int(nt.Op), 0)) Fatalf("funcargs %v", Oconv(nt.Op, 0))
} }
// re-start the variable generation number // re-start the variable generation number
...@@ -578,7 +578,7 @@ func funcargs(nt *Node) { ...@@ -578,7 +578,7 @@ func funcargs(nt *Node) {
if nt.Left != nil { if nt.Left != nil {
n := nt.Left n := nt.Left
if n.Op != ODCLFIELD { if n.Op != ODCLFIELD {
Fatalf("funcargs receiver %v", Oconv(int(n.Op), 0)) Fatalf("funcargs receiver %v", Oconv(n.Op, 0))
} }
if n.Left != nil { if n.Left != nil {
n.Left.Op = ONAME n.Left.Op = ONAME
...@@ -595,7 +595,7 @@ func funcargs(nt *Node) { ...@@ -595,7 +595,7 @@ func funcargs(nt *Node) {
for it := nodeSeqIterate(nt.List); !it.Done(); it.Next() { for it := nodeSeqIterate(nt.List); !it.Done(); it.Next() {
n = it.N() n = it.N()
if n.Op != ODCLFIELD { if n.Op != ODCLFIELD {
Fatalf("funcargs in %v", Oconv(int(n.Op), 0)) Fatalf("funcargs in %v", Oconv(n.Op, 0))
} }
if n.Left != nil { if n.Left != nil {
n.Left.Op = ONAME n.Left.Op = ONAME
...@@ -616,7 +616,7 @@ func funcargs(nt *Node) { ...@@ -616,7 +616,7 @@ func funcargs(nt *Node) {
n = it.N() n = it.N()
if n.Op != ODCLFIELD { if n.Op != ODCLFIELD {
Fatalf("funcargs out %v", Oconv(int(n.Op), 0)) Fatalf("funcargs out %v", Oconv(n.Op, 0))
} }
if n.Left == nil { if n.Left == nil {
......
...@@ -943,8 +943,8 @@ func escassign(e *EscState, dst *Node, src *Node) { ...@@ -943,8 +943,8 @@ func escassign(e *EscState, dst *Node, src *Node) {
if Debug['m'] > 1 { if Debug['m'] > 1 {
fmt.Printf("%v:[%d] %v escassign: %v(%v)[%v] = %v(%v)[%v]\n", fmt.Printf("%v:[%d] %v escassign: %v(%v)[%v] = %v(%v)[%v]\n",
linestr(lineno), e.loopdepth, funcSym(Curfn), linestr(lineno), e.loopdepth, funcSym(Curfn),
Nconv(dst, obj.FmtShort), Jconv(dst, obj.FmtShort), Oconv(int(dst.Op), 0), Nconv(dst, obj.FmtShort), Jconv(dst, obj.FmtShort), Oconv(dst.Op, 0),
Nconv(src, obj.FmtShort), Jconv(src, obj.FmtShort), Oconv(int(src.Op), 0)) Nconv(src, obj.FmtShort), Jconv(src, obj.FmtShort), Oconv(src.Op, 0))
} }
setlineno(dst) setlineno(dst)
...@@ -1639,7 +1639,7 @@ func escwalkBody(e *EscState, level Level, dst *Node, src *Node, extraloopdepth ...@@ -1639,7 +1639,7 @@ func escwalkBody(e *EscState, level Level, dst *Node, src *Node, extraloopdepth
if Debug['m'] > 1 { if Debug['m'] > 1 {
fmt.Printf("escwalk: level:%d depth:%d %.*s op=%v %v(%v) scope:%v[%d] extraloopdepth=%v\n", fmt.Printf("escwalk: level:%d depth:%d %.*s op=%v %v(%v) scope:%v[%d] extraloopdepth=%v\n",
level, e.pdepth, e.pdepth, "\t\t\t\t\t\t\t\t\t\t", Oconv(int(src.Op), 0), Nconv(src, obj.FmtShort), Jconv(src, obj.FmtShort), e.curfnSym(src), srcE.Escloopdepth, extraloopdepth) level, e.pdepth, e.pdepth, "\t\t\t\t\t\t\t\t\t\t", Oconv(src.Op, 0), Nconv(src, obj.FmtShort), Jconv(src, obj.FmtShort), e.curfnSym(src), srcE.Escloopdepth, extraloopdepth)
} }
e.pdepth++ e.pdepth++
......
...@@ -338,7 +338,7 @@ func dumpsym(s *Sym) { ...@@ -338,7 +338,7 @@ func dumpsym(s *Sym) {
switch s.Def.Op { switch s.Def.Op {
default: default:
Yyerror("unexpected export symbol: %v %v", Oconv(int(s.Def.Op), 0), s) Yyerror("unexpected export symbol: %v %v", Oconv(s.Def.Op, 0), s)
case OLITERAL: case OLITERAL:
dumpexportconst(s) dumpexportconst(s)
......
...@@ -174,14 +174,14 @@ var goopnames = []string{ ...@@ -174,14 +174,14 @@ var goopnames = []string{
} }
// Fmt "%O": Node opcodes // Fmt "%O": Node opcodes
func Oconv(o int, flag int) string { func Oconv(o Op, flag int) string {
if (flag&obj.FmtSharp != 0) || fmtmode != FDbg { if (flag&obj.FmtSharp != 0) || fmtmode != FDbg {
if o >= 0 && o < len(goopnames) && goopnames[o] != "" { if o >= 0 && int(o) < len(goopnames) && goopnames[o] != "" {
return goopnames[o] return goopnames[o]
} }
} }
if o >= 0 && o < len(opnames) && opnames[o] != "" { if o >= 0 && int(o) < len(opnames) && opnames[o] != "" {
return opnames[o] return opnames[o]
} }
...@@ -859,7 +859,7 @@ func stmtfmt(n *Node) string { ...@@ -859,7 +859,7 @@ func stmtfmt(n *Node) string {
break break
} }
f += fmt.Sprintf("%v %v= %v", n.Left, Oconv(int(n.Etype), obj.FmtSharp), n.Right) f += fmt.Sprintf("%v %v= %v", n.Left, Oconv(Op(n.Etype), obj.FmtSharp), n.Right)
case OAS2: case OAS2:
if n.Colas && !complexinit { if n.Colas && !complexinit {
...@@ -933,11 +933,11 @@ func stmtfmt(n *Node) string { ...@@ -933,11 +933,11 @@ func stmtfmt(n *Node) string {
case OSELECT, OSWITCH: case OSELECT, OSWITCH:
if fmtmode == FErr { if fmtmode == FErr {
f += fmt.Sprintf("%v statement", Oconv(int(n.Op), 0)) f += fmt.Sprintf("%v statement", Oconv(n.Op, 0))
break break
} }
f += Oconv(int(n.Op), obj.FmtSharp) f += Oconv(n.Op, obj.FmtSharp)
if simpleinit { if simpleinit {
f += fmt.Sprintf(" %v;", nodeSeqFirst(n.Ninit)) f += fmt.Sprintf(" %v;", nodeSeqFirst(n.Ninit))
} }
...@@ -960,9 +960,9 @@ func stmtfmt(n *Node) string { ...@@ -960,9 +960,9 @@ func stmtfmt(n *Node) string {
OFALL, OFALL,
OXFALL: OXFALL:
if n.Left != nil { if n.Left != nil {
f += fmt.Sprintf("%v %v", Oconv(int(n.Op), obj.FmtSharp), n.Left) f += fmt.Sprintf("%v %v", Oconv(n.Op, obj.FmtSharp), n.Left)
} else { } else {
f += Oconv(int(n.Op), obj.FmtSharp) f += Oconv(n.Op, obj.FmtSharp)
} }
case OEMPTY: case OEMPTY:
...@@ -1341,7 +1341,7 @@ func exprfmt(n *Node, prec int) string { ...@@ -1341,7 +1341,7 @@ func exprfmt(n *Node, prec int) string {
return f return f
case OCOPY, OCOMPLEX: case OCOPY, OCOMPLEX:
return fmt.Sprintf("%v(%v, %v)", Oconv(int(n.Op), obj.FmtSharp), n.Left, n.Right) return fmt.Sprintf("%v(%v, %v)", Oconv(n.Op, obj.FmtSharp), n.Left, n.Right)
case OCONV, case OCONV,
OCONVIFACE, OCONVIFACE,
...@@ -1373,12 +1373,12 @@ func exprfmt(n *Node, prec int) string { ...@@ -1373,12 +1373,12 @@ func exprfmt(n *Node, prec int) string {
OPRINT, OPRINT,
OPRINTN: OPRINTN:
if n.Left != nil { if n.Left != nil {
return fmt.Sprintf("%v(%v)", Oconv(int(n.Op), obj.FmtSharp), n.Left) return fmt.Sprintf("%v(%v)", Oconv(n.Op, obj.FmtSharp), n.Left)
} }
if n.Isddd { if n.Isddd {
return fmt.Sprintf("%v(%v...)", Oconv(int(n.Op), obj.FmtSharp), Hconv(n.List, obj.FmtComma)) return fmt.Sprintf("%v(%v...)", Oconv(n.Op, obj.FmtSharp), Hconv(n.List, obj.FmtComma))
} }
return fmt.Sprintf("%v(%v)", Oconv(int(n.Op), obj.FmtSharp), Hconv(n.List, obj.FmtComma)) return fmt.Sprintf("%v(%v)", Oconv(n.Op, obj.FmtSharp), Hconv(n.List, obj.FmtComma))
case OCALL, OCALLFUNC, OCALLINTER, OCALLMETH, OGETG: case OCALL, OCALLFUNC, OCALLINTER, OCALLMETH, OGETG:
var f string var f string
...@@ -1412,9 +1412,9 @@ func exprfmt(n *Node, prec int) string { ...@@ -1412,9 +1412,9 @@ func exprfmt(n *Node, prec int) string {
ORECV: ORECV:
var f string var f string
if n.Left.Op == n.Op { if n.Left.Op == n.Op {
f += fmt.Sprintf("%v ", Oconv(int(n.Op), obj.FmtSharp)) f += fmt.Sprintf("%v ", Oconv(n.Op, obj.FmtSharp))
} else { } else {
f += Oconv(int(n.Op), obj.FmtSharp) f += Oconv(n.Op, obj.FmtSharp)
} }
f += exprfmt(n.Left, nprec+1) f += exprfmt(n.Left, nprec+1)
return f return f
...@@ -1443,7 +1443,7 @@ func exprfmt(n *Node, prec int) string { ...@@ -1443,7 +1443,7 @@ func exprfmt(n *Node, prec int) string {
var f string var f string
f += exprfmt(n.Left, nprec) f += exprfmt(n.Left, nprec)
f += fmt.Sprintf(" %v ", Oconv(int(n.Op), obj.FmtSharp)) f += fmt.Sprintf(" %v ", Oconv(n.Op, obj.FmtSharp))
f += exprfmt(n.Right, nprec+1) f += exprfmt(n.Right, nprec+1)
return f return f
...@@ -1464,12 +1464,12 @@ func exprfmt(n *Node, prec int) string { ...@@ -1464,12 +1464,12 @@ func exprfmt(n *Node, prec int) string {
var f string var f string
f += exprfmt(n.Left, nprec) f += exprfmt(n.Left, nprec)
// TODO(marvin): Fix Node.EType type union. // TODO(marvin): Fix Node.EType type union.
f += fmt.Sprintf(" %v ", Oconv(int(n.Etype), obj.FmtSharp)) f += fmt.Sprintf(" %v ", Oconv(Op(n.Etype), obj.FmtSharp))
f += exprfmt(n.Right, nprec+1) f += exprfmt(n.Right, nprec+1)
return f return f
} }
return fmt.Sprintf("<node %v>", Oconv(int(n.Op), 0)) return fmt.Sprintf("<node %v>", Oconv(n.Op, 0))
} }
func nodefmt(n *Node, flag int) string { func nodefmt(n *Node, flag int) string {
...@@ -1524,40 +1524,40 @@ func nodedump(n *Node, flag int) string { ...@@ -1524,40 +1524,40 @@ func nodedump(n *Node, flag int) string {
} }
if nodeSeqLen(n.Ninit) != 0 { if nodeSeqLen(n.Ninit) != 0 {
fmt.Fprintf(&buf, "%v-init%v", Oconv(int(n.Op), 0), n.Ninit) fmt.Fprintf(&buf, "%v-init%v", Oconv(n.Op, 0), n.Ninit)
indent(&buf) indent(&buf)
} }
} }
switch n.Op { switch n.Op {
default: default:
fmt.Fprintf(&buf, "%v%v", Oconv(int(n.Op), 0), Jconv(n, 0)) fmt.Fprintf(&buf, "%v%v", Oconv(n.Op, 0), Jconv(n, 0))
case OREGISTER, OINDREG: case OREGISTER, OINDREG:
fmt.Fprintf(&buf, "%v-%v%v", Oconv(int(n.Op), 0), obj.Rconv(int(n.Reg)), Jconv(n, 0)) fmt.Fprintf(&buf, "%v-%v%v", Oconv(n.Op, 0), obj.Rconv(int(n.Reg)), Jconv(n, 0))
case OLITERAL: case OLITERAL:
fmt.Fprintf(&buf, "%v-%v%v", Oconv(int(n.Op), 0), Vconv(n.Val(), 0), Jconv(n, 0)) fmt.Fprintf(&buf, "%v-%v%v", Oconv(n.Op, 0), Vconv(n.Val(), 0), Jconv(n, 0))
case ONAME, ONONAME: case ONAME, ONONAME:
if n.Sym != nil { if n.Sym != nil {
fmt.Fprintf(&buf, "%v-%v%v", Oconv(int(n.Op), 0), n.Sym, Jconv(n, 0)) fmt.Fprintf(&buf, "%v-%v%v", Oconv(n.Op, 0), n.Sym, Jconv(n, 0))
} else { } else {
fmt.Fprintf(&buf, "%v%v", Oconv(int(n.Op), 0), Jconv(n, 0)) fmt.Fprintf(&buf, "%v%v", Oconv(n.Op, 0), Jconv(n, 0))
} }
if recur && n.Type == nil && n.Name != nil && n.Name.Param != nil && n.Name.Param.Ntype != nil { if recur && n.Type == nil && n.Name != nil && n.Name.Param != nil && n.Name.Param.Ntype != nil {
indent(&buf) indent(&buf)
fmt.Fprintf(&buf, "%v-ntype%v", Oconv(int(n.Op), 0), n.Name.Param.Ntype) fmt.Fprintf(&buf, "%v-ntype%v", Oconv(n.Op, 0), n.Name.Param.Ntype)
} }
case OASOP: case OASOP:
fmt.Fprintf(&buf, "%v-%v%v", Oconv(int(n.Op), 0), Oconv(int(n.Etype), 0), Jconv(n, 0)) fmt.Fprintf(&buf, "%v-%v%v", Oconv(n.Op, 0), Oconv(Op(n.Etype), 0), Jconv(n, 0))
case OTYPE: case OTYPE:
fmt.Fprintf(&buf, "%v %v%v type=%v", Oconv(int(n.Op), 0), n.Sym, Jconv(n, 0), n.Type) fmt.Fprintf(&buf, "%v %v%v type=%v", Oconv(n.Op, 0), n.Sym, Jconv(n, 0), n.Type)
if recur && n.Type == nil && n.Name.Param.Ntype != nil { if recur && n.Type == nil && n.Name.Param.Ntype != nil {
indent(&buf) indent(&buf)
fmt.Fprintf(&buf, "%v-ntype%v", Oconv(int(n.Op), 0), n.Name.Param.Ntype) fmt.Fprintf(&buf, "%v-ntype%v", Oconv(n.Op, 0), n.Name.Param.Ntype)
} }
} }
...@@ -1578,17 +1578,17 @@ func nodedump(n *Node, flag int) string { ...@@ -1578,17 +1578,17 @@ func nodedump(n *Node, flag int) string {
} }
if nodeSeqLen(n.List) != 0 { if nodeSeqLen(n.List) != 0 {
indent(&buf) indent(&buf)
fmt.Fprintf(&buf, "%v-list%v", Oconv(int(n.Op), 0), n.List) fmt.Fprintf(&buf, "%v-list%v", Oconv(n.Op, 0), n.List)
} }
if nodeSeqLen(n.Rlist) != 0 { if nodeSeqLen(n.Rlist) != 0 {
indent(&buf) indent(&buf)
fmt.Fprintf(&buf, "%v-rlist%v", Oconv(int(n.Op), 0), n.Rlist) fmt.Fprintf(&buf, "%v-rlist%v", Oconv(n.Op, 0), n.Rlist)
} }
if len(n.Nbody.Slice()) != 0 { if len(n.Nbody.Slice()) != 0 {
indent(&buf) indent(&buf)
fmt.Fprintf(&buf, "%v-body%v", Oconv(int(n.Op), 0), n.Nbody) fmt.Fprintf(&buf, "%v-body%v", Oconv(n.Op, 0), n.Nbody)
} }
} }
......
...@@ -225,7 +225,7 @@ func Genlist(l nodesOrNodeList) { ...@@ -225,7 +225,7 @@ func Genlist(l nodesOrNodeList) {
func cgen_proc(n *Node, proc int) { func cgen_proc(n *Node, proc int) {
switch n.Left.Op { switch n.Left.Op {
default: default:
Fatalf("cgen_proc: unknown call %v", Oconv(int(n.Left.Op), 0)) Fatalf("cgen_proc: unknown call %v", Oconv(n.Left.Op, 0))
case OCALLMETH: case OCALLMETH:
cgen_callmeth(n.Left, proc) cgen_callmeth(n.Left, proc)
......
...@@ -322,7 +322,7 @@ func Naddr(a *obj.Addr, n *Node) { ...@@ -322,7 +322,7 @@ func Naddr(a *obj.Addr, n *Node) {
a := a // copy to let escape into Ctxt.Dconv a := a // copy to let escape into Ctxt.Dconv
Debug['h'] = 1 Debug['h'] = 1
Dump("naddr", n) Dump("naddr", n)
Fatalf("naddr: bad %v %v", Oconv(int(n.Op), 0), Ctxt.Dconv(a)) Fatalf("naddr: bad %v %v", Oconv(n.Op, 0), Ctxt.Dconv(a))
case OREGISTER: case OREGISTER:
a.Type = obj.TYPE_REG a.Type = obj.TYPE_REG
...@@ -423,7 +423,7 @@ func Naddr(a *obj.Addr, n *Node) { ...@@ -423,7 +423,7 @@ func Naddr(a *obj.Addr, n *Node) {
if n.Left.Type.Etype != TSTRUCT || n.Left.Type.Type.Sym != n.Right.Sym { if n.Left.Type.Etype != TSTRUCT || n.Left.Type.Type.Sym != n.Right.Sym {
Debug['h'] = 1 Debug['h'] = 1
Dump("naddr", n) Dump("naddr", n)
Fatalf("naddr: bad %v %v", Oconv(int(n.Op), 0), Ctxt.Dconv(a)) Fatalf("naddr: bad %v %v", Oconv(n.Op, 0), Ctxt.Dconv(a))
} }
Naddr(a, n.Left) Naddr(a, n.Left)
...@@ -466,7 +466,7 @@ func Naddr(a *obj.Addr, n *Node) { ...@@ -466,7 +466,7 @@ func Naddr(a *obj.Addr, n *Node) {
} }
if a.Type != obj.TYPE_MEM { if a.Type != obj.TYPE_MEM {
a := a // copy to let escape into Ctxt.Dconv a := a // copy to let escape into Ctxt.Dconv
Fatalf("naddr: OADDR %v (from %v)", Ctxt.Dconv(a), Oconv(int(n.Left.Op), 0)) Fatalf("naddr: OADDR %v (from %v)", Ctxt.Dconv(a), Oconv(n.Left.Op, 0))
} }
a.Type = obj.TYPE_ADDR a.Type = obj.TYPE_ADDR
......
...@@ -174,7 +174,7 @@ func ordersafeexpr(n *Node, order *Order) *Node { ...@@ -174,7 +174,7 @@ func ordersafeexpr(n *Node, order *Order) *Node {
return a return a
} }
Fatalf("ordersafeexpr %v", Oconv(int(n.Op), 0)) Fatalf("ordersafeexpr %v", Oconv(n.Op, 0))
return nil // not reached return nil // not reached
} }
...@@ -427,7 +427,7 @@ func ordercall(n *Node, order *Order) { ...@@ -427,7 +427,7 @@ func ordercall(n *Node, order *Order) {
func ordermapassign(n *Node, order *Order) { func ordermapassign(n *Node, order *Order) {
switch n.Op { switch n.Op {
default: default:
Fatalf("ordermapassign %v", Oconv(int(n.Op), 0)) Fatalf("ordermapassign %v", Oconv(n.Op, 0))
case OAS: case OAS:
order.out = append(order.out, n) order.out = append(order.out, n)
...@@ -486,7 +486,7 @@ func orderstmt(n *Node, order *Order) { ...@@ -486,7 +486,7 @@ func orderstmt(n *Node, order *Order) {
switch n.Op { switch n.Op {
default: default:
Fatalf("orderstmt %v", Oconv(int(n.Op), 0)) Fatalf("orderstmt %v", Oconv(n.Op, 0))
case OVARKILL, OVARLIVE: case OVARKILL, OVARLIVE:
order.out = append(order.out, n) order.out = append(order.out, n)
...@@ -802,7 +802,7 @@ func orderstmt(n *Node, order *Order) { ...@@ -802,7 +802,7 @@ func orderstmt(n *Node, order *Order) {
var r *Node var r *Node
for it := nodeSeqIterate(n.List); !it.Done(); it.Next() { for it := nodeSeqIterate(n.List); !it.Done(); it.Next() {
if it.N().Op != OXCASE { if it.N().Op != OXCASE {
Fatalf("order select case %v", Oconv(int(it.N().Op), 0)) Fatalf("order select case %v", Oconv(it.N().Op, 0))
} }
r = it.N().Left r = it.N().Left
setlineno(it.N()) setlineno(it.N())
...@@ -815,7 +815,7 @@ func orderstmt(n *Node, order *Order) { ...@@ -815,7 +815,7 @@ func orderstmt(n *Node, order *Order) {
if r != nil { if r != nil {
switch r.Op { switch r.Op {
default: default:
Yyerror("unknown op in select %v", Oconv(int(r.Op), 0)) Yyerror("unknown op in select %v", Oconv(r.Op, 0))
Dump("select case", r) Dump("select case", r)
// If this is case x := <-ch or case x, y := <-ch, the case has // If this is case x := <-ch or case x, y := <-ch, the case has
...@@ -957,7 +957,7 @@ func orderstmt(n *Node, order *Order) { ...@@ -957,7 +957,7 @@ func orderstmt(n *Node, order *Order) {
orderexpr(&n.Left, order, nil) orderexpr(&n.Left, order, nil)
for it := nodeSeqIterate(n.List); !it.Done(); it.Next() { for it := nodeSeqIterate(n.List); !it.Done(); it.Next() {
if it.N().Op != OXCASE { if it.N().Op != OXCASE {
Fatalf("order switch case %v", Oconv(int(it.N().Op), 0)) Fatalf("order switch case %v", Oconv(it.N().Op, 0))
} }
orderexprlistinplace(it.N().List, order) orderexprlistinplace(it.N().List, order)
orderblockNodes(&it.N().Nbody) orderblockNodes(&it.N().Nbody)
......
...@@ -90,7 +90,7 @@ func gvardefx(n *Node, as int) { ...@@ -90,7 +90,7 @@ func gvardefx(n *Node, as int) {
Fatalf("gvardef nil") Fatalf("gvardef nil")
} }
if n.Op != ONAME { if n.Op != ONAME {
Yyerror("gvardef %v; %v", Oconv(int(n.Op), obj.FmtSharp), n) Yyerror("gvardef %v; %v", Oconv(n.Op, obj.FmtSharp), n)
return return
} }
......
...@@ -135,7 +135,7 @@ func instrumentnode(np **Node, init nodesOrNodeListPtr, wr int, skip int) { ...@@ -135,7 +135,7 @@ func instrumentnode(np **Node, init nodesOrNodeListPtr, wr int, skip int) {
switch n.Op { switch n.Op {
default: default:
Fatalf("instrument: unknown node type %v", Oconv(int(n.Op), 0)) Fatalf("instrument: unknown node type %v", Oconv(n.Op, 0))
case OAS, OASWB, OAS2FUNC: case OAS, OASWB, OAS2FUNC:
instrumentnode(&n.Left, init, 1, 0) instrumentnode(&n.Left, init, 1, 0)
...@@ -364,13 +364,13 @@ func instrumentnode(np **Node, init nodesOrNodeListPtr, wr int, skip int) { ...@@ -364,13 +364,13 @@ func instrumentnode(np **Node, init nodesOrNodeListPtr, wr int, skip int) {
OAS2RECV, OAS2RECV,
OAS2MAPR, OAS2MAPR,
OASOP: OASOP:
Yyerror("instrument: %v must be lowered by now", Oconv(int(n.Op), 0)) Yyerror("instrument: %v must be lowered by now", Oconv(n.Op, 0))
goto ret goto ret
// impossible nodes: only appear in backend. // impossible nodes: only appear in backend.
case ORROTC, OEXTEND: case ORROTC, OEXTEND:
Yyerror("instrument: %v cannot exist now", Oconv(int(n.Op), 0)) Yyerror("instrument: %v cannot exist now", Oconv(n.Op, 0))
goto ret goto ret
case OGETG: case OGETG:
......
...@@ -18,7 +18,7 @@ func typecheckselect(sel *Node) { ...@@ -18,7 +18,7 @@ func typecheckselect(sel *Node) {
ncase = it.N() ncase = it.N()
setlineno(ncase) setlineno(ncase)
if ncase.Op != OXCASE { if ncase.Op != OXCASE {
Fatalf("typecheckselect %v", Oconv(int(ncase.Op), 0)) Fatalf("typecheckselect %v", Oconv(ncase.Op, 0))
} }
if nodeSeqLen(ncase.List) == 0 { if nodeSeqLen(ncase.List) == 0 {
...@@ -121,7 +121,7 @@ func walkselect(sel *Node) { ...@@ -121,7 +121,7 @@ func walkselect(sel *Node) {
var ch *Node var ch *Node
switch n.Op { switch n.Op {
default: default:
Fatalf("select %v", Oconv(int(n.Op), 0)) Fatalf("select %v", Oconv(n.Op, 0))
// ok already // ok already
case OSEND: case OSEND:
...@@ -218,7 +218,7 @@ func walkselect(sel *Node) { ...@@ -218,7 +218,7 @@ func walkselect(sel *Node) {
setNodeSeq(&r.Ninit, cas.Ninit) setNodeSeq(&r.Ninit, cas.Ninit)
switch n.Op { switch n.Op {
default: default:
Fatalf("select %v", Oconv(int(n.Op), 0)) Fatalf("select %v", Oconv(n.Op, 0))
// if selectnbsend(c, v) { body } else { default body } // if selectnbsend(c, v) { body } else { default body }
case OSEND: case OSEND:
...@@ -284,7 +284,7 @@ func walkselect(sel *Node) { ...@@ -284,7 +284,7 @@ func walkselect(sel *Node) {
} else { } else {
switch n.Op { switch n.Op {
default: default:
Fatalf("select %v", Oconv(int(n.Op), 0)) Fatalf("select %v", Oconv(n.Op, 0))
// selectsend(sel *byte, hchan *chan any, elem *any) (selected bool); // selectsend(sel *byte, hchan *chan any, elem *any) (selected bool);
case OSEND: case OSEND:
......
...@@ -2328,7 +2328,7 @@ func (s *state) call(n *Node, k callKind) *ssa.Value { ...@@ -2328,7 +2328,7 @@ func (s *state) call(n *Node, k callKind) *ssa.Value {
// want to set it here. // want to set it here.
case OCALLINTER: case OCALLINTER:
if fn.Op != ODOTINTER { if fn.Op != ODOTINTER {
Fatalf("OCALLINTER: n.Left not an ODOTINTER: %v", Oconv(int(fn.Op), 0)) Fatalf("OCALLINTER: n.Left not an ODOTINTER: %v", Oconv(fn.Op, 0))
} }
i := s.expr(fn.Left) i := s.expr(fn.Left)
itab := s.newValue1(ssa.OpITab, Types[TUINTPTR], i) itab := s.newValue1(ssa.OpITab, Types[TUINTPTR], i)
...@@ -2558,7 +2558,7 @@ func (s *state) addr(n *Node, bounded bool) *ssa.Value { ...@@ -2558,7 +2558,7 @@ func (s *state) addr(n *Node, bounded bool) *ssa.Value {
return s.call(n, callNormal) return s.call(n, callNormal)
default: default:
s.Unimplementedf("unhandled addr %v", Oconv(int(n.Op), 0)) s.Unimplementedf("unhandled addr %v", Oconv(n.Op, 0))
return nil return nil
} }
} }
......
...@@ -1376,9 +1376,9 @@ func printframenode(n *Node) { ...@@ -1376,9 +1376,9 @@ func printframenode(n *Node) {
} }
switch n.Op { switch n.Op {
case ONAME: case ONAME:
fmt.Printf("%v %v G%d %v width=%d\n", Oconv(int(n.Op), 0), n.Sym, n.Name.Vargen, n.Type, w) fmt.Printf("%v %v G%d %v width=%d\n", Oconv(n.Op, 0), n.Sym, n.Name.Vargen, n.Type, w)
case OTYPE: case OTYPE:
fmt.Printf("%v %v width=%d\n", Oconv(int(n.Op), 0), n.Type, w) fmt.Printf("%v %v width=%d\n", Oconv(n.Op, 0), n.Type, w)
} }
} }
...@@ -1459,7 +1459,7 @@ func badtype(op Op, tl *Type, tr *Type) { ...@@ -1459,7 +1459,7 @@ func badtype(op Op, tl *Type, tr *Type) {
} }
s := fmt_ s := fmt_
Yyerror("illegal types for operand: %v%s", Oconv(int(op), 0), s) Yyerror("illegal types for operand: %v%s", Oconv(op, 0), s)
} }
// iterator to walk a structure declaration // iterator to walk a structure declaration
...@@ -1601,7 +1601,7 @@ func Brcom(op Op) Op { ...@@ -1601,7 +1601,7 @@ func Brcom(op Op) Op {
case OGE: case OGE:
return OLT return OLT
} }
Fatalf("brcom: no com for %v\n", Oconv(int(op), 0)) Fatalf("brcom: no com for %v\n", Oconv(op, 0))
return op return op
} }
...@@ -1622,7 +1622,7 @@ func Brrev(op Op) Op { ...@@ -1622,7 +1622,7 @@ func Brrev(op Op) Op {
case OGE: case OGE:
return OLE return OLE
} }
Fatalf("brrev: no rev for %v\n", Oconv(int(op), 0)) Fatalf("brrev: no rev for %v\n", Oconv(op, 0))
return op return op
} }
......
...@@ -349,7 +349,7 @@ func casebody(sw *Node, typeswvar *Node) { ...@@ -349,7 +349,7 @@ func casebody(sw *Node, typeswvar *Node) {
n := it.N() n := it.N()
setlineno(n) setlineno(n)
if n.Op != OXCASE { if n.Op != OXCASE {
Fatalf("casebody %v", Oconv(int(n.Op), 0)) Fatalf("casebody %v", Oconv(n.Op, 0))
} }
n.Op = OCASE n.Op = OCASE
needvar := nodeSeqLen(n.List) != 1 || nodeSeqFirst(n.List).Op == OLITERAL needvar := nodeSeqLen(n.List) != 1 || nodeSeqFirst(n.List).Op == OLITERAL
......
...@@ -273,7 +273,7 @@ OpSwitch: ...@@ -273,7 +273,7 @@ OpSwitch:
default: default:
Dump("typecheck", n) Dump("typecheck", n)
Fatalf("typecheck %v", Oconv(int(n.Op), 0)) Fatalf("typecheck %v", Oconv(n.Op, 0))
// names // names
case OLITERAL: case OLITERAL:
...@@ -592,7 +592,7 @@ OpSwitch: ...@@ -592,7 +592,7 @@ OpSwitch:
aop = assignop(l.Type, r.Type, nil) aop = assignop(l.Type, r.Type, nil)
if aop != 0 { if aop != 0 {
if Isinter(r.Type) && !Isinter(l.Type) && algtype1(l.Type, nil) == ANOEQ { if Isinter(r.Type) && !Isinter(l.Type) && algtype1(l.Type, nil) == ANOEQ {
Yyerror("invalid operation: %v (operator %v not defined on %s)", n, Oconv(int(op), 0), typekind(l.Type)) Yyerror("invalid operation: %v (operator %v not defined on %s)", n, Oconv(op, 0), typekind(l.Type))
n.Type = nil n.Type = nil
return return
} }
...@@ -614,7 +614,7 @@ OpSwitch: ...@@ -614,7 +614,7 @@ OpSwitch:
aop = assignop(r.Type, l.Type, nil) aop = assignop(r.Type, l.Type, nil)
if aop != 0 { if aop != 0 {
if Isinter(l.Type) && !Isinter(r.Type) && algtype1(r.Type, nil) == ANOEQ { if Isinter(l.Type) && !Isinter(r.Type) && algtype1(r.Type, nil) == ANOEQ {
Yyerror("invalid operation: %v (operator %v not defined on %s)", n, Oconv(int(op), 0), typekind(r.Type)) Yyerror("invalid operation: %v (operator %v not defined on %s)", n, Oconv(op, 0), typekind(r.Type))
n.Type = nil n.Type = nil
return return
} }
...@@ -645,7 +645,7 @@ OpSwitch: ...@@ -645,7 +645,7 @@ OpSwitch:
} }
if !okfor[op][et] { if !okfor[op][et] {
Yyerror("invalid operation: %v (operator %v not defined on %s)", n, Oconv(int(op), 0), typekind(t)) Yyerror("invalid operation: %v (operator %v not defined on %s)", n, Oconv(op, 0), typekind(t))
n.Type = nil n.Type = nil
return return
} }
...@@ -753,7 +753,7 @@ OpSwitch: ...@@ -753,7 +753,7 @@ OpSwitch:
return return
} }
if !okfor[n.Op][t.Etype] { if !okfor[n.Op][t.Etype] {
Yyerror("invalid operation: %v %v", Oconv(int(n.Op), 0), t) Yyerror("invalid operation: %v %v", Oconv(n.Op, 0), t)
n.Type = nil n.Type = nil
return return
} }
...@@ -1369,7 +1369,7 @@ OpSwitch: ...@@ -1369,7 +1369,7 @@ OpSwitch:
case OCAP, OLEN, OREAL, OIMAG: case OCAP, OLEN, OREAL, OIMAG:
ok |= Erv ok |= Erv
if !onearg(n, "%v", Oconv(int(n.Op), 0)) { if !onearg(n, "%v", Oconv(n.Op, 0)) {
n.Type = nil n.Type = nil
return return
} }
...@@ -1438,7 +1438,7 @@ OpSwitch: ...@@ -1438,7 +1438,7 @@ OpSwitch:
break OpSwitch break OpSwitch
badcall1: badcall1:
Yyerror("invalid argument %v for %v", Nconv(n.Left, obj.FmtLong), Oconv(int(n.Op), 0)) Yyerror("invalid argument %v for %v", Nconv(n.Left, obj.FmtLong), Oconv(n.Op, 0))
n.Type = nil n.Type = nil
return return
...@@ -1519,7 +1519,7 @@ OpSwitch: ...@@ -1519,7 +1519,7 @@ OpSwitch:
break OpSwitch break OpSwitch
case OCLOSE: case OCLOSE:
if !onearg(n, "%v", Oconv(int(n.Op), 0)) { if !onearg(n, "%v", Oconv(n.Op, 0)) {
n.Type = nil n.Type = nil
return return
} }
...@@ -2356,19 +2356,19 @@ func twoarg(n *Node) bool { ...@@ -2356,19 +2356,19 @@ func twoarg(n *Node) bool {
return true return true
} }
if nodeSeqLen(n.List) == 0 { if nodeSeqLen(n.List) == 0 {
Yyerror("missing argument to %v - %v", Oconv(int(n.Op), 0), n) Yyerror("missing argument to %v - %v", Oconv(n.Op, 0), n)
return false return false
} }
n.Left = nodeSeqFirst(n.List) n.Left = nodeSeqFirst(n.List)
if nodeSeqLen(n.List) == 1 { if nodeSeqLen(n.List) == 1 {
Yyerror("missing argument to %v - %v", Oconv(int(n.Op), 0), n) Yyerror("missing argument to %v - %v", Oconv(n.Op, 0), n)
setNodeSeq(&n.List, nil) setNodeSeq(&n.List, nil)
return false return false
} }
if nodeSeqLen(n.List) > 2 { if nodeSeqLen(n.List) > 2 {
Yyerror("too many arguments to %v - %v", Oconv(int(n.Op), 0), n) Yyerror("too many arguments to %v - %v", Oconv(n.Op, 0), n)
setNodeSeq(&n.List, nil) setNodeSeq(&n.List, nil)
return false return false
} }
...@@ -2744,7 +2744,7 @@ func typecheckaste(op Op, call *Node, isddd bool, tstruct *Type, nl *NodeList, d ...@@ -2744,7 +2744,7 @@ func typecheckaste(op Op, call *Node, isddd bool, tstruct *Type, nl *NodeList, d
if call != nil { if call != nil {
Yyerror("invalid use of ... in call to %v", call) Yyerror("invalid use of ... in call to %v", call)
} else { } else {
Yyerror("invalid use of ... in %v", Oconv(int(op), 0)) Yyerror("invalid use of ... in %v", Oconv(op, 0))
} }
} }
...@@ -2764,7 +2764,7 @@ notenough: ...@@ -2764,7 +2764,7 @@ notenough:
Yyerror("not enough arguments in call to %v", call) Yyerror("not enough arguments in call to %v", call)
} }
} else { } else {
Yyerror("not enough arguments to %v", Oconv(int(op), 0)) Yyerror("not enough arguments to %v", Oconv(op, 0))
} }
if n != nil { if n != nil {
n.Diag = 1 n.Diag = 1
...@@ -2777,7 +2777,7 @@ toomany: ...@@ -2777,7 +2777,7 @@ toomany:
if call != nil { if call != nil {
Yyerror("too many arguments in call to %v", call) Yyerror("too many arguments in call to %v", call)
} else { } else {
Yyerror("too many arguments to %v", Oconv(int(op), 0)) Yyerror("too many arguments to %v", Oconv(op, 0))
} }
goto out goto out
} }
...@@ -3679,7 +3679,7 @@ func typecheckdef(n *Node) *Node { ...@@ -3679,7 +3679,7 @@ func typecheckdef(n *Node) *Node {
switch n.Op { switch n.Op {
default: default:
Fatalf("typecheckdef %v", Oconv(int(n.Op), 0)) Fatalf("typecheckdef %v", Oconv(n.Op, 0))
// not really syms // not really syms
case OGOTO, OLABEL: case OGOTO, OLABEL:
......
...@@ -87,7 +87,7 @@ func unsafenmagic(nn *Node) *Node { ...@@ -87,7 +87,7 @@ func unsafenmagic(nn *Node) *Node {
default: default:
Dump("unsafenmagic", r) Dump("unsafenmagic", r)
Fatalf("impossible %v node after dot insertion", Oconv(int(r1.Op), obj.FmtSharp)) Fatalf("impossible %v node after dot insertion", Oconv(r1.Op, obj.FmtSharp))
goto bad goto bad
} }
} }
......
...@@ -163,7 +163,7 @@ func walkstmt(np **Node) { ...@@ -163,7 +163,7 @@ func walkstmt(np **Node) {
if n.Op == ONAME { if n.Op == ONAME {
Yyerror("%v is not a top level statement", n.Sym) Yyerror("%v is not a top level statement", n.Sym)
} else { } else {
Yyerror("%v is not a top level statement", Oconv(int(n.Op), 0)) Yyerror("%v is not a top level statement", Oconv(n.Op, 0))
} }
Dump("nottop", n) Dump("nottop", n)
...@@ -1559,7 +1559,7 @@ opswitch: ...@@ -1559,7 +1559,7 @@ opswitch:
// ifaceeq(i1 any-1, i2 any-2) (ret bool); // ifaceeq(i1 any-1, i2 any-2) (ret bool);
case OCMPIFACE: case OCMPIFACE:
if !Eqtype(n.Left.Type, n.Right.Type) { if !Eqtype(n.Left.Type, n.Right.Type) {
Fatalf("ifaceeq %v %v %v", Oconv(int(n.Op), 0), n.Left.Type, n.Right.Type) Fatalf("ifaceeq %v %v %v", Oconv(n.Op, 0), n.Left.Type, n.Right.Type)
} }
var fn *Node var fn *Node
if isnilinter(n.Left.Type) { if isnilinter(n.Left.Type) {
...@@ -1685,7 +1685,7 @@ func ascompatee(op Op, nl *NodeList, nr *NodeList, init nodesOrNodeListPtr) *Nod ...@@ -1685,7 +1685,7 @@ func ascompatee(op Op, nl *NodeList, nr *NodeList, init nodesOrNodeListPtr) *Nod
// cannot happen: caller checked that lists had same length // cannot happen: caller checked that lists had same length
if ll != nil || lr != nil { if ll != nil || lr != nil {
Yyerror("error in shape across %v %v %v / %d %d [%s]", Hconv(nl, obj.FmtSign), Oconv(int(op), 0), Hconv(nr, obj.FmtSign), count(nl), count(nr), Curfn.Func.Nname.Sym.Name) Yyerror("error in shape across %v %v %v / %d %d [%s]", Hconv(nl, obj.FmtSign), Oconv(op, 0), Hconv(nr, obj.FmtSign), count(nl), count(nr), Curfn.Func.Nname.Sym.Name)
} }
return nn return nn
} }
...@@ -1930,9 +1930,9 @@ loop: ...@@ -1930,9 +1930,9 @@ loop:
l1 = dumptypes(nl, "expected") l1 = dumptypes(nl, "expected")
l2 = dumpnodetypes(lr0, "given") l2 = dumpnodetypes(lr0, "given")
if l != nil { if l != nil {
Yyerror("not enough arguments to %v\n%s\n%s", Oconv(int(op), 0), l1, l2) Yyerror("not enough arguments to %v\n%s\n%s", Oconv(op, 0), l1, l2)
} else { } else {
Yyerror("too many arguments to %v\n%s\n%s", Oconv(int(op), 0), l1, l2) Yyerror("too many arguments to %v\n%s\n%s", Oconv(op, 0), l1, l2)
} }
} }
...@@ -2205,7 +2205,7 @@ func applywritebarrier(n *Node) *Node { ...@@ -2205,7 +2205,7 @@ func applywritebarrier(n *Node) *Node {
func convas(n *Node, init nodesOrNodeListPtr) *Node { func convas(n *Node, init nodesOrNodeListPtr) *Node {
if n.Op != OAS { if n.Op != OAS {
Fatalf("convas: not OAS %v", Oconv(int(n.Op), 0)) Fatalf("convas: not OAS %v", Oconv(n.Op, 0))
} }
n.Typecheck = 1 n.Typecheck = 1
...@@ -2352,7 +2352,7 @@ func reorder3(all *NodeList) *NodeList { ...@@ -2352,7 +2352,7 @@ func reorder3(all *NodeList) *NodeList {
switch l.Op { switch l.Op {
default: default:
Fatalf("reorder3 unexpected lvalue %v", Oconv(int(l.Op), obj.FmtSharp)) Fatalf("reorder3 unexpected lvalue %v", Oconv(l.Op, obj.FmtSharp))
case ONAME: case ONAME:
break break
...@@ -3813,7 +3813,7 @@ func usefield(n *Node) { ...@@ -3813,7 +3813,7 @@ func usefield(n *Node) {
switch n.Op { switch n.Op {
default: default:
Fatalf("usefield %v", Oconv(int(n.Op), 0)) Fatalf("usefield %v", Oconv(n.Op, 0))
case ODOT, ODOTPTR: case ODOT, ODOTPTR:
break break
......
...@@ -148,7 +148,7 @@ func ginscmp(op gc.Op, t *gc.Type, n1, n2 *gc.Node, likely int) *obj.Prog { ...@@ -148,7 +148,7 @@ func ginscmp(op gc.Op, t *gc.Type, n1, n2 *gc.Node, likely int) *obj.Prog {
case gc.TFLOAT32: case gc.TFLOAT32:
switch op { switch op {
default: default:
gc.Fatalf("ginscmp: no entry for op=%v type=%v", gc.Oconv(int(op), 0), t) gc.Fatalf("ginscmp: no entry for op=%v type=%v", gc.Oconv(op, 0), t)
case gc.OEQ, case gc.OEQ,
gc.ONE: gc.ONE:
...@@ -165,7 +165,7 @@ func ginscmp(op gc.Op, t *gc.Type, n1, n2 *gc.Node, likely int) *obj.Prog { ...@@ -165,7 +165,7 @@ func ginscmp(op gc.Op, t *gc.Type, n1, n2 *gc.Node, likely int) *obj.Prog {
case gc.TFLOAT64: case gc.TFLOAT64:
switch op { switch op {
default: default:
gc.Fatalf("ginscmp: no entry for op=%v type=%v", gc.Oconv(int(op), 0), t) gc.Fatalf("ginscmp: no entry for op=%v type=%v", gc.Oconv(op, 0), t)
case gc.OEQ, case gc.OEQ,
gc.ONE: gc.ONE:
...@@ -715,7 +715,7 @@ func optoas(op gc.Op, t *gc.Type) int { ...@@ -715,7 +715,7 @@ func optoas(op gc.Op, t *gc.Type) int {
a := int(obj.AXXX) a := int(obj.AXXX)
switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) { switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) {
default: default:
gc.Fatalf("optoas: no entry for op=%v type=%v", gc.Oconv(int(op), 0), t) gc.Fatalf("optoas: no entry for op=%v type=%v", gc.Oconv(op, 0), t)
case OEQ_ | gc.TBOOL, case OEQ_ | gc.TBOOL,
OEQ_ | gc.TINT8, OEQ_ | gc.TINT8,
......
...@@ -711,7 +711,7 @@ func optoas(op gc.Op, t *gc.Type) int { ...@@ -711,7 +711,7 @@ func optoas(op gc.Op, t *gc.Type) int {
a := int(obj.AXXX) a := int(obj.AXXX)
switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) { switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) {
default: default:
gc.Fatalf("optoas: no entry for op=%v type=%v", gc.Oconv(int(op), 0), t) gc.Fatalf("optoas: no entry for op=%v type=%v", gc.Oconv(op, 0), t)
case OEQ_ | gc.TBOOL, case OEQ_ | gc.TBOOL,
OEQ_ | gc.TINT8, OEQ_ | gc.TINT8,
......
...@@ -19,12 +19,12 @@ func cgen64(n *gc.Node, res *gc.Node) { ...@@ -19,12 +19,12 @@ func cgen64(n *gc.Node, res *gc.Node) {
if res.Op != gc.OINDREG && res.Op != gc.ONAME { if res.Op != gc.OINDREG && res.Op != gc.ONAME {
gc.Dump("n", n) gc.Dump("n", n)
gc.Dump("res", res) gc.Dump("res", res)
gc.Fatalf("cgen64 %v of %v", gc.Oconv(int(n.Op), 0), gc.Oconv(int(res.Op), 0)) gc.Fatalf("cgen64 %v of %v", gc.Oconv(n.Op, 0), gc.Oconv(res.Op, 0))
} }
switch n.Op { switch n.Op {
default: default:
gc.Fatalf("cgen64 %v", gc.Oconv(int(n.Op), 0)) gc.Fatalf("cgen64 %v", gc.Oconv(n.Op, 0))
case gc.OMINUS: case gc.OMINUS:
gc.Cgen(n.Left, res) gc.Cgen(n.Left, res)
...@@ -531,7 +531,7 @@ func cmp64(nl *gc.Node, nr *gc.Node, op gc.Op, likely int, to *obj.Prog) { ...@@ -531,7 +531,7 @@ func cmp64(nl *gc.Node, nr *gc.Node, op gc.Op, likely int, to *obj.Prog) {
var br *obj.Prog var br *obj.Prog
switch op { switch op {
default: default:
gc.Fatalf("cmp64 %v %v", gc.Oconv(int(op), 0), t) gc.Fatalf("cmp64 %v %v", gc.Oconv(op, 0), t)
// cmp hi // cmp hi
// jne L // jne L
......
...@@ -661,7 +661,7 @@ func cgen_floatsse(n *gc.Node, res *gc.Node) { ...@@ -661,7 +661,7 @@ func cgen_floatsse(n *gc.Node, res *gc.Node) {
switch n.Op { switch n.Op {
default: default:
gc.Dump("cgen_floatsse", n) gc.Dump("cgen_floatsse", n)
gc.Fatalf("cgen_floatsse %v", gc.Oconv(int(n.Op), 0)) gc.Fatalf("cgen_floatsse %v", gc.Oconv(n.Op, 0))
return return
case gc.OMINUS, case gc.OMINUS,
......
...@@ -91,7 +91,7 @@ func optoas(op gc.Op, t *gc.Type) int { ...@@ -91,7 +91,7 @@ func optoas(op gc.Op, t *gc.Type) int {
a := obj.AXXX a := obj.AXXX
switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) { switch uint32(op)<<16 | uint32(gc.Simtype[t.Etype]) {
default: default:
gc.Fatalf("optoas: no entry %v-%v", gc.Oconv(int(op), 0), t) gc.Fatalf("optoas: no entry %v-%v", gc.Oconv(op, 0), t)
case OADDR_ | gc.TPTR32: case OADDR_ | gc.TPTR32:
a = x86.ALEAL a = x86.ALEAL
...@@ -454,7 +454,7 @@ func foptoas(op gc.Op, t *gc.Type, flg int) int { ...@@ -454,7 +454,7 @@ func foptoas(op gc.Op, t *gc.Type, flg int) int {
if !gc.Thearch.Use387 { if !gc.Thearch.Use387 {
switch uint32(op)<<16 | uint32(et) { switch uint32(op)<<16 | uint32(et) {
default: default:
gc.Fatalf("foptoas-sse: no entry %v-%v", gc.Oconv(int(op), 0), t) gc.Fatalf("foptoas-sse: no entry %v-%v", gc.Oconv(op, 0), t)
case OCMP_ | gc.TFLOAT32: case OCMP_ | gc.TFLOAT32:
a = x86.AUCOMISS a = x86.AUCOMISS
...@@ -587,7 +587,7 @@ func foptoas(op gc.Op, t *gc.Type, flg int) int { ...@@ -587,7 +587,7 @@ func foptoas(op gc.Op, t *gc.Type, flg int) int {
return x86.AFCHS return x86.AFCHS
} }
gc.Fatalf("foptoas %v %v %#x", gc.Oconv(int(op), 0), t, flg) gc.Fatalf("foptoas %v %v %#x", gc.Oconv(op, 0), t, flg)
return 0 return 0
} }
......
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