]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.regabi] cmd/compile: rename addinit(n, init) to initExpr(init, n)
authorRuss Cox <rsc@golang.org>
Wed, 2 Dec 2020 22:03:18 +0000 (17:03 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 3 Dec 2020 17:45:50 +0000 (17:45 +0000)
Recreated manually to push below some CLs it depended on.

Change-Id: I1b3316fcdce39cbb33e5cbb471f5cd1cd2efc1f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/274599
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/inl.go
src/cmd/compile/internal/gc/order.go
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/gc/walk.go

index fd8e9cfd4648677874f526349e3bb0db65b57edc..42125f38f3e27b10d75913977d9c7889a0f8149a 100644 (file)
@@ -537,7 +537,7 @@ func inlconv2stmt(inlcall ir.Node) ir.Node {
 //     n.Left = inlconv2expr(n.Left)
 func inlconv2expr(n ir.Node) ir.Node {
        r := n.Rlist().First()
-       return addinit(r, append(n.Init().Slice(), n.Body().Slice()...))
+       return initExpr(append(n.Init().Slice(), n.Body().Slice()...), r)
 }
 
 // Turn the rlist (with the return values) of the OINLCALL in
@@ -551,7 +551,7 @@ func inlconv2list(n ir.Node) []ir.Node {
        }
 
        s := n.Rlist().Slice()
-       s[0] = addinit(s[0], append(n.Init().Slice(), n.Body().Slice()...))
+       s[0] = initExpr(append(n.Init().Slice(), n.Body().Slice()...), s[0])
        return s
 }
 
index 7816e684dc0899ac1c579114d9629df3fe0ffe81..e4175bbf368170a6dae4181eea3a1092bd13f23f 100644 (file)
@@ -433,7 +433,7 @@ func (o *Order) exprInPlace(n ir.Node) ir.Node {
        var order Order
        order.free = o.free
        n = order.expr(n, nil)
-       n = addinit(n, order.out)
+       n = initExpr(order.out, n)
 
        // insert new temporaries from order
        // at head of outer list.
index 011a7ac5bc0f795812ae0ce7bb11e37464774821..970f78b355ad36938af6470f81dec2f22c7932ff 100644 (file)
@@ -1355,9 +1355,9 @@ func ngotype(n ir.Node) *types.Sym {
        return nil
 }
 
-// The result of addinit MUST be assigned back to n, e.g.
-//     n.Left = addinit(n.Left, init)
-func addinit(n ir.Node, init []ir.Node) ir.Node {
+// The result of initExpr MUST be assigned back to n, e.g.
+//     n.Left = initExpr(init, n.Left)
+func initExpr(init []ir.Node, n ir.Node) ir.Node {
        if len(init) == 0 {
                return n
        }
index 5a073ac32462e09d42b3570fd10835877257dcd8..55443ba596e21715d8c65b9ae32393b6fb9f8b8b 100644 (file)
@@ -1314,7 +1314,7 @@ func typecheck1(n ir.Node, top int) (res ir.Node) {
                                }
                                old := n
                                n = ir.NodAt(n.Pos(), l.SubOp(), arg, nil)
-                               n = addinit(n, old.Init().Slice()) // typecheckargs can add to old.Init
+                               n = initExpr(old.Init().Slice(), n) // typecheckargs can add to old.Init
 
                        case ir.OCOMPLEX, ir.OCOPY:
                                typecheckargs(n)
@@ -1325,7 +1325,7 @@ func typecheck1(n ir.Node, top int) (res ir.Node) {
                                }
                                old := n
                                n = ir.NodAt(n.Pos(), l.SubOp(), arg1, arg2)
-                               n = addinit(n, old.Init().Slice()) // typecheckargs can add to old.Init
+                               n = initExpr(old.Init().Slice(), n) // typecheckargs can add to old.Init
                        }
                        n = typecheck1(n, top)
                        return n
index c0f447f1a221fd195a84a27436ffd267578d3779..e72015c05e8d76611fa73ed972468e8260aff1f3 100644 (file)
@@ -180,7 +180,7 @@ func walkstmt(n ir.Node) ir.Node {
                n = mkcall1(chanfn("chanrecv1", 2, n.Left().Type()), nil, &init, n.Left(), nodnil())
                n = walkexpr(n, &init)
 
-               n = addinit(n, init.Slice())
+               n = initExpr(init.Slice(), n)
 
        case ir.OBREAK,
                ir.OCONTINUE,
@@ -268,7 +268,7 @@ func walkstmt(n ir.Node) ir.Node {
                        init := n.Left().Init()
                        n.Left().PtrInit().Set(nil)
                        n.SetLeft(walkexpr(n.Left(), &init))
-                       n.SetLeft(addinit(n.Left(), init.Slice()))
+                       n.SetLeft(initExpr(init.Slice(), n.Left()))
                }
 
                n.SetRight(walkstmt(n.Right()))
@@ -557,7 +557,7 @@ opswitch:
                var ll ir.Nodes
 
                n.SetRight(walkexpr(n.Right(), &ll))
-               n.SetRight(addinit(n.Right(), ll.Slice()))
+               n.SetRight(initExpr(ll.Slice(), n.Right()))
 
        case ir.OPRINT, ir.OPRINTN:
                n = walkprint(n, init)