cmd/internal/gc: convert yet more Node fields to bools

Convert Embedded, Method, and Colas to bools.

I believe that this is the last of the Node fields
that can be trivially converted to bools.

No functional changes. Passes toolstash -cmp.

Change-Id: I81962ee47866596341fc60d24d6959c20cd7fc1c
Reviewed-on: https://go-review.googlesource.com/8440
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2015-04-02 19:58:37 -07:00
parent be4c38ed34
commit 75883bae28
23 changed files with 103 additions and 103 deletions

View file

@ -24,7 +24,7 @@ func cgen64(n *gc.Node, res *gc.Node) {
l := n.Left l := n.Left
var t1 gc.Node var t1 gc.Node
if l.Addable == 0 { if !l.Addable {
gc.Tempname(&t1, l.Type) gc.Tempname(&t1, l.Type)
gc.Cgen(l, &t1) gc.Cgen(l, &t1)
l = &t1 l = &t1
@ -108,7 +108,7 @@ func cgen64(n *gc.Node, res *gc.Node) {
// setup for binary operators // setup for binary operators
r := n.Right r := n.Right
if r != nil && r.Addable == 0 { if r != nil && !r.Addable {
var t2 gc.Node var t2 gc.Node
gc.Tempname(&t2, r.Type) gc.Tempname(&t2, r.Type)
gc.Cgen(r, &t2) gc.Cgen(r, &t2)

View file

@ -1090,7 +1090,7 @@ func dotaddable(n *gc.Node, n1 *gc.Node) bool {
var oary [10]int64 var oary [10]int64
var nn *gc.Node var nn *gc.Node
o := gc.Dotoffset(n, oary[:], &nn) o := gc.Dotoffset(n, oary[:], &nn)
if nn != nil && nn.Addable != 0 && o == 1 && oary[0] >= 0 { if nn != nil && nn.Addable && o == 1 && oary[0] >= 0 {
*n1 = *nn *n1 = *nn
n1.Type = n.Type n1.Type = n.Type
n1.Xoffset += oary[0] n1.Xoffset += oary[0]
@ -1169,7 +1169,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr) bool {
return false return false
} }
if nn.Addable != 0 && o == 1 && oary[0] >= 0 { if nn.Addable && o == 1 && oary[0] >= 0 {
// directly addressable set of DOTs // directly addressable set of DOTs
n1 := *nn n1 := *nn

View file

@ -1247,7 +1247,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr) bool {
return false return false
} }
if nn.Addable != 0 && o == 1 && oary[0] >= 0 { if nn.Addable && o == 1 && oary[0] >= 0 {
// directly addressable set of DOTs // directly addressable set of DOTs
n1 := *nn n1 := *nn

View file

@ -17,7 +17,7 @@ import (
*/ */
func igenindex(n *gc.Node, res *gc.Node, bounded bool) *obj.Prog { func igenindex(n *gc.Node, res *gc.Node, bounded bool) *obj.Prog {
if !gc.Is64(n.Type) { if !gc.Is64(n.Type) {
if n.Addable != 0 { if n.Addable {
// nothing to do. // nothing to do.
*res = *n *res = *n
} else { } else {
@ -58,13 +58,13 @@ func stackcopy(n, res *gc.Node, osrc, odst, w int64) {
gc.Tempname(&tsrc, gc.Types[gc.Tptr]) gc.Tempname(&tsrc, gc.Types[gc.Tptr])
var tdst gc.Node var tdst gc.Node
gc.Tempname(&tdst, gc.Types[gc.Tptr]) gc.Tempname(&tdst, gc.Types[gc.Tptr])
if n.Addable == 0 { if !n.Addable {
gc.Agen(n, &tsrc) gc.Agen(n, &tsrc)
} }
if res.Addable == 0 { if !res.Addable {
gc.Agen(res, &tdst) gc.Agen(res, &tdst)
} }
if n.Addable != 0 { if n.Addable {
gc.Agen(n, &src) gc.Agen(n, &src)
} else { } else {
gmove(&tsrc, &src) gmove(&tsrc, &src)
@ -74,7 +74,7 @@ func stackcopy(n, res *gc.Node, osrc, odst, w int64) {
gc.Gvardef(res) gc.Gvardef(res)
} }
if res.Addable != 0 { if res.Addable {
gc.Agen(res, &dst) gc.Agen(res, &dst)
} else { } else {
gmove(&tdst, &dst) gmove(&tdst, &dst)

View file

@ -63,14 +63,14 @@ func cgen64(n *gc.Node, res *gc.Node) {
l := n.Left l := n.Left
r := n.Right r := n.Right
if l.Addable == 0 { if !l.Addable {
var t1 gc.Node var t1 gc.Node
gc.Tempname(&t1, l.Type) gc.Tempname(&t1, l.Type)
gc.Cgen(l, &t1) gc.Cgen(l, &t1)
l = &t1 l = &t1
} }
if r != nil && r.Addable == 0 { if r != nil && !r.Addable {
var t2 gc.Node var t2 gc.Node
gc.Tempname(&t2, r.Type) gc.Tempname(&t2, r.Type)
gc.Cgen(r, &t2) gc.Cgen(r, &t2)

View file

@ -637,7 +637,7 @@ func cgen_float387(n *gc.Node, res *gc.Node) {
// binary // binary
if nl.Ullman >= nr.Ullman { if nl.Ullman >= nr.Ullman {
gc.Cgen(nl, &f0) gc.Cgen(nl, &f0)
if nr.Addable != 0 { if nr.Addable {
gins(foptoas(int(n.Op), n.Type, 0), nr, &f0) gins(foptoas(int(n.Op), n.Type, 0), nr, &f0)
} else { } else {
gc.Cgen(nr, &f0) gc.Cgen(nr, &f0)
@ -645,7 +645,7 @@ func cgen_float387(n *gc.Node, res *gc.Node) {
} }
} else { } else {
gc.Cgen(nr, &f0) gc.Cgen(nr, &f0)
if nl.Addable != 0 { if nl.Addable {
gins(foptoas(int(n.Op), n.Type, Frev), nl, &f0) gins(foptoas(int(n.Op), n.Type, Frev), nl, &f0)
} else { } else {
gc.Cgen(nl, &f0) gc.Cgen(nl, &f0)
@ -762,14 +762,14 @@ func bgen_float(n *gc.Node, true_ int, likely int, to *obj.Prog) {
var n2 gc.Node var n2 gc.Node
var ax gc.Node var ax gc.Node
if !gc.Thearch.Use387 { if !gc.Thearch.Use387 {
if nl.Addable == 0 { if !nl.Addable {
var n1 gc.Node var n1 gc.Node
gc.Tempname(&n1, nl.Type) gc.Tempname(&n1, nl.Type)
gc.Cgen(nl, &n1) gc.Cgen(nl, &n1)
nl = &n1 nl = &n1
} }
if nr.Addable == 0 { if !nr.Addable {
var tmp gc.Node var tmp gc.Node
gc.Tempname(&tmp, nr.Type) gc.Tempname(&tmp, nr.Type)
gc.Cgen(nr, &tmp) gc.Cgen(nr, &tmp)

View file

@ -1732,7 +1732,7 @@ func dotaddable(n *gc.Node, n1 *gc.Node) bool {
var oary [10]int64 var oary [10]int64
var nn *gc.Node var nn *gc.Node
o := gc.Dotoffset(n, oary[:], &nn) o := gc.Dotoffset(n, oary[:], &nn)
if nn != nil && nn.Addable != 0 && o == 1 && oary[0] >= 0 { if nn != nil && nn.Addable && o == 1 && oary[0] >= 0 {
*n1 = *nn *n1 = *nn
n1.Type = n.Type n1.Type = n.Type
n1.Xoffset += oary[0] n1.Xoffset += oary[0]

View file

@ -34,7 +34,7 @@ func Cgen(n *Node, res *Node) {
switch n.Op { switch n.Op {
case OSLICE, OSLICEARR, OSLICESTR, OSLICE3, OSLICE3ARR: case OSLICE, OSLICEARR, OSLICESTR, OSLICE3, OSLICE3ARR:
if res.Op != ONAME || res.Addable == 0 { if res.Op != ONAME || !res.Addable {
var n1 Node var n1 Node
Tempname(&n1, n.Type) Tempname(&n1, n.Type)
Cgen_slice(n, &n1) Cgen_slice(n, &n1)
@ -45,7 +45,7 @@ func Cgen(n *Node, res *Node) {
return return
case OEFACE: case OEFACE:
if res.Op != ONAME || res.Addable == 0 { if res.Op != ONAME || !res.Addable {
var n1 Node var n1 Node
Tempname(&n1, n.Type) Tempname(&n1, n.Type)
Cgen_eface(n, &n1) Cgen_eface(n, &n1)
@ -81,7 +81,7 @@ func Cgen(n *Node, res *Node) {
return return
} }
if res.Addable == 0 { if !res.Addable {
if n.Ullman > res.Ullman { if n.Ullman > res.Ullman {
if Ctxt.Arch.Regsize == 4 && Is64(n.Type) { if Ctxt.Arch.Regsize == 4 && Is64(n.Type) {
var n1 Node var n1 Node
@ -188,7 +188,7 @@ func Cgen(n *Node, res *Node) {
if Ctxt.Arch.Thechar == '5' { // TODO(rsc): Maybe more often? if Ctxt.Arch.Thechar == '5' { // TODO(rsc): Maybe more often?
// if both are addressable, move // if both are addressable, move
if n.Addable != 0 && res.Addable != 0 { if n.Addable && res.Addable {
if Is64(n.Type) || Is64(res.Type) || n.Op == OREGISTER || res.Op == OREGISTER || Iscomplex[n.Type.Etype] || Iscomplex[res.Type.Etype] { if Is64(n.Type) || Is64(res.Type) || n.Op == OREGISTER || res.Op == OREGISTER || Iscomplex[n.Type.Etype] || Iscomplex[res.Type.Etype] {
Thearch.Gmove(n, res) Thearch.Gmove(n, res)
} else { } else {
@ -203,7 +203,7 @@ func Cgen(n *Node, res *Node) {
} }
// if both are not addressable, use a temporary. // if both are not addressable, use a temporary.
if n.Addable == 0 && res.Addable == 0 { if !n.Addable && !res.Addable {
// could use regalloc here sometimes, // could use regalloc here sometimes,
// but have to check for ullman >= UINF. // but have to check for ullman >= UINF.
var n1 Node var n1 Node
@ -215,7 +215,7 @@ func Cgen(n *Node, res *Node) {
// if result is not addressable directly but n is, // if result is not addressable directly but n is,
// compute its address and then store via the address. // compute its address and then store via the address.
if res.Addable == 0 { if !res.Addable {
var n1 Node var n1 Node
Igen(res, &n1, nil) Igen(res, &n1, nil)
Cgen(n, &n1) Cgen(n, &n1)
@ -229,14 +229,14 @@ func Cgen(n *Node, res *Node) {
return return
} }
if (Ctxt.Arch.Thechar == '6' || Ctxt.Arch.Thechar == '8') && n.Addable != 0 { if (Ctxt.Arch.Thechar == '6' || Ctxt.Arch.Thechar == '8') && n.Addable {
Thearch.Gmove(n, res) Thearch.Gmove(n, res)
return return
} }
if Ctxt.Arch.Thechar == '7' || Ctxt.Arch.Thechar == '9' { if Ctxt.Arch.Thechar == '7' || Ctxt.Arch.Thechar == '9' {
// if both are addressable, move // if both are addressable, move
if n.Addable != 0 { if n.Addable {
if n.Op == OREGISTER || res.Op == OREGISTER { if n.Op == OREGISTER || res.Op == OREGISTER {
Thearch.Gmove(n, res) Thearch.Gmove(n, res)
} else { } else {
@ -458,7 +458,7 @@ func Cgen(n *Node, res *Node) {
var n1 Node var n1 Node
var n2 Node var n2 Node
if Ctxt.Arch.Thechar == '5' { if Ctxt.Arch.Thechar == '5' {
if nl.Addable != 0 && !Is64(nl.Type) { if nl.Addable && !Is64(nl.Type) {
Regalloc(&n1, nl.Type, res) Regalloc(&n1, nl.Type, res)
Thearch.Gmove(nl, &n1) Thearch.Gmove(nl, &n1)
} else { } else {
@ -795,7 +795,7 @@ func cgen_norm(n, n1, res *Node) {
func Mgen(n *Node, n1 *Node, rg *Node) { func Mgen(n *Node, n1 *Node, rg *Node) {
n1.Op = OEMPTY n1.Op = OEMPTY
if n.Addable != 0 { if n.Addable {
*n1 = *n *n1 = *n
if n1.Op == OREGISTER || n1.Op == OINDREG { if n1.Op == OREGISTER || n1.Op == OINDREG {
reg[n.Val.U.Reg-int16(Thearch.REGMIN)]++ reg[n.Val.U.Reg-int16(Thearch.REGMIN)]++
@ -832,7 +832,7 @@ func Cgenr(n *Node, a *Node, res *Node) {
Fatal("cgenr on fat node") Fatal("cgenr on fat node")
} }
if n.Addable != 0 { if n.Addable {
Regalloc(a, n.Type, res) Regalloc(a, n.Type, res)
Thearch.Gmove(n, a) Thearch.Gmove(n, a)
return return
@ -891,7 +891,7 @@ func Agenr(n *Node, a *Node, res *Node) {
bounded := Debug['B'] != 0 || n.Bounded bounded := Debug['B'] != 0 || n.Bounded
var n1 Node var n1 Node
var n3 Node var n3 Node
if nr.Addable != 0 { if nr.Addable {
var tmp Node var tmp Node
if !Isconst(nr, CTINT) { if !Isconst(nr, CTINT) {
Tempname(&tmp, Types[TINT32]) Tempname(&tmp, Types[TINT32])
@ -904,7 +904,7 @@ func Agenr(n *Node, a *Node, res *Node) {
Regalloc(&n1, tmp.Type, nil) Regalloc(&n1, tmp.Type, nil)
Thearch.Gmove(&tmp, &n1) Thearch.Gmove(&tmp, &n1)
} }
} else if nl.Addable != 0 { } else if nl.Addable {
if !Isconst(nr, CTINT) { if !Isconst(nr, CTINT) {
var tmp Node var tmp Node
Tempname(&tmp, Types[TINT32]) Tempname(&tmp, Types[TINT32])
@ -1040,7 +1040,7 @@ func Agenr(n *Node, a *Node, res *Node) {
var n3 Node var n3 Node
var tmp Node var tmp Node
var n1 Node var n1 Node
if nr.Addable != 0 { if nr.Addable {
// Generate &nl first, and move nr into register. // Generate &nl first, and move nr into register.
if !Isconst(nl, CTSTR) { if !Isconst(nl, CTSTR) {
Igen(nl, &n3, res) Igen(nl, &n3, res)
@ -1050,7 +1050,7 @@ func Agenr(n *Node, a *Node, res *Node) {
Regalloc(&n1, tmp.Type, nil) Regalloc(&n1, tmp.Type, nil)
Thearch.Gmove(&tmp, &n1) Thearch.Gmove(&tmp, &n1)
} }
} else if nl.Addable != 0 { } else if nl.Addable {
// Generate nr first, and move &nl into register. // Generate nr first, and move &nl into register.
if !Isconst(nr, CTINT) { if !Isconst(nr, CTINT) {
p2 = Thearch.Igenindex(nr, &tmp, bounded) p2 = Thearch.Igenindex(nr, &tmp, bounded)
@ -1201,10 +1201,10 @@ func Agenr(n *Node, a *Node, res *Node) {
var nlen Node var nlen Node
var tmp Node var tmp Node
var n1 Node var n1 Node
if nr.Addable != 0 { if nr.Addable {
goto irad goto irad
} }
if nl.Addable != 0 { if nl.Addable {
Cgenr(nr, &n1, nil) Cgenr(nr, &n1, nil)
if !Isconst(nl, CTSTR) { if !Isconst(nl, CTSTR) {
if Isfixedarray(nl.Type) { if Isfixedarray(nl.Type) {
@ -1233,7 +1233,7 @@ func Agenr(n *Node, a *Node, res *Node) {
if Isfixedarray(nl.Type) { if Isfixedarray(nl.Type) {
Agenr(nl, &n3, res) Agenr(nl, &n3, res)
} else { } else {
if nl.Addable == 0 { if !nl.Addable {
if res != nil && res.Op == OREGISTER { // give up res, which we don't need yet. if res != nil && res.Op == OREGISTER { // give up res, which we don't need yet.
Regfree(res) Regfree(res)
} }
@ -1432,7 +1432,7 @@ func Agen(n *Node, res *Node) {
return return
} }
if n.Addable != 0 { if n.Addable {
if n.Op == OREGISTER { if n.Op == OREGISTER {
Fatal("agen OREGISTER") Fatal("agen OREGISTER")
} }
@ -1592,7 +1592,7 @@ func Igen(n *Node, a *Node, res *Node) {
*a = Node{} *a = Node{}
a.Op = OINDREG a.Op = OINDREG
a.Val.U.Reg = int16(Thearch.REGSP) a.Val.U.Reg = int16(Thearch.REGSP)
a.Addable = 1 a.Addable = true
a.Xoffset = fp.Width a.Xoffset = fp.Width
if HasLinkRegister() { if HasLinkRegister() {
a.Xoffset += int64(Ctxt.Arch.Ptrsize) a.Xoffset += int64(Ctxt.Arch.Ptrsize)
@ -1692,7 +1692,7 @@ func Bgen(n *Node, true_ bool, likely int, to *obj.Prog) {
return return
case ONAME: case ONAME:
if n.Addable == 0 || Ctxt.Arch.Thechar == '5' || Ctxt.Arch.Thechar == '7' || Ctxt.Arch.Thechar == '9' { if !n.Addable || Ctxt.Arch.Thechar == '5' || Ctxt.Arch.Thechar == '7' || Ctxt.Arch.Thechar == '9' {
goto def goto def
} }
var n1 Node var n1 Node
@ -1824,14 +1824,14 @@ func Bgen(n *Node, true_ bool, likely int, to *obj.Prog) {
} }
if Ctxt.Arch.Regsize == 4 && Is64(nr.Type) { if Ctxt.Arch.Regsize == 4 && Is64(nr.Type) {
if nl.Addable == 0 || Isconst(nl, CTINT) { if !nl.Addable || Isconst(nl, CTINT) {
var n1 Node var n1 Node
Tempname(&n1, nl.Type) Tempname(&n1, nl.Type)
Cgen(nl, &n1) Cgen(nl, &n1)
nl = &n1 nl = &n1
} }
if nr.Addable == 0 { if !nr.Addable {
var n2 Node var n2 Node
Tempname(&n2, nr.Type) Tempname(&n2, nr.Type)
Cgen(nr, &n2) Cgen(nr, &n2)
@ -1862,7 +1862,7 @@ func Bgen(n *Node, true_ bool, likely int, to *obj.Prog) {
goto cmp goto cmp
} }
if nl.Addable == 0 && Ctxt.Arch.Thechar == '8' { if !nl.Addable && Ctxt.Arch.Thechar == '8' {
Tempname(&n1, nl.Type) Tempname(&n1, nl.Type)
} else { } else {
Regalloc(&n1, nl.Type, nil) Regalloc(&n1, nl.Type, nil)
@ -1879,7 +1879,7 @@ func Bgen(n *Node, true_ bool, likely int, to *obj.Prog) {
break break
} }
if nr.Addable == 0 && Ctxt.Arch.Thechar == '8' { if !nr.Addable && Ctxt.Arch.Thechar == '8' {
var tmp Node var tmp Node
Tempname(&tmp, nr.Type) Tempname(&tmp, nr.Type)
Cgen(nr, &tmp) Cgen(nr, &tmp)
@ -2199,7 +2199,7 @@ func cgen_callinter(n *Node, res *Node, proc int) {
i = i.Left // interface i = i.Left // interface
if i.Addable == 0 { if !i.Addable {
var tmpi Node var tmpi Node
Tempname(&tmpi, i.Type) Tempname(&tmpi, i.Type)
Cgen(i, &tmpi) Cgen(i, &tmpi)
@ -2304,7 +2304,7 @@ func cgen_call(n *Node, proc int) {
} }
// call direct // call direct
n.Left.Method = 1 n.Left.Method = true
Ginscall(n.Left, proc) Ginscall(n.Left, proc)
} }
@ -2334,7 +2334,7 @@ func cgen_callret(n *Node, res *Node) {
var nod Node var nod Node
nod.Op = OINDREG nod.Op = OINDREG
nod.Val.U.Reg = int16(Thearch.REGSP) nod.Val.U.Reg = int16(Thearch.REGSP)
nod.Addable = 1 nod.Addable = true
nod.Xoffset = fp.Width nod.Xoffset = fp.Width
if HasLinkRegister() { if HasLinkRegister() {
@ -2364,7 +2364,7 @@ func cgen_aret(n *Node, res *Node) {
var nod1 Node var nod1 Node
nod1.Op = OINDREG nod1.Op = OINDREG
nod1.Val.U.Reg = int16(Thearch.REGSP) nod1.Val.U.Reg = int16(Thearch.REGSP)
nod1.Addable = 1 nod1.Addable = true
nod1.Xoffset = fp.Width nod1.Xoffset = fp.Width
if HasLinkRegister() { if HasLinkRegister() {
nod1.Xoffset += int64(Ctxt.Arch.Ptrsize) nod1.Xoffset += int64(Ctxt.Arch.Ptrsize)

View file

@ -599,7 +599,7 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node {
ptr := Nod(ONAME, nil, nil) ptr := Nod(ONAME, nil, nil)
ptr.Sym = Lookup("rcvr") ptr.Sym = Lookup("rcvr")
ptr.Class = PAUTO ptr.Class = PAUTO
ptr.Addable = 1 ptr.Addable = true
ptr.Ullman = 1 ptr.Ullman = 1
ptr.Used = true ptr.Used = true
ptr.Curfn = xfunc ptr.Curfn = xfunc

View file

@ -23,13 +23,13 @@ func Complexbool(op int, nl *Node, nr *Node, true_ bool, likely int, to *obj.Pro
// make both sides addable in ullman order // make both sides addable in ullman order
if nr != nil { if nr != nil {
if nl.Ullman > nr.Ullman && nl.Addable == 0 { if nl.Ullman > nr.Ullman && !nl.Addable {
Tempname(&tnl, nl.Type) Tempname(&tnl, nl.Type)
Cgen(nl, &tnl) Cgen(nl, &tnl)
nl = &tnl nl = &tnl
} }
if nr.Addable == 0 { if !nr.Addable {
var tnr Node var tnr Node
Tempname(&tnr, nr.Type) Tempname(&tnr, nr.Type)
Cgen(nr, &tnr) Cgen(nr, &tnr)
@ -37,7 +37,7 @@ func Complexbool(op int, nl *Node, nr *Node, true_ bool, likely int, to *obj.Pro
} }
} }
if nl.Addable == 0 { if !nl.Addable {
Tempname(&tnl, nl.Type) Tempname(&tnl, nl.Type)
Cgen(nl, &tnl) Cgen(nl, &tnl)
nl = &tnl nl = &tnl
@ -83,7 +83,7 @@ func Complexbool(op int, nl *Node, nr *Node, true_ bool, likely int, to *obj.Pro
// break addable nc-complex into nr-real and ni-imaginary // break addable nc-complex into nr-real and ni-imaginary
func subnode(nr *Node, ni *Node, nc *Node) { func subnode(nr *Node, ni *Node, nc *Node) {
if nc.Addable == 0 { if !nc.Addable {
Fatal("subnode not addable") Fatal("subnode not addable")
} }
@ -227,7 +227,7 @@ func complexmul(nl *Node, nr *Node, res *Node) {
func nodfconst(n *Node, t *Type, fval *Mpflt) { func nodfconst(n *Node, t *Type, fval *Mpflt) {
*n = Node{} *n = Node{}
n.Op = OLITERAL n.Op = OLITERAL
n.Addable = 1 n.Addable = true
ullmancalc(n) ullmancalc(n)
n.Val.U.Fval = fval n.Val.U.Fval = fval
n.Val.Ctype = CTFLT n.Val.Ctype = CTFLT
@ -291,7 +291,7 @@ func Complexmove(f *Node, t *Node) {
Dump("complexmove-t", t) Dump("complexmove-t", t)
} }
if t.Addable == 0 { if !t.Addable {
Fatal("complexmove: to not addable") Fatal("complexmove: to not addable")
} }
@ -308,7 +308,7 @@ func Complexmove(f *Node, t *Node) {
TCOMPLEX64<<16 | TCOMPLEX128, TCOMPLEX64<<16 | TCOMPLEX128,
TCOMPLEX128<<16 | TCOMPLEX64, TCOMPLEX128<<16 | TCOMPLEX64,
TCOMPLEX128<<16 | TCOMPLEX128: TCOMPLEX128<<16 | TCOMPLEX128:
if f.Addable == 0 || overlap_cplx(f, t) { if !f.Addable || overlap_cplx(f, t) {
var tmp Node var tmp Node
Tempname(&tmp, f.Type) Tempname(&tmp, f.Type)
Complexmove(f, &tmp) Complexmove(f, &tmp)
@ -340,7 +340,7 @@ func Complexgen(n *Node, res *Node) {
// pick off float/complex opcodes // pick off float/complex opcodes
switch n.Op { switch n.Op {
case OCOMPLEX: case OCOMPLEX:
if res.Addable != 0 { if res.Addable {
var n1 Node var n1 Node
var n2 Node var n2 Node
subnode(&n1, &n2, res) subnode(&n1, &n2, res)
@ -354,7 +354,7 @@ func Complexgen(n *Node, res *Node) {
case OREAL, OIMAG: case OREAL, OIMAG:
nl := n.Left nl := n.Left
if nl.Addable == 0 { if !nl.Addable {
var tmp Node var tmp Node
Tempname(&tmp, nl.Type) Tempname(&tmp, nl.Type)
Complexgen(nl, &tmp) Complexgen(nl, &tmp)
@ -380,7 +380,7 @@ func Complexgen(n *Node, res *Node) {
tr := Simsimtype(n.Type) tr := Simsimtype(n.Type)
tr = cplxsubtype(tr) tr = cplxsubtype(tr)
if tl != tr { if tl != tr {
if n.Addable == 0 { if !n.Addable {
var n1 Node var n1 Node
Tempname(&n1, n.Type) Tempname(&n1, n.Type)
Complexmove(n, &n1) Complexmove(n, &n1)
@ -391,7 +391,7 @@ func Complexgen(n *Node, res *Node) {
return return
} }
if res.Addable == 0 { if !res.Addable {
var n1 Node var n1 Node
Igen(res, &n1, nil) Igen(res, &n1, nil)
Cgen(n, &n1) Cgen(n, &n1)
@ -399,7 +399,7 @@ func Complexgen(n *Node, res *Node) {
return return
} }
if n.Addable != 0 { if n.Addable {
Complexmove(n, res) Complexmove(n, res)
return return
} }
@ -444,13 +444,13 @@ func Complexgen(n *Node, res *Node) {
// make both sides addable in ullman order // make both sides addable in ullman order
var tnl Node var tnl Node
if nr != nil { if nr != nil {
if nl.Ullman > nr.Ullman && nl.Addable == 0 { if nl.Ullman > nr.Ullman && !nl.Addable {
Tempname(&tnl, nl.Type) Tempname(&tnl, nl.Type)
Cgen(nl, &tnl) Cgen(nl, &tnl)
nl = &tnl nl = &tnl
} }
if nr.Addable == 0 { if !nr.Addable {
var tnr Node var tnr Node
Tempname(&tnr, nr.Type) Tempname(&tnr, nr.Type)
Cgen(nr, &tnr) Cgen(nr, &tnr)
@ -458,7 +458,7 @@ func Complexgen(n *Node, res *Node) {
} }
} }
if nl.Addable == 0 { if !nl.Addable {
Tempname(&tnl, nl.Type) Tempname(&tnl, nl.Type)
Cgen(nl, &tnl) Cgen(nl, &tnl)
nl = &tnl nl = &tnl

View file

@ -367,7 +367,7 @@ func newname(s *Sym) *Node {
n := Nod(ONAME, nil, nil) n := Nod(ONAME, nil, nil)
n.Sym = s n.Sym = s
n.Type = nil n.Type = nil
n.Addable = 1 n.Addable = true
n.Ullman = 1 n.Ullman = 1
n.Xoffset = 0 n.Xoffset = 0
return n return n
@ -438,7 +438,7 @@ func oldname(s *Sym) *Node {
c.Class = PPARAMREF c.Class = PPARAMREF
c.Isddd = n.Isddd c.Isddd = n.Isddd
c.Defn = n c.Defn = n
c.Addable = 0 c.Addable = false
c.Ullman = 2 c.Ullman = 2
c.Funcdepth = Funcdepth c.Funcdepth = Funcdepth
c.Outer = n.Closure c.Outer = n.Closure
@ -521,7 +521,7 @@ func colas(left *NodeList, right *NodeList, lno int32) *Node {
as := Nod(OAS2, nil, nil) as := Nod(OAS2, nil, nil)
as.List = left as.List = left
as.Rlist = right as.Rlist = right
as.Colas = 1 as.Colas = true
as.Lineno = lno as.Lineno = lno
colasdefn(left, as) colasdefn(left, as)

View file

@ -201,7 +201,7 @@ func Jconv(n *Node, flag int) string {
fmt.Fprintf(&buf, " u(%d)", n.Ullman) fmt.Fprintf(&buf, " u(%d)", n.Ullman)
} }
if c == 0 && n.Addable != 0 { if c == 0 && n.Addable {
fmt.Fprintf(&buf, " a(%d)", n.Addable) fmt.Fprintf(&buf, " a(%d)", n.Addable)
} }
@ -229,7 +229,7 @@ func Jconv(n *Node, flag int) string {
} }
} }
if n.Colas != 0 { if n.Colas {
fmt.Fprintf(&buf, " colas(%d)", n.Colas) fmt.Fprintf(&buf, " colas(%d)", n.Colas)
} }
@ -822,7 +822,7 @@ func stmtfmt(n *Node) string {
break break
} }
if n.Colas != 0 && !complexinit { if n.Colas && !complexinit {
f += fmt.Sprintf("%v := %v", Nconv(n.Left, 0), Nconv(n.Right, 0)) f += fmt.Sprintf("%v := %v", Nconv(n.Left, 0), Nconv(n.Right, 0))
} else { } else {
f += fmt.Sprintf("%v = %v", Nconv(n.Left, 0), Nconv(n.Right, 0)) f += fmt.Sprintf("%v = %v", Nconv(n.Left, 0), Nconv(n.Right, 0))
@ -841,7 +841,7 @@ func stmtfmt(n *Node) string {
f += fmt.Sprintf("%v %v= %v", Nconv(n.Left, 0), Oconv(int(n.Etype), obj.FmtSharp), Nconv(n.Right, 0)) f += fmt.Sprintf("%v %v= %v", Nconv(n.Left, 0), Oconv(int(n.Etype), obj.FmtSharp), Nconv(n.Right, 0))
case OAS2: case OAS2:
if n.Colas != 0 && !complexinit { if n.Colas && !complexinit {
f += fmt.Sprintf("%v := %v", Hconv(n.List, obj.FmtComma), Hconv(n.Rlist, obj.FmtComma)) f += fmt.Sprintf("%v := %v", Hconv(n.List, obj.FmtComma), Hconv(n.Rlist, obj.FmtComma))
break break
} }

View file

@ -61,7 +61,7 @@ func addrescapes(n *Node) {
n.Stackparam = Nod(OPARAM, n, nil) n.Stackparam = Nod(OPARAM, n, nil)
n.Stackparam.Type = n.Type n.Stackparam.Type = n.Type
n.Stackparam.Addable = 1 n.Stackparam.Addable = true
if n.Xoffset == BADWIDTH { if n.Xoffset == BADWIDTH {
Fatal("addrescapes before param assignment") Fatal("addrescapes before param assignment")
} }
@ -73,7 +73,7 @@ func addrescapes(n *Node) {
case PAUTO: case PAUTO:
n.Class |= PHEAP n.Class |= PHEAP
n.Addable = 0 n.Addable = false
n.Ullman = 2 n.Ullman = 2
n.Xoffset = 0 n.Xoffset = 0
@ -332,7 +332,7 @@ func Clearslim(n *Node) {
var z Node var z Node
z.Op = OLITERAL z.Op = OLITERAL
z.Type = n.Type z.Type = n.Type
z.Addable = 1 z.Addable = true
switch Simtype[n.Type.Etype] { switch Simtype[n.Type.Etype] {
case TCOMPLEX64, TCOMPLEX128: case TCOMPLEX64, TCOMPLEX128:
@ -749,7 +749,7 @@ func Tempname(nn *Node, t *Type) {
s.Def = n s.Def = n
n.Type = t n.Type = t
n.Class = PAUTO n.Class = PAUTO
n.Addable = 1 n.Addable = true
n.Ullman = 1 n.Ullman = 1
n.Esc = EscNever n.Esc = EscNever
n.Curfn = Curfn n.Curfn = Curfn
@ -1373,7 +1373,7 @@ yes:
} }
func cadable(n *Node) bool { func cadable(n *Node) bool {
if n.Addable == 0 { if !n.Addable {
// dont know how it happens, // dont know how it happens,
// but it does // but it does
return false return false

View file

@ -618,7 +618,7 @@ range_stmt:
{ {
$$ = Nod(ORANGE, nil, $4); $$ = Nod(ORANGE, nil, $4);
$$.List = $1; $$.List = $1;
$$.Colas = 1; $$.Colas = true;
colasdefn($1, $$); colasdefn($1, $$);
} }
| LRANGE expr | LRANGE expr
@ -631,7 +631,7 @@ for_header:
osimple_stmt ';' osimple_stmt ';' osimple_stmt osimple_stmt ';' osimple_stmt ';' osimple_stmt
{ {
// init ; test ; incr // init ; test ; incr
if $5 != nil && $5.Colas != 0 { if $5 != nil && $5.Colas {
Yyerror("cannot declare in the for-increment"); Yyerror("cannot declare in the for-increment");
} }
$$ = Nod(OFOR, nil, nil); $$ = Nod(OFOR, nil, nil);

View file

@ -133,7 +133,7 @@ func Nodreg(n *Node, t *Type, r int) {
*n = Node{} *n = Node{}
n.Op = OREGISTER n.Op = OREGISTER
n.Addable = 1 n.Addable = true
ullmancalc(n) ullmancalc(n)
n.Val.U.Reg = int16(r) n.Val.U.Reg = int16(r)
n.Type = t n.Type = t
@ -361,7 +361,7 @@ func Naddr(a *obj.Addr, n *Node) {
if s == nil { if s == nil {
s = Lookup(".noname") s = Lookup(".noname")
} }
if n.Method != 0 { if n.Method {
if n.Type != nil { if n.Type != nil {
if n.Type.Sym != nil { if n.Type.Sym != nil {
if n.Type.Sym.Pkg != nil { if n.Type.Sym.Pkg != nil {
@ -520,7 +520,7 @@ func nodarg(t *Type, fp int) *Node {
Fatal("nodarg: offset not computed for %v", Tconv(t, 0)) Fatal("nodarg: offset not computed for %v", Tconv(t, 0))
} }
n.Xoffset = first.Width n.Xoffset = first.Width
n.Addable = 1 n.Addable = true
goto fp goto fp
} }
@ -546,7 +546,7 @@ func nodarg(t *Type, fp int) *Node {
Fatal("nodarg: offset not computed for %v", Tconv(t, 0)) Fatal("nodarg: offset not computed for %v", Tconv(t, 0))
} }
n.Xoffset = t.Width n.Xoffset = t.Width
n.Addable = 1 n.Addable = true
n.Orig = t.Nname n.Orig = t.Nname
// Rewrite argument named _ to __, // Rewrite argument named _ to __,

View file

@ -770,7 +770,7 @@ func orderstmt(n *Node, order *Order) {
// declaration (and possible allocation) until inside the case body. // declaration (and possible allocation) until inside the case body.
// Delete the ODCL nodes here and recreate them inside the body below. // Delete the ODCL nodes here and recreate them inside the body below.
case OSELRECV, OSELRECV2: case OSELRECV, OSELRECV2:
if r.Colas != 0 { if r.Colas {
t = r.Ninit t = r.Ninit
if t != nil && t.N.Op == ODCL && t.N.Left == r.Left { if t != nil && t.N.Op == ODCL && t.N.Left == r.Left {
t = t.Next t = t.Next
@ -814,7 +814,7 @@ func orderstmt(n *Node, order *Order) {
// the conversion happens in the OAS instead. // the conversion happens in the OAS instead.
tmp1 = r.Left tmp1 = r.Left
if r.Colas != 0 { if r.Colas {
tmp2 = Nod(ODCL, tmp1, nil) tmp2 = Nod(ODCL, tmp1, nil)
typecheck(&tmp2, Etop) typecheck(&tmp2, Etop)
l.N.Ninit = list(l.N.Ninit, tmp2) l.N.Ninit = list(l.N.Ninit, tmp2)
@ -831,7 +831,7 @@ func orderstmt(n *Node, order *Order) {
} }
if r.Ntest != nil { if r.Ntest != nil {
tmp1 = r.Ntest tmp1 = r.Ntest
if r.Colas != 0 { if r.Colas {
tmp2 = Nod(ODCL, tmp1, nil) tmp2 = Nod(ODCL, tmp1, nil)
typecheck(&tmp2, Etop) typecheck(&tmp2, Etop)
l.N.Ninit = list(l.N.Ninit, tmp2) l.N.Ninit = list(l.N.Ninit, tmp2)

View file

@ -331,7 +331,7 @@ func Cgen_checknil(n *Node) {
Fatal("bad checknil") Fatal("bad checknil")
} }
if ((Thearch.Thechar == '5' || Thearch.Thechar == '7' || Thearch.Thechar == '9') && n.Op != OREGISTER) || n.Addable == 0 || n.Op == OLITERAL { if ((Thearch.Thechar == '5' || Thearch.Thechar == '7' || Thearch.Thechar == '9') && n.Op != OREGISTER) || !n.Addable || n.Op == OLITERAL {
var reg Node var reg Node
Regalloc(&reg, Types[Tptr], n) Regalloc(&reg, Types[Tptr], n)
Cgen(n, &reg) Cgen(n, &reg)

View file

@ -882,7 +882,7 @@ func typenamesym(t *Type) *Sym {
n := Nod(ONAME, nil, nil) n := Nod(ONAME, nil, nil)
n.Sym = s n.Sym = s
n.Type = Types[TUINT8] n.Type = Types[TUINT8]
n.Addable = 1 n.Addable = true
n.Ullman = 1 n.Ullman = 1
n.Class = PEXTERN n.Class = PEXTERN
n.Xoffset = 0 n.Xoffset = 0
@ -899,7 +899,7 @@ func typename(t *Type) *Node {
s := typenamesym(t) s := typenamesym(t)
n := Nod(OADDR, s.Def, nil) n := Nod(OADDR, s.Def, nil)
n.Type = Ptrto(s.Def.Type) n.Type = Ptrto(s.Def.Type)
n.Addable = 1 n.Addable = true
n.Ullman = 2 n.Ullman = 2
n.Typecheck = 1 n.Typecheck = 1
return n return n

View file

@ -529,7 +529,7 @@ func simplename(n *Node) bool {
if n.Op != ONAME { if n.Op != ONAME {
return false return false
} }
if n.Addable == 0 { if !n.Addable {
return false return false
} }
if n.Class&PHEAP != 0 { if n.Class&PHEAP != 0 {
@ -1239,7 +1239,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 != 0 return n.Addable
case ODOT: case ODOT:
if !stataddr(nam, n.Left) { if !stataddr(nam, n.Left) {

View file

@ -669,7 +669,7 @@ func sortinter(t *Type) *Type {
func Nodintconst(v int64) *Node { func Nodintconst(v int64) *Node {
c := Nod(OLITERAL, nil, nil) c := Nod(OLITERAL, nil, nil)
c.Addable = 1 c.Addable = true
c.Val.U.Xval = new(Mpint) c.Val.U.Xval = new(Mpint)
Mpmovecfix(c.Val.U.Xval, v) Mpmovecfix(c.Val.U.Xval, v)
c.Val.Ctype = CTINT c.Val.Ctype = CTINT
@ -680,7 +680,7 @@ func Nodintconst(v int64) *Node {
func nodfltconst(v *Mpflt) *Node { func nodfltconst(v *Mpflt) *Node {
c := Nod(OLITERAL, nil, nil) c := Nod(OLITERAL, nil, nil)
c.Addable = 1 c.Addable = true
c.Val.U.Fval = newMpflt() c.Val.U.Fval = newMpflt()
mpmovefltflt(c.Val.U.Fval, v) mpmovefltflt(c.Val.U.Fval, v)
c.Val.Ctype = CTFLT c.Val.Ctype = CTFLT
@ -692,7 +692,7 @@ func nodfltconst(v *Mpflt) *Node {
func Nodconst(n *Node, t *Type, v int64) { func Nodconst(n *Node, t *Type, v int64) {
*n = Node{} *n = Node{}
n.Op = OLITERAL n.Op = OLITERAL
n.Addable = 1 n.Addable = true
ullmancalc(n) ullmancalc(n)
n.Val.U.Xval = new(Mpint) n.Val.U.Xval = new(Mpint)
Mpmovecfix(n.Val.U.Xval, v) Mpmovecfix(n.Val.U.Xval, v)
@ -2572,7 +2572,7 @@ func genhash(sym *Sym, t *Type) {
ni := newname(Lookup("i")) ni := newname(Lookup("i"))
ni.Type = Types[TINT] ni.Type = Types[TINT]
n.List = list1(ni) n.List = list1(ni)
n.Colas = 1 n.Colas = true
colasdefn(n.List, n) colasdefn(n.List, n)
ni = n.List.N ni = n.List.N
@ -2824,7 +2824,7 @@ func geneq(sym *Sym, t *Type) {
ni := newname(Lookup("i")) ni := newname(Lookup("i"))
ni.Type = Types[TINT] ni.Type = Types[TINT]
nrange.List = list1(ni) nrange.List = list1(ni)
nrange.Colas = 1 nrange.Colas = true
colasdefn(nrange.List, nrange) colasdefn(nrange.List, nrange)
ni = nrange.List.N ni = nrange.List.N

View file

@ -26,13 +26,13 @@ type Node struct {
Op uint8 Op uint8
Nointerface bool Nointerface bool
Ullman uint8 // sethi/ullman number Ullman uint8 // sethi/ullman number
Addable uint8 // type of addressability - 0 is not addressable Addable bool // addressable
Etype uint8 // op for OASOP, etype for OTYPE, exclam for export Etype uint8 // op for OASOP, etype for OTYPE, exclam for export
Bounded bool // bounds check unnecessary Bounded bool // bounds check unnecessary
Class uint8 // PPARAM, PAUTO, PEXTERN, etc Class uint8 // PPARAM, PAUTO, PEXTERN, etc
Method uint8 // OCALLMETH name Method bool // OCALLMETH is direct method call
Embedded uint8 // ODCLFIELD embedded type Embedded uint8 // ODCLFIELD embedded type
Colas uint8 // OAS resulting from := Colas bool // OAS resulting from :=
Diag uint8 // already printed error about this Diag uint8 // already printed error about this
Noescape bool // func arguments do not escape; TODO(rsc): move Noescape to Func struct (see CL 7360) Noescape bool // func arguments do not escape; TODO(rsc): move Noescape to Func struct (see CL 7360)
Walkdef uint8 Walkdef uint8

View file

@ -564,16 +564,16 @@ func walkexpr(np **Node, init **NodeList) {
goto ret goto ret
case OLITERAL: case OLITERAL:
n.Addable = 1 n.Addable = true
goto ret goto ret
case OCLOSUREVAR, OCFUNC: case OCLOSUREVAR, OCFUNC:
n.Addable = 1 n.Addable = true
goto ret goto ret
case ONAME: case ONAME:
if n.Class&PHEAP == 0 && n.Class != PPARAMREF { if n.Class&PHEAP == 0 && n.Class != PPARAMREF {
n.Addable = 1 n.Addable = true
} }
goto ret goto ret
@ -975,7 +975,7 @@ func walkexpr(np **Node, init **NodeList) {
l := Nod(ONAME, nil, nil) l := Nod(ONAME, nil, nil)
l.Sym = sym l.Sym = sym
l.Type = Ptrto(Types[TUINT8]) l.Type = Ptrto(Types[TUINT8])
l.Addable = 1 l.Addable = true
l.Class = PEXTERN l.Class = PEXTERN
l.Xoffset = 0 l.Xoffset = 0
sym.Def = l sym.Def = l
@ -983,7 +983,7 @@ func walkexpr(np **Node, init **NodeList) {
} }
l := Nod(OADDR, sym.Def, nil) l := Nod(OADDR, sym.Def, nil)
l.Addable = 1 l.Addable = true
ll = list(ll, l) ll = list(ll, l)
if isdirectiface(n.Left.Type) { if isdirectiface(n.Left.Type) {

View file

@ -1733,7 +1733,7 @@ yydefault:
{ {
yyVAL.node = Nod(ORANGE, nil, yyDollar[4].node) yyVAL.node = Nod(ORANGE, nil, yyDollar[4].node)
yyVAL.node.List = yyDollar[1].list yyVAL.node.List = yyDollar[1].list
yyVAL.node.Colas = 1 yyVAL.node.Colas = true
colasdefn(yyDollar[1].list, yyVAL.node) colasdefn(yyDollar[1].list, yyVAL.node)
} }
case 69: case 69:
@ -1748,7 +1748,7 @@ yydefault:
//line go.y:632 //line go.y:632
{ {
// init ; test ; incr // init ; test ; incr
if yyDollar[5].node != nil && yyDollar[5].node.Colas != 0 { if yyDollar[5].node != nil && yyDollar[5].node.Colas {
Yyerror("cannot declare in the for-increment") Yyerror("cannot declare in the for-increment")
} }
yyVAL.node = Nod(OFOR, nil, nil) yyVAL.node = Nod(OFOR, nil, nil)