Commit 79dbc1cc authored by Daniel Martí's avatar Daniel Martí

cmd/compile: replace classnames with Class.String

Since the slice of names is almost exactly the same as what stringer is
already generating for us.

Passes toolstash -cmp on std cmd.

Change-Id: I3f1e95efc690c0108236689e721627f00f79a461
Reviewed-on: https://go-review.googlesource.com/77190
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarDave Cheney <dave@cheney.net>
parent d0057362
......@@ -232,16 +232,6 @@ func (o Op) oconv(s fmt.State, flag FmtFlag, mode fmtMode) {
fmt.Fprint(s, o.String())
}
var classnames = []string{
"Pxxx",
"PEXTERN",
"PAUTO",
"PAUTOHEAP",
"PPARAM",
"PPARAMOUT",
"PFUNC",
}
type (
fmtMode int
......@@ -439,11 +429,7 @@ func (n *Node) jconv(s fmt.State, flag FmtFlag) {
}
if n.Class() != 0 {
if int(n.Class()) < len(classnames) {
fmt.Fprintf(s, " class(%s)", classnames[n.Class()])
} else {
fmt.Fprintf(s, " class(%d?)", n.Class())
}
fmt.Fprintf(s, " class(%v)", n.Class())
}
if n.Colas() {
......
......@@ -179,7 +179,7 @@ func buildssa(fn *Node, worker int) *ssa.Func {
case PFUNC:
// local function - already handled by frontend
default:
s.Fatalf("local variable with class %s unimplemented", classnames[n.Class()])
s.Fatalf("local variable with class %v unimplemented", n.Class())
}
}
......@@ -3394,7 +3394,7 @@ func (s *state) addr(n *Node, bounded bool) *ssa.Value {
// that cse works on their addresses
return s.newValue1A(ssa.OpAddr, t, n, s.sp)
default:
s.Fatalf("variable address class %v not implemented", classnames[n.Class()])
s.Fatalf("variable address class %v not implemented", n.Class())
return nil
}
case OINDREGSP:
......
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