Commit 24965bc9 authored by Dave Cheney's avatar Dave Cheney

cmd/compile/internal/gc: remove dead code

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent e7cc9c4f
// 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
}
......@@ -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)
}
}
}
......@@ -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
......
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