mirror of
https://github.com/golang/go
synced 2024-10-06 09:11:21 -06:00
[dev.ssa] cmd/internal/ssa: minor cleanup
These were review comments for CL 6681 that didn't get sent in time. Change-Id: If161af3655770487f3ba34535d3fb55dbfde7917 Reviewed-on: https://go-review.googlesource.com/7644 Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
parent
f52b234579
commit
7c2c0b4e53
@ -86,8 +86,10 @@ func deadcode(f *Func) {
|
|||||||
f.vid.put(v.ID)
|
f.vid.put(v.ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for j := i; j < len(b.Values); j++ {
|
// aid GC
|
||||||
b.Values[j] = nil // aid GC
|
tail := b.Values[i:]
|
||||||
|
for j := range tail {
|
||||||
|
tail[j] = nil
|
||||||
}
|
}
|
||||||
b.Values = b.Values[:i]
|
b.Values = b.Values[:i]
|
||||||
}
|
}
|
||||||
@ -105,9 +107,10 @@ func deadcode(f *Func) {
|
|||||||
f.bid.put(b.ID)
|
f.bid.put(b.ID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// zero remainder to help gc
|
// zero remainder to help GC
|
||||||
for j := i; j < len(f.Blocks); j++ {
|
tail := f.Blocks[i:]
|
||||||
f.Blocks[j] = nil
|
for j := range tail {
|
||||||
|
tail[j] = nil
|
||||||
}
|
}
|
||||||
f.Blocks = f.Blocks[:i]
|
f.Blocks = f.Blocks[:i]
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ const (
|
|||||||
OpStoreFP
|
OpStoreFP
|
||||||
OpStoreSP
|
OpStoreSP
|
||||||
|
|
||||||
// spill&restore ops for the register allocator. These are
|
// spill and restore ops for the register allocator. These are
|
||||||
// semantically identical to OpCopy - they do not take/return
|
// semantically identical to OpCopy - they do not take/return
|
||||||
// stores like regular memory ops do. We can get away with that because
|
// stores like regular memory ops do. We can get away with that because
|
||||||
// we know there is no aliasing to spill slots on the stack.
|
// we know there is no aliasing to spill slots on the stack.
|
||||||
|
@ -34,7 +34,7 @@ var (
|
|||||||
TypeFlags = &Flags{}
|
TypeFlags = &Flags{}
|
||||||
)
|
)
|
||||||
|
|
||||||
// typeIdentical returns whether it two arguments are the same type.
|
// typeIdentical reports whether its two arguments are the same type.
|
||||||
func typeIdentical(t, u Type) bool {
|
func typeIdentical(t, u Type) bool {
|
||||||
if t == TypeMem {
|
if t == TypeMem {
|
||||||
return u == TypeMem
|
return u == TypeMem
|
||||||
|
@ -24,7 +24,7 @@ type Value struct {
|
|||||||
// are a few other pseudo-types, see type.go.
|
// are a few other pseudo-types, see type.go.
|
||||||
Type Type
|
Type Type
|
||||||
|
|
||||||
// Auxiliary info for this value. The type of this information depends on the opcode (& type).
|
// Auxiliary info for this value. The type of this information depends on the opcode and type.
|
||||||
Aux interface{}
|
Aux interface{}
|
||||||
|
|
||||||
// Arguments of this value
|
// Arguments of this value
|
||||||
@ -67,9 +67,15 @@ func (v *Value) LongString() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *Value) AddArg(w *Value) {
|
func (v *Value) AddArg(w *Value) {
|
||||||
|
if v.Args == nil {
|
||||||
|
v.resetArgs() // use argstorage
|
||||||
|
}
|
||||||
v.Args = append(v.Args, w)
|
v.Args = append(v.Args, w)
|
||||||
}
|
}
|
||||||
func (v *Value) AddArgs(a ...*Value) {
|
func (v *Value) AddArgs(a ...*Value) {
|
||||||
|
if v.Args == nil {
|
||||||
|
v.resetArgs() // use argstorage
|
||||||
|
}
|
||||||
v.Args = append(v.Args, a...)
|
v.Args = append(v.Args, a...)
|
||||||
}
|
}
|
||||||
func (v *Value) SetArg(i int, w *Value) {
|
func (v *Value) SetArg(i int, w *Value) {
|
||||||
@ -77,6 +83,7 @@ func (v *Value) SetArg(i int, w *Value) {
|
|||||||
}
|
}
|
||||||
func (v *Value) RemoveArg(i int) {
|
func (v *Value) RemoveArg(i int) {
|
||||||
copy(v.Args[i:], v.Args[i+1:])
|
copy(v.Args[i:], v.Args[i+1:])
|
||||||
|
v.Args[len(v.Args)-1] = nil // aid GC
|
||||||
v.Args = v.Args[:len(v.Args)-1]
|
v.Args = v.Args[:len(v.Args)-1]
|
||||||
}
|
}
|
||||||
func (v *Value) SetArgs1(a *Value) {
|
func (v *Value) SetArgs1(a *Value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user