mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: simplify a few bits of the code
Remove an unused type, a few redundant returns and replace a few slice append loops with a single append. Change-Id: If07248180bae5631b5b152c6051d9635889997d5 Reviewed-on: https://go-review.googlesource.com/66851 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dave Cheney <dave@cheney.net>
This commit is contained in:
parent
6bbe1bc940
commit
ded2c65db3
5 changed files with 3 additions and 19 deletions
|
|
@ -663,9 +663,7 @@ func (p *exporter) typ(t *types.Type) {
|
||||||
// TODO(gri) Determine if they are already sorted
|
// TODO(gri) Determine if they are already sorted
|
||||||
// in which case we can drop this step.
|
// in which case we can drop this step.
|
||||||
var methods []*types.Field
|
var methods []*types.Field
|
||||||
for _, m := range t.Methods().Slice() {
|
methods = append(methods, t.Methods().Slice()...)
|
||||||
methods = append(methods, m)
|
|
||||||
}
|
|
||||||
sort.Sort(methodbyname(methods))
|
sort.Sort(methodbyname(methods))
|
||||||
p.int(len(methods))
|
p.int(len(methods))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,6 @@ func init1(n *Node, out *[]*Node) {
|
||||||
initlist = initlist[:last]
|
initlist = initlist[:last]
|
||||||
|
|
||||||
n.SetInitorder(InitDone)
|
n.SetInitorder(InitDone)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// foundinitloop prints an init loop error and exits.
|
// foundinitloop prints an init loop error and exits.
|
||||||
|
|
|
||||||
|
|
@ -3789,7 +3789,6 @@ ret:
|
||||||
|
|
||||||
lineno = lno
|
lineno = lno
|
||||||
n.SetWalkdef(1)
|
n.SetWalkdef(1)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkmake(t *types.Type, arg string, n *Node) bool {
|
func checkmake(t *types.Type, arg string, n *Node) bool {
|
||||||
|
|
|
||||||
|
|
@ -267,8 +267,6 @@ func insertLoopReschedChecks(f *Func) {
|
||||||
sdom = newSparseTree(f, f.Idom())
|
sdom = newSparseTree(f, f.Idom())
|
||||||
fmt.Printf("after %s = %s\n", f.Name, sdom.treestructure(f.Entry))
|
fmt.Printf("after %s = %s\n", f.Name, sdom.treestructure(f.Entry))
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// newPhiFor inserts a new Phi function into b,
|
// newPhiFor inserts a new Phi function into b,
|
||||||
|
|
|
||||||
|
|
@ -1715,14 +1715,10 @@ func (s *regAllocState) placeSpills() {
|
||||||
}
|
}
|
||||||
oldSched = append(oldSched[:0], b.Values[nphi:]...)
|
oldSched = append(oldSched[:0], b.Values[nphi:]...)
|
||||||
b.Values = b.Values[:nphi]
|
b.Values = b.Values[:nphi]
|
||||||
for _, v := range start[b.ID] {
|
b.Values = append(b.Values, start[b.ID]...)
|
||||||
b.Values = append(b.Values, v)
|
|
||||||
}
|
|
||||||
for _, v := range oldSched {
|
for _, v := range oldSched {
|
||||||
b.Values = append(b.Values, v)
|
b.Values = append(b.Values, v)
|
||||||
for _, w := range after[v.ID] {
|
b.Values = append(b.Values, after[v.ID]...)
|
||||||
b.Values = append(b.Values, w)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2211,12 +2207,6 @@ type liveInfo struct {
|
||||||
pos src.XPos // source position of next use
|
pos src.XPos // source position of next use
|
||||||
}
|
}
|
||||||
|
|
||||||
// dblock contains information about desired & avoid registers at the end of a block.
|
|
||||||
type dblock struct {
|
|
||||||
prefers []desiredStateEntry
|
|
||||||
avoid regMask
|
|
||||||
}
|
|
||||||
|
|
||||||
// computeLive computes a map from block ID to a list of value IDs live at the end
|
// computeLive computes a map from block ID to a list of value IDs live at the end
|
||||||
// of that block. Together with the value ID is a count of how many instructions
|
// of that block. Together with the value ID is a count of how many instructions
|
||||||
// to the next use of that value. The resulting map is stored in s.live.
|
// to the next use of that value. The resulting map is stored in s.live.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue