Commit ff046d2e authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile: implement fmt.Formatter for *Node formats %s, %v

Change-Id: I80ed668cdeab0c4342b734d34b429927e0213e5a
Reviewed-on: https://go-review.googlesource.com/28335Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent a0d20102
...@@ -40,7 +40,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -40,7 +40,7 @@ func defframe(ptxt *obj.Prog) {
gc.Fatalf("needzero class %d", n.Class) gc.Fatalf("needzero class %d", n.Class)
} }
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 { if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset)) gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
} }
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) { if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
......
...@@ -178,7 +178,7 @@ func bignodes() { ...@@ -178,7 +178,7 @@ func bignodes() {
*/ */
func gmove(f *gc.Node, t *gc.Node) { func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 { if gc.Debug['M'] != 0 {
fmt.Printf("gmove %v -> %v\n", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong)) fmt.Printf("gmove %2v -> %2v\n", f, t)
} }
ft := gc.Simsimtype(f.Type) ft := gc.Simsimtype(f.Type)
......
...@@ -34,7 +34,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -34,7 +34,7 @@ func defframe(ptxt *obj.Prog) {
gc.Fatalf("needzero class %d", n.Class) gc.Fatalf("needzero class %d", n.Class)
} }
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 { if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset)) gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
} }
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthptr) { if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthptr) {
// merge with range we already have // merge with range we already have
......
...@@ -43,7 +43,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -43,7 +43,7 @@ func defframe(ptxt *obj.Prog) {
gc.Fatalf("needzero class %d", n.Class) gc.Fatalf("needzero class %d", n.Class)
} }
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 { if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset)) gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
} }
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) { if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
......
...@@ -133,7 +133,7 @@ func ginscmp(op gc.Op, t *gc.Type, n1, n2 *gc.Node, likely int) *obj.Prog { ...@@ -133,7 +133,7 @@ func ginscmp(op gc.Op, t *gc.Type, n1, n2 *gc.Node, likely int) *obj.Prog {
*/ */
func gmove(f *gc.Node, t *gc.Node) { func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 { if gc.Debug['M'] != 0 {
fmt.Printf("gmove %v -> %v\n", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong)) fmt.Printf("gmove %2v -> %2v\n", f, t)
} }
ft := int(gc.Simsimtype(f.Type)) ft := int(gc.Simsimtype(f.Type))
......
...@@ -361,7 +361,7 @@ func cgen_wb(n, res *Node, wb bool) { ...@@ -361,7 +361,7 @@ func cgen_wb(n, res *Node, wb bool) {
default: default:
Dump("cgen", n) Dump("cgen", n)
Dump("cgen-res", res) Dump("cgen-res", res)
Fatalf("cgen: unknown op %v", Nconv(n, FmtShort|FmtSign)) Fatalf("cgen: unknown op %+1v", n)
case OOROR, OANDAND, case OOROR, OANDAND,
OEQ, ONE, OEQ, ONE,
...@@ -1553,7 +1553,7 @@ func Agen(n *Node, res *Node) { ...@@ -1553,7 +1553,7 @@ func Agen(n *Node, res *Node) {
switch n.Op { switch n.Op {
default: default:
Dump("bad agen", n) Dump("bad agen", n)
Fatalf("agen: unknown op %v", Nconv(n, FmtShort|FmtSign)) Fatalf("agen: unknown op %+1v", n)
case OCALLMETH: case OCALLMETH:
cgen_callmeth(n, 0) cgen_callmeth(n, 0)
...@@ -1864,7 +1864,7 @@ func bgenx(n, res *Node, wantTrue bool, likely int, to *obj.Prog) { ...@@ -1864,7 +1864,7 @@ func bgenx(n, res *Node, wantTrue bool, likely int, to *obj.Prog) {
case OLITERAL: case OLITERAL:
// n is a constant. // n is a constant.
if !Isconst(n, CTBOOL) { if !Isconst(n, CTBOOL) {
Fatalf("bgen: non-bool const %v\n", Nconv(n, FmtLong)) Fatalf("bgen: non-bool const %2v\n", n)
} }
if genval { if genval {
Cgen(Nodbool(wantTrue == n.Val().U.(bool)), res) Cgen(Nodbool(wantTrue == n.Val().U.(bool)), res)
......
...@@ -107,7 +107,7 @@ func typecheckclosure(func_ *Node, top int) { ...@@ -107,7 +107,7 @@ func typecheckclosure(func_ *Node, top int) {
if !n.Name.Captured { if !n.Name.Captured {
n.Name.Captured = true n.Name.Captured = true
if n.Name.Decldepth == 0 { if n.Name.Decldepth == 0 {
Fatalf("typecheckclosure: var %v does not have decldepth assigned", Nconv(n, FmtShort)) Fatalf("typecheckclosure: var %1v does not have decldepth assigned", n)
} }
// Ignore assignments to the variable in straightline code // Ignore assignments to the variable in straightline code
...@@ -193,7 +193,7 @@ func closurename(n *Node) *Sym { ...@@ -193,7 +193,7 @@ func closurename(n *Node) *Sym {
n.Func.Outerfunc.Func.Closgen++ n.Func.Outerfunc.Func.Closgen++
gen = n.Func.Outerfunc.Func.Closgen gen = n.Func.Outerfunc.Func.Closgen
default: default:
Fatalf("closurename called for %v", Nconv(n, FmtShort)) Fatalf("closurename called for %1v", n)
} }
n.Sym = Lookupf("%s.%s%d", outer, prefix, gen) n.Sym = Lookupf("%s.%s%d", outer, prefix, gen)
return n.Sym return n.Sym
......
...@@ -1386,7 +1386,7 @@ func defaultlitreuse(n *Node, t *Type, reuse canReuseNode) *Node { ...@@ -1386,7 +1386,7 @@ func defaultlitreuse(n *Node, t *Type, reuse canReuseNode) *Node {
Yyerror("defaultlit: unknown literal: %v", n) Yyerror("defaultlit: unknown literal: %v", n)
case CTxxx: case CTxxx:
Fatalf("defaultlit: idealkind is CTxxx: %v", Nconv(n, FmtSign)) Fatalf("defaultlit: idealkind is CTxxx: %+v", n)
case CTBOOL: case CTBOOL:
t1 := Types[TBOOL] t1 := Types[TBOOL]
......
This diff is collapsed.
...@@ -260,7 +260,7 @@ var classnames = []string{ ...@@ -260,7 +260,7 @@ var classnames = []string{
func (n *Node) Format(s fmt.State, format rune) { func (n *Node) Format(s fmt.State, format rune) {
switch format { switch format {
case 's', 'v': case 's', 'v':
fmt.Fprint(s, Nconv(n, fmtFlag(s))) n.Nconv(s)
case 'j': case 'j':
n.jconv(s) n.jconv(s)
...@@ -866,7 +866,7 @@ func (p *printer) stmtfmt(n *Node) *printer { ...@@ -866,7 +866,7 @@ func (p *printer) stmtfmt(n *Node) *printer {
if n.Left != nil { if n.Left != nil {
p.f("%v %v", n.Left, n.Right) p.f("%v %v", n.Left, n.Right)
} else { } else {
p.Nconv(n.Right, 0) p.f("%v", n.Right)
} }
// Don't export "v = <N>" initializing statements, hope they're always // Don't export "v = <N>" initializing statements, hope they're always
...@@ -972,7 +972,7 @@ func (p *printer) stmtfmt(n *Node) *printer { ...@@ -972,7 +972,7 @@ func (p *printer) stmtfmt(n *Node) *printer {
p.f(" %v;", n.Ninit.First()) p.f(" %v;", n.Ninit.First())
} }
if n.Left != nil { if n.Left != nil {
p.f(" %s ", Nconv(n.Left, 0)) p.f(" %v ", n.Left)
} }
p.f(" { %v }", n.List) p.f(" { %v }", n.List)
...@@ -1543,10 +1543,10 @@ func (p *printer) nodedump(n *Node, flag FmtFlag) *printer { ...@@ -1543,10 +1543,10 @@ func (p *printer) nodedump(n *Node, flag FmtFlag) *printer {
if recur { if recur {
if n.Left != nil { if n.Left != nil {
p.Nconv(n.Left, 0) p.f("%v", n.Left)
} }
if n.Right != nil { if n.Right != nil {
p.Nconv(n.Right, 0) p.f("%v", n.Right)
} }
if n.List.Len() != 0 { if n.List.Len() != 0 {
p.indent() p.indent()
...@@ -1649,7 +1649,7 @@ func Fldconv(f *Field, flag FmtFlag) string { ...@@ -1649,7 +1649,7 @@ func Fldconv(f *Field, flag FmtFlag) string {
if s != nil && f.Embedded == 0 { if s != nil && f.Embedded == 0 {
if f.Funarg != FunargNone { if f.Funarg != FunargNone {
name = Nconv(f.Nname, 0) name = f.Nname.String()
} else if flag&FmtLong != 0 { } else if flag&FmtLong != 0 {
name = fmt.Sprintf("%01v", s) name = fmt.Sprintf("%01v", s)
if !exportname(name) && flag&FmtUnsigned == 0 { if !exportname(name) && flag&FmtUnsigned == 0 {
...@@ -1735,37 +1735,31 @@ func (t *Type) tconv(s fmt.State) { ...@@ -1735,37 +1735,31 @@ func (t *Type) tconv(s fmt.State) {
t.Trecur-- t.Trecur--
} }
func (n *Node) Print(p *printer) {
p.Nconv(n, 0)
}
var _ Printable = new(Node) // verify that Node implements Printable
func (n *Node) String() string { func (n *Node) String() string {
return Nconv(n, 0) return fmt.Sprint(n)
} }
// Fmt '%N': Nodes. // Fmt '%N': Nodes.
// Flags: 'l' suffix with "(type %T)" where possible // Flags: 'l' suffix with "(type %T)" where possible
// '+h' in debug mode, don't recurse, no multiline output // '+h' in debug mode, don't recurse, no multiline output
func Nconv(n *Node, flag FmtFlag) string { func (n *Node) Nconv(s fmt.State) {
return new(printer).Nconv(n, flag).String() flag := fmtFlag(s)
}
func (p *printer) Nconv(n *Node, flag FmtFlag) *printer {
if n == nil { if n == nil {
return p.s("<N>") fmt.Fprint(s, "<N>")
return
} }
sf := flag sf := flag
sm := setfmode(&flag) sm := setfmode(&flag)
switch fmtmode { switch fmtmode {
case FErr: case FErr:
p.nodefmt(n, flag) fmt.Fprint(s, new(printer).nodefmt(n, flag).String())
case FDbg: case FDbg:
dumpdepth++ dumpdepth++
p.nodedump(n, flag) fmt.Fprint(s, new(printer).nodedump(n, flag).String())
dumpdepth-- dumpdepth--
default: default:
...@@ -1774,8 +1768,6 @@ func (p *printer) Nconv(n *Node, flag FmtFlag) *printer { ...@@ -1774,8 +1768,6 @@ func (p *printer) Nconv(n *Node, flag FmtFlag) *printer {
flag = sf flag = sf
fmtmode = sm fmtmode = sm
return p
} }
func (n Nodes) Print(p *printer) { func (n Nodes) Print(p *printer) {
...@@ -1809,7 +1801,7 @@ func (p *printer) hconv(l Nodes, flag FmtFlag) *printer { ...@@ -1809,7 +1801,7 @@ func (p *printer) hconv(l Nodes, flag FmtFlag) *printer {
} }
for i, n := range l.Slice() { for i, n := range l.Slice() {
p.Nconv(n, 0) p.f("%v", n)
if i+1 < l.Len() { if i+1 < l.Len() {
p.s(sep) p.s(sep)
} }
...@@ -1826,7 +1818,7 @@ func dumplist(s string, l Nodes) { ...@@ -1826,7 +1818,7 @@ func dumplist(s string, l Nodes) {
} }
func Dump(s string, n *Node) { func Dump(s string, n *Node) {
fmt.Printf("%s [%p]%v\n", s, n, Nconv(n, FmtSign)) fmt.Printf("%s [%p]%+v\n", s, n, n)
} }
// printer is a buffer for creating longer formatted strings. // printer is a buffer for creating longer formatted strings.
......
...@@ -716,7 +716,7 @@ func gen(n *Node) { ...@@ -716,7 +716,7 @@ func gen(n *Node) {
switch n.Op { switch n.Op {
default: default:
Fatalf("gen: unknown op %v", Nconv(n, FmtShort|FmtSign)) Fatalf("gen: unknown op %+1v", n)
case OCASE, case OCASE,
OFALL, OFALL,
......
...@@ -40,7 +40,7 @@ func fnpkg(fn *Node) *Pkg { ...@@ -40,7 +40,7 @@ func fnpkg(fn *Node) *Pkg {
rcvr = rcvr.Elem() rcvr = rcvr.Elem()
} }
if rcvr.Sym == nil { if rcvr.Sym == nil {
Fatalf("receiver with no sym: [%v] %v (%v)", fn.Sym, Nconv(fn, FmtLong), rcvr) Fatalf("receiver with no sym: [%v] %2v (%v)", fn.Sym, fn, rcvr)
} }
return rcvr.Sym.Pkg return rcvr.Sym.Pkg
} }
...@@ -65,7 +65,7 @@ func typecheckinl(fn *Node) { ...@@ -65,7 +65,7 @@ func typecheckinl(fn *Node) {
} }
if Debug['m'] > 2 || Debug_export != 0 { if Debug['m'] > 2 || Debug_export != 0 {
fmt.Printf("typecheck import [%v] %v { %v }\n", fn.Sym, Nconv(fn, FmtLong), hconv(fn.Func.Inl, FmtSharp)) fmt.Printf("typecheck import [%v] %2v { %v }\n", fn.Sym, fn, hconv(fn.Func.Inl, FmtSharp))
} }
save_safemode := safemode save_safemode := safemode
...@@ -89,7 +89,7 @@ func caninl(fn *Node) { ...@@ -89,7 +89,7 @@ func caninl(fn *Node) {
Fatalf("caninl %v", fn) Fatalf("caninl %v", fn)
} }
if fn.Func.Nname == nil { if fn.Func.Nname == nil {
Fatalf("caninl no nname %v", Nconv(fn, FmtSign)) Fatalf("caninl no nname %+v", fn)
} }
var reason string // reason, if any, that the function was not inlined var reason string // reason, if any, that the function was not inlined
...@@ -165,7 +165,7 @@ func caninl(fn *Node) { ...@@ -165,7 +165,7 @@ func caninl(fn *Node) {
fn.Type.SetNname(n) fn.Type.SetNname(n)
if Debug['m'] > 1 { if Debug['m'] > 1 {
fmt.Printf("%v: can inline %v as: %#v { %v }\n", fn.Line(), Nconv(n, FmtSharp), fn.Type, hconv(n.Func.Inl, FmtSharp)) fmt.Printf("%v: can inline %#v as: %#v { %v }\n", fn.Line(), n, fn.Type, hconv(n.Func.Inl, FmtSharp))
} else if Debug['m'] != 0 { } else if Debug['m'] != 0 {
fmt.Printf("%v: can inline %v\n", fn.Line(), n) fmt.Printf("%v: can inline %v\n", fn.Line(), n)
} }
...@@ -211,7 +211,7 @@ func ishairy(n *Node, budget *int32, reason *string) bool { ...@@ -211,7 +211,7 @@ func ishairy(n *Node, budget *int32, reason *string) bool {
case OCALLMETH: case OCALLMETH:
t := n.Left.Type t := n.Left.Type
if t == nil { if t == nil {
Fatalf("no function type for [%p] %v\n", n.Left, Nconv(n.Left, FmtSign)) Fatalf("no function type for [%p] %+v\n", n.Left, n.Left)
} }
if t.Nname() == nil { if t.Nname() == nil {
Fatalf("no function definition for [%p] %+v\n", t, t) Fatalf("no function definition for [%p] %+v\n", t, t)
...@@ -327,7 +327,7 @@ func inlconv2expr(n *Node) *Node { ...@@ -327,7 +327,7 @@ func inlconv2expr(n *Node) *Node {
// statements. // statements.
func inlconv2list(n *Node) []*Node { func inlconv2list(n *Node) []*Node {
if n.Op != OINLCALL || n.Rlist.Len() == 0 { if n.Op != OINLCALL || n.Rlist.Len() == 0 {
Fatalf("inlconv2list %v\n", Nconv(n, FmtSign)) Fatalf("inlconv2list %+v\n", n)
} }
s := n.Rlist.Slice() s := n.Rlist.Slice()
...@@ -475,7 +475,7 @@ func inlnode(n *Node) *Node { ...@@ -475,7 +475,7 @@ func inlnode(n *Node) *Node {
switch n.Op { switch n.Op {
case OCALLFUNC: case OCALLFUNC:
if Debug['m'] > 3 { if Debug['m'] > 3 {
fmt.Printf("%v:call to func %v\n", n.Line(), Nconv(n.Left, FmtSign)) fmt.Printf("%v:call to func %+v\n", n.Line(), n.Left)
} }
if n.Left.Func != nil && n.Left.Func.Inl.Len() != 0 && !isIntrinsicCall(n) { // normal case if n.Left.Func != nil && n.Left.Func.Inl.Len() != 0 && !isIntrinsicCall(n) { // normal case
n = mkinlcall(n, n.Left, n.Isddd) n = mkinlcall(n, n.Left, n.Isddd)
...@@ -485,12 +485,12 @@ func inlnode(n *Node) *Node { ...@@ -485,12 +485,12 @@ func inlnode(n *Node) *Node {
case OCALLMETH: case OCALLMETH:
if Debug['m'] > 3 { if Debug['m'] > 3 {
fmt.Printf("%v:call to meth %v\n", n.Line(), Nconv(n.Left.Right, FmtLong)) fmt.Printf("%v:call to meth %2v\n", n.Line(), n.Left.Right)
} }
// typecheck should have resolved ODOTMETH->type, whose nname points to the actual function. // typecheck should have resolved ODOTMETH->type, whose nname points to the actual function.
if n.Left.Type == nil { if n.Left.Type == nil {
Fatalf("no function type for [%p] %v\n", n.Left, Nconv(n.Left, FmtSign)) Fatalf("no function type for [%p] %+v\n", n.Left, n.Left)
} }
if n.Left.Type.Nname() == nil { if n.Left.Type.Nname() == nil {
...@@ -562,7 +562,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node { ...@@ -562,7 +562,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
} }
if Debug['m'] > 2 { if Debug['m'] > 2 {
fmt.Printf("%v: Before inlining: %v\n", n.Line(), Nconv(n, FmtSign)) fmt.Printf("%v: Before inlining: %+v\n", n.Line(), n)
} }
ninit := n.Ninit ninit := n.Ninit
...@@ -623,10 +623,10 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node { ...@@ -623,10 +623,10 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
Fatalf("missing inlvar for %v\n", t.Nname) Fatalf("missing inlvar for %v\n", t.Nname)
} }
if n.Left.Left == nil { if n.Left.Left == nil {
Fatalf("method call without receiver: %v", Nconv(n, FmtSign)) Fatalf("method call without receiver: %+v", n)
} }
if t == nil { if t == nil {
Fatalf("method call unknown receiver type: %v", Nconv(n, FmtSign)) Fatalf("method call unknown receiver type: %+v", n)
} }
as := Nod(OAS, tinlvar(t), n.Left.Left) as := Nod(OAS, tinlvar(t), n.Left.Left)
if as != nil { if as != nil {
...@@ -682,7 +682,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node { ...@@ -682,7 +682,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
if fn.Type.Recv() != nil && n.Left.Op != ODOTMETH { if fn.Type.Recv() != nil && n.Left.Op != ODOTMETH {
// non-method call to method // non-method call to method
if n.List.Len() == 0 { if n.List.Len() == 0 {
Fatalf("non-method call to method without first arg: %v", Nconv(n, FmtSign)) Fatalf("non-method call to method without first arg: %+v", n)
} }
// append receiver inlvar to LHS. // append receiver inlvar to LHS.
...@@ -692,7 +692,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node { ...@@ -692,7 +692,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
Fatalf("missing inlvar for %v\n", t.Nname) Fatalf("missing inlvar for %v\n", t.Nname)
} }
if t == nil { if t == nil {
Fatalf("method call unknown receiver type: %v", Nconv(n, FmtSign)) Fatalf("method call unknown receiver type: %+v", n)
} }
as.List.Append(tinlvar(t)) as.List.Append(tinlvar(t))
li++ li++
...@@ -843,7 +843,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node { ...@@ -843,7 +843,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
fn.Func.Inl.Set(body) fn.Func.Inl.Set(body)
if Debug['m'] > 2 { if Debug['m'] > 2 {
fmt.Printf("%v: After inlining %v\n\n", n.Line(), Nconv(n, FmtSign)) fmt.Printf("%v: After inlining %+v\n\n", n.Line(), n)
} }
return n return n
...@@ -854,7 +854,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node { ...@@ -854,7 +854,7 @@ func mkinlcall1(n *Node, fn *Node, isddd bool) *Node {
// PPARAM's, PAUTOS and PPARAMOUTs of the called function. // PPARAM's, PAUTOS and PPARAMOUTs of the called function.
func inlvar(var_ *Node) *Node { func inlvar(var_ *Node) *Node {
if Debug['m'] > 3 { if Debug['m'] > 3 {
fmt.Printf("inlvar %v\n", Nconv(var_, FmtSign)) fmt.Printf("inlvar %+v\n", var_)
} }
n := newname(var_.Sym) n := newname(var_.Sym)
...@@ -923,13 +923,13 @@ func (subst *inlsubst) node(n *Node) *Node { ...@@ -923,13 +923,13 @@ func (subst *inlsubst) node(n *Node) *Node {
case ONAME: case ONAME:
if n.Name.Inlvar != nil { // These will be set during inlnode if n.Name.Inlvar != nil { // These will be set during inlnode
if Debug['m'] > 2 { if Debug['m'] > 2 {
fmt.Printf("substituting name %v -> %v\n", Nconv(n, FmtSign), Nconv(n.Name.Inlvar, FmtSign)) fmt.Printf("substituting name %+v -> %+v\n", n, n.Name.Inlvar)
} }
return n.Name.Inlvar return n.Name.Inlvar
} }
if Debug['m'] > 2 { if Debug['m'] > 2 {
fmt.Printf("not substituting name %v\n", Nconv(n, FmtSign)) fmt.Printf("not substituting name %+v\n", n)
} }
return n return n
...@@ -978,7 +978,7 @@ func (subst *inlsubst) node(n *Node) *Node { ...@@ -978,7 +978,7 @@ func (subst *inlsubst) node(n *Node) *Node {
m.Ninit.Set(nil) m.Ninit.Set(nil)
if n.Op == OCLOSURE { if n.Op == OCLOSURE {
Fatalf("cannot inline function containing closure: %v", Nconv(n, FmtSign)) Fatalf("cannot inline function containing closure: %+v", n)
} }
m.Left = subst.node(n.Left) m.Left = subst.node(n.Left)
......
...@@ -1233,7 +1233,7 @@ func livenessepilogue(lv *Liveness) { ...@@ -1233,7 +1233,7 @@ func livenessepilogue(lv *Liveness) {
if !n.Name.Needzero { if !n.Name.Needzero {
n.Name.Needzero = true n.Name.Needzero = true
if debuglive >= 1 { if debuglive >= 1 {
Warnl(p.Lineno, "%v: %v is ambiguously live", Curfn.Func.Nname, Nconv(n, FmtLong)) Warnl(p.Lineno, "%v: %2v is ambiguously live", Curfn.Func.Nname, n)
} }
// Record in 'ambiguous' bitmap. // Record in 'ambiguous' bitmap.
...@@ -1329,7 +1329,7 @@ func livenessepilogue(lv *Liveness) { ...@@ -1329,7 +1329,7 @@ func livenessepilogue(lv *Liveness) {
} }
n := lv.vars[j] n := lv.vars[j]
if n.Class != PPARAM { if n.Class != PPARAM {
yyerrorl(p.Lineno, "internal error: %v %v recorded as live on entry, p.Pc=%v", Curfn.Func.Nname, Nconv(n, FmtLong), p.Pc) yyerrorl(p.Lineno, "internal error: %v %2v recorded as live on entry, p.Pc=%v", Curfn.Func.Nname, n, p.Pc)
} }
} }
} }
......
...@@ -746,7 +746,7 @@ func mergetemp(firstp *obj.Prog) { ...@@ -746,7 +746,7 @@ func mergetemp(firstp *obj.Prog) {
nfree := len(bystart) nfree := len(bystart)
for _, v := range bystart { for _, v := range bystart {
if debugmerge > 0 && Debug['v'] != 0 { if debugmerge > 0 && Debug['v'] != 0 {
fmt.Printf("consider %v: removed=%t\n", Nconv(v.node, FmtSharp), v.removed) fmt.Printf("consider %#v: removed=%t\n", v.node, v.removed)
} }
if v.removed { if v.removed {
...@@ -761,7 +761,7 @@ func mergetemp(firstp *obj.Prog) { ...@@ -761,7 +761,7 @@ func mergetemp(firstp *obj.Prog) {
} }
if debugmerge > 0 && Debug['v'] != 0 { if debugmerge > 0 && Debug['v'] != 0 {
fmt.Printf("consider %v: removed=%t nfree=%d nvar=%d\n", Nconv(v.node, FmtSharp), v.removed, nfree, len(bystart)) fmt.Printf("consider %#v: removed=%t nfree=%d nvar=%d\n", v.node, v.removed, nfree, len(bystart))
} }
// Find old temp to reuse if possible. // Find old temp to reuse if possible.
...@@ -770,7 +770,7 @@ func mergetemp(firstp *obj.Prog) { ...@@ -770,7 +770,7 @@ func mergetemp(firstp *obj.Prog) {
for j := nfree; j < len(inuse); j++ { for j := nfree; j < len(inuse); j++ {
v1 := inuse[j] v1 := inuse[j]
if debugmerge > 0 && Debug['v'] != 0 { if debugmerge > 0 && Debug['v'] != 0 {
fmt.Printf("consider %v: maybe %v: type=%v,%v addrtaken=%v,%v\n", Nconv(v.node, FmtSharp), Nconv(v1.node, FmtSharp), t, v1.node.Type, v.node.Addrtaken, v1.node.Addrtaken) fmt.Printf("consider %#v: maybe %#v: type=%v,%v addrtaken=%v,%v\n", v.node, v1.node, t, v1.node.Type, v.node.Addrtaken, v1.node.Addrtaken)
} }
// Require the types to match but also require the addrtaken bits to match. // Require the types to match but also require the addrtaken bits to match.
...@@ -806,7 +806,7 @@ func mergetemp(firstp *obj.Prog) { ...@@ -806,7 +806,7 @@ func mergetemp(firstp *obj.Prog) {
if debugmerge > 0 && Debug['v'] != 0 { if debugmerge > 0 && Debug['v'] != 0 {
fmt.Printf("%v [%d - %d]\n", Curfn.Func.Nname.Sym, len(vars), nkill) fmt.Printf("%v [%d - %d]\n", Curfn.Func.Nname.Sym, len(vars), nkill)
for _, v := range vars { for _, v := range vars {
fmt.Printf("var %v %v %d-%d", Nconv(v.node, FmtSharp), v.node.Type, v.start, v.end) fmt.Printf("var %#v %v %d-%d", v.node, v.node.Type, v.start, v.end)
if v.addr { if v.addr {
fmt.Printf(" addr=true") fmt.Printf(" addr=true")
} }
...@@ -814,7 +814,7 @@ func mergetemp(firstp *obj.Prog) { ...@@ -814,7 +814,7 @@ func mergetemp(firstp *obj.Prog) {
fmt.Printf(" removed=true") fmt.Printf(" removed=true")
} }
if v.merge != nil { if v.merge != nil {
fmt.Printf(" merge %v", Nconv(v.merge.node, FmtSharp)) fmt.Printf(" merge %#v", v.merge.node)
} }
if v.start == v.end && v.def != nil { if v.start == v.end && v.def != nil {
fmt.Printf(" %v", v.def.Prog) fmt.Printf(" %v", v.def.Prog)
......
...@@ -48,7 +48,7 @@ func typecheckrange(n *Node) { ...@@ -48,7 +48,7 @@ func typecheckrange(n *Node) {
toomany = 0 toomany = 0
switch t.Etype { switch t.Etype {
default: default:
Yyerror("cannot range over %v", Nconv(n.Right, FmtLong)) Yyerror("cannot range over %2v", n.Right)
goto out goto out
case TARRAY, TSLICE: case TARRAY, TSLICE:
...@@ -104,7 +104,7 @@ func typecheckrange(n *Node) { ...@@ -104,7 +104,7 @@ func typecheckrange(n *Node) {
if v1.Name != nil && v1.Name.Defn == n { if v1.Name != nil && v1.Name.Defn == n {
v1.Type = t1 v1.Type = t1
} else if v1.Type != nil && assignop(t1, v1.Type, &why) == 0 { } else if v1.Type != nil && assignop(t1, v1.Type, &why) == 0 {
Yyerror("cannot assign type %v to %v in range%s", t1, Nconv(v1, FmtLong), why) Yyerror("cannot assign type %v to %2v in range%s", t1, v1, why)
} }
checkassign(n, v1) checkassign(n, v1)
} }
...@@ -113,7 +113,7 @@ func typecheckrange(n *Node) { ...@@ -113,7 +113,7 @@ func typecheckrange(n *Node) {
if v2.Name != nil && v2.Name.Defn == n { if v2.Name != nil && v2.Name.Defn == n {
v2.Type = t2 v2.Type = t2
} else if v2.Type != nil && assignop(t2, v2.Type, &why) == 0 { } else if v2.Type != nil && assignop(t2, v2.Type, &why) == 0 {
Yyerror("cannot assign type %v to %v in range%s", t2, Nconv(v2, FmtLong), why) Yyerror("cannot assign type %v to %2v in range%s", t2, v2, why)
} }
checkassign(n, v2) checkassign(n, v2)
} }
......
...@@ -393,10 +393,10 @@ func mkvar(f *Flow, a *obj.Addr) Bits { ...@@ -393,10 +393,10 @@ func mkvar(f *Flow, a *obj.Addr) Bits {
if nvar >= NVAR { if nvar >= NVAR {
if Debug['w'] > 1 && node != nil { if Debug['w'] > 1 && node != nil {
Fatalf("variable not optimized: %v", Nconv(node, FmtSharp)) Fatalf("variable not optimized: %#v", node)
} }
if Debug['v'] > 0 { if Debug['v'] > 0 {
Warn("variable not optimized: %v", Nconv(node, FmtSharp)) Warn("variable not optimized: %#v", node)
} }
// If we're not tracking a word in a variable, mark the rest as // If we're not tracking a word in a variable, mark the rest as
...@@ -488,7 +488,7 @@ func mkvar(f *Flow, a *obj.Addr) Bits { ...@@ -488,7 +488,7 @@ func mkvar(f *Flow, a *obj.Addr) Bits {
} }
if Debug['R'] != 0 { if Debug['R'] != 0 {
fmt.Printf("bit=%2d et=%v w=%d+%d %v %v flag=%d\n", i, et, o, w, Nconv(node, FmtSharp), Ctxt.Dconv(a), v.addr) fmt.Printf("bit=%2d et=%v w=%d+%d %#v %v flag=%d\n", i, et, o, w, node, Ctxt.Dconv(a), v.addr)
} }
Ostats.Nvar++ Ostats.Nvar++
......
...@@ -201,7 +201,7 @@ func init2(n *Node, out *[]*Node) { ...@@ -201,7 +201,7 @@ func init2(n *Node, out *[]*Node) {
} }
if n.Op == ONAME && n.Ninit.Len() != 0 { if n.Op == ONAME && n.Ninit.Len() != 0 {
Fatalf("name %v with ninit: %v\n", n.Sym, Nconv(n, FmtSign)) Fatalf("name %v with ninit: %+v\n", n.Sym, n)
} }
init1(n, out) init1(n, out)
......
...@@ -1013,7 +1013,7 @@ func assignconvfn(n *Node, t *Type, context func() string) *Node { ...@@ -1013,7 +1013,7 @@ func assignconvfn(n *Node, t *Type, context func() string) *Node {
var why string var why string
op := assignop(n.Type, t, &why) op := assignop(n.Type, t, &why)
if op == 0 { if op == 0 {
Yyerror("cannot use %v as type %v in %s%s", Nconv(n, FmtLong), t, context(), why) Yyerror("cannot use %2v as type %v in %s%s", n, t, context(), why)
op = OCONV op = OCONV
} }
......
...@@ -71,7 +71,7 @@ func typecheckswitch(n *Node) { ...@@ -71,7 +71,7 @@ func typecheckswitch(n *Node) {
n.Left.Right = typecheck(n.Left.Right, Erv) n.Left.Right = typecheck(n.Left.Right, Erv)
t = n.Left.Right.Type t = n.Left.Right.Type
if t != nil && !t.IsInterface() { if t != nil && !t.IsInterface() {
Yyerror("cannot type switch on non-interface value %v", Nconv(n.Left.Right, FmtLong)) Yyerror("cannot type switch on non-interface value %2v", n.Left.Right)
} }
} else { } else {
// expression switch // expression switch
...@@ -86,14 +86,14 @@ func typecheckswitch(n *Node) { ...@@ -86,14 +86,14 @@ func typecheckswitch(n *Node) {
if t != nil { if t != nil {
switch { switch {
case !okforeq[t.Etype]: case !okforeq[t.Etype]:
Yyerror("cannot switch on %v", Nconv(n.Left, FmtLong)) Yyerror("cannot switch on %2v", n.Left)
case t.IsSlice(): case t.IsSlice():
nilonly = "slice" nilonly = "slice"
case t.IsArray() && !t.IsComparable(): case t.IsArray() && !t.IsComparable():
Yyerror("cannot switch on %v", Nconv(n.Left, FmtLong)) Yyerror("cannot switch on %2v", n.Left)
case t.IsStruct(): case t.IsStruct():
if f := t.IncomparableField(); f != nil { if f := t.IncomparableField(); f != nil {
Yyerror("cannot switch on %v (struct containing %v cannot be compared)", Nconv(n.Left, FmtLong), f.Type) Yyerror("cannot switch on %2v (struct containing %v cannot be compared)", n.Left, f.Type)
} }
case t.Etype == TFUNC: case t.Etype == TFUNC:
nilonly = "func" nilonly = "func"
...@@ -143,7 +143,7 @@ func typecheckswitch(n *Node) { ...@@ -143,7 +143,7 @@ func typecheckswitch(n *Node) {
case nilonly != "" && !isnil(n1): case nilonly != "" && !isnil(n1):
Yyerror("invalid case %v in switch (can only compare %s %v to nil)", n1, nilonly, n.Left) Yyerror("invalid case %v in switch (can only compare %s %v to nil)", n1, nilonly, n.Left)
case t.IsInterface() && !n1.Type.IsInterface() && !n1.Type.IsComparable(): case t.IsInterface() && !n1.Type.IsInterface() && !n1.Type.IsComparable():
Yyerror("invalid case %v in switch (incomparable type)", Nconv(n1, FmtLong)) Yyerror("invalid case %2v in switch (incomparable type)", n1)
} }
// type switch // type switch
...@@ -159,15 +159,15 @@ func typecheckswitch(n *Node) { ...@@ -159,15 +159,15 @@ func typecheckswitch(n *Node) {
niltype = ncase niltype = ncase
} }
case n1.Op != OTYPE && n1.Type != nil: // should this be ||? case n1.Op != OTYPE && n1.Type != nil: // should this be ||?
Yyerror("%v is not a type", Nconv(n1, FmtLong)) Yyerror("%2v is not a type", n1)
// reset to original type // reset to original type
n1 = n.Left.Right n1 = n.Left.Right
ls[i1] = n1 ls[i1] = n1
case !n1.Type.IsInterface() && t.IsInterface() && !implements(n1.Type, t, &missing, &have, &ptr): case !n1.Type.IsInterface() && t.IsInterface() && !implements(n1.Type, t, &missing, &have, &ptr):
if have != nil && !missing.Broke && !have.Broke { if have != nil && !missing.Broke && !have.Broke {
Yyerror("impossible type switch case: %v cannot have dynamic type %v"+" (wrong type for %v method)\n\thave %v%1v\n\twant %v%1v", Nconv(n.Left.Right, FmtLong), n1.Type, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type) Yyerror("impossible type switch case: %2v cannot have dynamic type %v"+" (wrong type for %v method)\n\thave %v%1v\n\twant %v%1v", n.Left.Right, n1.Type, missing.Sym, have.Sym, have.Type, missing.Sym, missing.Type)
} else if !missing.Broke { } else if !missing.Broke {
Yyerror("impossible type switch case: %v cannot have dynamic type %v"+" (missing %v method)", Nconv(n.Left.Right, FmtLong), n1.Type, missing.Sym) Yyerror("impossible type switch case: %2v cannot have dynamic type %v"+" (missing %v method)", n.Left.Right, n1.Type, missing.Sym)
} }
} }
} }
......
...@@ -490,7 +490,7 @@ OpSwitch: ...@@ -490,7 +490,7 @@ OpSwitch:
if !t.IsPtr() { if !t.IsPtr() {
if top&(Erv|Etop) != 0 { if top&(Erv|Etop) != 0 {
Yyerror("invalid indirect of %v", Nconv(n.Left, FmtLong)) Yyerror("invalid indirect of %2v", n.Left)
n.Type = nil n.Type = nil
return n return n
} }
...@@ -1380,7 +1380,7 @@ OpSwitch: ...@@ -1380,7 +1380,7 @@ OpSwitch:
break OpSwitch break OpSwitch
badcall1: badcall1:
Yyerror("invalid argument %v for %v", Nconv(n.Left, FmtLong), n.Op) Yyerror("invalid argument %2v for %v", n.Left, n.Op)
n.Type = nil n.Type = nil
return n return n
...@@ -1681,7 +1681,7 @@ OpSwitch: ...@@ -1681,7 +1681,7 @@ OpSwitch:
n.Op = convertop(t, n.Type, &why) n.Op = convertop(t, n.Type, &why)
if n.Op == 0 { if n.Op == 0 {
if n.Diag == 0 && !n.Type.Broke { if n.Diag == 0 && !n.Type.Broke {
Yyerror("cannot convert %v to type %v%s", Nconv(n.Left, FmtLong), n.Type, why) Yyerror("cannot convert %2v to type %v%s", n.Left, n.Type, why)
n.Diag = 1 n.Diag = 1
} }
...@@ -2006,7 +2006,7 @@ OpSwitch: ...@@ -2006,7 +2006,7 @@ OpSwitch:
if n.Left != nil { if n.Left != nil {
t := n.Left.Type t := n.Left.Type
if t != nil && !t.IsBoolean() { if t != nil && !t.IsBoolean() {
Yyerror("non-bool %v used as for condition", Nconv(n.Left, FmtLong)) Yyerror("non-bool %2v used as for condition", n.Left)
} }
} }
n.Right = typecheck(n.Right, Etop) n.Right = typecheck(n.Right, Etop)
...@@ -2021,7 +2021,7 @@ OpSwitch: ...@@ -2021,7 +2021,7 @@ OpSwitch:
if n.Left != nil { if n.Left != nil {
t := n.Left.Type t := n.Left.Type
if t != nil && !t.IsBoolean() { if t != nil && !t.IsBoolean() {
Yyerror("non-bool %v used as if condition", Nconv(n.Left, FmtLong)) Yyerror("non-bool %2v used as if condition", n.Left)
} }
} }
typecheckslice(n.Nbody.Slice(), Etop) typecheckslice(n.Nbody.Slice(), Etop)
...@@ -2466,7 +2466,7 @@ func lookdot(n *Node, t *Type, dostrcmp int) *Field { ...@@ -2466,7 +2466,7 @@ func lookdot(n *Node, t *Type, dostrcmp int) *Field {
n.Left.Implicit = true n.Left.Implicit = true
n.Left = typecheck(n.Left, Etype|Erv) n.Left = typecheck(n.Left, Etype|Erv)
} else if tt.Etype == Tptr && tt.Elem().Etype == Tptr && Eqtype(derefall(tt), derefall(rcvr)) { } else if tt.Etype == Tptr && tt.Elem().Etype == Tptr && Eqtype(derefall(tt), derefall(rcvr)) {
Yyerror("calling method %v with receiver %v requires explicit dereference", n.Sym, Nconv(n.Left, FmtLong)) Yyerror("calling method %v with receiver %2v requires explicit dereference", n.Sym, n.Left)
for tt.Etype == Tptr { for tt.Etype == Tptr {
// Stop one level early for method with pointer receiver. // Stop one level early for method with pointer receiver.
if rcvr.Etype == Tptr && tt.Elem().Etype != Tptr { if rcvr.Etype == Tptr && tt.Elem().Etype != Tptr {
...@@ -3250,7 +3250,7 @@ func checkassignto(src *Type, dst *Node) { ...@@ -3250,7 +3250,7 @@ func checkassignto(src *Type, dst *Node) {
var why string var why string
if assignop(src, dst.Type, &why) == 0 { if assignop(src, dst.Type, &why) == 0 {
Yyerror("cannot assign %v to %v in multiple assignment%s", src, Nconv(dst, FmtLong), why) Yyerror("cannot assign %v to %2v in multiple assignment%s", src, dst, why)
return return
} }
} }
...@@ -3669,7 +3669,7 @@ func typecheckdef(n *Node) *Node { ...@@ -3669,7 +3669,7 @@ func typecheckdef(n *Node) *Node {
} }
if !e.Type.IsUntyped() && !Eqtype(t, e.Type) { if !e.Type.IsUntyped() && !Eqtype(t, e.Type) {
Yyerror("cannot use %v as type %v in const initializer", Nconv(e, FmtLong), t) Yyerror("cannot use %2v as type %v in const initializer", e, t)
goto ret goto ret
} }
......
...@@ -184,7 +184,7 @@ func walkstmt(n *Node) *Node { ...@@ -184,7 +184,7 @@ func walkstmt(n *Node) *Node {
ORECOVER, ORECOVER,
OGETG: OGETG:
if n.Typecheck == 0 { if n.Typecheck == 0 {
Fatalf("missing typecheck: %v", Nconv(n, FmtSign)) Fatalf("missing typecheck: %+v", n)
} }
wascopy := n.Op == OCOPY wascopy := n.Op == OCOPY
init := n.Ninit init := n.Ninit
...@@ -199,7 +199,7 @@ func walkstmt(n *Node) *Node { ...@@ -199,7 +199,7 @@ func walkstmt(n *Node) *Node {
// the value received. // the value received.
case ORECV: case ORECV:
if n.Typecheck == 0 { if n.Typecheck == 0 {
Fatalf("missing typecheck: %v", Nconv(n, FmtSign)) Fatalf("missing typecheck: %+v", n)
} }
init := n.Ninit init := n.Ninit
n.Ninit.Set(nil) n.Ninit.Set(nil)
...@@ -366,7 +366,7 @@ func walkstmt(n *Node) *Node { ...@@ -366,7 +366,7 @@ func walkstmt(n *Node) *Node {
} }
if n.Op == ONAME { if n.Op == ONAME {
Fatalf("walkstmt ended up with name: %v", Nconv(n, FmtSign)) Fatalf("walkstmt ended up with name: %+v", n)
} }
return n return n
} }
...@@ -500,7 +500,7 @@ func walkexpr(n *Node, init *Nodes) *Node { ...@@ -500,7 +500,7 @@ func walkexpr(n *Node, init *Nodes) *Node {
} }
if n.Typecheck != 1 { if n.Typecheck != 1 {
Fatalf("missed typecheck: %v\n", Nconv(n, FmtSign)) Fatalf("missed typecheck: %+v", n)
} }
if n.Op == ONAME && n.Class == PAUTOHEAP { if n.Op == ONAME && n.Class == PAUTOHEAP {
...@@ -515,7 +515,7 @@ opswitch: ...@@ -515,7 +515,7 @@ opswitch:
switch n.Op { switch n.Op {
default: default:
Dump("walk", n) Dump("walk", n)
Fatalf("walkexpr: switch 1 unknown op %v", Nconv(n, FmtShort|FmtSign)) Fatalf("walkexpr: switch 1 unknown op %+1v", n)
case OTYPE, case OTYPE,
ONONAME, ONONAME,
...@@ -2217,7 +2217,7 @@ func needwritebarrier(l *Node, r *Node) bool { ...@@ -2217,7 +2217,7 @@ func needwritebarrier(l *Node, r *Node) bool {
func applywritebarrier(n *Node) *Node { func applywritebarrier(n *Node) *Node {
if n.Left != nil && n.Right != nil && needwritebarrier(n.Left, n.Right) { if n.Left != nil && n.Right != nil && needwritebarrier(n.Left, n.Right) {
if Debug_wb > 1 { if Debug_wb > 1 {
Warnl(n.Lineno, "marking %v for barrier", Nconv(n.Left, 0)) Warnl(n.Lineno, "marking %v for barrier", n.Left)
} }
n.Op = OASWB n.Op = OASWB
return n return n
......
...@@ -36,7 +36,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -36,7 +36,7 @@ func defframe(ptxt *obj.Prog) {
gc.Fatalf("needzero class %d", n.Class) gc.Fatalf("needzero class %d", n.Class)
} }
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 { if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset)) gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
} }
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) { if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
......
...@@ -215,7 +215,7 @@ func bignodes() { ...@@ -215,7 +215,7 @@ func bignodes() {
*/ */
func gmove(f *gc.Node, t *gc.Node) { func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 { if gc.Debug['M'] != 0 {
fmt.Printf("gmove %v -> %v\n", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong)) fmt.Printf("gmove %2v -> %2v\n", f, t)
} }
ft := int(gc.Simsimtype(f.Type)) ft := int(gc.Simsimtype(f.Type))
......
...@@ -36,7 +36,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -36,7 +36,7 @@ func defframe(ptxt *obj.Prog) {
gc.Fatalf("needzero class %d", n.Class) gc.Fatalf("needzero class %d", n.Class)
} }
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 { if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset)) gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
} }
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) { if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
......
...@@ -170,7 +170,7 @@ func bignodes() { ...@@ -170,7 +170,7 @@ func bignodes() {
*/ */
func gmove(f *gc.Node, t *gc.Node) { func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 { if gc.Debug['M'] != 0 {
fmt.Printf("gmove %v -> %v\n", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong)) fmt.Printf("gmove %2v -> %2v\n", f, t)
} }
ft := int(gc.Simsimtype(f.Type)) ft := int(gc.Simsimtype(f.Type))
......
...@@ -42,7 +42,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -42,7 +42,7 @@ func defframe(ptxt *obj.Prog) {
gc.Fatalf("needzero class %d", n.Class) gc.Fatalf("needzero class %d", n.Class)
} }
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 { if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset)) gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
} }
if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) { if lo != hi && n.Xoffset+n.Type.Width >= lo-int64(2*gc.Widthreg) {
......
...@@ -182,7 +182,7 @@ func gmvc(f, t *gc.Node) bool { ...@@ -182,7 +182,7 @@ func gmvc(f, t *gc.Node) bool {
// hard part is conversions. // hard part is conversions.
func gmove(f *gc.Node, t *gc.Node) { func gmove(f *gc.Node, t *gc.Node) {
if gc.Debug['M'] != 0 { if gc.Debug['M'] != 0 {
fmt.Printf("gmove %v -> %v\n", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong)) fmt.Printf("gmove %2v -> %2v\n", f, t)
} }
ft := int(gc.Simsimtype(f.Type)) ft := int(gc.Simsimtype(f.Type))
......
...@@ -34,7 +34,7 @@ func defframe(ptxt *obj.Prog) { ...@@ -34,7 +34,7 @@ func defframe(ptxt *obj.Prog) {
gc.Fatalf("needzero class %d", n.Class) gc.Fatalf("needzero class %d", n.Class)
} }
if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 { if n.Type.Width%int64(gc.Widthptr) != 0 || n.Xoffset%int64(gc.Widthptr) != 0 || n.Type.Width == 0 {
gc.Fatalf("var %v has size %d offset %d", gc.Nconv(n, gc.FmtLong), int(n.Type.Width), int(n.Xoffset)) gc.Fatalf("var %2v has size %d offset %d", n, int(n.Type.Width), int(n.Xoffset))
} }
if lo != hi && n.Xoffset+n.Type.Width == lo-int64(2*gc.Widthptr) { if lo != hi && n.Xoffset+n.Type.Width == lo-int64(2*gc.Widthptr) {
// merge with range we already have // merge with range we already have
......
...@@ -1594,7 +1594,7 @@ hardmem: ...@@ -1594,7 +1594,7 @@ hardmem:
// should not happen // should not happen
fatal: fatal:
gc.Fatalf("gmove %v -> %v", gc.Nconv(f, gc.FmtLong), gc.Nconv(t, gc.FmtLong)) gc.Fatalf("gmove %2v -> %2v", f, t)
return return
} }
......
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