go.tools/pointer: reflect, part 2: channels.

        (reflect.Value).Send
        (reflect.Value).TrySend
        (reflect.Value).Recv
        (reflect.Value).TryRecv
        (reflect.Type).ChanOf
        (reflect.Type).In
        (reflect.Type).Out
        reflect.Indirect
        reflect.MakeChan

Also:
- specialize genInvoke when the receiver is a reflect.Type under the
  assumption that there's only one possible concrete type.  This
  makes all reflect.Type operations context-sensitive since the calls
  are no longer dynamic.
- Rename all variables to match the actual parameter names used in
  the reflect API.
- Add pointer.Config.Reflection flag
  (exposed in oracle as --reflect, default false) to enable reflection.
  It currently adds about 20% running time.  I'll make it true after
  the presolver is implemented.
- Simplified worklist datatype and solver main loop slightly
  (~10% speed improvement).
- Use addLabel() utility to add a label to a PTS.

(Working on my 3 yr old 2x2GHz+4GB Mac vs 8x4GHz+24GB workstation,
one really notices the cost of pointer analysis.
Note to self: time to implement presolver.)

R=crawshaw
CC=golang-dev
https://golang.org/cl/13242062
diff --git a/pointer/analysis.go b/pointer/analysis.go
index 319d976..b825bb1 100644
--- a/pointer/analysis.go
+++ b/pointer/analysis.go
@@ -185,7 +185,8 @@
 	hasher          typemap.Hasher // cache of type hashes
 	reflectValueObj types.Object   // type symbol for reflect.Value (if present)
 	reflectRtypeObj types.Object   // *types.TypeName for reflect.rtype (if present)
-	reflectRtype    *types.Pointer // *reflect.rtype
+	reflectRtypePtr *types.Pointer // *reflect.rtype
+	reflectType     *types.Named   // reflect.Type
 	rtypes          typemap.M      // nodeid of canonical *rtype-tagged object for type T
 	reflectZeros    typemap.M      // nodeid of canonical T-tagged object for zero value
 }
@@ -244,8 +245,9 @@
 
 	if reflect := a.prog.ImportedPackage("reflect"); reflect != nil {
 		a.reflectValueObj = reflect.Object.Scope().Lookup("Value")
+		a.reflectType = reflect.Object.Scope().Lookup("Type").Type().(*types.Named)
 		a.reflectRtypeObj = reflect.Object.Scope().Lookup("rtype")
-		a.reflectRtype = types.NewPointer(a.reflectRtypeObj.Type())
+		a.reflectRtypePtr = types.NewPointer(a.reflectRtypeObj.Type())
 
 		// Override flattening of reflect.Value, treating it like a basic type.
 		tReflectValue := a.reflectValueObj.Type()
@@ -265,11 +267,7 @@
 
 	root := a.generate()
 
-	// ---------- Presolver ----------
-
-	// TODO(adonovan): opt: presolver optimisations.
-
-	// ---------- Solver ----------
+	//a.optimize()
 
 	a.solve()