]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/{asm,compile/internal}: delete dead code
authorDave Cheney <dave@cheney.net>
Thu, 25 Aug 2016 06:40:50 +0000 (16:40 +1000)
committerDave Cheney <dave@cheney.net>
Thu, 25 Aug 2016 12:20:29 +0000 (12:20 +0000)
Delete unused fields, methods, vars, and funcs. Spotted by
honnef.co/go/unused.

Change-Id: I0e65484bbd916e59369c4018be46f120b469d610
Reviewed-on: https://go-review.googlesource.com/27731
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
src/cmd/asm/internal/asm/parse.go
src/cmd/compile/internal/gc/bimport.go
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/gen.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/obj.go
src/cmd/compile/internal/gc/parser.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/type.go
src/cmd/internal/gcprog/gcprog.go
src/cmd/internal/goobj/read.go

index 40206e6dc1afd2f231f8f21a8eb07b3e58572802..406c65e4464588947e0ff66509f1c61fb80f40d9 100644 (file)
@@ -941,14 +941,6 @@ func (p *Parser) atof(str string) float64 {
        return value
 }
 
-func (p *Parser) atos(str string) string {
-       value, err := strconv.Unquote(str)
-       if err != nil {
-               p.errorf("%s", err)
-       }
-       return value
-}
-
 // EOF represents the end of input.
 var EOF = lex.Make(scanner.EOF, "EOF")
 
index ff7ea418d1ad5a2b31ef485b4a2d8724987fcf01..be196ceee53682e0123493c454a29526a1259854 100644 (file)
@@ -444,7 +444,7 @@ func (p *importer) typ() *Type {
                        result := p.paramList()
                        nointerface := p.bool()
 
-                       n := methodname1(newname(sym), recv[0].Right)
+                       n := methodname(newname(sym), recv[0].Right)
                        n.Type = functype(recv[0], params, result)
                        checkwidth(n.Type)
                        addmethod(sym, n.Type, tsym.Pkg, false, nointerface)
index a4b98ec7c5219abd31586f0ed945c6059b260e90..7c2d2a43cf9504bd0e892af47a073ebe4d7c15a3 100644 (file)
@@ -1123,15 +1123,7 @@ bad:
        return nil
 }
 
