]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/gc: remove dead code
authorDave Cheney <dave@cheney.net>
Thu, 15 Sep 2016 04:20:55 +0000 (14:20 +1000)
committerDave Cheney <dave@cheney.net>
Thu, 15 Sep 2016 05:16:15 +0000 (05:16 +0000)
Remove unused functions spotted by honnef.co/go/unused.

Change-Id: Iabf3b201215ce21e420a60f4ef2679b36231eda7
Reviewed-on: https://go-review.googlesource.com/29132
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/cgen.go [deleted file]
src/cmd/compile/internal/gc/gen.go
src/cmd/compile/internal/gc/gsubr.go

diff --git a/src/cmd/compile/internal/gc/cgen.go b/src/cmd/compile/internal/gc/cgen.go
deleted file mode 100644 (file)
index 3d8a7c1..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package gc
-
-import "cmd/internal/sys"
-
-// hasHMUL64 reports whether the architecture supports 64-bit
-// signed and unsigned high multiplication (OHMUL).
-func hasHMUL64() bool {
-       switch Ctxt.Arch.Family {
-       case sys.AMD64, sys.S390X, sys.ARM64:
-               return true
-       case sys.ARM, sys.I386, sys.MIPS64, sys.PPC64:
-               return false
-       }
-       Fatalf("unknown architecture")
-       return false
-}
-
-// hasRROTC64 reports whether the architecture supports 64-bit
-// rotate through carry instructions (ORROTC).
-func hasRROTC64() bool {
-       switch Ctxt.Arch.Family {
-       case sys.AMD64:
-               return true
-       case sys.ARM, sys.ARM64, sys.I386, sys.MIPS64, sys.PPC64, sys.S390X:
-               return false
-       }
-       Fatalf("unknown architecture")
-       return false
-}
-
-func hasRightShiftWithCarry() bool {
-       switch Ctxt.Arch.Family {
-       case sys.ARM64:
-               return true
-       case sys.AMD64, sys.ARM, sys.I386, sys.MIPS64, sys.PPC64, sys.S390X:
-               return false
-       }
-       Fatalf("unknown architecture")
-       return false
-}
-
-func hasAddSetCarry() bool {
-       switch Ctxt.Arch.Family {
-       case sys.ARM64:
-               return true
-       case sys.AMD64, sys.ARM, sys.I386, sys.MIPS64, sys.PPC64, sys.S390X:
-               return false
-       }
-       Fatalf("unknown architecture")
-       return false
-}
index f948fc6100776da63dc309c1244949ffa0cb4ad2..7a22b20333a6b102ed7ee5d3e3c9c5145318a34f 100644 (file)
@@ -189,104 +189,6 @@ func clearlabels() {
        labellist = labellist[:0]
 }
 
