Commit b1892d74 authored by Daniel Martí's avatar Daniel Martí

cmd/compile/internal/gc: various cleanups

Remove a couple of unnecessary var declarations, an unused sort.Sort
type, and simplify a range by using the two-name variant.

Change-Id: Ia251f634db0bfbe8b1d553b8659272ddbd13b2c3
Reviewed-on: https://go-review.googlesource.com/102336
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent bf8eef2a
...@@ -465,8 +465,8 @@ func createComplexVars(fn *Func) ([]*Node, []*dwarf.Var, map[*Node]bool) { ...@@ -465,8 +465,8 @@ func createComplexVars(fn *Func) ([]*Node, []*dwarf.Var, map[*Node]bool) {
var vars []*dwarf.Var var vars []*dwarf.Var
ssaVars := make(map[*Node]bool) ssaVars := make(map[*Node]bool)
for varID := range debugInfo.Vars { for varID, dvar := range debugInfo.Vars {
n := debugInfo.Vars[varID].(*Node) n := dvar.(*Node)
ssaVars[n] = true ssaVars[n] = true
for _, slot := range debugInfo.VarSlots[varID] { for _, slot := range debugInfo.VarSlots[varID] {
ssaVars[debugInfo.Slots[slot].N.(*Node)] = true ssaVars[debugInfo.Slots[slot].N.(*Node)] = true
......
...@@ -304,17 +304,16 @@ func affectedNode(v *ssa.Value) (*Node, ssa.SymEffect) { ...@@ -304,17 +304,16 @@ func affectedNode(v *ssa.Value) (*Node, ssa.SymEffect) {
return nil, 0 return nil, 0
} }
var n *Node
switch a := v.Aux.(type) { switch a := v.Aux.(type) {
case nil, *obj.LSym: case nil, *obj.LSym:
// ok, but no node // ok, but no node
return nil, e
case *Node: case *Node:
n = a return a, e
default: default:
Fatalf("weird aux: %s", v.LongString()) Fatalf("weird aux: %s", v.LongString())
return nil, e
} }
return n, e
} }
// Constructs a new liveness structure used to hold the global state of the // Constructs a new liveness structure used to hold the global state of the
......
...@@ -343,9 +343,8 @@ func methodfunc(f *types.Type, receiver *types.Type) *types.Type { ...@@ -343,9 +343,8 @@ func methodfunc(f *types.Type, receiver *types.Type) *types.Type {
in = append(in, d) in = append(in, d)
} }
var d *Node
for _, t := range f.Params().Fields().Slice() { for _, t := range f.Params().Fields().Slice() {
d = nod(ODCLFIELD, nil, nil) d := nod(ODCLFIELD, nil, nil)
d.Type = t.Type d.Type = t.Type
d.SetIsddd(t.Isddd()) d.SetIsddd(t.Isddd())
in = append(in, d) in = append(in, d)
...@@ -353,7 +352,7 @@ func methodfunc(f *types.Type, receiver *types.Type) *types.Type { ...@@ -353,7 +352,7 @@ func methodfunc(f *types.Type, receiver *types.Type) *types.Type {
var out []*Node var out []*Node
for _, t := range f.Results().Fields().Slice() { for _, t := range f.Results().Fields().Slice() {
d = nod(ODCLFIELD, nil, nil) d := nod(ODCLFIELD, nil, nil)
d.Type = t.Type d.Type = t.Type
out = append(out, d) out = append(out, d)
} }
......
...@@ -113,14 +113,6 @@ func compactScopes(dwarfScopes []dwarf.Scope) []dwarf.Scope { ...@@ -113,14 +113,6 @@ func compactScopes(dwarfScopes []dwarf.Scope) []dwarf.Scope {
return dwarfScopes return dwarfScopes
} }
type pcsByPC []scopedPCs
func (s pcsByPC) Len() int { return len(s) }
func (s pcsByPC) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
func (s pcsByPC) Less(i, j int) bool {
return s[i].start < s[j].start
}
type varsByScopeAndOffset struct { type varsByScopeAndOffset struct {
vars []*dwarf.Var vars []*dwarf.Var
scopes []ScopeID scopes []ScopeID
......
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