Skip to content

Commit 4ee0df8

Browse files
qiulaidongfengadonovan
authored andcommitted
cmd: remove dead code
Fixes #74076 Change-Id: Icc67b3d4e342f329584433bd1250c56ae8f5a73d Reviewed-on: https://go-review.googlesource.com/c/go/+/690635 Reviewed-by: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Commit-Queue: Alan Donovan <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]> Auto-Submit: Alan Donovan <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent a2c45f0 commit 4ee0df8

File tree

52 files changed

+1
-1033
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1
-1033
lines changed

src/cmd/asm/internal/arch/loong64.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ func jumpLoong64(word string) bool {
2323
return false
2424
}
2525

26-
// IsLoong64MUL reports whether the op (as defined by an loong64.A* constant) is
27-
// one of the MUL/DIV/REM instructions that require special handling.
28-
func IsLoong64MUL(op obj.As) bool {
29-
switch op {
30-
case loong64.AMUL, loong64.AMULU, loong64.AMULV, loong64.AMULVU,
31-
loong64.ADIV, loong64.ADIVU, loong64.ADIVV, loong64.ADIVVU,
32-
loong64.AREM, loong64.AREMU, loong64.AREMV, loong64.AREMVU:
33-
return true
34-
}
35-
return false
36-
}
37-
3826
// IsLoong64RDTIME reports whether the op (as defined by an loong64.A*
3927
// constant) is one of the RDTIMELW/RDTIMEHW/RDTIMED instructions that
4028
// require special handling.

src/cmd/asm/internal/asm/asm.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -974,14 +974,6 @@ func (p *Parser) getConstant(prog *obj.Prog, op obj.As, addr *obj.Addr) int64 {
974974
return addr.Offset
975975
}
976976

