cmd/5g etc: mechanical cleanup

Run rsc.io/grind rev 796d0f2 on C->Go conversions.

This replaces various awkward := initializations with plain var declarations.

Checked bit-for-bit compatibility with toolstash + buildall.

Change-Id: I601101d8177894adb9b0e3fb55dfe0ed4f544716
Reviewed-on: https://go-review.googlesource.com/6517
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Russ Cox 2015-03-02 14:22:05 -05:00
parent 1fdeb6b58a
commit 175929b9fe
50 changed files with 175 additions and 178 deletions

View file

@ -678,7 +678,7 @@ func agen(n *gc.Node, res *gc.Node) {
} }
if n.Addable != 0 { if n.Addable != 0 {
n1 := gc.Node{} var n1 gc.Node
n1.Op = gc.OADDR n1.Op = gc.OADDR
n1.Left = n n1.Left = n
var n2 gc.Node var n2 gc.Node
@ -983,7 +983,7 @@ func agenr(n *gc.Node, a *gc.Node, res *gc.Node) {
gc.Cgen_checknil(a) gc.Cgen_checknil(a)
case gc.OINDEX: case gc.OINDEX:
p2 := (*obj.Prog)(nil) // to be patched to panicindex. var p2 *obj.Prog // to be patched to panicindex.
w := uint32(n.Type.Width) w := uint32(n.Type.Width)
bounded := gc.Debug['B'] != 0 || n.Bounded bounded := gc.Debug['B'] != 0 || n.Bounded
var n1 gc.Node var n1 gc.Node
@ -1199,7 +1199,7 @@ func bgen(n *gc.Node, true_ bool, likely int, to *obj.Prog) {
return return
} }
nr := (*gc.Node)(nil) var nr *gc.Node
var nl *gc.Node var nl *gc.Node
switch n.Op { switch n.Op {
@ -1658,7 +1658,7 @@ func sgen(n *gc.Node, res *gc.Node, w int64) {
regalloc(&tmp, gc.Types[gc.TUINT32], nil) regalloc(&tmp, gc.Types[gc.TUINT32], nil)
// set up end marker // set up end marker
nend := gc.Node{} var nend gc.Node
if c >= 4 { if c >= 4 {
regalloc(&nend, gc.Types[gc.TUINT32], nil) regalloc(&nend, gc.Types[gc.TUINT32], nil)

View file

@ -790,7 +790,7 @@ func cmp64(nl *gc.Node, nr *gc.Node, op int, likely int, to *obj.Prog) {
regfree(&r1) regfree(&r1)
regfree(&r2) regfree(&r2)
br := (*obj.Prog)(nil) var br *obj.Prog
switch op { switch op {
default: default:
gc.Fatal("cmp64 %v %v", gc.Oconv(int(op), 0), gc.Tconv(t, 0)) gc.Fatal("cmp64 %v %v", gc.Oconv(int(op), 0), gc.Tconv(t, 0))

View file

@ -366,7 +366,7 @@ func cgen_callret(n *gc.Node, res *gc.Node) {
gc.Fatal("cgen_callret: nil") gc.Fatal("cgen_callret: nil")
} }
nod := gc.Node{} var nod gc.Node
nod.Op = gc.OINDREG nod.Op = gc.OINDREG
nod.Val.U.Reg = arm.REGSP nod.Val.U.Reg = arm.REGSP
nod.Addable = 1 nod.Addable = 1
@ -393,7 +393,7 @@ func cgen_aret(n *gc.Node, res *gc.Node) {
gc.Fatal("cgen_aret: nil") gc.Fatal("cgen_aret: nil")
} }
nod1 := gc.Node{} var nod1 gc.Node
nod1.Op = gc.OINDREG nod1.Op = gc.OINDREG
nod1.Val.U.Reg = arm.REGSP nod1.Val.U.Reg = arm.REGSP
nod1.Addable = 1 nod1.Addable = 1

View file

@ -840,9 +840,9 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
// constnode.vconst = v; // constnode.vconst = v;
// idx.reg = nod.reg; // idx.reg = nod.reg;
// regfree(&nod); // regfree(&nod);
af := obj.Addr{} var af obj.Addr
at := obj.Addr{} var at obj.Addr
if f != nil { if f != nil {
gc.Naddr(f, &af, 1) gc.Naddr(f, &af, 1)
} }

View file

@ -1114,7 +1114,7 @@ func bgen(n *gc.Node, true_ bool, likely int, to *obj.Prog) {
return return
} }
nr := (*gc.Node)(nil) var nr *gc.Node
for n.Op == gc.OCONVNOP { for n.Op == gc.OCONVNOP {
n = n.Left n = n.Left

View file

@ -180,7 +180,7 @@ func ginscall(f *gc.Node, proc int) {
case 1, // call in new proc (go) case 1, // call in new proc (go)
2: // deferred call (defer) 2: // deferred call (defer)
stk := gc.Node{} var stk gc.Node
stk.Op = gc.OINDREG stk.Op = gc.OINDREG
stk.Val.U.Reg = x86.REG_SP stk.Val.U.Reg = x86.REG_SP
@ -370,7 +370,7 @@ func cgen_callret(n *gc.Node, res *gc.Node) {
gc.Fatal("cgen_callret: nil") gc.Fatal("cgen_callret: nil")
} }
nod := gc.Node{} var nod gc.Node
nod.Op = gc.OINDREG nod.Op = gc.OINDREG
nod.Val.U.Reg = x86.REG_SP nod.Val.U.Reg = x86.REG_SP
nod.Addable = 1 nod.Addable = 1
@ -397,7 +397,7 @@ func cgen_aret(n *gc.Node, res *gc.Node) {
gc.Fatal("cgen_aret: nil") gc.Fatal("cgen_aret: nil")
} }
nod1 := gc.Node{} var nod1 gc.Node
nod1.Op = gc.OINDREG nod1.Op = gc.OINDREG
nod1.Val.U.Reg = x86.REG_SP nod1.Val.U.Reg = x86.REG_SP
nod1.Addable = 1 nod1.Addable = 1
@ -503,7 +503,7 @@ func dodiv(op int, nl *gc.Node, nr *gc.Node, res *gc.Node) {
gmove(&n31, &n3) gmove(&n31, &n3)
} }
p2 := (*obj.Prog)(nil) var p2 *obj.Prog
var n4 gc.Node var n4 gc.Node
if gc.Nacl { if gc.Nacl {
// Native Client does not relay the divide-by-zero trap // Native Client does not relay the divide-by-zero trap
@ -842,7 +842,7 @@ func cgen_shift(op int, bounded bool, nl *gc.Node, nr *gc.Node, res *gc.Node) {
var cx gc.Node var cx gc.Node
gc.Nodreg(&cx, gc.Types[gc.TUINT64], x86.REG_CX) gc.Nodreg(&cx, gc.Types[gc.TUINT64], x86.REG_CX)
oldcx := gc.Node{} var oldcx gc.Node
if rcx > 0 && !gc.Samereg(&cx, res) { if rcx > 0 && !gc.Samereg(&cx, res) {
regalloc(&oldcx, gc.Types[gc.TUINT64], nil) regalloc(&oldcx, gc.Types[gc.TUINT64], nil)
gmove(&cx, &oldcx) gmove(&cx, &oldcx)

View file

@ -743,8 +743,8 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
} }
} }
af := obj.Addr{} var af obj.Addr
at := obj.Addr{} var at obj.Addr
if f != nil { if f != nil {
gc.Naddr(f, &af, 1) gc.Naddr(f, &af, 1)
} }

View file

@ -308,7 +308,7 @@ func pushback(r0 *gc.Flow) {
var r *gc.Flow var r *gc.Flow
var p *obj.Prog var p *obj.Prog
b := (*gc.Flow)(nil) var b *gc.Flow
p0 := (*obj.Prog)(r0.Prog) p0 := (*obj.Prog)(r0.Prog)
for r = gc.Uniqp(r0); r != nil && gc.Uniqs(r) != nil; r = gc.Uniqp(r) { for r = gc.Uniqp(r0); r != nil && gc.Uniqs(r) != nil; r = gc.Uniqp(r) {
p = r.Prog p = r.Prog

View file

@ -622,7 +622,7 @@ func agen(n *gc.Node, res *gc.Node) {
agen(&n1, res) agen(&n1, res)
case gc.OINDEX: case gc.OINDEX:
p2 := (*obj.Prog)(nil) // to be patched to panicindex. var p2 *obj.Prog // to be patched to panicindex.
w := uint32(n.Type.Width) w := uint32(n.Type.Width)
bounded := gc.Debug['B'] != 0 || n.Bounded bounded := gc.Debug['B'] != 0 || n.Bounded
var n3 gc.Node var n3 gc.Node
@ -1005,7 +1005,7 @@ func bgen(n *gc.Node, true_ bool, likely int, to *obj.Prog) {
} }
nl := n.Left nl := n.Left
nr := (*gc.Node)(nil) var nr *gc.Node
if nl != nil && gc.Isfloat[nl.Type.Etype] { if nl != nil && gc.Isfloat[nl.Type.Etype] {
bgen_float(n, bool2int(true_), likely, to) bgen_float(n, bool2int(true_), likely, to)

View file

@ -236,7 +236,7 @@ func cgen64(n *gc.Node, res *gc.Node) {
// load shift value into register. // load shift value into register.
// if high bits are set, zero value. // if high bits are set, zero value.
p1 := (*obj.Prog)(nil) var p1 *obj.Prog
if gc.Is64(r.Type) { if gc.Is64(r.Type) {
gins(i386.ACMPL, &hi2, ncon(0)) gins(i386.ACMPL, &hi2, ncon(0))
@ -337,7 +337,7 @@ func cgen64(n *gc.Node, res *gc.Node) {
// load shift value into register. // load shift value into register.
// if high bits are set, zero value. // if high bits are set, zero value.
p1 := (*obj.Prog)(nil) var p1 *obj.Prog
if gc.Is64(r.Type) { if gc.Is64(r.Type) {
gins(i386.ACMPL, &hi2, ncon(0)) gins(i386.ACMPL, &hi2, ncon(0))
@ -529,7 +529,7 @@ func cmp64(nl *gc.Node, nr *gc.Node, op int, likely int, to *obj.Prog) {
regfree(&rr) regfree(&rr)
} }
br := (*obj.Prog)(nil) var br *obj.Prog
switch op { switch op {
default: default:
gc.Fatal("cmp64 %v %v", gc.Oconv(int(op), 0), gc.Tconv(t, 0)) gc.Fatal("cmp64 %v %v", gc.Oconv(int(op), 0), gc.Tconv(t, 0))

View file

@ -253,7 +253,7 @@ func ginscall(f *gc.Node, proc int) {
case 1, // call in new proc (go) case 1, // call in new proc (go)
2: // deferred call (defer) 2: // deferred call (defer)
stk := gc.Node{} var stk gc.Node
stk.Op = gc.OINDREG stk.Op = gc.OINDREG
stk.Val.U.Reg = i386.REG_SP stk.Val.U.Reg = i386.REG_SP
@ -429,7 +429,7 @@ func cgen_callret(n *gc.Node, res *gc.Node) {
gc.Fatal("cgen_callret: nil") gc.Fatal("cgen_callret: nil")
} }
nod := gc.Node{} var nod gc.Node
nod.Op = gc.OINDREG nod.Op = gc.OINDREG
nod.Val.U.Reg = i386.REG_SP nod.Val.U.Reg = i386.REG_SP
nod.Addable = 1 nod.Addable = 1
@ -456,7 +456,7 @@ func cgen_aret(n *gc.Node, res *gc.Node) {
gc.Fatal("cgen_aret: nil") gc.Fatal("cgen_aret: nil")
} }
nod1 := gc.Node{} var nod1 gc.Node
nod1.Op = gc.OINDREG nod1.Op = gc.OINDREG
nod1.Val.U.Reg = i386.REG_SP nod1.Val.U.Reg = i386.REG_SP
nod1.Addable = 1 nod1.Addable = 1
@ -565,7 +565,7 @@ func dodiv(op int, nl *gc.Node, nr *gc.Node, res *gc.Node, ax *gc.Node, dx *gc.N
} }
gmove(&t2, &n1) gmove(&t2, &n1)
gmove(&t1, ax) gmove(&t1, ax)
p2 := (*obj.Prog)(nil) var p2 *obj.Prog
var n4 gc.Node var n4 gc.Node
if gc.Nacl { if gc.Nacl {
// Native Client does not relay the divide-by-zero trap // Native Client does not relay the divide-by-zero trap
@ -709,7 +709,7 @@ func cgen_shift(op int, bounded bool, nl *gc.Node, nr *gc.Node, res *gc.Node) {
return return
} }
oldcx := gc.Node{} var oldcx gc.Node
var cx gc.Node var cx gc.Node
gc.Nodreg(&cx, gc.Types[gc.TUINT32], i386.REG_CX) gc.Nodreg(&cx, gc.Types[gc.TUINT32], i386.REG_CX)
if reg[i386.REG_CX] > 1 && !gc.Samereg(&cx, res) { if reg[i386.REG_CX] > 1 && !gc.Samereg(&cx, res) {

View file

@ -1842,8 +1842,8 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
} }
} }
af := obj.Addr{} var af obj.Addr
at := obj.Addr{} var at obj.Addr
if f != nil { if f != nil {
gc.Naddr(f, &af, 1) gc.Naddr(f, &af, 1)
} }

View file

@ -690,7 +690,7 @@ func agenr(n *gc.Node, a *gc.Node, res *gc.Node) {
gc.Cgen_checknil(a) gc.Cgen_checknil(a)
case gc.OINDEX: case gc.OINDEX:
p2 := (*obj.Prog)(nil) // to be patched to panicindex. var p2 *obj.Prog // to be patched to panicindex.
w := uint32(n.Type.Width) w := uint32(n.Type.Width)
//bounded = debug['B'] || n->bounded; //bounded = debug['B'] || n->bounded;
@ -894,7 +894,7 @@ func agen(n *gc.Node, res *gc.Node) {
clearfat(&n1) clearfat(&n1)
var n2 gc.Node var n2 gc.Node
regalloc(&n2, gc.Types[gc.Tptr], res) regalloc(&n2, gc.Types[gc.Tptr], res)
n3 := gc.Node{} var n3 gc.Node
n3.Op = gc.OADDR n3.Op = gc.OADDR
n3.Left = &n1 n3.Left = &n1
gins(ppc64.AMOVD, &n3, &n2) gins(ppc64.AMOVD, &n3, &n2)
@ -904,7 +904,7 @@ func agen(n *gc.Node, res *gc.Node) {
} }
if n.Addable != 0 { if n.Addable != 0 {
n1 := gc.Node{} var n1 gc.Node
n1.Op = gc.OADDR n1.Op = gc.OADDR
n1.Left = n n1.Left = n
var n2 gc.Node var n2 gc.Node
@ -1132,7 +1132,7 @@ func bgen(n *gc.Node, true_ bool, likely int, to *obj.Prog) {
return return
} }
nr := (*gc.Node)(nil) var nr *gc.Node
for n.Op == gc.OCONVNOP { for n.Op == gc.OCONVNOP {
n = n.Left n = n.Left
@ -1538,7 +1538,7 @@ func sgen(n *gc.Node, ns *gc.Node, w int64) {
regalloc(&tmp, gc.Types[gc.Tptr], nil) regalloc(&tmp, gc.Types[gc.Tptr], nil)
// set up end marker // set up end marker
nend := gc.Node{} var nend gc.Node
// move src and dest to the end of block if necessary // move src and dest to the end of block if necessary
if dir < 0 { if dir < 0 {

View file

@ -374,7 +374,7 @@ func cgen_callret(n *gc.Node, res *gc.Node) {
gc.Fatal("cgen_callret: nil") gc.Fatal("cgen_callret: nil")
} }
nod := gc.Node{} var nod gc.Node
nod.Op = gc.OINDREG nod.Op = gc.OINDREG
nod.Val.U.Reg = ppc64.REGSP nod.Val.U.Reg = ppc64.REGSP
nod.Addable = 1 nod.Addable = 1
@ -401,7 +401,7 @@ func cgen_aret(n *gc.Node, res *gc.Node) {
gc.Fatal("cgen_aret: nil") gc.Fatal("cgen_aret: nil")
} }
nod1 := gc.Node{} var nod1 gc.Node
nod1.Op = gc.OINDREG nod1.Op = gc.OINDREG
nod1.Val.U.Reg = ppc64.REGSP nod1.Val.U.Reg = ppc64.REGSP
nod1.Addable = 1 nod1.Addable = 1

View file

@ -262,7 +262,7 @@ func capturevars(xfunc *Node) {
} }
if Debug['m'] > 1 { if Debug['m'] > 1 {
name := (*Sym)(nil) var name *Sym
if v.Curfn != nil && v.Curfn.Nname != nil { if v.Curfn != nil && v.Curfn.Nname != nil {
name = v.Curfn.Nname.Sym name = v.Curfn.Nname.Sym
} }
@ -362,7 +362,7 @@ func transformclosure(xfunc *Node) {
// The closure is not called, so it is going to stay as closure. // The closure is not called, so it is going to stay as closure.
nvar := 0 nvar := 0
body := (*NodeList)(nil) var body *NodeList
offset := int64(Widthptr) offset := int64(Widthptr)
var addr *Node var addr *Node
var v *Node var v *Node
@ -526,7 +526,7 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node {
Fatal("missing base type for %v", Tconv(rcvrtype, 0)) Fatal("missing base type for %v", Tconv(rcvrtype, 0))
} }
spkg := (*Pkg)(nil) var spkg *Pkg
if basetype.Sym != nil { if basetype.Sym != nil {
spkg = basetype.Sym.Pkg spkg = basetype.Sym.Pkg
} }
@ -549,8 +549,8 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node {
xtype := Nod(OTFUNC, nil, nil) xtype := Nod(OTFUNC, nil, nil)
i := 0 i := 0
l := (*NodeList)(nil) var l *NodeList
callargs := (*NodeList)(nil) var callargs *NodeList
ddd := 0 ddd := 0
xfunc := Nod(ODCLFUNC, nil, nil) xfunc := Nod(ODCLFUNC, nil, nil)
Curfn = xfunc Curfn = xfunc
@ -575,7 +575,7 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node {
xtype.List = l xtype.List = l
i = 0 i = 0
l = nil l = nil
retargs := (*NodeList)(nil) var retargs *NodeList
for t := getoutargx(t0).Type; t != nil; t = t.Down { for t := getoutargx(t0).Type; t != nil; t = t.Down {
namebuf = fmt.Sprintf("r%d", i) namebuf = fmt.Sprintf("r%d", i)
i++ i++
@ -596,7 +596,7 @@ func makepartialcall(fn *Node, t0 *Type, meth *Node) *Node {
declare(xfunc.Nname, PFUNC) declare(xfunc.Nname, PFUNC)
// Declare and initialize variable holding receiver. // Declare and initialize variable holding receiver.
body := (*NodeList)(nil) var body *NodeList
xfunc.Needctxt = true xfunc.Needctxt = true
cv := Nod(OCLOSUREVAR, nil, nil) cv := Nod(OCLOSUREVAR, nil, nil)

View file

@ -15,7 +15,7 @@ func truncfltlit(oldv *Mpflt, t *Type) *Mpflt {
return oldv return oldv
} }
v := Val{} var v Val
v.Ctype = CTFLT v.Ctype = CTFLT
v.U.Fval = oldv v.U.Fval = oldv
overflow(v, t) overflow(v, t)

View file

@ -54,7 +54,7 @@ func Complexbool(op int, nl *Node, nr *Node, true_ bool, likely int, to *obj.Pro
var n4 Node var n4 Node
subnode(&n3, &n4, nr) subnode(&n3, &n4, nr)
na := Node{} var na Node
na.Op = OANDAND na.Op = OANDAND
var nb Node var nb Node
na.Left = &nb na.Left = &nb
@ -107,7 +107,7 @@ func subnode(nr *Node, ni *Node, nc *Node) {
// generate code res = -nl // generate code res = -nl
func minus(nl *Node, res *Node) { func minus(nl *Node, res *Node) {
ra := Node{} var ra Node
ra.Op = OMINUS ra.Op = OMINUS
ra.Left = nl ra.Left = nl
ra.Type = nl.Type ra.Type = nl.Type
@ -145,7 +145,7 @@ func complexadd(op int, nl *Node, nr *Node, res *Node) {
subnode(&n3, &n4, nr) subnode(&n3, &n4, nr)
subnode(&n5, &n6, res) subnode(&n5, &n6, res)
ra := Node{} var ra Node
ra.Op = uint8(op) ra.Op = uint8(op)
ra.Left = &n1 ra.Left = &n1
ra.Right = &n3 ra.Right = &n3
@ -179,20 +179,20 @@ func complexmul(nl *Node, nr *Node, res *Node) {
Tempname(&tmp, n5.Type) Tempname(&tmp, n5.Type)
// real part -> tmp // real part -> tmp
rm1 := Node{} var rm1 Node
rm1.Op = OMUL rm1.Op = OMUL
rm1.Left = &n1 rm1.Left = &n1
rm1.Right = &n3 rm1.Right = &n3
rm1.Type = n1.Type rm1.Type = n1.Type
rm2 := Node{} var rm2 Node
rm2.Op = OMUL rm2.Op = OMUL
rm2.Left = &n2 rm2.Left = &n2
rm2.Right = &n4 rm2.Right = &n4
rm2.Type = n2.Type rm2.Type = n2.Type
ra := Node{} var ra Node
ra.Op = OSUB ra.Op = OSUB
ra.Left = &rm1 ra.Left = &rm1
ra.Right = &rm2 ra.Right = &rm2

View file

@ -247,7 +247,7 @@ func addvar(n *Node, t *Type, ctxt int) {
* new_name_list (type | [type] = expr_list) * new_name_list (type | [type] = expr_list)
*/ */
func variter(vl *NodeList, t *Node, el *NodeList) *NodeList { func variter(vl *NodeList, t *Node, el *NodeList) *NodeList {
init := (*NodeList)(nil) var init *NodeList
doexpr := el != nil doexpr := el != nil
if count(el) == 1 && count(vl) > 1 { if count(el) == 1 && count(vl) > 1 {
@ -313,7 +313,7 @@ func variter(vl *NodeList, t *Node, el *NodeList) *NodeList {
* new_name_list [[type] = expr_list] * new_name_list [[type] = expr_list]
*/ */
func constiter(vl *NodeList, t *Node, cl *NodeList) *NodeList { func constiter(vl *NodeList, t *Node, cl *NodeList) *NodeList {
vv := (*NodeList)(nil) var vv *NodeList
if cl == nil { if cl == nil {
if t != nil { if t != nil {
Yyerror("const declaration cannot have type without expression") Yyerror("const declaration cannot have type without expression")
@ -1081,7 +1081,7 @@ func checkarglist(all *NodeList, input int) *NodeList {
} }
if named != 0 { if named != 0 {
n := (*Node)(nil) var n *Node
var l *NodeList var l *NodeList
for l = all; l != nil; l = l.Next { for l = all; l != nil; l = l.Next {
n = l.N n = l.N
@ -1096,7 +1096,7 @@ func checkarglist(all *NodeList, input int) *NodeList {
} }
} }
nextt := (*Node)(nil) var nextt *Node
var t *Node var t *Node
var n *Node var n *Node
for l := all; l != nil; l = l.Next { for l := all; l != nil; l = l.Next {
@ -1195,7 +1195,7 @@ func isifacemethod(f *Type) bool {
func functype(this *Node, in *NodeList, out *NodeList) *Type { func functype(this *Node, in *NodeList, out *NodeList) *Type {
t := typ(TFUNC) t := typ(TFUNC)
rcvr := (*NodeList)(nil) var rcvr *NodeList
if this != nil { if this != nil {
rcvr = list1(this) rcvr = list1(this)
} }
@ -1413,7 +1413,7 @@ func addmethod(sf *Sym, t *Type, local bool, nointerface bool) {
n := Nod(ODCLFIELD, newname(sf), nil) n := Nod(ODCLFIELD, newname(sf), nil)
n.Type = t n.Type = t
d := (*Type)(nil) // last found var d *Type // last found
for f := pa.Method; f != nil; f = f.Down { for f := pa.Method; f != nil; f = f.Down {
d = f d = f
if f.Etype != TFIELD { if f.Etype != TFIELD {

View file

@ -258,7 +258,7 @@ func parsetag(note *Strlit) int {
} }
func escAnalyze(all *NodeList, recursive bool) { func escAnalyze(all *NodeList, recursive bool) {
es := EscState{} var es EscState
e := &es e := &es
e.theSink.Op = ONAME e.theSink.Op = ONAME
e.theSink.Orig = &e.theSink e.theSink.Orig = &e.theSink
@ -985,7 +985,7 @@ func esccall(e *EscState, n *Node, up *Node) {
var lr *NodeList var lr *NodeList
var fntype *Type var fntype *Type
fn := (*Node)(nil) var fn *Node
switch n.Op { switch n.Op {
default: default:
Fatal("esccall") Fatal("esccall")

View file

@ -171,9 +171,9 @@ func checkgoto(from *Node, to *Node) {
// decide what to complain about. // decide what to complain about.
// prefer to complain about 'into block' over declarations, // prefer to complain about 'into block' over declarations,
// so scan backward to find most recent block or else dcl. // so scan backward to find most recent block or else dcl.
block := (*Sym)(nil) var block *Sym
dcl := (*Sym)(nil) var dcl *Sym
ts := to.Sym ts := to.Sym
for ; nt > nf; nt-- { for ; nt > nf; nt-- {
if ts.Pkg == nil { if ts.Pkg == nil {
@ -332,7 +332,7 @@ func cgen_discard(nr *Node) {
* clearslim generates code to zero a slim node. * clearslim generates code to zero a slim node.
*/ */
func Clearslim(n *Node) { func Clearslim(n *Node) {
z := Node{} var z Node
z.Op = OLITERAL z.Op = OLITERAL
z.Type = n.Type z.Type = n.Type
z.Addable = 1 z.Addable = 1
@ -418,7 +418,7 @@ func Cgen_eface(n *Node, res *Node) {
func Cgen_slice(n *Node, res *Node) { func Cgen_slice(n *Node, res *Node) {
cap := n.List.N cap := n.List.N
len := n.List.Next.N len := n.List.Next.N
offs := (*Node)(nil) var offs *Node
if n.List.Next.Next != nil { if n.List.Next.Next != nil {
offs = n.List.Next.Next.N offs = n.List.Next.Next.N
} }

View file

@ -115,7 +115,7 @@ func fninit(n *NodeList) {
return return
} }
r := (*NodeList)(nil) var r *NodeList
// (1) // (1)
namebuf = "initdone·" namebuf = "initdone·"

View file

@ -231,7 +231,7 @@ func ishairy(n *Node, budget *int) bool {
// Any name-like node of non-local class is marked for re-export by adding it to // Any name-like node of non-local class is marked for re-export by adding it to
// the exportlist. // the exportlist.
func inlcopylist(ll *NodeList) *NodeList { func inlcopylist(ll *NodeList) *NodeList {
l := (*NodeList)(nil) var l *NodeList
for ; ll != nil; ll = ll.Next { for ; ll != nil; ll = ll.Next {
l = list(l, inlcopy(ll.N)) l = list(l, inlcopy(ll.N))
} }
@ -628,7 +628,7 @@ func mkinlcall1(np **Node, fn *Node, isddd int) {
// check if inlined function is variadic. // check if inlined function is variadic.
variadic := false variadic := false
varargtype := (*Type)(nil) var varargtype *Type
varargcount := 0 varargcount := 0
for t := fn.Type.Type.Down.Down.Type; t != nil; t = t.Down { for t := fn.Type.Type.Down.Down.Type; t != nil; t = t.Down {
if t.Isddd != 0 { if t.Isddd != 0 {
@ -694,8 +694,8 @@ func mkinlcall1(np **Node, fn *Node, isddd int) {
// append ordinary arguments to LHS. // append ordinary arguments to LHS.
chkargcount := n.List != nil && n.List.Next != nil chkargcount := n.List != nil && n.List.Next != nil
vararg := (*Node)(nil) // the slice argument to a variadic call var vararg *Node // the slice argument to a variadic call
varargs := (*NodeList)(nil) // the list of LHS names to put in vararg. var varargs *NodeList // the list of LHS names to put in vararg.
if !chkargcount { if !chkargcount {
// 0 or 1 expression on RHS. // 0 or 1 expression on RHS.
var i int var i int
@ -897,7 +897,7 @@ func newlabel_inl() *Node {
// to input/output parameters with ones to the tmpnames, and // to input/output parameters with ones to the tmpnames, and
// substituting returns with assignments to the output. // substituting returns with assignments to the output.
func inlsubstlist(ll *NodeList) *NodeList { func inlsubstlist(ll *NodeList) *NodeList {
l := (*NodeList)(nil) var l *NodeList
for ; ll != nil; ll = ll.Next { for ; ll != nil; ll = ll.Next {
l = list(l, inlsubst(ll.N)) l = list(l, inlsubst(ll.N))
} }

View file

@ -73,7 +73,7 @@ func md5sum(d *MD5, hi *uint64) uint64 {
// Padding. Add a 1 bit and 0 bits until 56 bytes mod 64. // Padding. Add a 1 bit and 0 bits until 56 bytes mod 64.
len := d.len len := d.len
tmp := [64]uint8{} var tmp [64]uint8
tmp[0] = 0x80 tmp[0] = 0x80
if len%64 < 56 { if len%64 < 56 {
md5write(d, tmp[:], int(56-len%64)) md5write(d, tmp[:], int(56-len%64))

View file

@ -71,7 +71,7 @@ func dumpobj() {
fmt.Fprintf(bout, "\n!\n") fmt.Fprintf(bout, "\n!\n")
externs := (*NodeList)(nil) var externs *NodeList
if externdcl != nil { if externdcl != nil {
externs = externdcl.End externs = externdcl.End
} }

View file

@ -256,7 +256,7 @@ func orderstmtlist(l *NodeList, order *Order) {
// Orderblock orders the block of statements *l onto a new list, // Orderblock orders the block of statements *l onto a new list,
// and then replaces *l with that list. // and then replaces *l with that list.
func orderblock(l **NodeList) { func orderblock(l **NodeList) {
order := Order{} var order Order
mark := marktemp(&order) mark := marktemp(&order)
orderstmtlist(*l, &order) orderstmtlist(*l, &order)
cleantemp(mark, &order) cleantemp(mark, &order)
@ -267,7 +267,7 @@ func orderblock(l **NodeList) {
// leaves them as the init list of the final *np. // leaves them as the init list of the final *np.
func orderexprinplace(np **Node, outer *Order) { func orderexprinplace(np **Node, outer *Order) {
n := *np n := *np
order := Order{} var order Order
orderexpr(&n, &order) orderexpr(&n, &order)
addinit(&n, order.out) addinit(&n, order.out)
@ -288,7 +288,7 @@ func orderexprinplace(np **Node, outer *Order) {
// and replaces it with the resulting statement list. // and replaces it with the resulting statement list.
func orderstmtinplace(np **Node) { func orderstmtinplace(np **Node) {
n := *np n := *np
order := Order{} var order Order
mark := marktemp(&order) mark := marktemp(&order)
orderstmt(n, &order) orderstmt(n, &order)
cleantemp(mark, &order) cleantemp(mark, &order)
@ -332,8 +332,8 @@ func copyret(n *Node, order *Order) *NodeList {
Fatal("copyret %v %d", Tconv(n.Type, 0), n.Left.Type.Outtuple) Fatal("copyret %v %d", Tconv(n.Type, 0), n.Left.Type.Outtuple)
} }
l1 := (*NodeList)(nil) var l1 *NodeList
l2 := (*NodeList)(nil) var l2 *NodeList
var tl Iter var tl Iter
var tmp *Node var tmp *Node
for t := Structfirst(&tl, &n.Type); t != nil; t = structnext(&tl) { for t := Structfirst(&tl, &n.Type); t != nil; t = structnext(&tl) {
@ -413,7 +413,7 @@ func ordermapassign(n *Node, order *Order) {
OAS2DOTTYPE, OAS2DOTTYPE,
OAS2MAPR, OAS2MAPR,
OAS2FUNC: OAS2FUNC:
post := (*NodeList)(nil) var post *NodeList
var m *Node var m *Node
var a *Node var a *Node
for l := n.List; l != nil; l = l.Next { for l := n.List; l != nil; l = l.Next {
@ -644,7 +644,7 @@ func orderstmt(n *Node, order *Order) {
t := marktemp(order) t := marktemp(order)
orderexprinplace(&n.Ntest, order) orderexprinplace(&n.Ntest, order)
l := (*NodeList)(nil) var l *NodeList
cleantempnopop(t, order, &l) cleantempnopop(t, order, &l)
n.Nbody = concat(l, n.Nbody) n.Nbody = concat(l, n.Nbody)
orderblock(&n.Nbody) orderblock(&n.Nbody)
@ -658,7 +658,7 @@ func orderstmt(n *Node, order *Order) {
t := marktemp(order) t := marktemp(order)
orderexprinplace(&n.Ntest, order) orderexprinplace(&n.Ntest, order)
l := (*NodeList)(nil) var l *NodeList
cleantempnopop(t, order, &l) cleantempnopop(t, order, &l)
n.Nbody = concat(l, n.Nbody) n.Nbody = concat(l, n.Nbody)
l = nil l = nil
@ -1060,7 +1060,7 @@ func orderexpr(np **Node, order *Order) {
// Clean temporaries from first branch at beginning of second. // Clean temporaries from first branch at beginning of second.
// Leave them on the stack so that they can be killed in the outer // Leave them on the stack so that they can be killed in the outer
// context in case the short circuit is taken. // context in case the short circuit is taken.
l := (*NodeList)(nil) var l *NodeList
cleantempnopop(mark, order, &l) cleantempnopop(mark, order, &l)
n.Right.Ninit = concat(l, n.Right.Ninit) n.Right.Ninit = concat(l, n.Right.Ninit)

View file

@ -1296,7 +1296,7 @@ func livenessepilogue(lv *Liveness) {
any := bvalloc(nvars) any := bvalloc(nvars)
all := bvalloc(nvars) all := bvalloc(nvars)
ambig := bvalloc(localswords() * obj.BitsPerPointer) ambig := bvalloc(localswords() * obj.BitsPerPointer)
msg := []string(nil) var msg []string
nmsg := int32(0) nmsg := int32(0)
startmsg := int32(0) startmsg := int32(0)

View file

@ -283,7 +283,7 @@ func fixjmp(firstp *obj.Prog) {
mark(firstp) mark(firstp)
// pass 3: delete dead code (mostly JMPs). // pass 3: delete dead code (mostly JMPs).
last := (*obj.Prog)(nil) var last *obj.Prog
for p := firstp; p != nil; p = p.Link { for p := firstp; p != nil; p = p.Link {
if p.Opt == dead { if p.Opt == dead {
@ -315,7 +315,7 @@ func fixjmp(firstp *obj.Prog) {
// pass 4: elide JMP to next instruction. // pass 4: elide JMP to next instruction.
// only safe if there are no jumps to JMPs anymore. // only safe if there are no jumps to JMPs anymore.
if jmploop == 0 { if jmploop == 0 {
last := (*obj.Prog)(nil) var last *obj.Prog
for p := firstp; p != nil; p = p.Link { for p := firstp; p != nil; p = p.Link {
if p.As == obj.AJMP && p.To.Type == obj.TYPE_BRANCH && p.To.U.Branch == p.Link { if p.As == obj.AJMP && p.To.Type == obj.TYPE_BRANCH && p.To.U.Branch == p.Link {
if Debug['R'] != 0 && Debug['v'] != 0 { if Debug['R'] != 0 && Debug['v'] != 0 {
@ -1187,7 +1187,7 @@ func nilwalkfwd(fcheck *Flow) {
// avoid problems like: // avoid problems like:
// _ = *x // should panic // _ = *x // should panic
// for {} // no writes but infinite loop may be considered visible // for {} // no writes but infinite loop may be considered visible
last := (*Flow)(nil) var last *Flow
for f := Uniqs(fcheck); f != nil; f = Uniqs(f) { for f := Uniqs(fcheck); f != nil; f = Uniqs(f) {
p = f.Prog p = f.Prog

View file

@ -163,7 +163,7 @@ func racewalknode(np **Node, init **NodeList, wr int, skip int) {
OCALLINTER: OCALLINTER:
racewalknode(&n.List.N, &n.List.N.Ninit, 0, 0) racewalknode(&n.List.N, &n.List.N.Ninit, 0, 0)
fini := (*NodeList)(nil) var fini *NodeList
racewalklist(n.List.Next, &fini) racewalklist(n.List.Next, &fini)
n.List = concat(n.List, fini) n.List = concat(n.List, fini)

View file

@ -136,16 +136,16 @@ out:
func walkrange(n *Node) { func walkrange(n *Node) {
t := n.Type t := n.Type
init := (*NodeList)(nil) var init *NodeList
a := n.Right a := n.Right
lno := int(setlineno(a)) lno := int(setlineno(a))
v1 := (*Node)(nil) var v1 *Node
if n.List != nil { if n.List != nil {
v1 = n.List.N v1 = n.List.N
} }
v2 := (*Node)(nil) var v2 *Node
if n.List != nil && n.List.Next != nil && !isblank(n.List.Next.N) { if n.List != nil && n.List.Next != nil && !isblank(n.List.Next.N) {
v2 = n.List.Next.N v2 = n.List.Next.N
} }
@ -154,7 +154,7 @@ func walkrange(n *Node) {
// to avoid erroneous processing by racewalk. // to avoid erroneous processing by racewalk.
n.List = nil n.List = nil
hv2 := (*Node)(nil) var hv2 *Node
var body *NodeList var body *NodeList
switch t.Etype { switch t.Etype {
@ -250,7 +250,7 @@ func walkrange(n *Node) {
hv1 := temp(Types[TINT]) hv1 := temp(Types[TINT])
hn := temp(Types[TINT]) hn := temp(Types[TINT])
hp := (*Node)(nil) var hp *Node
init = list(init, Nod(OAS, hv1, nil)) init = list(init, Nod(OAS, hv1, nil))
init = list(init, Nod(OAS, hn, Nod(OLEN, ha, nil))) init = list(init, Nod(OAS, hn, Nod(OLEN, ha, nil)))

View file

@ -275,7 +275,7 @@ func hiter(t *Type) *Type {
* return function type, receiver as first argument (or not). * return function type, receiver as first argument (or not).
*/ */
func methodfunc(f *Type, receiver *Type) *Type { func methodfunc(f *Type, receiver *Type) *Type {
in := (*NodeList)(nil) var in *NodeList
if receiver != nil { if receiver != nil {
d := Nod(ODCLFIELD, nil, nil) d := Nod(ODCLFIELD, nil, nil)
d.Type = receiver d.Type = receiver
@ -290,7 +290,7 @@ func methodfunc(f *Type, receiver *Type) *Type {
in = list(in, d) in = list(in, d)
} }
out := (*NodeList)(nil) var out *NodeList
for t := getoutargx(f).Type; t != nil; t = t.Down { for t := getoutargx(f).Type; t != nil; t = t.Down {
d = Nod(ODCLFIELD, nil, nil) d = Nod(ODCLFIELD, nil, nil)
d.Type = t.Type d.Type = t.Type
@ -328,7 +328,7 @@ func methods(t *Type) *Sig {
// make list of methods for t, // make list of methods for t,
// generating code if necessary. // generating code if necessary.
a := (*Sig)(nil) var a *Sig
var this *Type var this *Type
var b *Sig var b *Sig
@ -412,8 +412,8 @@ func imethods(t *Type) *Sig {
var method *Sym var method *Sym
var isym *Sym var isym *Sym
all := (*Sig)(nil) var all *Sig
last := (*Sig)(nil) var last *Sig
for f := t.Type; f != nil; f = f.Down { for f := t.Type; f != nil; f = f.Down {
if f.Etype != TFIELD { if f.Etype != TFIELD {
Fatal("imethods: not field") Fatal("imethods: not field")
@ -687,7 +687,7 @@ func dcommontype(s *Sym, ot int, t *Type) int {
} }
dowidth(t) dowidth(t)
alg := algtype(t) alg := algtype(t)
algsym := (*Sym)(nil) var algsym *Sym
if alg < 0 || alg == AMEM { if alg < 0 || alg == AMEM {
algsym = dalgsym(t) algsym = dalgsym(t)
} }

View file

@ -11,7 +11,7 @@ func typecheckselect(sel *Node) {
var ncase *Node var ncase *Node
var n *Node var n *Node
def := (*Node)(nil) var def *Node
lno := int(setlineno(sel)) lno := int(setlineno(sel))
count := 0 count := 0
typechecklist(sel.Ninit, Etop) typechecklist(sel.Ninit, Etop)

View file

@ -260,7 +260,7 @@ func initreorder(l *NodeList, out **NodeList) {
// declarations and outputs the corresponding list of statements // declarations and outputs the corresponding list of statements
// to include in the init() function body. // to include in the init() function body.
func initfix(l *NodeList) *NodeList { func initfix(l *NodeList) *NodeList {
lout := (*NodeList)(nil) var lout *NodeList
lno := int(lineno) lno := int(lineno)
initreorder(l, &lout) initreorder(l, &lout)
lineno = int32(lno) lineno = int32(lno)
@ -772,7 +772,7 @@ func slicelit(ctxt int, n *Node, var_ *Node, init **NodeList) {
// if the literal contains constants, // if the literal contains constants,
// make static initialized array (1),(2) // make static initialized array (1),(2)
vstat := (*Node)(nil) var vstat *Node
mode := getdyn(n, 1) mode := getdyn(n, 1)
if mode&MODECONST != 0 { if mode&MODECONST != 0 {
@ -1011,9 +1011,9 @@ func maplit(ctxt int, n *Node, var_ *Node, init **NodeList) {
} }
// put in dynamic entries one-at-a-time // put in dynamic entries one-at-a-time
key := (*Node)(nil) var key *Node
val := (*Node)(nil) var val *Node
for l := n.List; l != nil; l = l.Next { for l := n.List; l != nil; l = l.Next {
r = l.N r = l.N

View file

@ -2332,7 +2332,7 @@ func structargs(tl **Type, mustname int) *NodeList {
var n *Node var n *Node
var buf string var buf string
args := (*NodeList)(nil) var args *NodeList
gen := 0 gen := 0
for t := Structfirst(&savet, tl); t != nil; t = structnext(&savet) { for t := Structfirst(&savet, tl); t != nil; t = structnext(&savet) {
n = nil n = nil
@ -2431,7 +2431,7 @@ func genwrapper(rcvr *Type, method *Type, newnam *Sym, iface int) {
funchdr(fn) funchdr(fn)
// arg list // arg list
args := (*NodeList)(nil) var args *NodeList
isddd := 0 isddd := 0
for l := in; l != nil; l = l.Next { for l := in; l != nil; l = l.Next {
@ -2450,7 +2450,7 @@ func genwrapper(rcvr *Type, method *Type, newnam *Sym, iface int) {
// these strings are already in the reflect tables, // these strings are already in the reflect tables,
// so no space cost to use them here. // so no space cost to use them here.
l := (*NodeList)(nil) var l *NodeList
var v Val var v Val
v.Ctype = CTSTR v.Ctype = CTSTR
@ -2670,7 +2670,7 @@ func genhash(sym *Sym, t *Type) {
// Walk the struct using memhash for runs of AMEM // Walk the struct using memhash for runs of AMEM
// and calling specific hash functions for the others. // and calling specific hash functions for the others.
case TSTRUCT: case TSTRUCT:
first := (*Type)(nil) var first *Type
offend := int64(0) offend := int64(0)
var size int64 var size int64
@ -2915,7 +2915,7 @@ func geneq(sym *Sym, t *Type) {
// and calling specific equality tests for the others. // and calling specific equality tests for the others.
// Skip blank-named fields. // Skip blank-named fields.
case TSTRUCT: case TSTRUCT:
first := (*Type)(nil) var first *Type
offend := int64(0) offend := int64(0)
var size int64 var size int64
@ -3231,7 +3231,7 @@ func listsort(l **NodeList, f func(*Node, *Node) int) {
} }
func listtreecopy(l *NodeList) *NodeList { func listtreecopy(l *NodeList) *NodeList {
out := (*NodeList)(nil) var out *NodeList
for ; l != nil; l = l.Next { for ; l != nil; l = l.Next {
out = list(out, treecopy(l.N)) out = list(out, treecopy(l.N))
} }

View file

@ -1473,7 +1473,7 @@ reswitch:
l = args.N l = args.N
args = args.Next args = args.Next
typecheck(&l, Erv) typecheck(&l, Erv)
r := (*Node)(nil) var r *Node
if args != nil { if args != nil {
r = args.N r = args.N
args = args.Next args = args.Next
@ -2282,7 +2282,7 @@ func twoarg(n *Node) int {
} }
func lookdot1(errnode *Node, s *Sym, t *Type, f *Type, dostrcmp int) *Type { func lookdot1(errnode *Node, s *Sym, t *Type, f *Type, dostrcmp int) *Type {
r := (*Type)(nil) var r *Type
for ; f != nil; f = f.Down { for ; f != nil; f = f.Down {
if dostrcmp != 0 && f.Sym.Name == s.Name { if dostrcmp != 0 && f.Sym.Name == s.Name {
return f return f
@ -2361,12 +2361,12 @@ func lookdot(n *Node, t *Type, dostrcmp int) bool {
s := n.Right.Sym s := n.Right.Sym
dowidth(t) dowidth(t)
f1 := (*Type)(nil) var f1 *Type
if t.Etype == TSTRUCT || t.Etype == TINTER { if t.Etype == TSTRUCT || t.Etype == TINTER {
f1 = lookdot1(n, s, t, t.Type, dostrcmp) f1 = lookdot1(n, s, t, t.Type, dostrcmp)
} }
f2 := (*Type)(nil) var f2 *Type
if n.Left.Type == t || n.Left.Type.Sym == nil { if n.Left.Type == t || n.Left.Type.Sym == nil {
f2 = methtype(t, 0) f2 = methtype(t, 0)
if f2 != nil { if f2 != nil {
@ -2713,7 +2713,7 @@ func keydup(n *Node, hash []*Node) {
} }
h := uint(b % uint32(len(hash))) h := uint(b % uint32(len(hash)))
cmp := Node{} var cmp Node
for a := hash[h]; a != nil; a = a.Ntest { for a := hash[h]; a != nil; a = a.Ntest {
cmp.Op = OEQ cmp.Op = OEQ
cmp.Left = n cmp.Left = n

View file

@ -287,7 +287,7 @@ func walkstmt(np **Node) {
if (Curfn.Type.Outnamed != 0 && count(n.List) > 1) || paramoutheap(Curfn) != 0 { if (Curfn.Type.Outnamed != 0 && count(n.List) > 1) || paramoutheap(Curfn) != 0 {
// assign to the function out parameters, // assign to the function out parameters,
// so that reorder3 can fix up conflicts // so that reorder3 can fix up conflicts
rl := (*NodeList)(nil) var rl *NodeList
var cl int var cl int
for ll := Curfn.Dcl; ll != nil; ll = ll.Next { for ll := Curfn.Dcl; ll != nil; ll = ll.Next {
@ -552,7 +552,7 @@ func walkexpr(np **Node, init **NodeList) {
// cannot put side effects from n->right on init, // cannot put side effects from n->right on init,
// because they cannot run before n->left is checked. // because they cannot run before n->left is checked.
// save elsewhere and store on the eventual n->right. // save elsewhere and store on the eventual n->right.
ll := (*NodeList)(nil) var ll *NodeList
walkexpr(&n.Right, &ll) walkexpr(&n.Right, &ll)
addinit(&n.Right, ll) addinit(&n.Right, ll)
@ -942,7 +942,7 @@ func walkexpr(np **Node, init **NodeList) {
buf := fmt.Sprintf("conv%s2%s", from, to) buf := fmt.Sprintf("conv%s2%s", from, to)
fn := syslook(buf, 1) fn := syslook(buf, 1)
ll := (*NodeList)(nil) var ll *NodeList
if !Isinter(n.Left.Type) { if !Isinter(n.Left.Type) {
ll = list(ll, typename(n.Left.Type)) ll = list(ll, typename(n.Left.Type))
} }
@ -1654,7 +1654,7 @@ func ascompatee(op int, nl *NodeList, nr *NodeList, init **NodeList) *NodeList {
lr.N = safeexpr(lr.N, init) lr.N = safeexpr(lr.N, init)
} }
nn := (*NodeList)(nil) var nn *NodeList
ll = nl ll = nl
lr = nr lr = nr
for ; ll != nil && lr != nil; (func() { ll = ll.Next; lr = lr.Next })() { for ; ll != nil && lr != nil; (func() { ll = ll.Next; lr = lr.Next })() {
@ -1682,7 +1682,7 @@ func fncall(l *Node, rt *Type) bool {
if l.Ullman >= UINF || l.Op == OINDEXMAP { if l.Ullman >= UINF || l.Op == OINDEXMAP {
return true return true
} }
r := Node{} var r Node
if needwritebarrier(l, &r) { if needwritebarrier(l, &r) {
return true return true
} }
@ -1706,8 +1706,8 @@ func ascompatet(op int, nl *NodeList, nr **Type, fp int, init **NodeList) *NodeL
*/ */
r := Structfirst(&saver, nr) r := Structfirst(&saver, nr)
nn := (*NodeList)(nil) var nn *NodeList
mm := (*NodeList)(nil) var mm *NodeList
ucount := 0 ucount := 0
for ll = nl; ll != nil; ll = ll.Next { for ll = nl; ll != nil; ll = ll.Next {
if r == nil { if r == nil {
@ -1846,11 +1846,11 @@ func ascompatte(op int, call *Node, isddd int, nl **Type, lr *NodeList, fp int,
lr0 := lr lr0 := lr
l := Structfirst(&savel, nl) l := Structfirst(&savel, nl)
r := (*Node)(nil) var r *Node
if lr != nil { if lr != nil {
r = lr.N r = lr.N
} }
nn := (*NodeList)(nil) var nn *NodeList
// f(g()) where g has multiple return values // f(g()) where g has multiple return values
var a *Node var a *Node
@ -1869,7 +1869,7 @@ func ascompatte(op int, call *Node, isddd int, nl **Type, lr *NodeList, fp int,
// conversions involved. // conversions involved.
// copy into temporaries. // copy into temporaries.
alist := (*NodeList)(nil) var alist *NodeList
for l := Structfirst(&savel, &r.Type); l != nil; l = structnext(&savel) { for l := Structfirst(&savel, &r.Type); l != nil; l = structnext(&savel) {
a = temp(l.Type) a = temp(l.Type)
@ -1958,7 +1958,7 @@ func walkprint(nn *Node, init **NodeList) *Node {
op := int(nn.Op) op := int(nn.Op)
all := nn.List all := nn.List
calls := (*NodeList)(nil) var calls *NodeList
notfirst := false notfirst := false
// Hoist all the argument evaluation up before the lock. // Hoist all the argument evaluation up before the lock.
@ -2337,9 +2337,9 @@ func reorder1(all *NodeList) *NodeList {
return all return all
} }
g := (*NodeList)(nil) // fncalls assigned to tempnames var g *NodeList // fncalls assigned to tempnames
f := (*Node)(nil) // last fncall assigned to stack var f *Node // last fncall assigned to stack
r := (*NodeList)(nil) // non fncalls and tempnames assigned to stack var r *NodeList // non fncalls and tempnames assigned to stack
d := 0 d := 0
var a *Node var a *Node
for l := all; l != nil; l = l.Next { for l := all; l != nil; l = l.Next {
@ -2388,9 +2388,9 @@ func reorder3(all *NodeList) *NodeList {
// If a needed expression may be affected by an // If a needed expression may be affected by an
// earlier assignment, make an early copy of that // earlier assignment, make an early copy of that
// expression and use the copy instead. // expression and use the copy instead.
early := (*NodeList)(nil) var early *NodeList
mapinit := (*NodeList)(nil) var mapinit *NodeList
for list := all; list != nil; list = list.Next { for list := all; list != nil; list = list.Next {
l = list.N.Left l = list.N.Left
@ -2691,7 +2691,7 @@ func paramstoheap(argin **Type, out int) *NodeList {
var v *Node var v *Node
var as *Node var as *Node
nn := (*NodeList)(nil) var nn *NodeList
for t := Structfirst(&savet, argin); t != nil; t = structnext(&savet) { for t := Structfirst(&savet, argin); t != nil; t = structnext(&savet) {
v = t.Nname v = t.Nname
if v != nil && v.Sym != nil && v.Sym.Name[0] == '~' && v.Sym.Name[1] == 'r' { // unnamed result if v != nil && v.Sym != nil && v.Sym.Name[0] == '~' && v.Sym.Name[1] == 'r' { // unnamed result
@ -2738,7 +2738,7 @@ func returnsfromheap(argin **Type) *NodeList {
var savet Iter var savet Iter
var v *Node var v *Node
nn := (*NodeList)(nil) var nn *NodeList
for t := Structfirst(&savet, argin); t != nil; t = structnext(&savet) { for t := Structfirst(&savet, argin); t != nil; t = structnext(&savet) {
v = t.Nname v = t.Nname
if v == nil || v.Class != PHEAP|PPARAMOUT { if v == nil || v.Class != PHEAP|PPARAMOUT {
@ -2772,7 +2772,7 @@ func vmkcall(fn *Node, t *Type, init **NodeList, va []*Node) *Node {
Fatal("mkcall %v %v", Nconv(fn, 0), Tconv(fn.Type, 0)) Fatal("mkcall %v %v", Nconv(fn, 0), Tconv(fn.Type, 0))
} }
args := (*NodeList)(nil) var args *NodeList
n := fn.Type.Intuple n := fn.Type.Intuple
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
args = list(args, va[i]) args = list(args, va[i])
@ -2937,7 +2937,7 @@ func appendslice(n *Node, init **NodeList) *Node {
l2 := n.List.Next.N l2 := n.List.Next.N
s := temp(l1.Type) // var s []T s := temp(l1.Type) // var s []T
l := (*NodeList)(nil) var l *NodeList
l = list(l, Nod(OAS, s, l1)) // s = l1 l = list(l, Nod(OAS, s, l1)) // s = l1
nt := temp(Types[TINT]) nt := temp(Types[TINT])
@ -3057,7 +3057,7 @@ func walkappend(n *Node, init **NodeList) *Node {
return nsrc return nsrc
} }
l := (*NodeList)(nil) var l *NodeList
ns := temp(nsrc.Type) ns := temp(nsrc.Type)
l = list(l, Nod(OAS, ns, nsrc)) // s = src l = list(l, Nod(OAS, ns, nsrc)) // s = src
@ -3129,7 +3129,7 @@ func copyany(n *Node, init **NodeList, runtimecall int) *Node {
walkexpr(&n.Right, init) walkexpr(&n.Right, init)
nl := temp(n.Left.Type) nl := temp(n.Left.Type)
nr := temp(n.Right.Type) nr := temp(n.Right.Type)
l := (*NodeList)(nil) var l *NodeList
l = list(l, Nod(OAS, nl, n.Left)) l = list(l, Nod(OAS, nl, n.Left))
l = list(l, Nod(OAS, nr, n.Right)) l = list(l, Nod(OAS, nr, n.Right))
@ -3235,9 +3235,9 @@ func sliceany(n *Node, init **NodeList) *Node {
// Checking src[lb:hb:cb] or src[lb:hb]. // Checking src[lb:hb:cb] or src[lb:hb].
// if chk0 || chk1 || chk2 { panicslice() } // if chk0 || chk1 || chk2 { panicslice() }
chk0 := (*Node)(nil) // cap(src) < cb var chk0 *Node // cap(src) < cb
chk1 := (*Node)(nil) // cb < hb for src[lb:hb:cb]; cap(src) < hb for src[lb:hb] var chk1 *Node // cb < hb for src[lb:hb:cb]; cap(src) < hb for src[lb:hb]
chk2 := (*Node)(nil) // hb < lb var chk2 *Node // hb < lb
// All comparisons are unsigned to avoid testing < 0. // All comparisons are unsigned to avoid testing < 0.
bt := Types[Simtype[TUINT]] bt := Types[Simtype[TUINT]]
@ -3421,9 +3421,9 @@ func walkcompare(np **Node, init **NodeList) {
// Handle != similarly. // Handle != similarly.
// This avoids the allocation that would be required // This avoids the allocation that would be required
// to convert r to l for comparison. // to convert r to l for comparison.
l := (*Node)(nil) var l *Node
r := (*Node)(nil) var r *Node
if Isinter(n.Left.Type) && !Isinter(n.Right.Type) { if Isinter(n.Left.Type) && !Isinter(n.Right.Type) {
l = n.Left l = n.Left
r = n.Right r = n.Right
@ -4251,7 +4251,7 @@ func walkprintfunc(np **Node, init **NodeList) {
t := Nod(OTFUNC, nil, nil) t := Nod(OTFUNC, nil, nil)
num := 0 num := 0
printargs := (*NodeList)(nil) var printargs *NodeList
var a *Node var a *Node
var buf string var buf string
for l := n.List; l != nil; l = l.Next { for l := n.List; l != nil; l = l.Next {

View file

@ -1153,7 +1153,7 @@ func dodata() {
} }
Bflush(&Bso) Bflush(&Bso)
last := (*LSym)(nil) var last *LSym
datap = nil datap = nil
for s := Ctxt.Allsym; s != nil; s = s.Allsym { for s := Ctxt.Allsym; s != nil; s = s.Allsym {
@ -1643,10 +1643,10 @@ func address() {
if HEADTYPE == Hplan9 { if HEADTYPE == Hplan9 {
Segdata.Fileoff = Segtext.Fileoff + Segtext.Filelen Segdata.Fileoff = Segtext.Fileoff + Segtext.Filelen
} }
data := (*Section)(nil) var data *Section
noptr := (*Section)(nil) var noptr *Section
bss := (*Section)(nil) var bss *Section
noptrbss := (*Section)(nil) var noptrbss *Section
var vlen int64 var vlen int64
for s := Segdata.Sect; s != nil; s = s.Next { for s := Segdata.Sect; s != nil; s = s.Next {
vlen = int64(s.Length) vlen = int64(s.Length)

View file

@ -995,7 +995,7 @@ func putdie(die *DWDie) {
func reverselist(list **DWDie) { func reverselist(list **DWDie) {
curr := *list curr := *list
prev := (*DWDie)(nil) var prev *DWDie
for curr != nil { for curr != nil {
var next *DWDie = curr.link var next *DWDie = curr.link
curr.link = prev curr.link = prev
@ -1537,7 +1537,7 @@ func defdwsymb(sym *LSym, s string, t int, v int64, size int64, ver int, gotype
return return
} }
dv := (*DWDie)(nil) var dv *DWDie
var dt *DWDie var dt *DWDie
switch t { switch t {
@ -1678,9 +1678,9 @@ func writelines() {
unitstart := int64(-1) unitstart := int64(-1)
headerend := int64(-1) headerend := int64(-1)
epc := int64(0) epc := int64(0)
epcs := (*LSym)(nil) var epcs *LSym
lineo = Cpos() lineo = Cpos()
dwinfo := (*DWDie)(nil) var dwinfo *DWDie
flushunit(dwinfo, epc, epcs, unitstart, int32(headerend-unitstart-10)) flushunit(dwinfo, epc, epcs, unitstart, int32(headerend-unitstart-10))
unitstart = Cpos() unitstart = Cpos()
@ -2488,7 +2488,7 @@ func dwarfaddelfheaders() {
sh.addralign = 1 sh.addralign = 1
} }
sharanges := (*ElfShdr)(nil) var sharanges *ElfShdr
if arangessize != 0 { if arangessize != 0 {
sh := newElfShdr(elfstrdbg[ElfStrDebugAranges]) sh := newElfShdr(elfstrdbg[ElfStrDebugAranges])
sh.type_ = SHT_PROGBITS sh.type_ = SHT_PROGBITS

View file

@ -1260,7 +1260,7 @@ func elfdynhash() {
i >>= 1 i >>= 1
} }
needlib := (*Elflib)(nil) var needlib *Elflib
need := make([]*Elfaux, nsym) need := make([]*Elfaux, nsym)
chain := make([]uint32, nsym) chain := make([]uint32, nsym)
buckets := make([]uint32, nbucket) buckets := make([]uint32, nbucket)
@ -1885,7 +1885,7 @@ func Asmbelf(symo int64) {
startva := INITTEXT - int64(HEADR) startva := INITTEXT - int64(HEADR)
resoff := int64(ELFRESERVE) resoff := int64(ELFRESERVE)
pph := (*ElfPhdr)(nil) var pph *ElfPhdr
var pnote *ElfPhdr var pnote *ElfPhdr
if Linkmode == LinkExternal { if Linkmode == LinkExternal {
/* skip program headers */ /* skip program headers */
@ -1958,7 +1958,7 @@ func Asmbelf(symo int64) {
pnote = nil pnote = nil
if HEADTYPE == Hnetbsd || HEADTYPE == Hopenbsd { if HEADTYPE == Hnetbsd || HEADTYPE == Hopenbsd {
sh := (*ElfShdr)(nil) var sh *ElfShdr
switch HEADTYPE { switch HEADTYPE {
case Hnetbsd: case Hnetbsd:
sh = elfshname(".note.netbsd.ident") sh = elfshname(".note.netbsd.ident")

View file

@ -664,7 +664,7 @@ func deadcode() {
} }
// remove dead text but keep file information (z symbols). // remove dead text but keep file information (z symbols).
last := (*LSym)(nil) var last *LSym
for s := Ctxt.Textp; s != nil; s = s.Next { for s := Ctxt.Textp; s != nil; s = s.Next {
if !s.Reachable { if !s.Reachable {

View file

@ -285,8 +285,6 @@ func valuecmp(a *LSym, b *LSym) int {
} }
func ldelf(f *Biobuf, pkg string, length int64, pn string) { func ldelf(f *Biobuf, pkg string, length int64, pn string) {
symbols := []*LSym(nil)
if Debug['v'] != 0 { if Debug['v'] != 0 {
fmt.Fprintf(&Bso, "%5.2f ldelf %s\n", obj.Cputime(), pn) fmt.Fprintf(&Bso, "%5.2f ldelf %s\n", obj.Cputime(), pn)
} }
@ -314,6 +312,7 @@ func ldelf(f *Biobuf, pkg string, length int64, pn string) {
var s *LSym var s *LSym
var sect *ElfSect var sect *ElfSect
var sym ElfSym var sym ElfSym
var symbols []*LSym
if Bread(f, hdrbuf[:]) != len(hdrbuf) { if Bread(f, hdrbuf[:]) != len(hdrbuf) {
goto bad goto bad
} }
@ -835,7 +834,7 @@ func readelfsym(elfobj *ElfObj, i int, sym *ElfSym, needSym int) (err error) {
sym.other = b.Other sym.other = b.Other
} }
s := (*LSym)(nil) var s *LSym
if sym.name == "_GLOBAL_OFFSET_TABLE_" { if sym.name == "_GLOBAL_OFFSET_TABLE_" {
sym.name = ".got" sym.name = ".got"
} }

View file

@ -131,7 +131,7 @@ func ldpe(f *Biobuf, pkg string, length int64, pn string) {
fmt.Fprintf(&Bso, "%5.2f ldpe %s\n", obj.Cputime(), pn) fmt.Fprintf(&Bso, "%5.2f ldpe %s\n", obj.Cputime(), pn)
} }
sect := (*PeSect)(nil) var sect *PeSect
Ctxt.Version++ Ctxt.Version++
base := int32(Boffset(f)) base := int32(Boffset(f))

View file

@ -423,7 +423,7 @@ func Asmbmacho() {
mh.subcpu = MACHO_SUBCPU_X86 mh.subcpu = MACHO_SUBCPU_X86
} }
ms := (*MachoSeg)(nil) var ms *MachoSeg
if Linkmode == LinkExternal { if Linkmode == LinkExternal {
/* segment for entire file */ /* segment for entire file */
ms = newMachoSeg("", 40) ms = newMachoSeg("", 40)

View file

@ -19,7 +19,7 @@ var endmagic string = "\xff\xffgo13ld"
func ldobjfile(ctxt *Link, f *Biobuf, pkg string, length int64, pn string) { func ldobjfile(ctxt *Link, f *Biobuf, pkg string, length int64, pn string) {
start := Boffset(f) start := Boffset(f)
ctxt.Version++ ctxt.Version++
buf := [8]uint8{} var buf [8]uint8
Bread(f, buf[:]) Bread(f, buf[:])
if string(buf[:]) != startmagic { if string(buf[:]) != startmagic {
log.Fatalf("%s: invalid file start %x %x %x %x %x %x %x %x", pn, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]) log.Fatalf("%s: invalid file start %x %x %x %x %x %x %x %x", pn, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7])
@ -82,7 +82,7 @@ func readsym(ctxt *Link, f *Biobuf, pkg string, pn string) {
v = ctxt.Version v = ctxt.Version
} }
s := Linklookup(ctxt, name, v) s := Linklookup(ctxt, name, v)
dup := (*LSym)(nil) var dup *LSym
if s.Type != 0 && s.Type != SXREF { if s.Type != 0 && s.Type != SXREF {
if (t == SDATA || t == SBSS || t == SNOPTRBSS) && len(data) == 0 && nreloc == 0 { if (t == SDATA || t == SBSS || t == SNOPTRBSS) && len(data) == 0 && nreloc == 0 {
if s.Size < int64(size) { if s.Size < int64(size) {

View file

@ -153,7 +153,7 @@ func renumberfiles(ctxt *Link, files []*LSym, d *Pcdata) {
} }
newval := int32(-1) newval := int32(-1)
out := Pcdata{} var out Pcdata
var dv int32 var dv int32
var it Pciter var it Pciter
@ -229,7 +229,7 @@ func pclntab() {
setuintxx(Ctxt, ftab, 8, uint64(nfunc), int64(Thearch.Ptrsize)) setuintxx(Ctxt, ftab, 8, uint64(nfunc), int64(Thearch.Ptrsize))
nfunc = 0 nfunc = 0
last := (*LSym)(nil) var last *LSym
var end int32 var end int32
var frameptrsize int32 var frameptrsize int32
var funcstart int32 var funcstart int32

View file

@ -467,7 +467,7 @@ func initdynimport() *Dll {
var d *Dll var d *Dll
dr = nil dr = nil
m := (*Imp)(nil) var m *Imp
for s := Ctxt.Allsym; s != nil; s = s.Allsym { for s := Ctxt.Allsym; s != nil; s = s.Allsym {
if !s.Reachable || s.Type != SDYNIMPORT { if !s.Reachable || s.Type != SDYNIMPORT {
continue continue

View file

@ -187,8 +187,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
ctxt.Symmorestack[1] = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0) ctxt.Symmorestack[1] = obj.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
} }
q := (*obj.Prog)(nil)
ctxt.Cursym = cursym ctxt.Cursym = cursym
if cursym.Text == nil || cursym.Text.Link == nil { if cursym.Text == nil || cursym.Text.Link == nil {
@ -271,6 +269,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
* expand BECOME pseudo * expand BECOME pseudo
*/ */
var q1 *obj.Prog var q1 *obj.Prog
var q *obj.Prog
for p := cursym.Text; p != nil; p = p.Link { for p := cursym.Text; p != nil; p = p.Link {
switch p.As { switch p.As {
case ACASE: case ACASE:

View file

@ -244,13 +244,12 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
cursym.Locals = autoffset cursym.Locals = autoffset
cursym.Args = p.To.U.Argsize cursym.Args = p.To.U.Argsize
q := (*obj.Prog)(nil)
if p.From3.Offset&obj.NOSPLIT == 0 || (p.From3.Offset&obj.WRAPPER != 0) { if p.From3.Offset&obj.NOSPLIT == 0 || (p.From3.Offset&obj.WRAPPER != 0) {
p = obj.Appendp(ctxt, p) p = obj.Appendp(ctxt, p)
p = load_g_cx(ctxt, p) // load g into CX p = load_g_cx(ctxt, p) // load g into CX
} }
var q *obj.Prog
if cursym.Text.From3.Offset&obj.NOSPLIT == 0 { if cursym.Text.From3.Offset&obj.NOSPLIT == 0 {
p = stacksplit(ctxt, p, autoffset, cursym.Text.From3.Offset&obj.NEEDCTXT == 0, &q) // emit split check p = stacksplit(ctxt, p, autoffset, cursym.Text.From3.Offset&obj.NEEDCTXT == 0, &q) // emit split check
} }
@ -523,7 +522,7 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, noctxt bool, jmpok
q1.Pcond = p q1.Pcond = p
} }
q1 := (*obj.Prog)(nil) var q1 *obj.Prog
if framesize <= obj.StackSmall { if framesize <= obj.StackSmall {
// small stack: SP <= stackguard // small stack: SP <= stackguard

View file

@ -26,12 +26,12 @@ func Writeobjdirect(ctxt *Link, b *Biobuf) {
// Build list of symbols, and assign instructions to lists. // Build list of symbols, and assign instructions to lists.
// Ignore ctxt->plist boundaries. There are no guarantees there, // Ignore ctxt->plist boundaries. There are no guarantees there,
// and the C compilers and assemblers just use one big list. // and the C compilers and assemblers just use one big list.
text := (*LSym)(nil) var text *LSym
curtext := (*LSym)(nil) var curtext *LSym
data := (*LSym)(nil) var data *LSym
etext := (*LSym)(nil) var etext *LSym
edata := (*LSym)(nil) var edata *LSym
for pl := ctxt.Plist; pl != nil; pl = pl.Link { for pl := ctxt.Plist; pl != nil; pl = pl.Link {
for p = pl.Firstpc; p != nil; p = plink { for p = pl.Firstpc; p != nil; p = plink {
if ctxt.Debugasm != 0 && ctxt.Debugvlog != 0 { if ctxt.Debugasm != 0 && ctxt.Debugvlog != 0 {

View file

@ -144,7 +144,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
} }
obj.Bflush(ctxt.Bso) obj.Bflush(ctxt.Bso)
q := (*obj.Prog)(nil) var q *obj.Prog
var q1 *obj.Prog var q1 *obj.Prog
for p := cursym.Text; p != nil; p = p.Link { for p := cursym.Text; p != nil; p = p.Link {
switch p.As { switch p.As {
@ -645,7 +645,7 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, noctxt bool) *obj.
p.To.Type = obj.TYPE_REG p.To.Type = obj.TYPE_REG
p.To.Reg = REG_R3 p.To.Reg = REG_R3
q := (*obj.Prog)(nil) var q *obj.Prog
if framesize <= obj.StackSmall { if framesize <= obj.StackSmall {
// small stack: SP < stackguard // small stack: SP < stackguard
// CMP stackguard, SP // CMP stackguard, SP

View file

@ -363,12 +363,12 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
noleaf: noleaf:
} }
q := (*obj.Prog)(nil)
if p.From3.Offset&obj.NOSPLIT == 0 || (p.From3.Offset&obj.WRAPPER != 0) { if p.From3.Offset&obj.NOSPLIT == 0 || (p.From3.Offset&obj.WRAPPER != 0) {
p = obj.Appendp(ctxt, p) p = obj.Appendp(ctxt, p)
p = load_g_cx(ctxt, p) // load g into CX p = load_g_cx(ctxt, p) // load g into CX
} }
var q *obj.Prog
if cursym.Text.From3.Offset&obj.NOSPLIT == 0 { if cursym.Text.From3.Offset&obj.NOSPLIT == 0 {
p = stacksplit(ctxt, p, autoffset, int32(textarg), cursym.Text.From3.Offset&obj.NEEDCTXT == 0, &q) // emit split check p = stacksplit(ctxt, p, autoffset, int32(textarg), cursym.Text.From3.Offset&obj.NEEDCTXT == 0, &q) // emit split check
} }
@ -718,7 +718,7 @@ func stacksplit(ctxt *obj.Link, p *obj.Prog, framesize int32, textarg int32, noc
sub = ASUBL sub = ASUBL
} }
q1 := (*obj.Prog)(nil) var q1 *obj.Prog
if framesize <= obj.StackSmall { if framesize <= obj.StackSmall {
// small stack: SP <= stackguard // small stack: SP <= stackguard
// CMPQ SP, stackguard // CMPQ SP, stackguard