Commit a301b329 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent af9342ca
...@@ -2127,18 +2127,9 @@ func isstack(n *Node) bool { ...@@ -2127,18 +2127,9 @@ func isstack(n *Node) bool {
return false return false
} }
func isglobal(n *Node) bool { func (n *Node) isGlobal() bool {
n = outervalue(n) n = outervalue(n)
return n.Op == ONAME && n.Class == PEXTERN
switch n.Op {
case ONAME:
switch n.Class {
case PEXTERN:
return true
}
}
return false
} }
// Do we need a write barrier for the assignment l = r? // Do we need a write barrier for the assignment l = r?
...@@ -2193,7 +2184,7 @@ func needwritebarrier(l *Node, r *Node) bool { ...@@ -2193,7 +2184,7 @@ func needwritebarrier(l *Node, r *Node) bool {
// No write barrier for storing address of global, which // No write barrier for storing address of global, which
// is live no matter what. // is live no matter what.
if r.Op == OADDR && isglobal(r.Left) { if r.Op == OADDR && r.Left.isGlobal() {
return false return false
} }
......
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