]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/gc/gsubr.go
[dev.ssa] Merge remote-tracking branch 'origin/master' into ssamerge
[gostls13.git] / src / cmd / compile / internal / gc / gsubr.go
index f5d7a8d2de26aa7f534d841892756f644db478f7..73f71dd0fbe7ae13297e24e1fc699e5b1f778000 100644 (file)
@@ -530,6 +530,16 @@ func newplist() *obj.Plist {
        return pl
 }
 
+// nodarg does something that depends on the value of
+// fp (this was previously completely undocumented).
+//
+// fp=1 corresponds to input args
+// fp=0 corresponds to output args
+// fp=-1 is a special case of output args for a
+// specific call from walk that previously (and
+// incorrectly) passed a 1; the behavior is exactly
+// the same as it is for 1, except that PARAMOUT is
+// generated instead of PARAM.
 func nodarg(t *Type, fp int) *Node {
        var n *Node
 
@@ -555,7 +565,7 @@ func nodarg(t *Type, fp int) *Node {
                Fatalf("nodarg: not field %v", t)
        }
 
-       if fp == 1 {
+       if fp == 1 || fp == -1 {
                for _, n := range Curfn.Func.Dcl {
                        if (n.Class == PPARAM || n.Class == PPARAMOUT) && !isblanksym(t.Sym) && n.Sym == t.Sym {
                                return n
@@ -592,6 +602,9 @@ fp:
        case 1: // input arg
                n.Class = PPARAM
 
+       case -1: // output arg from paramstoheap
+               n.Class = PPARAMOUT
+
        case 2: // offset output arg
                Fatalf("shouldn't be used")
        }