mirror of
https://github.com/golang/go
synced 2025-05-16 05:02:16 +00:00
[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>
This commit is contained in:
@ -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))
|
||||
|
@ -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() }
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user