Commit 951f74c4 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/...: fix vet issues and cull dead code

Change-Id: Ied0eab872950793b34dd2268055b29c702b07e99
Reviewed-on: https://go-review.googlesource.com/9081Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
parent d0f3100b
......@@ -329,7 +329,7 @@ func pushback(r0 *gc.Flow) {
if gc.Debug['P'] != 0 && gc.Debug['v'] != 0 {
fmt.Printf("no pushback: %v\n", r0.Prog)
if r != nil {
fmt.Printf("\t%v [%d]\n", r.Prog, gc.Uniqs(r) != nil)
fmt.Printf("\t%v [%v]\n", r.Prog, gc.Uniqs(r) != nil)
}
}
......
......@@ -543,25 +543,6 @@ func rawgins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
return p
}
func fixlargeoffset(n *gc.Node) {
if n == nil {
return
}
if n.Op != gc.OINDREG {
return
}
if -4096 <= n.Xoffset && n.Xoffset < 4096 {
return
}
a := gc.Node(*n)
a.Op = gc.OREGISTER
a.Type = gc.Types[gc.Tptr]
a.Xoffset = 0
gc.Cgen_checknil(&a)
ginscon(optoas(gc.OADD, gc.Types[gc.Tptr]), n.Xoffset, &a)
n.Xoffset = 0
}
/*
* insert n into reg slot of p
*/
......
......@@ -293,7 +293,7 @@ func copyprop(r0 *gc.Flow) bool {
v2 := (*obj.Addr)(&p.To)
if copyas(v1, v2) {
if gc.Debug['P'] != 0 {
fmt.Printf("eliminating self-move\n", r0.Prog)
fmt.Printf("eliminating self-move: %v\n", r0.Prog)
}
return true
}
......
......@@ -638,31 +638,6 @@ func rawgins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
return p
}
func fixlargeoffset(n *gc.Node) {
if n == nil {
return
}
if n.Op != gc.OINDREG {
return
}
if n.Reg == ppc64.REGSP { // stack offset cannot be large
return
}
if n.Xoffset != int64(int32(n.Xoffset)) {
// TODO(minux): offset too large, move into R31 and add to R31 instead.
// this is used only in test/fixedbugs/issue6036.go.
gc.Fatal("offset too large: %v", n)
a := gc.Node(*n)
a.Op = gc.OREGISTER
a.Type = gc.Types[gc.Tptr]
a.Xoffset = 0
gc.Cgen_checknil(&a)
ginscon(optoas(gc.OADD, gc.Types[gc.Tptr]), n.Xoffset, &a)
n.Xoffset = 0
}
}
/*
* return Axxx for Oxxx on type t.
*/
......
......@@ -481,7 +481,7 @@ func copyprop(r0 *gc.Flow) bool {
v2 := (*obj.Addr)(&p.To)
if copyas(v1, v2) {
if gc.Debug['P'] != 0 {
fmt.Printf("eliminating self-move\n", r0.Prog)
fmt.Printf("eliminating self-move: %v\n", r0.Prog)
}
return true
}
......
......@@ -1135,7 +1135,6 @@ func idealkind(n *Node) int {
} else {
return k2
}
fallthrough
case OREAL, OIMAG:
return CTFLT
......
......@@ -1184,7 +1184,6 @@ func exprfmt(n *Node, prec int) string {
return fmt.Sprintf("chan %v", n.Left)
}
}
fallthrough
case OTSTRUCT:
return "<struct>"
......
......@@ -1738,51 +1738,48 @@ OpSwitch:
break OpSwitch
case OCONV:
{
ok |= Erv
saveorignode(n)
typecheck(&n.Left, Erv|top&(Eindir|Eiota))
convlit1(&n.Left, n.Type, true)
t := n.Left.Type
if t == nil || n.Type == nil {
n.Type = nil
return
ok |= Erv
saveorignode(n)
typecheck(&n.Left, Erv|top&(Eindir|Eiota))
convlit1(&n.Left, n.Type, true)
t := n.Left.Type
if t == nil || n.Type == nil {
n.Type = nil
return
}
var why string
n.Op = uint8(convertop(t, n.Type, &why))
if (n.Op) == 0 {
if n.Diag == 0 && n.Type.Broke == 0 {
Yyerror("cannot convert %v to type %v%s", Nconv(n.Left, obj.FmtLong), n.Type, why)
n.Diag = 1
}
var why string
n.Op = uint8(convertop(t, n.Type, &why))
if (n.Op) == 0 {
if n.Diag == 0 && n.Type.Broke == 0 {
Yyerror("cannot convert %v to type %v%s", Nconv(n.Left, obj.FmtLong), n.Type, why)
n.Diag = 1
}
n.Op = OCONV
}
switch n.Op {
case OCONVNOP:
if n.Left.Op == OLITERAL && n.Type != Types[TBOOL] {
r := Nod(OXXX, nil, nil)
n.Op = OCONV
n.Orig = r
*r = *n
n.Op = OLITERAL
n.Val = n.Left.Val
}
switch n.Op {
case OCONVNOP:
if n.Left.Op == OLITERAL && n.Type != Types[TBOOL] {
r := Nod(OXXX, nil, nil)
n.Op = OCONV
n.Orig = r
*r = *n
n.Op = OLITERAL
n.Val = n.Left.Val
}
// do not use stringtoarraylit.
// generated code and compiler memory footprint is better without it.
case OSTRARRAYBYTE:
break
// do not use stringtoarraylit.
// generated code and compiler memory footprint is better without it.
case OSTRARRAYBYTE:
break
case OSTRARRAYRUNE:
if n.Left.Op == OLITERAL {
stringtoarraylit(&n)
}
case OSTRARRAYRUNE:
if n.Left.Op == OLITERAL {
stringtoarraylit(&n)
}
break OpSwitch
}
break OpSwitch
case OMAKE:
......
......@@ -791,14 +791,14 @@ func Codeblk(addr int64, size int64) {
q = sym.P
for n >= 16 {
fmt.Fprintf(&Bso, "%.6x\t%%-20.16I\n", uint64(addr), q)
fmt.Fprintf(&Bso, "%.6x\t%-20.16I\n", uint64(addr), q)
addr += 16
q = q[16:]
n -= 16
}
if n > 0 {
fmt.Fprintf(&Bso, "%.6x\t%%-20.*I\n", uint64(addr), int(n), q)
fmt.Fprintf(&Bso, "%.6x\t%-20.*I\n", uint64(addr), int(n), q)
}
addr += n
}
......
......@@ -973,7 +973,7 @@ func defgotype(gotype *LSym) *DWDie {
}
if false && Debug['v'] > 2 {
fmt.Printf("new type: %%Y\n", gotype)
fmt.Printf("new type: %v\n", gotype)
}
kind := decodetype_kind(gotype)
......
......@@ -1011,8 +1011,6 @@ func hostlink() {
func ldobj(f *Biobuf, pkg string, length int64, pn string, file string, whence int) {
eof := Boffset(f) + length
pn = pn
start := Boffset(f)
c1 := Bgetc(f)
c2 := Bgetc(f)
......
......@@ -781,7 +781,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
}
p.As = obj.ARET
p.Lineno = p.Lineno
p.To.Type = obj.TYPE_MEM
p.To.Offset = 0
p.To.Reg = REGLINK
......
......@@ -323,7 +323,7 @@ func (ctx *traceContext) emit(e *ViewerEvent) {
func (ctx *traceContext) time(ev *trace.Event) int64 {
if ev.Ts < ctx.startTime || ev.Ts > ctx.endTime {
fmt.Printf("ts=%v startTime=%v endTime\n", ev.Ts, ctx.startTime, ctx.endTime)
fmt.Printf("ts=%v startTime=%v endTime=%v\n", ev.Ts, ctx.startTime, ctx.endTime)
panic("timestamp is outside of trace range")
}
// NOTE: trace viewer wants timestamps in microseconds and it does not
......
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