summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-01-02 03:23:49 -0800
committerMatthew Dempsky <mdempsky@google.com>2021-01-03 06:16:36 +0000
commitbb1b6c95c2d312ec0e23a90dffd37a62f98af7ae (patch)
tree3ac6ffffd222bd631a0e5a84ae92dbe80142d023
parent57c426c9a57736d84f6ddd88d7a3306e63f66945 (diff)
downloadgo-git-bb1b6c95c2d312ec0e23a90dffd37a62f98af7ae.tar.gz
[dev.regabi] cmd/compile: remove Node.{,Set}Walkdef
After the previous commit, we no longer access Walkdef on anything but ir.Names, so we can remove them from the Node interface and miniNode. The flag bits storage should also move from miniNode.bits to Name.flags, but the latter is already full at the moment. Leaving as a TODO for now. Passes toolstash -cmp. Change-Id: I2427e4cf7bc68dc1d1529f40fb93dd9f7a9149f6 Reviewed-on: https://go-review.googlesource.com/c/go/+/281005 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
-rw-r--r--src/cmd/compile/internal/ir/mini.go9
-rw-r--r--src/cmd/compile/internal/ir/name.go8
-rw-r--r--src/cmd/compile/internal/ir/node.go2
3 files changed, 9 insertions, 10 deletions
diff --git a/src/cmd/compile/internal/ir/mini.go b/src/cmd/compile/internal/ir/mini.go
index 93aa15abec..4dd9a8807a 100644
--- a/src/cmd/compile/internal/ir/mini.go
+++ b/src/cmd/compile/internal/ir/mini.go
@@ -54,20 +54,13 @@ func (n *miniNode) Esc() uint16 { return n.esc }
func (n *miniNode) SetEsc(x uint16) { n.esc = x }
const (
- miniWalkdefShift = 0
+ miniWalkdefShift = 0 // TODO(mdempsky): Move to Name.flags.
miniTypecheckShift = 2
miniDiag = 1 << 4
miniHasCall = 1 << 5 // for miniStmt
)
-func (n *miniNode) Walkdef() uint8 { return n.bits.get2(miniWalkdefShift) }
func (n *miniNode) Typecheck() uint8 { return n.bits.get2(miniTypecheckShift) }
-func (n *miniNode) SetWalkdef(x uint8) {
- if x > 3 {
- panic(fmt.Sprintf("cannot SetWalkdef %d", x))
- }
- n.bits.set2(miniWalkdefShift, x)
-}
func (n *miniNode) SetTypecheck(x uint8) {
if x > 3 {
panic(fmt.Sprintf("cannot SetTypecheck %d", x))
diff --git a/src/cmd/compile/internal/ir/name.go b/src/cmd/compile/internal/ir/name.go
index 5acb2d0762..afee6e1308 100644
--- a/src/cmd/compile/internal/ir/name.go
+++ b/src/cmd/compile/internal/ir/name.go
@@ -10,6 +10,7 @@ import (
"cmd/internal/obj"
"cmd/internal/objabi"
"cmd/internal/src"
+ "fmt"
"go/constant"
)
@@ -240,6 +241,13 @@ func (n *Name) FrameOffset() int64 { return n.Offset_ }
func (n *Name) SetFrameOffset(x int64) { n.Offset_ = x }
func (n *Name) Iota() int64 { return n.Offset_ }
func (n *Name) SetIota(x int64) { n.Offset_ = x }
+func (n *Name) Walkdef() uint8 { return n.bits.get2(miniWalkdefShift) }
+func (n *Name) SetWalkdef(x uint8) {
+ if x > 3 {
+ panic(fmt.Sprintf("cannot SetWalkdef %d", x))
+ }
+ n.bits.set2(miniWalkdefShift, x)
+}
func (n *Name) Linksym() *obj.LSym { return n.sym.Linksym() }
diff --git a/src/cmd/compile/internal/ir/node.go b/src/cmd/compile/internal/ir/node.go
index 9d1ee17aa8..a5a7203faa 100644
--- a/src/cmd/compile/internal/ir/node.go
+++ b/src/cmd/compile/internal/ir/node.go
@@ -46,8 +46,6 @@ type Node interface {
// Storage for analysis passes.
Esc() uint16
SetEsc(x uint16)
- Walkdef() uint8
- SetWalkdef(x uint8)
Diag() bool
SetDiag(x bool)
Typecheck() uint8