]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/gc/gsubr.go
[dev.ssa] Merge remote-tracking branch 'origin/master' into mergebranch
[gostls13.git] / src / cmd / compile / internal / gc / gsubr.go
index 14d4d3da8f6faa90e2b2311d0dc97613e9801270..f17a701b98c268e0a429ae8e8293ea47fe1d7634 100644 (file)
@@ -518,6 +518,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
 
@@ -543,7 +553,7 @@ func nodarg(t *Type, fp int) *Node {
                Fatalf("nodarg: not field %v", t)
        }
 
-       if fp == 1 {
+       if fp == 1 || fp == -1 {
                var n *Node
                for l := Curfn.Func.Dcl; l != nil; l = l.Next {
                        n = l.N
@@ -582,6 +592,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")
        }