[remove overloaded 'Fetch' in favor of PeekVal and Promote as needed
John Meacham <john@repetae.net>**20090709010944
 Ignore-this: b81741cb529191411d3e41a2de8836db
] hunk ./C/FromGrin2.hs 296
-convertBody (Fetch v :>>= [(NodeC t as)] :-> e') = nodeAssign v t as e'
+--convertBody (Fetch v :>>= [(NodeC t as)] :-> e') = nodeAssign v t as e'
hunk ./C/FromGrin2.hs 457
-convertBody (Fetch (Index base off)) | getType base == TyPtr tyINode = do
+convertBody (BaseOp PeekVal [Index base off]) | getType base == TyPtr tyINode = do
hunk ./C/FromGrin2.hs 468
-convertBody (Fetch v)        | getType v == tyINode = simpleRet =<< f_promote `liftM` convertVal v
+convertBody (BaseOp Promote [v])        | getType v == tyINode = simpleRet =<< f_promote `liftM` convertVal v
hunk ./C/FromGrin2.hs 522
-isCompound Fetch {} = False
+--isCompound Fetch {} = False
+isCompound BaseOp {} = False
hunk ./Grin/DeadCode.hs 128
+            g (BaseOp PeekVal [vv]) = addRule $ (doNode vv)
+            g (BaseOp Promote [vv]) = addRule $ (doNode vv)
hunk ./Grin/DeadCode.hs 131
-            g (Fetch x) = addRule $ doNode x
hunk ./Grin/DeadCode.hs 145
-            h (p,Return vs) = mapM_ (h . \v -> (p,Fetch v)) vs -- addRule $ mconcat $ [ conditionalRule id  (varValue pv) (doNode v) | pv <- freeVars p]
-            h (p,Fetch v) = addRule $ mconcat $ [ conditionalRule id  (varValue pv) (doNode v) | pv <- freeVars p]
+            h (p,Return vs) = mapM_ (h . \v -> (p,BaseOp Promote [v])) vs -- addRule $ mconcat $ [ conditionalRule id  (varValue pv) (doNode v) | pv <- freeVars p]
+            h (p,BaseOp Promote [v]) = addRule $ mconcat $ [ conditionalRule id  (varValue pv) (doNode v) | pv <- freeVars p]
hunk ./Grin/FromE.hs 356
-            return (Fetch (toVal tvr))
+            return (BaseOp Promote [toVal tvr])
hunk ./Grin/FromE.hs 434
-            return $ Fetch (Index r' (toUnVal (0::Int)))
+            --return $ Fetch (Index r' (toUnVal (0::Int)))
+            return $ BaseOp PeekVal [Index r' (toUnVal (0::Int))]
hunk ./Grin/FromE.hs 449
-            return $ Fetch (Index r' o')
+            --return $ Fetch (Index r' o')
+            return $ BaseOp PeekVal [Index r' o']
hunk ./Grin/FromE.hs 453
-            return $ Fetch (Index r' o')
+            return $ BaseOp PeekVal [Index r' o']
hunk ./Grin/Grin.hs 199
-    | Fetch     { expAddress :: Val }                                     -- ^ Load given heap node
hunk ./Grin/Grin.hs 513
+    getType (BaseOp Promote _) = [TyNode]
+    getType (BaseOp PeekVal [v]) = case getType v of
+        TyPtr t -> [t]
+        _ -> error "Exp.getType: PeekVal of non-pointer type"
hunk ./Grin/Grin.hs 518
-    getType (Fetch v) = case getType v of
-        TyINode -> [TyNode]
-        TyPtr t -> [t]
-        _ -> error "Exp.getType: fetch of non-pointer type"
hunk ./Grin/Grin.hs 579
-    freeVars (Fetch v) = freeVars v
hunk ./Grin/Grin.hs 596
-    freeVars (Fetch v) = freeVars v
hunk ./Grin/Grin.hs 636
-    freeVars (Fetch v) = freeVars v
hunk ./Grin/Lint.hs 137
-    f [b] (Fetch x@Var {}) = do assign "promote" b x
hunk ./Grin/Lint.hs 285
-    f (Fetch v) = do
-        v' <- tcVal v
-        case v' of
-            (TyPtr t) -> return [t]
-            TyINode -> return [TyNode]
+    f (BaseOp Promote [v]) = do
+        TyINode <- tcVal v
+        return [TyNode]
+    f (BaseOp PeekVal [v]) = do
+        TyPtr t <- tcVal v
+        return [t]
hunk ./Grin/NodeAnalyze.hs 222
-        f (Fetch w) | tyINode == getType w = do
+        f (BaseOp Promote [w]) = do
hunk ./Grin/NodeAnalyze.hs 226
-        f (Fetch w) | TyPtr tyINode == getType w = do
+        f (BaseOp PeekVal [w])  = do
hunk ./Grin/NodeAnalyze.hs 304
-                return (Fetch arg)
+                return (BaseOp Promote [arg])
hunk ./Grin/Noodle.hs 50
-    f (Fetch v) = return Fetch `ap` g v
hunk ./Grin/Noodle.hs 145
-isOmittable (Fetch {}) = True
+isOmittable (BaseOp Promote _) = True
+isOmittable (BaseOp PeekVal _) = True
hunk ./Grin/Noodle.hs 182
-        cfunc Fetch {} = return mempty
hunk ./Grin/SSimplify.hs 103
-    f p app@(App a [v] _) | a == funcEval =  cse' "Simplify.CSE.eval" [(Fetch v,Return p)]
-    f p (Fetch v@Var {}) =  cse' "Simplify.CSE.fetch" [(gEval v,Return p)]
+    f p app@(App a [v] _) | a == funcEval =  cse' "Simplify.CSE.eval" [(BaseOp Promote [v],Return p)]
+    f p (BaseOp Promote [v@Var {}]) =  cse' "Simplify.CSE.fetch" [(gEval v,Return p)]
hunk ./Grin/SSimplify.hs 108
-    f [p] (Store v@Var {})  =  cse' "Simplify.CSE.demote" [(Fetch p,Return [v]),(gEval p,Return [v])]
+    f [p] (Store v@Var {})  =  cse' "Simplify.CSE.demote" [(BaseOp Promote [p],Return [v]),(gEval p,Return [v])]
hunk ./Grin/SSimplify.hs 110
-        True -> local (\s -> s { envPush = IM.insert vn (Store v) (envPush s) }) $ cse "Simplify.CSE.store-whnf" [(Fetch p,Return [v]),(gEval p,Return [v])]
+        True -> local (\s -> s { envPush = IM.insert vn (Store v) (envPush s) }) $ cse "Simplify.CSE.store-whnf" [(BaseOp Promote [p],Return [v]),(gEval p,Return [v])]
hunk ./Grin/SSimplify.hs 126
-    f (Fetch (Const x)) rs = do
+    f (BaseOp Promote [Const x]) rs = do
hunk ./Grin/Show.hs 77
-prettyExp vl (Fetch v@Var {}) | getType v == tyINode = vl <> keyword "promote" <+> prettyVal v
-prettyExp vl (Fetch v) = vl <> keyword "fetch" <+> prettyVal v
hunk ./Grin/Show.hs 88
---prettyExp vl (Update x y) = vl <> keyword "update" <+> prettyVal x <+> prettyVal y
hunk ./Grin/Show.hs 93
---prettyExp vl (BaseOp Promote [x]) = vl <> keyword "promote" <+> prettyVal x
hunk ./Grin/Simplify.hs 46
-at_OptSimplifyConstFetch  = toAtom "Optimize.simplify.const-fetch"
+at_OptSimplifyConstPromote  = toAtom "Optimize.simplify.const-promote"
hunk ./Grin/Simplify.hs 99
-    gs (Fetch (Const n)) = do
-        lift $ tick stats at_OptSimplifyConstFetch
+    gs (BaseOp Promote [Const n]) = do
+        lift $ tick stats at_OptSimplifyConstPromote
hunk ./Grin/Simplify.hs 175
-    g Fetch {} = "Fetch"
+    --g Fetch {} = "Fetch"
+    g (BaseOp Promote _) = "Promote"
+    g (BaseOp PeekVal _) = "PeekVal"
hunk ./Grin/Simplify.hs 314
-    f (Store t :>>= [v] :-> Fetch v' :>>= lr) | v == v' = do
-        mtick "Optimize.optimize.store-fetch"
-        f (Store t :>>= [v] :-> Return [t] :>>= lr)
+--    f (Store t :>>= [v] :-> Fetch v' :>>= lr) | v == v' = do
+--        mtick "Optimize.optimize.store-fetch"
+--        f (Store t :>>= [v] :-> Return [t] :>>= lr)