go/ssa: cleanup: make NewFunction a member of *Program.

(since it always needs this field)

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/106960045
diff --git a/go/pointer/gen.go b/go/pointer/gen.go
index 9d8e2c1..ee680f6 100644
--- a/go/pointer/gen.go
+++ b/go/pointer/gen.go
@@ -1102,9 +1102,7 @@
 // or a library.
 //
 func (a *analysis) genRootCalls() *cgnode {
-	r := ssa.NewFunction("<root>", new(types.Signature), "root of callgraph")
-	r.Prog = a.prog // hack.
-	r.String()      // (asserts that it doesn't crash)
+	r := a.prog.NewFunction("<root>", new(types.Signature), "root of callgraph")
 	root := a.makeCGNode(r, 0, nil)
 
 	// TODO(adonovan): make an ssa utility to construct an actual
diff --git a/go/ssa/func.go b/go/ssa/func.go
index 1bd24ec..5de5b61 100644
--- a/go/ssa/func.go
+++ b/go/ssa/func.go
@@ -640,11 +640,11 @@
 	return b
 }
 
-// NewFunction returns a new synthetic Function instance with its name
-// and signature fields set as specified.
+// NewFunction returns a new synthetic Function instance belonging to
+// prog, with its name and signature fields set as specified.
 //
 // The caller is responsible for initializing the remaining fields of
-// the function object, e.g. Pkg, Prog, Params, Blocks.
+// the function object, e.g. Pkg, Params, Blocks.
 //
 // It is practically impossible for clients to construct well-formed
 // SSA functions/packages/programs directly, so we assume this is the
@@ -655,8 +655,8 @@
 //
 // TODO(adonovan): think harder about the API here.
 //
-func NewFunction(name string, sig *types.Signature, provenance string) *Function {
-	return &Function{name: name, Signature: sig, Synthetic: provenance}
+func (prog *Program) NewFunction(name string, sig *types.Signature, provenance string) *Function {
+	return &Function{Prog: prog, name: name, Signature: sig, Synthetic: provenance}
 }
 
 type extentNode [2]token.Pos
diff --git a/go/ssa/interp/reflect.go b/go/ssa/interp/reflect.go
index 53bc614..91a0b30 100644
--- a/go/ssa/interp/reflect.go
+++ b/go/ssa/interp/reflect.go
@@ -491,9 +491,8 @@
 	// now, we'll set it to always be false since we're only
 	// concerned with rtype.  Encapsulate this better.
 	sig := types.NewSignature(nil, types.NewVar(token.NoPos, nil, "recv", recvType), nil, nil, false)
-	fn := ssa.NewFunction(name, sig, "fake reflect method")
+	fn := pkg.Prog.NewFunction(name, sig, "fake reflect method")
 	fn.Pkg = pkg
-	fn.Prog = pkg.Prog
 	return fn
 }