Commit 46be01f4 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: remove Addable flag

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 9f4fb681
...@@ -203,7 +203,6 @@ func newnoname(s *types.Sym) *Node { ...@@ -203,7 +203,6 @@ func newnoname(s *types.Sym) *Node {
} }
n := nod(ONONAME, nil, nil) n := nod(ONONAME, nil, nil)
n.Sym = s n.Sym = s
n.SetAddable(true)
n.Xoffset = 0 n.Xoffset = 0
return n return n
} }
...@@ -282,7 +281,6 @@ func oldname(s *types.Sym) *Node { ...@@ -282,7 +281,6 @@ func oldname(s *types.Sym) *Node {
c.SetIsClosureVar(true) c.SetIsClosureVar(true)
c.SetIsDDD(n.IsDDD()) c.SetIsDDD(n.IsDDD())
c.Name.Defn = n c.Name.Defn = n
c.SetAddable(false)
// Link into list of active closure variables. // Link into list of active closure variables.
// Popped from list in func closurebody. // Popped from list in func closurebody.
......
...@@ -283,7 +283,6 @@ func moveToHeap(n *Node) { ...@@ -283,7 +283,6 @@ func moveToHeap(n *Node) {
// and substitute that copy into the function declaration list // and substitute that copy into the function declaration list
// so that analyses of the local (on-stack) variables use it. // so that analyses of the local (on-stack) variables use it.
stackcopy := newname(n.Sym) stackcopy := newname(n.Sym)
stackcopy.SetAddable(false)
stackcopy.Type = n.Type stackcopy.Type = n.Type
stackcopy.Xoffset = n.Xoffset stackcopy.Xoffset = n.Xoffset
stackcopy.SetClass(n.Class()) stackcopy.SetClass(n.Class())
......
...@@ -417,10 +417,6 @@ func (n *Node) format(s fmt.State, verb rune, mode fmtMode) { ...@@ -417,10 +417,6 @@ func (n *Node) format(s fmt.State, verb rune, mode fmtMode) {
func (n *Node) jconv(s fmt.State, flag FmtFlag) { func (n *Node) jconv(s fmt.State, flag FmtFlag) {
c := flag & FmtShort 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 { if c == 0 && n.Name != nil && n.Name.Vargen != 0 {
fmt.Fprintf(s, " g(%d)", n.Name.Vargen) fmt.Fprintf(s, " g(%d)", n.Name.Vargen)
} }
......
...@@ -1024,7 +1024,6 @@ func typename(t *types.Type) *Node { ...@@ -1024,7 +1024,6 @@ func typename(t *types.Type) *Node {
n := nod(OADDR, asNode(s.Def), nil) n := nod(OADDR, asNode(s.Def), nil)
n.Type = types.NewPtr(asNode(s.Def).Type) n.Type = types.NewPtr(asNode(s.Def).Type)
n.SetAddable(true)
n.SetTypecheck(1) n.SetTypecheck(1)
return n return n
} }
...@@ -1045,7 +1044,6 @@ func itabname(t, itype *types.Type) *Node { ...@@ -1045,7 +1044,6 @@ func itabname(t, itype *types.Type) *Node {
n := nod(OADDR, asNode(s.Def), nil) n := nod(OADDR, asNode(s.Def), nil)
n.Type = types.NewPtr(asNode(s.Def).Type) n.Type = types.NewPtr(asNode(s.Def).Type)
n.SetAddable(true)
n.SetTypecheck(1) n.SetTypecheck(1)
return n return n
} }
...@@ -1886,7 +1884,6 @@ func zeroaddr(size int64) *Node { ...@@ -1886,7 +1884,6 @@ func zeroaddr(size int64) *Node {
} }
z := nod(OADDR, asNode(s.Def), nil) z := nod(OADDR, asNode(s.Def), nil)
z.Type = types.NewPtr(types.Types[TUINT8]) z.Type = types.NewPtr(types.Types[TUINT8])
z.SetAddable(true)
z.SetTypecheck(1) z.SetTypecheck(1)
return z return z
} }
...@@ -388,7 +388,7 @@ func isLiteral(n *Node) bool { ...@@ -388,7 +388,7 @@ func isLiteral(n *Node) bool {
} }
func (n *Node) isSimpleName() 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) { func litas(l *Node, r *Node, init *Nodes) {
...@@ -1018,7 +1018,7 @@ func stataddr(nam *Node, n *Node) bool { ...@@ -1018,7 +1018,7 @@ func stataddr(nam *Node, n *Node) bool {
switch n.Op { switch n.Op {
case ONAME: case ONAME:
*nam = *n *nam = *n
return n.Addable() return true
case ODOT: case ODOT:
if !stataddr(nam, n.Left) { if !stataddr(nam, n.Left) {
......
...@@ -6151,7 +6151,6 @@ func (e *ssafn) splitSlot(parent *ssa.LocalSlot, suffix string, offset int64, t ...@@ -6151,7 +6151,6 @@ func (e *ssafn) splitSlot(parent *ssa.LocalSlot, suffix string, offset int64, t
n.Sym = s n.Sym = s
n.Type = t n.Type = t
n.SetClass(PAUTO) n.SetClass(PAUTO)
n.SetAddable(true)
n.Esc = EscNever n.Esc = EscNever
n.Name.Curfn = e.curfn n.Name.Curfn = e.curfn
e.curfn.Func.Dcl = append(e.curfn.Func.Dcl, n) e.curfn.Func.Dcl = append(e.curfn.Func.Dcl, n)
......
...@@ -370,7 +370,6 @@ func newnamel(pos src.XPos, s *types.Sym) *Node { ...@@ -370,7 +370,6 @@ func newnamel(pos src.XPos, s *types.Sym) *Node {
n.Orig = n n.Orig = n
n.Sym = s n.Sym = s
n.SetAddable(true)
return n return n
} }
......
...@@ -153,7 +153,6 @@ const ( ...@@ -153,7 +153,6 @@ const (
_, nodeNonNil // guaranteed to be non-nil _, nodeNonNil // guaranteed to be non-nil
_, nodeTransient // storage can be reused immediately after this statement _, nodeTransient // storage can be reused immediately after this statement
_, nodeBounded // bounds check unnecessary _, nodeBounded // bounds check unnecessary
_, nodeAddable // addressable
_, nodeHasCall // expression contains a function call _, nodeHasCall // expression contains a function call
_, nodeLikely // if statement condition likely _, nodeLikely // if statement condition likely
_, nodeHasVal // node.E contains a Val _, nodeHasVal // node.E contains a Val
...@@ -181,7 +180,6 @@ func (n *Node) Colas() bool { return n.flags&nodeColas != 0 } ...@@ -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) NonNil() bool { return n.flags&nodeNonNil != 0 }
func (n *Node) Transient() bool { return n.flags&nodeTransient != 0 } func (n *Node) Transient() bool { return n.flags&nodeTransient != 0 }
func (n *Node) Bounded() bool { return n.flags&nodeBounded != 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) HasCall() bool { return n.flags&nodeHasCall != 0 }
func (n *Node) Likely() bool { return n.flags&nodeLikely != 0 } func (n *Node) Likely() bool { return n.flags&nodeLikely != 0 }
func (n *Node) HasVal() bool { return n.flags&nodeHasVal != 0 } func (n *Node) HasVal() bool { return n.flags&nodeHasVal != 0 }
...@@ -208,7 +206,6 @@ func (n *Node) SetColas(b bool) { n.flags.set(nodeColas, b) } ...@@ -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) SetNonNil(b bool) { n.flags.set(nodeNonNil, b) }
func (n *Node) SetTransient(b bool) { n.flags.set(nodeTransient, 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) 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) SetHasCall(b bool) { n.flags.set(nodeHasCall, b) }
func (n *Node) SetLikely(b bool) { n.flags.set(nodeLikely, b) } func (n *Node) SetLikely(b bool) { n.flags.set(nodeLikely, b) }
func (n *Node) SetHasVal(b bool) { n.flags.set(nodeHasVal, b) } func (n *Node) SetHasVal(b bool) { n.flags.set(nodeHasVal, b) }
......
...@@ -564,7 +564,6 @@ opswitch: ...@@ -564,7 +564,6 @@ opswitch:
n = mkcall("gorecover", n.Type, init, nod(OADDR, nodfp, nil)) n = mkcall("gorecover", n.Type, init, nod(OADDR, nodfp, nil))
case OCLOSUREVAR, OCFUNC: case OCLOSUREVAR, OCFUNC:
n.SetAddable(true)
case OCALLINTER, OCALLFUNC, OCALLMETH: case OCALLINTER, OCALLFUNC, OCALLMETH:
if n.Op == OCALLINTER { if n.Op == OCALLINTER {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment