[dev.regabi] cmd/compile: remove gc ↔ ssa cycle hacks

The cycle hacks existed because gc needed to import ssa
which need to know about gc.Node. But now that's ir.Node,
and there's no cycle anymore.

Don't know how much it matters but LocalSlot is now
one word shorter than before, because it holds a pointer
instead of an interface for the *Node. That won't last long.

Now that they're not necessary for interface satisfaction,
IsSynthetic and IsAutoTmp can move to top-level ir functions.

Change-Id: Ie511e93466cfa2b17d9a91afc4bd8d53fdb80453
Reviewed-on: https://go-review.googlesource.com/c/go/+/272931
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-17 21:47:56 -05:00
parent 84e2bd611f
commit 048debb224
16 changed files with 73 additions and 126 deletions

View file

@ -13,7 +13,6 @@ import (
"unsafe"
"cmd/compile/internal/base"
"cmd/compile/internal/ssa"
"cmd/compile/internal/types"
"cmd/internal/obj"
"cmd/internal/objabi"
@ -156,14 +155,14 @@ func (n *Node) SetTChanDir(dir types.ChanDir) {
n.aux = uint8(dir)
}
func (n *Node) IsSynthetic() bool {
func IsSynthetic(n *Node) bool {
name := n.Sym.Name
return name[0] == '.' || name[0] == '~'
}
// IsAutoTmp indicates if n was created by the compiler as a temporary,
// based on the setting of the .AutoTemp flag in n's Name.
func (n *Node) IsAutoTmp() bool {
func IsAutoTmp(n *Node) bool {
if n == nil || n.Op != ONAME {
return false
}
@ -683,7 +682,7 @@ type Func struct {
Closgen int
FieldTrack map[*types.Sym]struct{}
DebugInfo *ssa.FuncDebug
DebugInfo interface{}
LSym *obj.LSym
Inl *Inline
@ -1550,21 +1549,3 @@ func IsBlank(n *Node) bool {
func IsMethod(n *Node) bool {
return n.Type.Recv() != nil
}
func (n *Node) Typ() *types.Type {
return n.Type
}
func (n *Node) StorageClass() ssa.StorageClass {
switch n.Class() {
case PPARAM:
return ssa.ClassParam
case PPARAMOUT:
return ssa.ClassParamOut
case PAUTO:
return ssa.ClassAuto
default:
base.Fatalf("untranslatable storage class for %v: %s", n, n.Class())
return 0
}
}