Skip to content

Commit

Permalink
cmd/compile: remove Addable flag
Browse files Browse the repository at this point in the history
This flag is supposed to indicate whether the expression is
"addressable"; but in practice, we infer this from other
attributes about the expression (e.g., n.Op and n.Class()).

Passes toolstash-check.

Change-Id: I19352ca07ab5646e232d98e8a7c1c9aec822ddd0
Reviewed-on: https://go-review.googlesource.com/c/go/+/200897
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
mdempsky committed Oct 13, 2019
1 parent 9f4fb68 commit 46be01f
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 18 deletions.
2 changes: 0 additions & 2 deletions src/cmd/compile/internal/gc/dcl.go
Expand Up @@ -203,7 +203,6 @@ func newnoname(s *types.Sym) *Node {
}
n := nod(ONONAME, nil, nil)
n.Sym = s
n.SetAddable(true)
n.Xoffset = 0
return n
}
Expand Down Expand Up @@ -282,7 +281,6 @@ func oldname(s *types.Sym) *Node {
c.SetIsClosureVar(true)
c.SetIsDDD(n.IsDDD())
c.Name.Defn = n
c.SetAddable(false)

// Link into list of active closure variables.
// Popped from list in func closurebody.
Expand Down
1 change: 0 additions & 1 deletion src/cmd/compile/internal/gc/esc.go
Expand Up @@ -283,7 +283,6 @@ func moveToHeap(n *Node) {
// and substitute that copy into the function declaration list
// so that analyses of the local (on-stack) variables use it.
stackcopy := newname(n.Sym)
stackcopy.SetAddable(false)
stackcopy.Type = n.Type
stackcopy.Xoffset = n.Xoffset
stackcopy.SetClass(n.Class())
Expand Down
4 changes: 0 additions & 4 deletions src/cmd/compile/internal/gc/fmt.go
Expand Up @@ -417,10 +417,6 @@ func (n *Node) format(s fmt.State, verb rune, mode fmtMode) {
func (n *Node) jconv(s fmt.State, flag FmtFlag) {
c := flag & FmtShort

if c == 0 && n.Addable() {
fmt.Fprintf(s, " a(%v)", n.Addable())
}

if c == 0 && n.Name != nil && n.Name.Vargen != 0 {
fmt.Fprintf(s, " g(%d)", n.Name.Vargen)
}
Expand Down
3 changes: 0 additions & 3 deletions src/cmd/compile/internal/gc/reflect.go
Expand Up @@ -1024,7 +1024,6 @@ func typename(t *types.Type) *Node {

n := nod(OADDR, asNode(s.Def), nil)
n.Type = types.NewPtr(asNode(s.Def).Type)
n.SetAddable(true)
n.SetTypecheck(1)
return n
}
Expand All @@ -1045,7 +1044,6 @@ func itabname(t, itype *types.Type) *Node {

n := nod(OADDR, asNode(s.Def), nil)
n.Type = types.NewPtr(asNode(s.Def).Type)
n.SetAddable(true)
n.SetTypecheck(1)
return n
}
Expand Down Expand Up @@ -1886,7 +1884,6 @@ func zeroaddr(size int64) *Node {
}
z := nod(OADDR, asNode(s.Def), nil)
z.Type = types.NewPtr(types.Types[TUINT8])
z.SetAddable(true)
z.SetTypecheck(1)
return z
}
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/gc/sinit.go
Expand Up @@ -388,7 +388,7 @@ func isLiteral(n *Node) bool {
}

func (n *Node) isSimpleName() bool {
return n.Op == ONAME && n.Addable() && n.Class() != PAUTOHEAP && n.Class() != PEXTERN
return n.Op == ONAME && n.Class() != PAUTOHEAP && n.Class() != PEXTERN
}

func litas(l *Node, r *Node, init *Nodes) {
Expand Down Expand Up @@ -1018,7 +1018,7 @@ func stataddr(nam *Node, n *Node) bool {
switch n.Op {
case ONAME:
*nam = *n
return n.Addable()
return true

case ODOT:
if !stataddr(nam, n.Left) {
Expand Down
1 change: 0 additions & 1 deletion src/cmd/compile/internal/gc/ssa.go
Expand Up @@ -6151,7 +6151,6 @@ func (e *ssafn) splitSlot(parent *ssa.LocalSlot, suffix string, offset int64, t
n.Sym = s
n.Type = t
n.SetClass(PAUTO)
n.SetAddable(true)
n.Esc = EscNever
n.Name.Curfn = e.curfn
e.curfn.Func.Dcl = append(e.curfn.Func.Dcl, n)
Expand Down
1 change: 0 additions & 1 deletion src/cmd/compile/internal/gc/subr.go
Expand Up @@ -370,7 +370,6 @@ func newnamel(pos src.XPos, s *types.Sym) *Node {
n.Orig = n

n.Sym = s
n.SetAddable(true)
return n
}

Expand Down
3 changes: 0 additions & 3 deletions src/cmd/compile/internal/gc/syntax.go
Expand Up @@ -153,7 +153,6 @@ const (
_, nodeNonNil // guaranteed to be non-nil
_, nodeTransient // storage can be reused immediately after this statement
_, nodeBounded // bounds check unnecessary
_, nodeAddable // addressable
_, nodeHasCall // expression contains a function call
_, nodeLikely // if statement condition likely
_, nodeHasVal // node.E contains a Val
Expand Down Expand Up @@ -181,7 +180,6 @@ func (n *Node) Colas() bool { return n.flags&nodeColas != 0 }
func (n *Node) NonNil() bool { return n.flags&nodeNonNil != 0 }
func (n *Node) Transient() bool { return n.flags&nodeTransient != 0 }
func (n *Node) Bounded() bool { return n.flags&nodeBounded != 0 }
func (n *Node) Addable() bool { return n.flags&nodeAddable != 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 }
Expand All @@ -208,7 +206,6 @@ func (n *Node) SetColas(b bool) { n.flags.set(nodeColas, b) }
func (n *Node) SetNonNil(b bool) { n.flags.set(nodeNonNil, b) }
func (n *Node) SetTransient(b bool) { n.flags.set(nodeTransient, b) }
func (n *Node) SetBounded(b bool) { n.flags.set(nodeBounded, b) }
func (n *Node) SetAddable(b bool) { n.flags.set(nodeAddable, b) }
func (n *Node) SetHasCall(b bool) { n.flags.set(nodeHasCall, b) }
func (n *Node) SetLikely(b bool) { n.flags.set(nodeLikely, b) }
func (n *Node) SetHasVal(b bool) { n.flags.set(nodeHasVal, b) }
Expand Down
1 change: 0 additions & 1 deletion src/cmd/compile/internal/gc/walk.go
Expand Up @@ -564,7 +564,6 @@ opswitch:
n = mkcall("gorecover", n.Type, init, nod(OADDR, nodfp, nil))

case OCLOSUREVAR, OCFUNC:
n.SetAddable(true)

case OCALLINTER, OCALLFUNC, OCALLMETH:
if n.Op == OCALLINTER {
Expand Down

0 comments on commit 46be01f

Please sign in to comment.