]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: remove Node.{,Set}Walkdef
authorMatthew Dempsky <mdempsky@google.com>
Sat, 2 Jan 2021 11:23:49 +0000 (03:23 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Sun, 3 Jan 2021 06:16:36 +0000 (06:16 +0000)
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>
src/cmd/compile/internal/ir/mini.go
src/cmd/compile/internal/ir/name.go
src/cmd/compile/internal/ir/node.go

index 93aa15abece25565cd547e5cb67141ddca386425..4dd9a8807aadf4e17563f29c23c2c843d2f7408f 100644 (file)
@@ -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))
index 5acb2d07627a14bc1978358e44bef6004f9932db..afee6e1308fd49b6c9c16f8caa48d9d40eb121c9 100644 (file)
@@ -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() }
 
index 9d1ee17aa8a84f6db2fc65e1664ed97ea7e28acf..a5a7203faaa22d7474781dbb07044d46ba68b79f 100644 (file)
@@ -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