-func newlab(n *Node) *Label {
-       s := n.Left.Sym
-       lab := s.Label
-       if lab == nil {
-               lab = new(Label)
-               lab.Sym = s
-               s.Label = lab
-               if n.Used {
-                       lab.Used = true
-               }
-               labellist = append(labellist, lab)
-       }
-
-       if n.Op == OLABEL {
-               if lab.Def != nil {
-                       Yyerror("label %v already defined at %v", s, lab.Def.Line())
-               } else {
-                       lab.Def = n
-               }
-       } else {
-               lab.Use = append(lab.Use, n)
-       }
-
-       return lab
-}
-
-// There is a copy of checkgoto in the new SSA backend.
-// Please keep them in sync.
-func checkgoto(from *Node, to *Node) {
-       if from.Sym == to.Sym {
-               return
-       }
-
-       nf := 0
-       for fs := from.Sym; fs != nil; fs = fs.Link {
-               nf++
-       }
-       nt := 0
-       for fs := to.Sym; fs != nil; fs = fs.Link {
-               nt++
-       }
-       fs := from.Sym
-       for ; nf > nt; nf-- {
-               fs = fs.Link
-       }
-       if fs != to.Sym {
-               lno := lineno
-               setlineno(from)
-
-               // decide what to complain about.
-               // prefer to complain about 'into block' over declarations,
-               // so scan backward to find most recent block or else dcl.
-               var block *Sym
-
-               var dcl *Sym
-               ts := to.Sym
-               for ; nt > nf; nt-- {
-                       if ts.Pkg == nil {
-                               block = ts
-                       } else {
-                               dcl = ts
-                       }
-                       ts = ts.Link
-               }
-
-               for ts != fs {
-                       if ts.Pkg == nil {
-                               block = ts
-                       } else {
-                               dcl = ts
-                       }
-                       ts = ts.Link
-                       fs = fs.Link
-               }
-
-               if block != nil {
-                       Yyerror("goto %v jumps into block starting at %v", from.Left.Sym, linestr(block.Lastlineno))
-               } else {
-                       Yyerror("goto %v jumps over declaration of %v at %v", from.Left.Sym, dcl, linestr(dcl.Lastlineno))
-               }
-               lineno = lno
-       }
-}
-
-func stmtlabel(n *Node) *Label {
-       if n.Sym != nil {
-               lab := n.Sym.Label
-               if lab != nil {
-                       if lab.Def != nil {
-                               if lab.Def.Name.Defn == n {
-                                       return lab
-                               }
-                       }
-               }
-       }
-       return nil
-}
-
 // make a new off the books
 func Tempname(nn *Node, t *Type) {
        if Curfn == nil {
@@ -328,26 +230,3 @@ func temp(t *Type) *Node {
        n.Sym.Def.Used = true
        return n.Orig
 }
-
-func checklabels() {
-       for _, lab := range labellist {
-               if lab.Def == nil {
-                       for _, n := range lab.Use {
-                               yyerrorl(n.Lineno, "label %v not defined", lab.Sym)
-                       }
-                       continue
-               }
-
-               if lab.Use == nil && !lab.Used {
-                       yyerrorl(lab.Def.Lineno, "label %v defined and not used", lab.Sym)
-                       continue
-               }
-
-               if lab.Gotopc != nil {
-                       Fatalf("label %v never resolved", lab.Sym)
-               }
-               for _, n := range lab.Use {
-                       checkgoto(n, lab.Def)
-               }
-       }
-}
index 59ac9afd926e5675225268332556574dee6aaad1..68e2a224de0d61e008b6415ef868f1541c3540a8 100644 (file)
@@ -255,14 +255,6 @@ func ggloblLSym(s *obj.LSym, width int32, flags int16) {
        p.From3.Offset = int64(flags)
 }
 
-func gjmp(to *obj.Prog) *obj.Prog {
-       p := Gbranch(obj.AJMP, nil, 0)
-       if to != nil {
-               Patch(p, to)
-       }
-       return p
-}
-
 func gtrack(s *Sym) {
        p := Thearch.Gins(obj.AUSEFIELD, nil, nil)
        p.From.Type = obj.TYPE_MEM
@@ -270,10 +262,6 @@ func gtrack(s *Sym) {
        p.From.Sym = Linksym(s)
 }
 
-func gused(n *Node) {
-       Thearch.Gins(obj.ANOP, n, nil) // used
-}
-
 func Isfat(t *Type) bool {
        if t != nil {
                switch t.Etype {
@@ -655,16 +643,6 @@ func Patch(p *obj.Prog, to *obj.Prog) {
        p.To.Offset = to.Pc
 }
 
-func unpatch(p *obj.Prog) *obj.Prog {
-       if p.To.Type != obj.TYPE_BRANCH {
-               Fatalf("unpatch: not a branch")
-       }
-       q, _ := p.To.Val.(*obj.Prog)
-       p.To.Val = nil
-       p.To.Offset = 0
-       return q
-}
-
 var reg [100]int       // count of references to reg
 var regstk [100][]byte // allocation sites, when -v is given