cmd/internal/obj reconverted using rsc.io/c2go rev
40275b8.
All Prog*s need Ctxt field set so that the printer can tell
which architecture the Prog belongs to.
Use ctxt.NewProg consistently for this.
Change-Id: Ic981b3d68f24931ffae74a772e83a3dc2fdf518a
Reviewed-on: https://go-review.googlesource.com/3152
Reviewed-by: Rob Pike <r@golang.org>
// split it into two instructions:
// ADD $-100004, R13
// MOVW R14, 0(R13)
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
p.Scond &^= C_WBIT
*q = *p
ctxt.Diag("unsupported instruction (.P/.W): %v", p)
}
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
*q = *p
if p.To.Type == D_OREG {
a2 = &q.To
if false && skip == 1 {
fmt.Printf("note: flush literal pool at %x: len=%d ref=%x\n", uint64(p.Pc+4), pool.size, pool.start)
}
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.As = AB
q.To.Type = D_BRANCH
q.Pcond = p.Link
}
if ctxt.Headtype == obj.Hnacl && pool.size%16 != 0 {
// if pool is not multiple of 16 bytes, add an alignment marker
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.As = ADATABUNDLEEND
ctxt.Elitrl.Link = q
if ctxt.Headtype == obj.Hnacl && pool.size%16 == 0 {
// start a new data bundle
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
*q = zprg
q.As = ADATABUNDLE
ctxt.Elitrl = q
}
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
*q = t
q.Pc = int64(pool.size)
}
func prg() *obj.Prog {
- var p *obj.Prog
-
- p = new(obj.Prog)
- *p = zprg5
- return p
+ p := zprg
+ return &p
}
// Prog.mark
soft:
if !(wasfloat != 0) || (p.Mark&LABEL != 0) {
- next = ctxt.Arch.Prg()
+ next = ctxt.NewProg()
*next = *p
// BL _sfloat(SB)
ctxt.Cursym = s
- firstp = ctxt.Arch.Prg()
+ firstp = ctxt.NewProg()
lastp = firstp
xfol(ctxt, s.Text, &lastp)
lastp.Link = nil
copy:
for {
- r = ctxt.Arch.Prg()
+ r = ctxt.NewProg()
*r = *p
if !(r.Mark&FOLL != 0) {
fmt.Printf("can't happen 1\n")
}
a = AB
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.As = int16(a)
q.Lineno = p.Lineno
q.To.Type = D_BRANCH
}
func prg() *obj.Prog {
- var p *obj.Prog
-
- p = new(obj.Prog)
- *p = zprg
- return p
+ p := zprg
+ return &p
}
func addstacksplit(ctxt *obj.Link, cursym *obj.LSym) {
ctxt.Cursym = s
- firstp = ctxt.Arch.Prg()
+ firstp = ctxt.NewProg()
lastp = firstp
xfol(ctxt, s.Text, &lastp)
lastp.Link = nil
/* */
}
}
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.As = AJMP
q.Lineno = p.Lineno
q.To.Type = D_BRANCH
func Copyp(ctxt *Link, q *Prog) *Prog {
var p *Prog
- p = ctxt.Arch.Prg()
+ p = ctxt.NewProg()
*p = *q
return p
}
func Appendp(ctxt *Link, q *Prog) *Prog {
var p *Prog
- p = ctxt.Arch.Prg()
+ p = ctxt.NewProg()
p.Link = q.Link
q.Link = p
p.Lineno = q.Lineno
Class int8
Etype uint8
Offset2 int32
- Node *struct{}
+ Node interface{}
Width int64
}
otxt = p.Pcond.Pc - c
if otxt < -(1<<15)+10 || otxt >= (1<<15)-10 {
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.Link = p.Link
p.Link = q
q.As = ABR
q.To.Type = D_BRANCH
q.Pcond = p.Pcond
p.Pcond = q
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.Link = p.Link
p.Link = q
q.As = ABR
p.To.Reg = REGSP
p.Spadj = -autosize
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.As = ABR
q.Lineno = p.Lineno
q.To.Type = D_SPR
p.To.Type = D_REG
p.To.Reg = REGTMP
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.As = AMOVD
q.Lineno = p.Lineno
q.From.Type = D_REG
if false {
// Debug bad returns
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.As = AMOVD
q.Lineno = p.Lineno
}
if autosize != 0 {
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.As = AADD
q.Lineno = p.Lineno
q.From.Type = D_CONST
p.Link = q
}
- q1 = ctxt.Arch.Prg()
+ q1 = ctxt.NewProg()
q1.As = ABR
q1.Lineno = p.Lineno
q1.To.Type = D_SPR
ctxt.Cursym = s
- firstp = ctxt.Arch.Prg()
+ firstp = ctxt.NewProg()
lastp = firstp
xfol(ctxt, s.Text, &lastp)
lastp.Link = nil
copy:
for {
- r = ctxt.Arch.Prg()
+ r = ctxt.NewProg()
*r = *p
if !(r.Mark&FOLL != 0) {
fmt.Printf("cant happen 1\n")
}
a = ABR
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.As = int16(a)
q.Lineno = p.Lineno
q.To.Type = D_BRANCH
}
func prg() *obj.Prog {
- var p *obj.Prog
-
- p = new(obj.Prog)
- *p = zprg
- return p
+ p := zprg
+ return &p
}
var Linkppc64 = obj.LinkArch{
}
return p.Ctxt.Arch.Pconv(p)
}
+
+func (ctxt *Link) NewProg() *Prog {
+ p := ctxt.Arch.Prg() // should be the only call to this; all others should use ctxt.NewProg
+ p.Ctxt = ctxt
+ return p
+}
ctxt.Cursym = s
- firstp = ctxt.Arch.Prg()
+ firstp = ctxt.NewProg()
lastp = firstp
xfol(ctxt, s.Text, &lastp)
lastp.Link = nil
/* */
}
}
- q = ctxt.Arch.Prg()
+ q = ctxt.NewProg()
q.As = AJMP
q.Lineno = p.Lineno
q.To.Type = D_BRANCH
}
func prg() *obj.Prog {
- var p *obj.Prog
-
- p = new(obj.Prog)
- *p = zprg
- return p
+ p := zprg
+ return &p
}
var Linkamd64 = obj.LinkArch{
reg = int(g2.Scale)
}
- p = asm.Ctxt.Arch.Prg()
+ p = asm.Ctxt.NewProg()
p.As = int16(a)
p.Lineno = asm.Lineno
if nosched != 0 {
goto out
}
- p = asm.Ctxt.Arch.Prg()
+ p = asm.Ctxt.NewProg()
p.As = int16(a)
p.Lineno = asm.Lineno
if nosched != 0 {