[make grin push in optimization not push things into let bindings
John Meacham <john@repetae.net>**20060815094331] hunk ./Grin/Grin.hs 21
+    extendTyEnv,
hunk ./Grin/Grin.hs 213
-    props = funcProps { funcFreeVars = freeVars body, funcTags = freeVars body }
+    props = funcProps { funcFreeVars = freeVars body, funcTags = freeVars body, funcType = (map getType (fromTuple args),getType rest) }
+
+
+extendTyEnv ds (TyEnv env) = TyEnv (Map.fromList xs `mappend` env) where
+    xs = [ (funcDefName d,funcType $ funcDefProps d) |  d <- ds]
hunk ./Grin/Grin.hs 224
+    funcType    :: ([Ty],Ty),
hunk ./Grin/Optimize.hs 63
+        exp <- fixupLet exp
hunk ./Grin/Optimize.hs 67
+        exp <- fixupLet exp
hunk ./Grin/Optimize.hs 70
+    fixupLet lt@Let { expDefs = defs, expBody = b } = do
+        let def = (Set.fromList $ map funcDefName defs)
+            f (e :>>= l :-> r) | Set.null (freeVars e `Set.intersect` def) = do
+                exp <- f r
+                return (e :>>= l :-> exp)
+            f r = return lt {  expBody = r }
+        f b
+    fixupLet exp = return exp
hunk ./Grin/Optimize.hs 89
+    dropAll exp fvs = do
+        (nn,xs) <- get
+        let graph = newGraph xs pexpUniq pexpDeps
+            deps = justDeps xs fvs
+            reached = reachable graph deps
+            dropped =  reverse $ topSort $ newGraph reached pexpUniq pexpDeps
+            ff pexp exp = pexpExp pexp :>>= pexpBind pexp :-> exp
+        put (nn,[ x | x <- xs, pexpUniq x `notElem` (map pexpUniq reached) ])
+        return (foldr ff exp dropped :: Exp)
hunk ./Grin/Optimize.hs 115
+isOmittable Let { expBody = x } = isOmittable x
hunk ./Grin/PointsToAnalysis.hs 419
-        Just (ts,_) = findArgsType te n
+        ts = case findArgsType te n of
+            Just (ts,_) -> ts
+            _ -> []
hunk ./Grin/Simplify.hs 361
---    f lt@Let { expDefs = defs, expBody = e :>>= l :-> r } | Set.null (freeVars e `Set.intersect` (Set.fromList $ map funcDefName defs)) = do
---        mtick "Optimize.optimize.let-shrink-head"
---        f (e :>>= l :-> lt { expDefs = defs, expBody = r })
+    f lt@Let { expDefs = defs, expBody = e :>>= l :-> r } | Set.null (freeVars e `Set.intersect` (Set.fromList $ map funcDefName defs)) = do
+        mtick "Optimize.optimize.let-shrink-head"
+        f (e :>>= l :-> lt { expDefs = defs, expBody = r })