1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:01:37 -07: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:
Russ Cox 2020-11-28 00:05:15 -05:00
parent 65f4ec2fae
commit 0c65a2f317
2 changed files with 5 additions and 6 deletions

View File

@ -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)
}
if n.HasOpt() {
if n.Opt() != nil {
base.Fatalf("%v already has a location", n)
}
n.SetOpt(loc)

View File

@ -111,7 +111,6 @@ type Node interface {
SetWalkdef(x uint8)
Opt() interface{}
SetOpt(x interface{})
HasOpt() bool
Diag() bool
SetDiag(x 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) Likely() bool { return n.flags&nodeLikely != 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) 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,
// which must not have been used with SetOpt.
func (n *node) SetVal(v constant.Value) {
if n.HasOpt() {
if n.hasOpt() {
base.Flag.LowerH = 1
Dump("have Opt", n)
base.Fatalf("have Opt")
@ -413,7 +412,7 @@ func (n *node) SetVal(v constant.Value) {
// Opt returns the optimizer data for the node.
func (n *node) Opt() interface{} {
if !n.HasOpt() {
if !n.hasOpt() {
return nil
}
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.
func (n *node) SetOpt(x interface{}) {
if x == nil {
if n.HasOpt() {
if n.hasOpt() {
n.setHasOpt(false)
n.e = nil
}