mirror of
https://github.com/golang/go
synced 2024-11-05 14:36:11 -07:00
cmd/compile: make Afunclit the default/only behavior for Naddr
Naddr used to translate PFUNC Nodes into references to the function literal wrapper, and then Afunclit could be used to rewrite it to reference the function text itself. But now everywhere we use Naddr on PFUNC Nodes, we immediately call Afunclit anyway. So just merge Afunclit's behavior into Naddr. Passes toolstash/buildall. Change-Id: If2ca6d7f314c1a0711df9b8209aace16ba4b8bc0 Reviewed-on: https://go-review.googlesource.com/30073 Run-TryBot: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
d2df8498f3
commit
dd748cf314
@ -74,9 +74,7 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64, r0 *uint32) *obj.Pr
|
||||
p = gc.Appendpp(p, arm.AADD, obj.TYPE_CONST, 0, 4+frame+lo, obj.TYPE_REG, arm.REG_R1, 0)
|
||||
p.Reg = arm.REGSP
|
||||
p = gc.Appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0)
|
||||
f := gc.Sysfunc("duffzero")
|
||||
gc.Naddr(&p.To, f)
|
||||
gc.Afunclit(&p.To, f)
|
||||
gc.Naddr(&p.To, gc.Sysfunc("duffzero"))
|
||||
p.To.Offset = 4 * (128 - cnt/int64(gc.Widthptr))
|
||||
} else {
|
||||
p = gc.Appendpp(p, arm.AADD, obj.TYPE_CONST, 0, 4+frame+lo, obj.TYPE_REG, arm.REG_R1, 0)
|
||||
|
@ -81,9 +81,7 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64) *obj.Prog {
|
||||
p = gc.Appendpp(p, arm64.AADD, obj.TYPE_CONST, 0, 8+frame+lo-8, obj.TYPE_REG, arm64.REGRT1, 0)
|
||||
p.Reg = arm64.REGRT1
|
||||
p = gc.Appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0)
|
||||
f := gc.Sysfunc("duffzero")
|
||||
gc.Naddr(&p.To, f)
|
||||
gc.Afunclit(&p.To, f)
|
||||
gc.Naddr(&p.To, gc.Sysfunc("duffzero"))
|
||||
p.To.Offset = 4 * (128 - cnt/int64(gc.Widthptr))
|
||||
} else {
|
||||
p = gc.Appendpp(p, arm64.AMOVD, obj.TYPE_CONST, 0, 8+frame+lo-8, obj.TYPE_REG, arm64.REGTMP, 0)
|
||||
|
@ -52,13 +52,6 @@ func Prog(as obj.As) *obj.Prog {
|
||||
return p
|
||||
}
|
||||
|
||||
func Afunclit(a *obj.Addr, n *Node) {
|
||||
if a.Type == obj.TYPE_ADDR && a.Name == obj.NAME_EXTERN {
|
||||
a.Type = obj.TYPE_MEM
|
||||
a.Sym = Linksym(n.Sym)
|
||||
}
|
||||
}
|
||||
|
||||
func Clearp(p *obj.Prog) {
|
||||
obj.Nopout(p)
|
||||
p.As = obj.AEND
|
||||
@ -210,7 +203,7 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||
default:
|
||||
Fatalf("naddr: ONAME class %v %d\n", n.Sym, n.Class)
|
||||
|
||||
case PEXTERN:
|
||||
case PEXTERN, PFUNC:
|
||||
a.Name = obj.NAME_EXTERN
|
||||
|
||||
case PAUTO:
|
||||
@ -218,11 +211,6 @@ func Naddr(a *obj.Addr, n *Node) {
|
||||
|
||||
case PPARAM, PPARAMOUT:
|
||||
a.Name = obj.NAME_PARAM
|
||||
|
||||
case PFUNC:
|
||||
a.Name = obj.NAME_EXTERN
|
||||
a.Type = obj.TYPE_ADDR
|
||||
s = funcsym(s)
|
||||
}
|
||||
|
||||
a.Sym = Linksym(s)
|
||||
|
@ -383,7 +383,6 @@ func compile(fn *Node) {
|
||||
nam = nil
|
||||
}
|
||||
ptxt := Gins(obj.ATEXT, nam, &nod1)
|
||||
Afunclit(&ptxt.From, Curfn.Func.Nname)
|
||||
ptxt.From3 = new(obj.Addr)
|
||||
if fn.Func.Dupok {
|
||||
ptxt.From3.Offset |= obj.DUPOK
|
||||
|
@ -74,9 +74,7 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64) *obj.Prog {
|
||||
p = gc.Appendpp(p, mips.AADDV, obj.TYPE_CONST, 0, 8+frame+lo-8, obj.TYPE_REG, mips.REGRT1, 0)
|
||||
p.Reg = mips.REGSP
|
||||
p = gc.Appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0)
|
||||
f := gc.Sysfunc("duffzero")
|
||||
gc.Naddr(&p.To, f)
|
||||
gc.Afunclit(&p.To, f)
|
||||
gc.Naddr(&p.To, gc.Sysfunc("duffzero"))
|
||||
p.To.Offset = 8 * (128 - cnt/int64(gc.Widthptr))
|
||||
} else {
|
||||
// ADDV $(8+frame+lo-8), SP, r1
|
||||
|
@ -71,9 +71,7 @@ func zerorange(p *obj.Prog, frame int64, lo int64, hi int64) *obj.Prog {
|
||||
p = gc.Appendpp(p, ppc64.AADD, obj.TYPE_CONST, 0, gc.Ctxt.FixedFrameSize()+frame+lo-8, obj.TYPE_REG, ppc64.REGRT1, 0)
|
||||
p.Reg = ppc64.REGSP
|
||||
p = gc.Appendpp(p, obj.ADUFFZERO, obj.TYPE_NONE, 0, 0, obj.TYPE_MEM, 0, 0)
|
||||
f := gc.Sysfunc("duffzero")
|
||||
gc.Naddr(&p.To, f)
|
||||
gc.Afunclit(&p.To, f)
|
||||
gc.Naddr(&p.To, gc.Sysfunc("duffzero"))
|
||||
p.To.Offset = 4 * (128 - cnt/int64(gc.Widthptr))
|
||||
} else {
|
||||
p = gc.Appendpp(p, ppc64.AMOVD, obj.TYPE_CONST, 0, gc.Ctxt.FixedFrameSize()+frame+lo-8, obj.TYPE_REG, ppc64.REGTMP, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user