Commit 6582d1cf authored by Michael Hudson-Doyle's avatar Michael Hudson-Doyle Committed by Ian Lance Taylor

cmd/internal/gc, etc: remove canemitecode of Naddr

The argument is never consulted apart from passing it to recursive
calls.  So delete it.

Change-Id: Ia15eefb6385b3c99ea4def88f564f4e5a94c68ab
Reviewed-on: https://go-review.googlesource.com/7032Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 362f7bfa
...@@ -78,7 +78,7 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64, r0 *uint32) *obj.Pr ...@@ -78,7 +78,7 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64, r0 *uint32) *obj.Pr
p.Reg = arm.REGSP p.Reg = arm.REGSP
p = appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0) p = appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0)
f := gc.Sysfunc("duffzero") f := gc.Sysfunc("duffzero")
p.To = gc.Naddr(f, 1) p.To = gc.Naddr(f)
gc.Afunclit(&p.To, f) gc.Afunclit(&p.To, f)
p.To.Offset = 4 * (128 - cnt/int64(gc.Widthptr)) p.To.Offset = 4 * (128 - cnt/int64(gc.Widthptr))
} else { } else {
......
...@@ -846,10 +846,10 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog { ...@@ -846,10 +846,10 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
var at obj.Addr var at obj.Addr
if f != nil { if f != nil {
af = gc.Naddr(f, 1) af = gc.Naddr(f)
} }
if t != nil { if t != nil {
at = gc.Naddr(t, 1) at = gc.Naddr(t)
} }
p := gc.Prog(as) p := gc.Prog(as)
if f != nil { if f != nil {
...@@ -870,7 +870,7 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog { ...@@ -870,7 +870,7 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
func raddr(n *gc.Node, p *obj.Prog) { func raddr(n *gc.Node, p *obj.Prog) {
var a obj.Addr var a obj.Addr
a = gc.Naddr(n, 1) a = gc.Naddr(n)
if a.Type != obj.TYPE_REG { if a.Type != obj.TYPE_REG {
if n != nil { if n != nil {
gc.Fatal("bad in raddr: %v", gc.Oconv(int(n.Op), 0)) gc.Fatal("bad in raddr: %v", gc.Oconv(int(n.Op), 0))
...@@ -1306,7 +1306,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr, w *int) bool { ...@@ -1306,7 +1306,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr, w *int) bool {
reg1 := &clean[cleani-2] reg1 := &clean[cleani-2]
reg.Op = gc.OEMPTY reg.Op = gc.OEMPTY
reg1.Op = gc.OEMPTY reg1.Op = gc.OEMPTY
*a = gc.Naddr(n, 1) *a = gc.Naddr(n)
return true return true
case gc.ODOT, case gc.ODOT,
...@@ -1330,7 +1330,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr, w *int) bool { ...@@ -1330,7 +1330,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr, w *int) bool {
n1.Type = n.Type n1.Type = n.Type
n1.Xoffset += oary[0] n1.Xoffset += oary[0]
*a = gc.Naddr(&n1, 1) *a = gc.Naddr(&n1)
return true return true
} }
...@@ -1358,7 +1358,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr, w *int) bool { ...@@ -1358,7 +1358,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr, w *int) bool {
a.Type = obj.TYPE_NONE a.Type = obj.TYPE_NONE
a.Name = obj.NAME_NONE a.Name = obj.NAME_NONE
n1.Type = n.Type n1.Type = n.Type
*a = gc.Naddr(&n1, 1) *a = gc.Naddr(&n1)
return true return true
case gc.OINDEX: case gc.OINDEX:
......
...@@ -748,11 +748,11 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog { ...@@ -748,11 +748,11 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
var af obj.Addr var af obj.Addr
if f != nil { if f != nil {
af = gc.Naddr(f, 1) af = gc.Naddr(f)
} }
var at obj.Addr var at obj.Addr
if t != nil { if t != nil {
at = gc.Naddr(t, 1) at = gc.Naddr(t)
} }
p := gc.Prog(as) p := gc.Prog(as)
if f != nil { if f != nil {
...@@ -1405,7 +1405,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr) bool { ...@@ -1405,7 +1405,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr) bool {
reg1 := &clean[cleani-2] reg1 := &clean[cleani-2]
reg.Op = gc.OEMPTY reg.Op = gc.OEMPTY
reg1.Op = gc.OEMPTY reg1.Op = gc.OEMPTY
*a = gc.Naddr(n, 1) *a = gc.Naddr(n)
return true return true
case gc.ODOT, case gc.ODOT,
...@@ -1429,7 +1429,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr) bool { ...@@ -1429,7 +1429,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr) bool {
n1.Type = n.Type n1.Type = n.Type
n1.Xoffset += oary[0] n1.Xoffset += oary[0]
*a = gc.Naddr(&n1, 1) *a = gc.Naddr(&n1)
return true return true
} }
...@@ -1457,7 +1457,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr) bool { ...@@ -1457,7 +1457,7 @@ func sudoaddable(as int, n *gc.Node, a *obj.Addr) bool {
a.Type = obj.TYPE_NONE a.Type = obj.TYPE_NONE
a.Index = obj.TYPE_NONE a.Index = obj.TYPE_NONE
fixlargeoffset(&n1) fixlargeoffset(&n1)
*a = gc.Naddr(&n1, 1) *a = gc.Naddr(&n1)
return true return true
case gc.OINDEX: case gc.OINDEX:
......
...@@ -1847,10 +1847,10 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog { ...@@ -1847,10 +1847,10 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
var af obj.Addr var af obj.Addr
var at obj.Addr var at obj.Addr
if f != nil { if f != nil {
af = gc.Naddr(f, 1) af = gc.Naddr(f)
} }
if t != nil { if t != nil {
at = gc.Naddr(t, 1) at = gc.Naddr(t)
} }
p := gc.Prog(as) p := gc.Prog(as)
if f != nil { if f != nil {
......
...@@ -76,7 +76,7 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64) *obj.Prog { ...@@ -76,7 +76,7 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64) *obj.Prog {
p.Reg = ppc64.REGSP p.Reg = ppc64.REGSP
p = appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0) p = appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0)
f := gc.Sysfunc("duffzero") f := gc.Sysfunc("duffzero")
p.To = gc.Naddr(f, 1) p.To = gc.Naddr(f)
gc.Afunclit(&p.To, f) gc.Afunclit(&p.To, f)
p.To.Offset = 4 * (128 - cnt/int64(gc.Widthptr)) p.To.Offset = 4 * (128 - cnt/int64(gc.Widthptr))
} else { } else {
......
...@@ -700,10 +700,10 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog { ...@@ -700,10 +700,10 @@ func gins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
at := obj.Addr(obj.Addr{}) at := obj.Addr(obj.Addr{})
if f != nil { if f != nil {
af = gc.Naddr(f, 1) af = gc.Naddr(f)
} }
if t != nil { if t != nil {
at = gc.Naddr(t, 1) at = gc.Naddr(t)
} }
p := (*obj.Prog)(gc.Prog(as)) p := (*obj.Prog)(gc.Prog(as))
if f != nil { if f != nil {
......
...@@ -273,7 +273,7 @@ func markautoused(p *obj.Prog) { ...@@ -273,7 +273,7 @@ func markautoused(p *obj.Prog) {
} }
} }
func Naddr(n *Node, canemitcode int) (a obj.Addr) { func Naddr(n *Node) (a obj.Addr) {
if n == nil { if n == nil {
return return
} }
...@@ -337,7 +337,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) { ...@@ -337,7 +337,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) {
a.Offset = n.Xoffset a.Offset = n.Xoffset
case OCFUNC: case OCFUNC:
a = Naddr(n.Left, canemitcode) a = Naddr(n.Left)
a.Sym = Linksym(n.Left.Sym) a.Sym = Linksym(n.Left.Sym)
case ONAME: case ONAME:
...@@ -421,7 +421,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) { ...@@ -421,7 +421,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) {
} }
case OADDR: case OADDR:
a = Naddr(n.Left, canemitcode) a = Naddr(n.Left)
a.Etype = uint8(Tptr) a.Etype = uint8(Tptr)
if Thearch.Thechar != '5' && Thearch.Thechar != '9' { // TODO(rsc): Do this even for arm, ppc64. if Thearch.Thechar != '5' && Thearch.Thechar != '9' { // TODO(rsc): Do this even for arm, ppc64.
a.Width = int64(Widthptr) a.Width = int64(Widthptr)
...@@ -434,7 +434,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) { ...@@ -434,7 +434,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) {
// itable of interface value // itable of interface value
case OITAB: case OITAB:
a = Naddr(n.Left, canemitcode) a = Naddr(n.Left)
if a.Type == obj.TYPE_CONST && a.Offset == 0 { if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // itab(nil) break // itab(nil)
...@@ -444,7 +444,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) { ...@@ -444,7 +444,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) {
// pointer in a string or slice // pointer in a string or slice
case OSPTR: case OSPTR:
a = Naddr(n.Left, canemitcode) a = Naddr(n.Left)
if a.Type == obj.TYPE_CONST && a.Offset == 0 { if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // ptr(nil) break // ptr(nil)
...@@ -455,7 +455,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) { ...@@ -455,7 +455,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) {
// len of string or slice // len of string or slice
case OLEN: case OLEN:
a = Naddr(n.Left, canemitcode) a = Naddr(n.Left)
if a.Type == obj.TYPE_CONST && a.Offset == 0 { if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // len(nil) break // len(nil)
...@@ -471,7 +471,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) { ...@@ -471,7 +471,7 @@ func Naddr(n *Node, canemitcode int) (a obj.Addr) {
// cap of string or slice // cap of string or slice
case OCAP: case OCAP:
a = Naddr(n.Left, canemitcode) a = Naddr(n.Left)
if a.Type == obj.TYPE_CONST && a.Offset == 0 { if a.Type == obj.TYPE_CONST && a.Offset == 0 {
break // cap(nil) break // cap(nil)
......
...@@ -1054,8 +1054,8 @@ func newpcdataprog(prog *obj.Prog, index int32) *obj.Prog { ...@@ -1054,8 +1054,8 @@ func newpcdataprog(prog *obj.Prog, index int32) *obj.Prog {
Nodconst(&to, Types[TINT32], int64(index)) Nodconst(&to, Types[TINT32], int64(index))
pcdata := unlinkedprog(obj.APCDATA) pcdata := unlinkedprog(obj.APCDATA)
pcdata.Lineno = prog.Lineno pcdata.Lineno = prog.Lineno
pcdata.From = Naddr(&from, 0) pcdata.From = Naddr(&from)
pcdata.To = Naddr(&to, 0) pcdata.To = Naddr(&to)
return pcdata return pcdata
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment