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: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Matthew Dempsky 2016-03-07 08:23:55 -08:00
parent 0de0cafb9f
commit c3dfad5df9
29 changed files with 117 additions and 117 deletions

View file

@ -1376,9 +1376,9 @@ func printframenode(n *Node) {
}
switch n.Op {
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:
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) {
}
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
@ -1601,7 +1601,7 @@ func Brcom(op Op) Op {
case OGE:
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
}
@ -1622,7 +1622,7 @@ func Brrev(op Op) Op {
case OGE:
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
}