mirror of
https://github.com/golang/go
synced 2024-11-12 10:30:23 -07:00
cmd/compile: simplify isglobal
Passes toolstash -cmp. Change-Id: I16ec0c11096bf4c020cf41392effeb67436f32ba Reviewed-on: https://go-review.googlesource.com/26750 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
af9342ca10
commit
a301b329e5
@ -2127,18 +2127,9 @@ func isstack(n *Node) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func isglobal(n *Node) bool {
|
||||
func (n *Node) isGlobal() bool {
|
||||
n = outervalue(n)
|
||||
|
||||
switch n.Op {
|
||||
case ONAME:
|
||||
switch n.Class {
|
||||
case PEXTERN:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
return n.Op == ONAME && n.Class == PEXTERN
|
||||
}
|
||||
|
||||
// Do we need a write barrier for the assignment l = r?
|
||||
@ -2193,7 +2184,7 @@ func needwritebarrier(l *Node, r *Node) bool {
|
||||
|
||||
// No write barrier for storing address of global, which
|
||||
// is live no matter what.
|
||||
if r.Op == OADDR && isglobal(r.Left) {
|
||||
if r.Op == OADDR && r.Left.isGlobal() {
|
||||
return false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user