-func methodname(n *Node, t *Type) *Node {
-       s := methodsym(n.Sym, t, 0)
-       if s == nil {
-               return n
-       }
-       return newname(s)
-}
-
-func methodname1(n *Node, t *Node) *Node {
+func methodname(n *Node, t *Node) *Node {
        star := ""
        if t.Op == OIND {
                star = "*"
index e86875d95c90d7d36d5921f0daff9f6c2f2354dc..fa7655471165db566ff8325fcb67e0ac0878954f 100644 (file)
@@ -103,23 +103,6 @@ func (n *Node) isParamHeapCopy() bool {
        return n.Op == ONAME && n.Class == PAUTOHEAP && n.Name.Param.Stackcopy != nil
 }
 
-// paramClass reports the parameter class (PPARAM or PPARAMOUT)
-// of the node, which may be an unmoved on-stack parameter
-// or the on-heap or on-stack copy of a parameter that moved to the heap.
-// If the node is not a parameter, paramClass returns Pxxx.
-func (n *Node) paramClass() Class {
-       if n.Op != ONAME {
-               return Pxxx
-       }
-       if n.Class == PPARAM || n.Class == PPARAMOUT {
-               return n.Class
-       }
-       if n.isParamHeapCopy() {
-               return n.Name.Param.Stackcopy.Class
-       }
-       return Pxxx
-}
-
 // moveToHeap records the parameter or local variable n as moved to the heap.
 func moveToHeap(n *Node) {
        if Debug['r'] != 0 {
index 918d43d090d4a8951a73d2d53ac6327e4cb844b8..44c6df9e5ea8716c0a08e872dc1bbb995f2df0fa 100644 (file)
@@ -258,7 +258,7 @@ func (p *noder) funcHeader(fun *syntax.FuncDecl) *Node {
                // Receiver MethodName Signature
 
                f.Func.Shortname = newfuncname(name)
-               f.Func.Nname = methodname1(f.Func.Shortname, t.Left.Right)
+               f.Func.Nname = methodname(f.Func.Shortname, t.Left.Right)
        }
 
        f.Func.Nname.Name.Defn = f
@@ -955,10 +955,6 @@ func (p *noder) newname(name *syntax.Name) *Node {
        return newname(p.name(name))
 }
 
-func (p *noder) oldname(name *syntax.Name) *Node {
-       return oldname(p.name(name))
-}
-
 func (p *noder) wrapname(n syntax.Node, x *Node) *Node {
        // These nodes do not carry line numbers.
        // Introduce a wrapper node to give them the correct line.
index b5c06d165d4c6d23c0fc1eb5eeab37c4b7a2f112..ed69c7a6772d0ec083b826ff946ff7de1ced29b0 100644 (file)
@@ -337,24 +337,6 @@ func datagostring(sval string, a *obj.Addr) {
        a.Etype = uint8(TSTRING)
 }
 
-func dgostringptr(s *Sym, off int, str string) int {
-       if str == "" {
-               return duintptr(s, off, 0)
-       }
-       return dgostrlitptr(s, off, &str)
-}
-
-func dgostrlitptr(s *Sym, off int, lit *string) int {
-       if lit == nil {
-               return duintptr(s, off, 0)
-       }
-       off = int(Rnd(int64(off), int64(Widthptr)))
-       symhdr, _ := stringsym(*lit)
-       Linksym(s).WriteAddr(Ctxt, int64(off), Widthptr, symhdr, 0)
-       off += Widthptr
-       return off
-}
-
 func dsname(s *Sym, off int, t string) int {
        return dsnameLSym(Linksym(s), off, t)
 }
index 19202674a6e5ffdebd2ae9b5cb851dd13f97dc94..d910be064403d2df054ea517b11c60e8a7dff94e 100644 (file)
@@ -1891,7 +1891,7 @@ func (p *parser) fndcl() *Node {
 
                f := Nod(ODCLFUNC, nil, nil)
                f.Func.Shortname = newfuncname(name)
-               f.Func.Nname = methodname1(f.Func.Shortname, recv.Right)
+               f.Func.Nname = methodname(f.Func.Shortname, recv.Right)
                f.Func.Nname.Name.Defn = f
                f.Func.Nname.Name.Param.Ntype = t
                declare(f.Func.Nname, PFUNC)
index 646f2e1833a82394ca86088a07611a64693b8be4..928575c3fa22d4425751e23bedce1e91d2e8f754 100644 (file)
@@ -3434,20 +3434,6 @@ var u64_f32 u2fcvtTab = u2fcvtTab{
        one:   (*state).constInt64,
 }
 
-// Excess generality on a machine with 64-bit integer registers.
-// Not used on AMD64.
-var u32_f32 u2fcvtTab = u2fcvtTab{
-       geq:   ssa.OpGeq32,
-       cvt2F: ssa.OpCvt32to32F,
-       and:   ssa.OpAnd32,
-       rsh:   ssa.OpRsh32Ux32,
-       or:    ssa.OpOr32,
-       add:   ssa.OpAdd32F,
-       one: func(s *state, t ssa.Type, x int64) *ssa.Value {
-               return s.constInt32(t, int32(x))
-       },
-}
-
 func (s *state) uint64Tofloat64(n *Node, x *ssa.Value, ft, tt *Type) *ssa.Value {
        return s.uintTofloat(&u64_f64, n, x, ft, tt)
 }
@@ -4119,20 +4105,6 @@ func genssa(f *ssa.Func, ptxt *obj.Prog, gcargs, gclocals *Sym) {
        f.Config.HTML.Close()
 }
 
-// movZero generates a register indirect move with a 0 immediate and keeps track of bytes left and next offset
-func movZero(as obj.As, width int64, nbytes int64, offset int64, regnum int16) (nleft int64, noff int64) {
-       p := Prog(as)
-       // TODO: use zero register on archs that support it.
-       p.From.Type = obj.TYPE_CONST
-       p.From.Offset = 0
-       p.To.Type = obj.TYPE_MEM
-       p.To.Reg = regnum
-       p.To.Offset = offset
-       offset += width
-       nleft = nbytes - width
-       return nleft, offset
-}
-
 type FloatingEQNEJump struct {
        Jump  obj.As
        Index int
index 9da83a3435f2cda243e9fb8e7241403e36454685..3810bb878e6a82ca0d047bf37b31b1e64566b3bd 100644 (file)
@@ -677,12 +677,6 @@ func (t *Type) wantEtype(et EType) {
        }
 }
 
-func (t *Type) wantEtype2(et1, et2 EType) {
-       if t.Etype != et1 && t.Etype != et2 {
-               Fatalf("want %v or %v, but have %v", et1, et2, t)
-       }
-}
-
 func (t *Type) RecvsP() **Type {
        t.wantEtype(TFUNC)
        return &t.Extra.(*FuncType).Receiver
index 7880917ecfd047dfa7c55425c8868aa7b0860601..c8bf20646870d12c54aa8b9a55c28410d98a5345 100644 (file)
@@ -37,7 +37,6 @@ const progMaxLiteral = 127 // maximum n for literal n bit code
 // to describe the data type, and then finally call End.
 type Writer struct {
        writeByte func(byte)
-       symoff    int
        index     int64
        b         [progMaxLiteral]byte
        nb        int
index 329f80146d4bede293a4125ff56b58a78ff614b6..81f1726860bb587c5c9a3645fcee62606210fd84 100644 (file)
@@ -244,7 +244,6 @@ type objReader struct {
        dataOffset int64
        limit      int64
        tmp        [256]byte
-       pkg        string
        pkgprefix  string
 }