Commit 1acba7d4 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/internal/obj: remove prasm

Fold the printing of the offending instruction
into the neighboring Diag call, if it is not
already present.

Change-Id: I310f1479e16a4d2a24ff3c2f7e2c60e5e2015c1b
Reviewed-on: https://go-review.googlesource.com/38714
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 2b4274d6
...@@ -1155,10 +1155,6 @@ func aconsize(ctxt *obj.Link) int { ...@@ -1155,10 +1155,6 @@ func aconsize(ctxt *obj.Link) int {
return C_LACON return C_LACON
} }
func prasm(p *obj.Prog) {
fmt.Printf("%v\n", p)
}
func oplook(ctxt *obj.Link, p *obj.Prog) *Optab { func oplook(ctxt *obj.Link, p *obj.Prog) *Optab {
a1 := int(p.Optab) a1 := int(p.Optab)
if a1 != 0 { if a1 != 0 {
...@@ -1201,7 +1197,6 @@ func oplook(ctxt *obj.Link, p *obj.Prog) *Optab { ...@@ -1201,7 +1197,6 @@ func oplook(ctxt *obj.Link, p *obj.Prog) *Optab {
ctxt.Diag("illegal combination %v; %v %v %v, %d %d", p, DRconv(a1), DRconv(a2), DRconv(a3), p.From.Type, p.To.Type) ctxt.Diag("illegal combination %v; %v %v %v, %d %d", p, DRconv(a1), DRconv(a2), DRconv(a3), p.From.Type, p.To.Type)
ctxt.Diag("from %d %d to %d %d\n", p.From.Type, p.From.Name, p.To.Type, p.To.Name) ctxt.Diag("from %d %d to %d %d\n", p.From.Type, p.From.Name, p.To.Type, p.To.Name)
prasm(p)
if ops == nil { if ops == nil {
ops = optab ops = optab
} }
...@@ -1485,8 +1480,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) { ...@@ -1485,8 +1480,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
} }
switch o.type_ { switch o.type_ {
default: default:
ctxt.Diag("unknown asm %d", o.type_) ctxt.Diag("%v: unknown asm %d", p, o.type_)
prasm(p)
case 0: /* pseudo ops */ case 0: /* pseudo ops */
if false { /*debug['G']*/ if false { /*debug['G']*/
...@@ -1706,8 +1700,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) { ...@@ -1706,8 +1700,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
if false { if false {
if rt == r || rf == REGPC&15 || r == REGPC&15 || rt == REGPC&15 { if rt == r || rf == REGPC&15 || r == REGPC&15 || rt == REGPC&15 {
ctxt.Diag("bad registers in MUL") ctxt.Diag("%v: bad registers in MUL", p)
prasm(p)
} }
} }
...@@ -2573,8 +2566,7 @@ func oprrr(ctxt *obj.Link, a obj.As, sc int) uint32 { ...@@ -2573,8 +2566,7 @@ func oprrr(ctxt *obj.Link, a obj.As, sc int) uint32 {
return o&(0xf<<28) | 0x12fff3<<4 return o&(0xf<<28) | 0x12fff3<<4
} }
ctxt.Diag("bad rrr %d", a) ctxt.Diag("%v: bad rrr %d", ctxt.Curp, a)
prasm(ctxt.Curp)
return 0 return 0
} }
...@@ -2627,8 +2619,7 @@ func opbra(ctxt *obj.Link, p *obj.Prog, a obj.As, sc int) uint32 { ...@@ -2627,8 +2619,7 @@ func opbra(ctxt *obj.Link, p *obj.Prog, a obj.As, sc int) uint32 {
return 0xe<<28 | 0x5<<25 return 0xe<<28 | 0x5<<25
} }
ctxt.Diag("bad bra %v", a) ctxt.Diag("%v: bad bra %v", ctxt.Curp, a)
prasm(ctxt.Curp)
return 0 return 0
} }
...@@ -2767,8 +2758,7 @@ func omvl(ctxt *obj.Link, p *obj.Prog, a *obj.Addr, dr int) uint32 { ...@@ -2767,8 +2758,7 @@ func omvl(ctxt *obj.Link, p *obj.Prog, a *obj.Addr, dr int) uint32 {
aclass(ctxt, a) aclass(ctxt, a)
v := immrot(^uint32(ctxt.Instoffset)) v := immrot(^uint32(ctxt.Instoffset))
if v == 0 { if v == 0 {
ctxt.Diag("missing literal") ctxt.Diag("%v: missing literal", p)
prasm(p)
return 0 return 0
} }
......
...@@ -524,10 +524,6 @@ var pool struct { ...@@ -524,10 +524,6 @@ var pool struct {
size uint32 size uint32
} }
func prasm(p *obj.Prog) {
fmt.Printf("%v\n", p)
}
func span7(ctxt *obj.Link, cursym *obj.LSym) { func span7(ctxt *obj.Link, cursym *obj.LSym) {
p := cursym.Text p := cursym.Text
if p == nil || p.Link == nil { // handle external functions and ELF section symbols if p == nil || p.Link == nil { // handle external functions and ELF section symbols
...@@ -1255,7 +1251,6 @@ func oplook(ctxt *obj.Link, p *obj.Prog) *Optab { ...@@ -1255,7 +1251,6 @@ func oplook(ctxt *obj.Link, p *obj.Prog) *Optab {
} }
ctxt.Diag("illegal combination %v %v %v %v, %d %d", p, DRconv(a1), DRconv(a2), DRconv(a3), p.From.Type, p.To.Type) ctxt.Diag("illegal combination %v %v %v %v, %d %d", p, DRconv(a1), DRconv(a2), DRconv(a3), p.From.Type, p.To.Type)
prasm(p)
if ops == nil { if ops == nil {
ops = optab ops = optab
} }
...@@ -1934,8 +1929,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) { ...@@ -1934,8 +1929,7 @@ func asmout(ctxt *obj.Link, p *obj.Prog, o *Optab, out []uint32) {
} }
switch o.type_ { switch o.type_ {
default: default:
ctxt.Diag("unknown asm %d", o.type_) ctxt.Diag("%v: unknown asm %d", p, o.type_)
prasm(p)
case 0: /* pseudo ops */ case 0: /* pseudo ops */
break break
...@@ -3489,8 +3483,7 @@ func oprrr(ctxt *obj.Link, a obj.As) uint32 { ...@@ -3489,8 +3483,7 @@ func oprrr(ctxt *obj.Link, a obj.As) uint32 {
return FPOP1S(0, 0, 3, 5) return FPOP1S(0, 0, 3, 5)
} }
ctxt.Diag("bad rrr %d %v", a, a) ctxt.Diag("%v: bad rrr %d %v", ctxt.Curp, a, a)
prasm(ctxt.Curp)
return 0 return 0
} }
...@@ -3676,8 +3669,7 @@ func opirr(ctxt *obj.Link, a obj.As) uint32 { ...@@ -3676,8 +3669,7 @@ func opirr(ctxt *obj.Link, a obj.As) uint32 {
return SYSOP(0, 0, 3, 2, 0, 0, 0x1F) return SYSOP(0, 0, 3, 2, 0, 0, 0x1F)
} }
ctxt.Diag("bad irr %v", a) ctxt.Diag("%v: bad irr %v", ctxt.Curp, a)
prasm(ctxt.Curp)
return 0 return 0
} }
...@@ -3786,8 +3778,7 @@ func opimm(ctxt *obj.Link, a obj.As) uint32 { ...@@ -3786,8 +3778,7 @@ func opimm(ctxt *obj.Link, a obj.As) uint32 {
return SYSOP(0, 0, 3, 3, 0, 2, 0x1F) return SYSOP(0, 0, 3, 3, 0, 2, 0x1F)
} }
ctxt.Diag("bad imm %v", a) ctxt.Diag("%v: bad imm %v", ctxt.Curp, a)
prasm(ctxt.Curp)
return 0 return 0
} }
...@@ -3870,8 +3861,7 @@ func opbra(ctxt *obj.Link, a obj.As) uint32 { ...@@ -3870,8 +3861,7 @@ func opbra(ctxt *obj.Link, a obj.As) uint32 {
return 1<<31 | 5<<26 return 1<<31 | 5<<26
} }
ctxt.Diag("bad bra %v", a) ctxt.Diag("%v: bad bra %v", ctxt.Curp, a)
prasm(ctxt.Curp)
return 0 return 0
} }
...@@ -3887,8 +3877,7 @@ func opbrr(ctxt *obj.Link, a obj.As) uint32 { ...@@ -3887,8 +3877,7 @@ func opbrr(ctxt *obj.Link, a obj.As) uint32 {
return OPBLR(2) /* RET */ return OPBLR(2) /* RET */
} }
ctxt.Diag("bad brr %v", a) ctxt.Diag("%v: bad brr %v", ctxt.Curp, a)
prasm(ctxt.Curp)
return 0 return 0
} }
...@@ -3919,8 +3908,7 @@ func op0(ctxt *obj.Link, a obj.As) uint32 { ...@@ -3919,8 +3908,7 @@ func op0(ctxt *obj.Link, a obj.As) uint32 {
return SYSHINT(5) return SYSHINT(5)
} }
ctxt.Diag("bad op0 %v", a) ctxt.Diag("%v: bad op0 %v", ctxt.Curp, a)
prasm(ctxt.Curp)
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