977-
// getImmediate checks that addr represents an immediate constant and returns its value.
978-
func (p *Parser) getImmediate(prog *obj.Prog, op obj.As, addr *obj.Addr) int64 {
979-
if addr.Type != obj.TYPE_CONST || addr.Name != 0 || addr.Reg != 0 || addr.Index != 0 {
980-
p.errorf("%s: expected immediate constant; found %s", op, obj.Dconv(prog, addr))
981-
}
982-
return addr.Offset
983-
}
984-
985977
// getRegister checks that addr represents a register and returns its value.
986978
func (p *Parser) getRegister(prog *obj.Prog, op obj.As, addr *obj.Addr) int16 {
987979
if addr.Type != obj.TYPE_REG || addr.Offset != 0 || addr.Name != 0 || addr.Index != 0 {

src/cmd/compile/internal/importer/support.go

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@ package importer
99
import (
1010
"cmd/compile/internal/base"
1111
"cmd/compile/internal/types2"
12-
"fmt"
1312
"go/token"
1413
"internal/pkgbits"
15-
"sync"
1614
)
1715

1816
func assert(p bool) {
1917
base.Assert(p)
2018
}
2119

22-
func errorf(format string, args ...interface{}) {
23-
panic(fmt.Sprintf(format, args...))
24-
}
25-
2620
const deltaNewFile = -64 // see cmd/compile/internal/gc/bexport.go
2721

2822
// Synthesize a token.Pos
@@ -31,108 +25,6 @@ type fakeFileSet struct {
3125
files map[string]*token.File
3226
}
3327

34-
func (s *fakeFileSet) pos(file string, line, column int) token.Pos {
35-
// TODO(mdempsky): Make use of column.
36-
37-
// Since we don't know the set of needed file positions, we
38-
// reserve maxlines positions per file.
39-
const maxlines = 64 * 1024
40-
f := s.files[file]
41-
if f == nil {
42-
f = s.fset.AddFile(file, -1, maxlines)
43-
s.files[file] = f
44-
// Allocate the fake linebreak indices on first use.
45-
// TODO(adonovan): opt: save ~512KB using a more complex scheme?
46-
fakeLinesOnce.Do(func() {
47-
fakeLines = make([]int, maxlines)
48-
for i := range fakeLines {
49-
fakeLines[i] = i
50-
}
51-
})
52-
f.SetLines(fakeLines)
53-
}
54-
55-
if line > maxlines {
56-
line = 1
57-
}
58-
59-
// Treat the file as if it contained only newlines
60-
// and column=1: use the line number as the offset.
61-
return f.Pos(line - 1)
62-
}
63-
64-
var (
65-
fakeLines []int
66-
fakeLinesOnce sync.Once
67-
)
68-
69-
func chanDir(d int) types2.ChanDir {
70-
// tag values must match the constants in cmd/compile/internal/gc/go.go
71-
switch d {
72-
case 1 /* Crecv */ :
73-
return types2.RecvOnly
74-
case 2 /* Csend */ :
75-
return types2.SendOnly
76-
case 3 /* Cboth */ :
77-
return types2.SendRecv
78-
default:
79-
errorf("unexpected channel dir %d", d)
80-
return 0
81-
}
82-
}
83-
84-
var predeclared = []types2.Type{
85-
// basic types
86-
types2.Typ[types2.Bool],
87-
types2.Typ[types2.Int],
88-
types2.Typ[types2.Int8],
89-
types2.Typ[types2.Int16],
90-
types2.Typ[types2.Int32],
91-
types2.Typ[types2.Int64],
92-
types2.Typ[types2.Uint],
93-
types2.Typ[types2.Uint8],
94-
types2.Typ[types2.Uint16],
95-
types2.Typ[types2.Uint32],
96-
types2.Typ[types2.Uint64],
97-
types2.Typ[types2.Uintptr],
98-
types2.Typ[types2.Float32],
99-
types2.Typ[types2.Float64],
100-
types2.Typ[types2.Complex64],
101-
types2.Typ[types2.Complex128],
102-
types2.Typ[types2.String],
103-
104-
// basic type aliases
105-
types2.Universe.Lookup("byte").Type(),
106-
types2.Universe.Lookup("rune").Type(),
107-
108-
// error
109-
types2.Universe.Lookup("error").Type(),
110-
111-
// untyped types
112-
types2.Typ[types2.UntypedBool],
113-
types2.Typ[types2.UntypedInt],
114-
types2.Typ[types2.UntypedRune],
115-
types2.Typ[types2.UntypedFloat],
116-
types2.Typ[types2.UntypedComplex],
117-
types2.Typ[types2.UntypedString],
118-
types2.Typ[types2.UntypedNil],
119-
120-
// package unsafe
121-
types2.Typ[types2.UnsafePointer],
122-
123-
// invalid type
124-
types2.Typ[types2.Invalid], // only appears in packages with errors
125-
126-
// used internally by gc; never used by this package or in .a files
127-
// not to be confused with the universe any
128-
anyType{},
129-
130-
// comparable
131-
types2.Universe.Lookup("comparable").Type(),
132-
133-
// "any" has special handling: see usage of predeclared.
134-
}
135-
13628
type anyType struct{}
13729

13830
func (t anyType) Underlying() types2.Type { return t }

src/cmd/compile/internal/inline/inl.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,17 +1211,6 @@ func pruneUnusedAutos(ll []*ir.Name, vis *hairyVisitor) []*ir.Name {
12111211
return s
12121212
}
12131213

1214-
// numNonClosures returns the number of functions in list which are not closures.
1215-
func numNonClosures(list []*ir.Func) int {
1216-
count := 0
1217-
for _, fn := range list {
1218-
if fn.OClosure == nil {
1219-
count++
1220-
}
1221-
}
1222-
return count
1223-
}
1224-
12251214
func doList(list []ir.Node, do func(ir.Node) bool) bool {
12261215
for _, x := range list {
12271216
if x != nil {

src/cmd/compile/internal/inline/inlheur/scoring.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,6 @@ func LargestNegativeScoreAdjustment(fn *ir.Func, props *FuncProps) int {
399399
return score
400400
}
401401

402-
// LargestPositiveScoreAdjustment tries to estimate the largest possible
403-
// positive score adjustment that could be applied to a given callsite.
404-
// At the moment we don't have very many positive score adjustments, so
405-
// this is just hard-coded, not table-driven.
406-
func LargestPositiveScoreAdjustment(fn *ir.Func) int {
407-
return adjValues[panicPathAdj] + adjValues[initFuncAdj]
408-
}
409-
410402
// callSiteTab contains entries for each call in the function
411403
// currently being processed by InlineCalls; this variable will either
412404
// be set to 'cstabCache' below (for non-inlinable routines) or to the

src/cmd/compile/internal/ir/copy.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,3 @@ func DeepCopy(pos src.XPos, n Node) Node {
3232
}
3333
return edit(n)
3434
}
35-
36-
// DeepCopyList returns a list of deep copies (using DeepCopy) of the nodes in list.
37-
func DeepCopyList(pos src.XPos, list []Node) []Node {
38-
var out []Node
39-
for _, n := range list {
40-
out = append(out, DeepCopy(pos, n))
41-
}
42-
return out
43-
}

src/cmd/compile/internal/ir/mini.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,6 @@ type miniNode struct {
3434
esc uint16
3535
}
3636

37-
// posOr returns pos if known, or else n.pos.
38-
// For use in DeepCopy.
39-
func (n *miniNode) posOr(pos src.XPos) src.XPos {
40-
if pos.IsKnown() {
41-
return pos
42-
}
43-
return n.pos
44-
}
45-
4637
// op can be read, but not written.
4738
// An embedding implementation can provide a SetOp if desired.
4839
// (The panicking SetOp is with the other panics below.)

src/cmd/compile/internal/ir/visit.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,6 @@ func Any(n Node, cond func(Node) bool) bool {
155155
return do(n)
156156
}
157157

158-
// AnyList calls Any(x, cond) for each node x in the list, in order.
159-
// If any call returns true, AnyList stops and returns true.
160-
// Otherwise, AnyList returns false after calling Any(x, cond)
161-
// for every x in the list.
162-
func AnyList(list Nodes, cond func(Node) bool) bool {
163-
for _, x := range list {
164-
if Any(x, cond) {
165-
return true
166-
}
167-
}
168-
return false
169-
}
170-
171158
// EditChildren edits the child nodes of n, replacing each child x with edit(x).
172159
//
173160
// Note that EditChildren(n, edit) only calls edit(x) for n's immediate children.

src/cmd/compile/internal/noder/posmap.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ type poser interface{ Pos() syntax.Pos }
2323
type ender interface{ End() syntax.Pos }
2424

2525
func (m *posMap) pos(p poser) src.XPos { return m.makeXPos(p.Pos()) }
26-
func (m *posMap) end(p ender) src.XPos { return m.makeXPos(p.End()) }
2726

2827
func (m *posMap) makeXPos(pos syntax.Pos) src.XPos {
2928
// Predeclared objects (e.g., the result parameter for error.Error)

src/cmd/compile/internal/noder/reader.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3681,17 +3681,6 @@ func expandInline(fn *ir.Func, pri pkgReaderIndex) {
36813681
typecheck.Target.Funcs = typecheck.Target.Funcs[:topdcls]
36823682
}
36833683

3684-
// usedLocals returns a set of local variables that are used within body.
3685-
func usedLocals(body []ir.Node) ir.NameSet {
3686-
var used ir.NameSet
3687-
ir.VisitList(body, func(n ir.Node) {
3688-
if n, ok := n.(*ir.Name); ok && n.Op() == ir.ONAME && n.Class == ir.PAUTO {
3689-
used.Add(n)
3690-
}
3691-
})
3692-
return used
3693-
}
3694-
36953684
// @@@ Method wrappers
36963685
//
36973686
// Here we handle constructing "method wrappers," alternative entry

0 commit comments

Comments
 (0)