aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile
diff options
context:
space:
mode:
authorqiulaidongfeng <2645477756@qq.com>2025-07-26 16:46:22 +0800
committerAlan Donovan <adonovan@google.com>2025-08-05 10:31:25 -0700
commit4ee0df8c466861bcd258ec55b58283f276d3b3d5 (patch)
tree9f8b467a6eff9720f5033477d21777e373848d2e /src/cmd/compile
parenta2c45f0eb1f281ed39c5111dd0fe4b2728f11cf3 (diff)
downloadgo-4ee0df8c466861bcd258ec55b58283f276d3b3d5.tar.xz
cmd: remove dead code
Fixes #74076 Change-Id: Icc67b3d4e342f329584433bd1250c56ae8f5a73d Reviewed-on: https://go-review.googlesource.com/c/go/+/690635 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Alan Donovan <adonovan@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/cmd/compile')
-rw-r--r--src/cmd/compile/internal/importer/support.go108
-rw-r--r--src/cmd/compile/internal/inline/inl.go11
-rw-r--r--src/cmd/compile/internal/inline/inlheur/scoring.go8
-rw-r--r--src/cmd/compile/internal/ir/copy.go9
-rw-r--r--src/cmd/compile/internal/ir/mini.go9
-rw-r--r--src/cmd/compile/internal/ir/visit.go13
-rw-r--r--src/cmd/compile/internal/noder/posmap.go1
-rw-r--r--src/cmd/compile/internal/noder/reader.go11
-rw-r--r--src/cmd/compile/internal/noder/writer.go5
-rw-r--r--src/cmd/compile/internal/reflectdata/reflect.go7
-rw-r--r--src/cmd/compile/internal/ssa/biasedsparsemap.go8
-rw-r--r--src/cmd/compile/internal/ssa/debug.go4
-rw-r--r--src/cmd/compile/internal/ssa/expand_calls.go55
-rw-r--r--src/cmd/compile/internal/ssa/prove.go5
-rw-r--r--src/cmd/compile/internal/ssa/regalloc.go5
-rw-r--r--src/cmd/compile/internal/ssa/rewrite.go68
-rw-r--r--src/cmd/compile/internal/ssagen/ssa.go23
-rw-r--r--src/cmd/compile/internal/syntax/printer.go4
-rw-r--r--src/cmd/compile/internal/typecheck/iexport.go20
-rw-r--r--src/cmd/compile/internal/typecheck/stmt.go3
-rw-r--r--src/cmd/compile/internal/types/type.go7
-rw-r--r--src/cmd/compile/internal/types2/api.go4
-rw-r--r--src/cmd/compile/internal/types2/compilersupport.go6
23 files changed, 1 insertions, 393 deletions
diff --git a/src/cmd/compile/internal/importer/support.go b/src/cmd/compile/internal/importer/support.go
index a443b4d862..6ce721557a 100644
--- a/src/cmd/compile/internal/importer/support.go
+++ b/src/cmd/compile/internal/importer/support.go
@@ -9,20 +9,14 @@ package importer
import (
"cmd/compile/internal/base"
"cmd/compile/internal/types2"
- "fmt"
"go/token"
"internal/pkgbits"
- "sync"
)
func assert(p bool) {
base.Assert(p)
}
-func errorf(format string, args ...interface{}) {
- panic(fmt.Sprintf(format, args...))
-}
-
const deltaNewFile = -64 // see cmd/compile/internal/gc/bexport.go
// Synthesize a token.Pos
@@ -31,108 +25,6 @@ type fakeFileSet struct {
files map[string]*token.File
}
-func (s *fakeFileSet) pos(file string, line, column int) token.Pos {
- // TODO(mdempsky): Make use of column.
-
- // Since we don't know the set of needed file positions, we
- // reserve maxlines positions per file.
- const maxlines = 64 * 1024
- f := s.files[file]
- if f == nil {
- f = s.fset.AddFile(file, -1, maxlines)
- s.files[file] = f
- // Allocate the fake linebreak indices on first use.
- // TODO(adonovan): opt: save ~512KB using a more complex scheme?
- fakeLinesOnce.Do(func() {
- fakeLines = make([]int, maxlines)
- for i := range fakeLines {
- fakeLines[i] = i
- }
- })
- f.SetLines(fakeLines)
- }
-
- if line > maxlines {
- line = 1
- }
-
- // Treat the file as if it contained only newlines
- // and column=1: use the line number as the offset.
- return f.Pos(line - 1)
-}
-
-var (
- fakeLines []int
- fakeLinesOnce sync.Once
-)
-
-func chanDir(d int) types2.ChanDir {
- // tag values must match the constants in cmd/compile/internal/gc/go.go
- switch d {
- case 1 /* Crecv */ :
- return types2.RecvOnly
- case 2 /* Csend */ :
- return types2.SendOnly
- case 3 /* Cboth */ :
- return types2.SendRecv
- default:
- errorf("unexpected channel dir %d", d)
- return 0
- }
-}
-
-var predeclared = []types2.Type{
- // basic types
- types2.Typ[types2.Bool],
- types2.Typ[types2.Int],
- types2.Typ[types2.Int8],
- types2.Typ[types2.Int16],
- types2.Typ[types2.Int32],
- types2.Typ[types2.Int64],
- types2.Typ[types2.Uint],
- types2.Typ[types2.Uint8],
- types2.Typ[types2.Uint16],
- types2.Typ[types2.Uint32],
- types2.Typ[types2.Uint64],
- types2.Typ[types2.Uintptr],
- types2.Typ[types2.Float32],
- types2.Typ[types2.Float64],
- types2.Typ[types2.Complex64],
- types2.Typ[types2.Complex128],
- types2.Typ[types2.String],
-
- // basic type aliases
- types2.Universe.Lookup("byte").Type(),
- types2.Universe.Lookup("rune").Type(),
-
- // error
- types2.Universe.Lookup("error").Type(),
-
- // untyped types
- types2.Typ[types2.UntypedBool],
- types2.Typ[types2.UntypedInt],
- types2.Typ[types2.UntypedRune],
- types2.Typ[types2.UntypedFloat],
- types2.Typ[types2.UntypedComplex],
- types2.Typ[types2.UntypedString],
- types2.Typ[types2.UntypedNil],
-
- // package unsafe
- types2.Typ[types2.UnsafePointer],
-
- // invalid type
- types2.Typ[types2.Invalid], // only appears in packages with errors
-
- // used internally by gc; never used by this package or in .a files
- // not to be confused with the universe any
- anyType{},
-
- // comparable
- types2.Universe.Lookup("comparable").Type(),
-
- // "any" has special handling: see usage of predeclared.
-}
-
type anyType struct{}
func (t anyType) Underlying() types2.Type { return t }
diff --git a/src/cmd/compile/internal/inline/inl.go b/src/cmd/compile/internal/inline/inl.go
index c06f76fe9f..b39710548e 100644
--- a/src/cmd/compile/internal/inline/inl.go
+++ b/src/cmd/compile/internal/inline/inl.go
@@ -1211,17 +1211,6 @@ func pruneUnusedAutos(ll []*ir.Name, vis *hairyVisitor) []*ir.Name {
return s
}
-// numNonClosures returns the number of functions in list which are not closures.
-func numNonClosures(list []*ir.Func) int {
- count := 0
- for _, fn := range list {
- if fn.OClosure == nil {
- count++
- }
- }
- return count
-}
-
func doList(list []ir.Node, do func(ir.Node) bool) bool {
for _, x := range list {
if x != nil {
diff --git a/src/cmd/compile/internal/inline/inlheur/scoring.go b/src/cmd/compile/internal/inline/inlheur/scoring.go
index 28fa643132..1396c4d800 100644
--- a/src/cmd/compile/internal/inline/inlheur/scoring.go
+++ b/src/cmd/compile/internal/inline/inlheur/scoring.go
@@ -399,14 +399,6 @@ func LargestNegativeScoreAdjustment(fn *ir.Func, props *FuncProps) int {
return score
}
-// LargestPositiveScoreAdjustment tries to estimate the largest possible
-// positive score adjustment that could be applied to a given callsite.
-// At the moment we don't have very many positive score adjustments, so
-// this is just hard-coded, not table-driven.
-func LargestPositiveScoreAdjustment(fn *ir.Func) int {
- return adjValues[panicPathAdj] + adjValues[initFuncAdj]
-}
-
// callSiteTab contains entries for each call in the function
// currently being processed by InlineCalls; this variable will either
// be set to 'cstabCache' below (for non-inlinable routines) or to the
diff --git a/src/cmd/compile/internal/ir/copy.go b/src/cmd/compile/internal/ir/copy.go
index d30f7bc688..4ec887d397 100644
--- a/src/cmd/compile/internal/ir/copy.go
+++ b/src/cmd/compile/internal/ir/copy.go
@@ -32,12 +32,3 @@ func DeepCopy(pos src.XPos, n Node) Node {
}
return edit(n)
}
-
-// DeepCopyList returns a list of deep copies (using DeepCopy) of the nodes in list.
-func DeepCopyList(pos src.XPos, list []Node) []Node {
- var out []Node
- for _, n := range list {
- out = append(out, DeepCopy(pos, n))
- }
- return out
-}
diff --git a/src/cmd/compile/internal/ir/mini.go b/src/cmd/compile/internal/ir/mini.go
index 70897fc3f9..6c91560e52 100644
--- a/src/cmd/compile/internal/ir/mini.go
+++ b/src/cmd/compile/internal/ir/mini.go
@@ -34,15 +34,6 @@ type miniNode struct {
esc uint16
}
-// posOr returns pos if known, or else n.pos.
-// For use in DeepCopy.
-func (n *miniNode) posOr(pos src.XPos) src.XPos {
- if pos.IsKnown() {
- return pos
- }
- return n.pos
-}
-
// op can be read, but not written.
// An embedding implementation can provide a SetOp if desired.
// (The panicking SetOp is with the other panics below.)
diff --git a/src/cmd/compile/internal/ir/visit.go b/src/cmd/compile/internal/ir/visit.go
index 8dff11af33..c68bb5d033 100644
--- a/src/cmd/compile/internal/ir/visit.go
+++ b/src/cmd/compile/internal/ir/visit.go
@@ -155,19 +155,6 @@ func Any(n Node, cond func(Node) bool) bool {
return do(n)
}
-// AnyList calls Any(x, cond) for each node x in the list, in order.
-// If any call returns true, AnyList stops and returns true.
-// Otherwise, AnyList returns false after calling Any(x, cond)
-// for every x in the list.
-func AnyList(list Nodes, cond func(Node) bool) bool {
- for _, x := range list {
- if Any(x, cond) {
- return true
- }
- }
- return false
-}
-
// EditChildren edits the child nodes of n, replacing each child x with edit(x).
//
// Note that EditChildren(n, edit) only calls edit(x) for n's immediate children.
diff --git a/src/cmd/compile/internal/noder/posmap.go b/src/cmd/compile/internal/noder/posmap.go
index 439daf454e..9b02765e95 100644
--- a/src/cmd/compile/internal/noder/posmap.go
+++ b/src/cmd/compile/internal/noder/posmap.go
@@ -23,7 +23,6 @@ type poser interface{ Pos() syntax.Pos }
type ender interface{ End() syntax.Pos }
func (m *posMap) pos(p poser) src.XPos { return m.makeXPos(p.Pos()) }
-func (m *posMap) end(p ender) src.XPos { return m.makeXPos(p.End()) }
func (m *posMap) makeXPos(pos syntax.Pos) src.XPos {
// Predeclared objects (e.g., the result parameter for error.Error)
diff --git a/src/cmd/compile/internal/noder/reader.go b/src/cmd/compile/internal/noder/reader.go
index 38b0bc1d8a..3cbc7989a7 100644
--- a/src/cmd/compile/internal/noder/reader.go
+++ b/src/cmd/compile/internal/noder/reader.go
@@ -3681,17 +3681,6 @@ func expandInline(fn *ir.Func, pri pkgReaderIndex) {
typecheck.Target.Funcs = typecheck.Target.Funcs[:topdcls]
}
-// usedLocals returns a set of local variables that are used within body.
-func usedLocals(body []ir.Node) ir.NameSet {
- var used ir.NameSet
- ir.VisitList(body, func(n ir.Node) {
- if n, ok := n.(*ir.Name); ok && n.Op() == ir.ONAME && n.Class == ir.PAUTO {
- used.Add(n)
- }
- })
- return used
-}
-
// @@@ Method wrappers
//
// Here we handle constructing "method wrappers," alternative entry
diff --git a/src/cmd/compile/internal/noder/writer.go b/src/cmd/compile/internal/noder/writer.go
index dd79c3ef4c..baff0ceea0 100644
--- a/src/cmd/compile/internal/noder/writer.go
+++ b/src/cmd/compile/internal/noder/writer.go
@@ -2413,11 +2413,6 @@ func (p posVar) String() string {
return p.pos.String() + ":" + p.var_.String()
}
-func (w *writer) exprList(expr syntax.Expr) {
- w.Sync(pkgbits.SyncExprList)
- w.exprs(syntax.UnpackListExpr(expr))
-}
-
func (w *writer) exprs(exprs []syntax.Expr) {
w.Sync(pkgbits.SyncExprs)
w.Len(len(exprs))
diff --git a/src/cmd/compile/internal/reflectdata/reflect.go b/src/cmd/compile/internal/reflectdata/reflect.go
index 4d1d780190..c561d527a7 100644
--- a/src/cmd/compile/internal/reflectdata/reflect.go
+++ b/src/cmd/compile/internal/reflectdata/reflect.go
@@ -1468,10 +1468,3 @@ func MarkUsedIfaceMethod(n *ir.CallExpr) {
Add: InterfaceMethodOffset(ityp, midx),
})
}
-
-func deref(t *types.Type) *types.Type {
- if t.IsPtr() {
- return t.Elem()
- }
- return t
-}
diff --git a/src/cmd/compile/internal/ssa/biasedsparsemap.go b/src/cmd/compile/internal/ssa/biasedsparsemap.go
index 3032309b7a..25fbaf6862 100644
--- a/src/cmd/compile/internal/ssa/biasedsparsemap.go
+++ b/src/cmd/compile/internal/ssa/biasedsparsemap.go
@@ -84,14 +84,6 @@ func (s *biasedSparseMap) getEntry(i int) (x uint, v int32) {
return
}
-// add inserts x->0 into s, provided that x is in the range of keys stored in s.
-func (s *biasedSparseMap) add(x uint) {
- if int(x) < s.first || int(x) >= s.cap() {
- return
- }
- s.s.set(ID(int(x)-s.first), 0)
-}
-
// add inserts x->v into s, provided that x is in the range of keys stored in s.
func (s *biasedSparseMap) set(x uint, v int32) {
if int(x) < s.first || int(x) >= s.cap() {
diff --git a/src/cmd/compile/internal/ssa/debug.go b/src/cmd/compile/internal/ssa/debug.go
index e92b37fb7b..c9a3e4291c 100644
--- a/src/cmd/compile/internal/ssa/debug.go
+++ b/src/cmd/compile/internal/ssa/debug.go
@@ -77,10 +77,6 @@ func (ls *liveSlot) String() string {
return fmt.Sprintf("0x%x.%d.%d", ls.Registers, ls.stackOffsetValue(), int32(ls.StackOffset)&1)
}
-func (ls liveSlot) absent() bool {
- return ls.Registers == 0 && !ls.onStack()
-}
-
// StackOffset encodes whether a value is on the stack and if so, where.
// It is a 31-bit integer followed by a presence flag at the low-order
// bit.
diff --git a/src/cmd/compile/internal/ssa/expand_calls.go b/src/cmd/compile/internal/ssa/expand_calls.go
index 30606bb805..1730dbf53d 100644
--- a/src/cmd/compile/internal/ssa/expand_calls.go
+++ b/src/cmd/compile/internal/ssa/expand_calls.go
@@ -851,27 +851,6 @@ func (c *registerCursor) plus(regWidth Abi1RO) registerCursor {
return rc
}
-// at returns the register cursor for component i of t, where the first
-// component is numbered 0.
-func (c *registerCursor) at(t *types.Type, i int) registerCursor {
- rc := *c
- if i == 0 || len(c.regs) == 0 {
- return rc
- }
- if t.IsArray() {
- w := c.config.NumParamRegs(t.Elem())
- rc.nextSlice += Abi1RO(i * w)
- return rc
- }
- if t.IsStruct() {
- for j := 0; j < i; j++ {
- rc.next(t.FieldType(j))
- }
- return rc
- }
- panic("Haven't implemented this case yet, do I need to?")
-}
-
func (c *registerCursor) init(regs []abi.RegIndex, info *abi.ABIParamResultInfo, result *[]*Value, storeDest *Value, storeOffset int64) {
c.regs = regs
c.nextSlice = 0
@@ -930,17 +909,6 @@ type expandState struct {
indentLevel int // Indentation for debugging recursion
}
-// intPairTypes returns the pair of 32-bit int types needed to encode a 64-bit integer type on a target
-// that has no 64-bit integer registers.
-func (x *expandState) intPairTypes(et types.Kind) (tHi, tLo *types.Type) {
- tHi = x.typs.UInt32
- if et == types.TINT64 {
- tHi = x.typs.Int32
- }
- tLo = x.typs.UInt32
- return
-}
-
// offsetFrom creates an offset from a pointer, simplifying chained offsets and offsets from SP
func (x *expandState) offsetFrom(b *Block, from *Value, offset int64, pt *types.Type) *Value {
ft := from.Type
@@ -964,29 +932,6 @@ func (x *expandState) offsetFrom(b *Block, from *Value, offset int64, pt *types.
return b.NewValue1I(from.Pos.WithNotStmt(), OpOffPtr, pt, offset, from)
}
-func (x *expandState) regWidth(t *types.Type) Abi1RO {
- return Abi1RO(x.f.ABI1.NumParamRegs(t))
-}
-
-// regOffset returns the register offset of the i'th element of type t
-func (x *expandState) regOffset(t *types.Type, i int) Abi1RO {
- // TODO maybe cache this in a map if profiling recommends.
- if i == 0 {
- return 0
- }
- if t.IsArray() {
- return Abi1RO(i) * x.regWidth(t.Elem())
- }
- if t.IsStruct() {
- k := Abi1RO(0)
- for j := 0; j < i; j++ {
- k += x.regWidth(t.FieldType(j))
- }
- return k
- }
- panic("Haven't implemented this case yet, do I need to?")
-}
-
// prAssignForArg returns the ABIParamAssignment for v, assumed to be an OpArg.
func (x *expandState) prAssignForArg(v *Value) *abi.ABIParamAssignment {
if v.Op != OpArg {
diff --git a/src/cmd/compile/internal/ssa/prove.go b/src/cmd/compile/internal/ssa/prove.go
index be70226695..3f85bd2351 100644
--- a/src/cmd/compile/internal/ssa/prove.go
+++ b/src/cmd/compile/internal/ssa/prove.go
@@ -145,10 +145,7 @@ func (l limit) signedMin(m int64) limit {
l.min = max(l.min, m)
return l
}
-func (l limit) signedMax(m int64) limit {
- l.max = min(l.max, m)
- return l
-}
+
func (l limit) signedMinMax(minimum, maximum int64) limit {
l.min = max(l.min, minimum)
l.max = min(l.max, maximum)
diff --git a/src/cmd/compile/internal/ssa/regalloc.go b/src/cmd/compile/internal/ssa/regalloc.go
index fb9642cfed..c0881c7a45 100644
--- a/src/cmd/compile/internal/ssa/regalloc.go
+++ b/src/cmd/compile/internal/ssa/regalloc.go
@@ -2980,11 +2980,6 @@ type desiredStateEntry struct {
regs [4]register
}
-func (d *desiredState) clear() {
- d.entries = d.entries[:0]
- d.avoid = 0
-}
-
// get returns a list of desired registers for value vid.
func (d *desiredState) get(vid ID) [4]register {
for _, e := range d.entries {
diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go
index 87f7b517c2..03b1e39b74 100644
--- a/src/cmd/compile/internal/ssa/rewrite.go
+++ b/src/cmd/compile/internal/ssa/rewrite.go
@@ -625,51 +625,16 @@ func truncate64Fto32F(f float64) float32 {
return math.Float32frombits(r)
}
-// extend32Fto64F converts a float32 value to a float64 value preserving the bit
-// pattern of the mantissa.
-func extend32Fto64F(f float32) float64 {
- if !math.IsNaN(float64(f)) {
- return float64(f)
- }
- // NaN bit patterns aren't necessarily preserved across conversion
- // instructions so we need to do the conversion manually.
- b := uint64(math.Float32bits(f))
- // | sign | exponent | mantissa |
- r := ((b << 32) & (1 << 63)) | (0x7ff << 52) | ((b & 0x7fffff) << (52 - 23))
- return math.Float64frombits(r)
-}
-
// DivisionNeedsFixUp reports whether the division needs fix-up code.
func DivisionNeedsFixUp(v *Value) bool {
return v.AuxInt == 0
}
-// auxFrom64F encodes a float64 value so it can be stored in an AuxInt.
-func auxFrom64F(f float64) int64 {
- if f != f {
- panic("can't encode a NaN in AuxInt field")
- }
- return int64(math.Float64bits(f))
-}
-
-// auxFrom32F encodes a float32 value so it can be stored in an AuxInt.
-func auxFrom32F(f float32) int64 {
- if f != f {
- panic("can't encode a NaN in AuxInt field")
- }
- return int64(math.Float64bits(extend32Fto64F(f)))
-}
-
// auxTo32F decodes a float32 from the AuxInt value provided.
func auxTo32F(i int64) float32 {
return truncate64Fto32F(math.Float64frombits(uint64(i)))
}
-// auxTo64F decodes a float64 from the AuxInt value provided.
-func auxTo64F(i int64) float64 {
- return math.Float64frombits(uint64(i))
-}
-
func auxIntToBool(i int64) bool {
if i == 0 {
return false
@@ -703,12 +668,6 @@ func auxIntToValAndOff(i int64) ValAndOff {
func auxIntToArm64BitField(i int64) arm64BitField {
return arm64BitField(i)
}
-func auxIntToInt128(x int64) int128 {
- if x != 0 {
- panic("nonzero int128 not allowed")
- }
- return 0
-}
func auxIntToFlagConstant(x int64) flagConstant {
return flagConstant(x)
}
@@ -750,12 +709,6 @@ func valAndOffToAuxInt(v ValAndOff) int64 {
func arm64BitFieldToAuxInt(v arm64BitField) int64 {
return int64(v)
}
-func int128ToAuxInt(x int128) int64 {
- if x != 0 {
- panic("nonzero int128 not allowed")
- }
- return 0
-}
func flagConstantToAuxInt(x flagConstant) int64 {
return int64(x)
}
@@ -826,23 +779,6 @@ func uaddOvf(a, b int64) bool {
return uint64(a)+uint64(b) < uint64(a)
}
-// loadLSymOffset simulates reading a word at an offset into a
-// read-only symbol's runtime memory. If it would read a pointer to
-// another symbol, that symbol is returned. Otherwise, it returns nil.
-func loadLSymOffset(lsym *obj.LSym, offset int64) *obj.LSym {
- if lsym.Type != objabi.SRODATA {
- return nil
- }
-
- for _, r := range lsym.R {
- if int64(r.Off) == offset && r.Type&^objabi.R_WEAK == objabi.R_ADDR && r.Add == 0 {
- return r.Sym
- }
- }
-
- return nil
-}
-
func devirtLECall(v *Value, sym *obj.LSym) *Value {
v.Op = OpStaticLECall
auxcall := v.Aux.(*AuxCall)
@@ -1564,10 +1500,6 @@ func GetPPC64Shiftmb(auxint int64) int64 {
return int64(int8(auxint >> 8))
}
-func GetPPC64Shiftme(auxint int64) int64 {
- return int64(int8(auxint))
-}
-
// Test if this value can encoded as a mask for a rlwinm like
// operation. Masks can also extend from the msb and wrap to
// the lsb too. That is, the valid masks are 32 bit strings
diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go
index 72928f267b..1e2159579d 100644
--- a/src/cmd/compile/internal/ssagen/ssa.go
+++ b/src/cmd/compile/internal/ssagen/ssa.go
@@ -1322,9 +1322,6 @@ func (s *state) constInt(t *types.Type, c int64) *ssa.Value {
}
return s.constInt32(t, int32(c))
}
-func (s *state) constOffPtrSP(t *types.Type, c int64) *ssa.Value {
- return s.f.ConstOffPtrSP(t, c, s.sp)
-}
// newValueOrSfCall* are wrappers around newValue*, which may create a call to a
// soft-float runtime function instead (when emitting soft-float code).
@@ -5382,26 +5379,6 @@ func (s *state) putArg(n ir.Node, t *types.Type) *ssa.Value {
return a
}
-func (s *state) storeArgWithBase(n ir.Node, t *types.Type, base *ssa.Value, off int64) {
- pt := types.NewPtr(t)
- var addr *ssa.Value
- if base == s.sp {
- // Use special routine that avoids allocation on duplicate offsets.
- addr = s.constOffPtrSP(pt, off)
- } else {
- addr = s.newValue1I(ssa.OpOffPtr, pt, off, base)
- }
-
- if !ssa.CanSSA(t) {
- a := s.addr(n)
- s.move(t, addr, a)
- return
- }
-
- a := s.expr(n)
- s.storeType(t, addr, a, 0, false)
-}
-
// slice computes the slice v[i:j:k] and returns ptr, len, and cap of result.
// i,j,k may be nil, in which case they are set to their default value.
// v may be a slice, string or pointer to an array.
diff --git a/src/cmd/compile/internal/syntax/printer.go b/src/cmd/compile/internal/syntax/printer.go
index 1c0bfc190e..d86d77e73f 100644
--- a/src/cmd/compile/internal/syntax/printer.go
+++ b/src/cmd/compile/internal/syntax/printer.go
@@ -138,10 +138,6 @@ func impliesSemi(tok token) bool {
// TODO(gri) provide table of []byte values for all tokens to avoid repeated string conversion
-func lineComment(text string) bool {
- return strings.HasPrefix(text, "//")
-}
-
func (p *printer) addWhitespace(kind ctrlSymbol, text string) {
p.pending = append(p.pending, whitespace{p.lastTok, kind /*text*/})
switch kind {
diff --git a/src/cmd/compile/internal/typecheck/iexport.go b/src/cmd/compile/internal/typecheck/iexport.go
index 29d6b2cc2d..f3498f6009 100644
--- a/src/cmd/compile/internal/typecheck/iexport.go
+++ b/src/cmd/compile/internal/typecheck/iexport.go
@@ -235,27 +235,7 @@
package typecheck
-import (
- "strings"
-)
-
const blankMarker = "$"
-// TparamName returns the real name of a type parameter, after stripping its
-// qualifying prefix and reverting blank-name encoding. See TparamExportName
-// for details.
-func TparamName(exportName string) string {
- // Remove the "path" from the type param name that makes it unique.
- ix := strings.LastIndex(exportName, ".")
- if ix < 0 {
- return ""
- }
- name := exportName[ix+1:]
- if strings.HasPrefix(name, blankMarker) {
- return "_"
- }
- return name
-}
-
// The name used for dictionary parameters or local variables.
const LocalDictName = ".dict"
diff --git a/src/cmd/compile/internal/typecheck/stmt.go b/src/cmd/compile/internal/typecheck/stmt.go
index ac49f251bb..2ca8e7fb86 100644
--- a/src/cmd/compile/internal/typecheck/stmt.go
+++ b/src/cmd/compile/internal/typecheck/stmt.go
@@ -19,9 +19,6 @@ func RangeExprType(t *types.Type) *types.Type {
return t
}
-func typecheckrangeExpr(n *ir.RangeStmt) {
-}
-
// type check assignment.
// if this assignment is the definition of a var on the left side,
// fill in the var's type.
diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go
index d73b5e8d7b..f28490fc44 100644
--- a/src/cmd/compile/internal/types/type.go
+++ b/src/cmd/compile/internal/types/type.go
@@ -1694,13 +1694,6 @@ func fieldsHasShape(fields []*Field) bool {
return false
}
-// newBasic returns a new basic type of the given kind.
-func newBasic(kind Kind, obj Object) *Type {
- t := newType(kind)
- t.obj = obj
- return t
-}
-
// NewInterface returns a new interface for the given methods and
// embedded types. Embedded types are specified as fields with no Sym.
func NewInterface(methods []*Field) *Type {
diff --git a/src/cmd/compile/internal/types2/api.go b/src/cmd/compile/internal/types2/api.go
index 49cc0e54ec..8752eff992 100644
--- a/src/cmd/compile/internal/types2/api.go
+++ b/src/cmd/compile/internal/types2/api.go
@@ -187,10 +187,6 @@ type Config struct {
EnableAlias bool
}
-func srcimporter_setUsesCgo(conf *Config) {
- conf.go115UsesCgo = true
-}
-
// Info holds result type information for a type-checked package.
// Only the information for which a map is provided is collected.
// If the package has type errors, the collected information may
diff --git a/src/cmd/compile/internal/types2/compilersupport.go b/src/cmd/compile/internal/types2/compilersupport.go
index 20a1364288..d29241a2ed 100644
--- a/src/cmd/compile/internal/types2/compilersupport.go
+++ b/src/cmd/compile/internal/types2/compilersupport.go
@@ -13,12 +13,6 @@ func AsPointer(t Type) *Pointer {
return u
}
-// If t is a signature, AsSignature returns that type, otherwise it returns nil.
-func AsSignature(t Type) *Signature {
- u, _ := t.Underlying().(*Signature)
- return u
-}
-
// If typ is a type parameter, CoreType returns the single underlying
// type of all types in the corresponding type constraint if it exists, or
// nil otherwise. If the type set contains only unrestricted and restricted