mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: drop Node.HasOpt method
Node.HasOpt is only used once, and that use can use Opt instead. Interface is one method smaller. Passes buildall w/ toolstash -cmp. Change-Id: I6a9d5859a9977a8f4c9db70e166f50f0d8052160 Reviewed-on: https://go-review.googlesource.com/c/go/+/274087 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
65f4ec2fae
commit
0c65a2f317
2 changed files with 5 additions and 6 deletions
|
|
@ -1092,7 +1092,7 @@ func (e *Escape) newLoc(n ir.Node, transient bool) *EscLocation {
|
||||||
base.Fatalf("curfn mismatch: %v != %v", n.Name().Curfn, e.curfn)
|
base.Fatalf("curfn mismatch: %v != %v", n.Name().Curfn, e.curfn)
|
||||||
}
|
}
|
||||||
|
|
||||||
if n.HasOpt() {
|
if n.Opt() != nil {
|
||||||
base.Fatalf("%v already has a location", n)
|
base.Fatalf("%v already has a location", n)
|
||||||
}
|
}
|
||||||
n.SetOpt(loc)
|
n.SetOpt(loc)
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,6 @@ type Node interface {
|
||||||
SetWalkdef(x uint8)
|
SetWalkdef(x uint8)
|
||||||
Opt() interface{}
|
Opt() interface{}
|
||||||
SetOpt(x interface{})
|
SetOpt(x interface{})
|
||||||
HasOpt() bool
|
|
||||||
Diag() bool
|
Diag() bool
|
||||||
SetDiag(x bool)
|
SetDiag(x bool)
|
||||||
Bounded() bool
|
Bounded() bool
|
||||||
|
|
@ -325,7 +324,7 @@ func (n *node) Bounded() bool { return n.flags&nodeBounded != 0 }
|
||||||
func (n *node) HasCall() bool { return n.flags&nodeHasCall != 0 }
|
func (n *node) HasCall() bool { return n.flags&nodeHasCall != 0 }
|
||||||
func (n *node) Likely() bool { return n.flags&nodeLikely != 0 }
|
func (n *node) Likely() bool { return n.flags&nodeLikely != 0 }
|
||||||
func (n *node) HasVal() bool { return n.flags&nodeHasVal != 0 }
|
func (n *node) HasVal() bool { return n.flags&nodeHasVal != 0 }
|
||||||
func (n *node) HasOpt() bool { return n.flags&nodeHasOpt != 0 }
|
func (n *node) hasOpt() bool { return n.flags&nodeHasOpt != 0 }
|
||||||
func (n *node) Embedded() bool { return n.flags&nodeEmbedded != 0 }
|
func (n *node) Embedded() bool { return n.flags&nodeEmbedded != 0 }
|
||||||
|
|
||||||
func (n *node) SetClass(b Class) { n.flags.set3(nodeClass, uint8(b)) }
|
func (n *node) SetClass(b Class) { n.flags.set3(nodeClass, uint8(b)) }
|
||||||
|
|
@ -399,7 +398,7 @@ func (n *node) Val() constant.Value {
|
||||||
// SetVal sets the constant.Value for the node,
|
// SetVal sets the constant.Value for the node,
|
||||||
// which must not have been used with SetOpt.
|
// which must not have been used with SetOpt.
|
||||||
func (n *node) SetVal(v constant.Value) {
|
func (n *node) SetVal(v constant.Value) {
|
||||||
if n.HasOpt() {
|
if n.hasOpt() {
|
||||||
base.Flag.LowerH = 1
|
base.Flag.LowerH = 1
|
||||||
Dump("have Opt", n)
|
Dump("have Opt", n)
|
||||||
base.Fatalf("have Opt")
|
base.Fatalf("have Opt")
|
||||||
|
|
@ -413,7 +412,7 @@ func (n *node) SetVal(v constant.Value) {
|
||||||
|
|
||||||
// Opt returns the optimizer data for the node.
|
// Opt returns the optimizer data for the node.
|
||||||
func (n *node) Opt() interface{} {
|
func (n *node) Opt() interface{} {
|
||||||
if !n.HasOpt() {
|
if !n.hasOpt() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return n.e
|
return n.e
|
||||||
|
|
@ -423,7 +422,7 @@ func (n *node) Opt() interface{} {
|
||||||
// SetOpt(nil) is ignored for Vals to simplify call sites that are clearing Opts.
|
// SetOpt(nil) is ignored for Vals to simplify call sites that are clearing Opts.
|
||||||
func (n *node) SetOpt(x interface{}) {
|
func (n *node) SetOpt(x interface{}) {
|
||||||
if x == nil {
|
if x == nil {
|
||||||
if n.HasOpt() {
|
if n.hasOpt() {
|
||||||
n.setHasOpt(false)
|
n.setHasOpt(false)
|
||||||
n.e = nil
|
n.e = nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue