]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: drop Node.HasOpt method
authorRuss Cox <rsc@golang.org>
Sat, 28 Nov 2020 05:05:15 +0000 (00:05 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 30 Nov 2020 18:33:49 +0000 (18:33 +0000)
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>
src/cmd/compile/internal/gc/escape.go
src/cmd/compile/internal/ir/node.go

index 34f52c743abb8b42ceb17fa957b02e7a036104d8..6b6fb44a9942a25cdfa5812b7b2adc36566efb8c 100644 (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)
index 477d07f5029b532f4d51866fa004ee03119c1be8..acfddd2dc7d768eaaad09c382177d5d27759492f 100644 (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
                }