]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: fixes for big rewrite
authorRuss Cox <rsc@golang.org>
Tue, 22 Dec 2020 22:22:28 +0000 (17:22 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 23 Dec 2020 00:51:53 +0000 (00:51 +0000)
Adjust the new regabi code a bit to make the rewrites apply cleanly.

Change-Id: Ice5378e94d94ab45ca0572f44ab8c94b847271b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/279530
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/gsubr.go
src/cmd/compile/internal/gc/ssa.go

index f3ef14c99b771d85dc31154d41c05b12b5a5205f..aa498a009705a58c8dbc009f67d8d3500616c1bc 100644 (file)
@@ -265,20 +265,21 @@ func makeABIWrapper(f *ir.Func, wrapperABI obj.ABI) {
        // to allocate any stack space). Doing this will require some
        // extra work in typecheck/walk/ssa, might want to add a new node
        // OTAILCALL or something to this effect.
-       var call ir.Node
+       var tail ir.Node
        if tfn.Type().NumResults() == 0 && tfn.Type().NumParams() == 0 && tfn.Type().NumRecvs() == 0 {
-               call = nodSym(ir.ORETJMP, nil, f.Nname.Sym())
+               tail = nodSym(ir.ORETJMP, nil, f.Nname.Sym())
        } else {
-               call = ir.Nod(ir.OCALL, f.Nname, nil)
+               call := ir.Nod(ir.OCALL, f.Nname, nil)
                call.PtrList().Set(paramNnames(tfn.Type()))
                call.SetIsDDD(tfn.Type().IsVariadic())
+               tail = call
                if tfn.Type().NumResults() > 0 {
                        n := ir.Nod(ir.ORETURN, nil, nil)
                        n.PtrList().Set1(call)
-                       call = n
+                       tail = n
                }
        }
-       fn.PtrBody().Append(call)
+       fn.PtrBody().Append(tail)
 
        funcbody()
        if base.Debug.DclStack != 0 {
index 1fc1feae67509389fa061e72686fe12f372036d6..cc5f9eeea62ab4c703c746783a137eb5e6fb0565 100644 (file)
@@ -7332,18 +7332,20 @@ func callTargetLSym(callee *types.Sym, callerLSym *obj.LSym) *obj.LSym {
        if ir.AsNode(callee.Def) == nil {
                return lsym
        }
-       ndclfunc := ir.AsNode(callee.Def).Name().Defn
-       if ndclfunc == nil {
+       defn := ir.AsNode(callee.Def).Name().Defn
+       if defn == nil {
                return lsym
        }
+       ndclfunc := defn.(*ir.Func)
+
        // check for case 1 above
        if callerLSym.ABIWrapper() {
-               if nlsym := ndclfunc.Func().LSym; nlsym != nil {
+               if nlsym := ndclfunc.LSym; nlsym != nil {
                        lsym = nlsym
                }
        } else {
                // check for case 2 above
-               nam := ndclfunc.Func().Nname
+               nam := ndclfunc.Nname
                defABI, hasDefABI := symabiDefs[nam.Sym().LinksymName()]
                if hasDefABI && defABI == obj.ABI0 {
                        lsym = nam.Sym().LinksymABI0()