More refactoring
authorRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 2 Aug 2007 02:28:59 +0000 (02:28 +0000)
committerRoman Leshchinskiy <rl@cse.unsw.edu.au>
Thu, 2 Aug 2007 02:28:59 +0000 (02:28 +0000)
compiler/vectorise/VectUtils.hs

index 0727c94..b3c110e 100644 (file)
@@ -7,7 +7,7 @@ module VectUtils (
   paMethod, lengthPA, replicatePA, emptyPA, liftPA,
   polyAbstract, polyApply, polyVApply,
   lookupPArrayFamInst,
   paMethod, lengthPA, replicatePA, emptyPA, liftPA,
   polyAbstract, polyApply, polyVApply,
   lookupPArrayFamInst,
-  hoistExpr, hoistPolyVExpr, takeHoisted,
+  hoistBinding, hoistExpr, hoistPolyVExpr, takeHoisted,
   buildClosure, buildClosures,
   mkClosureApp
 ) where
   buildClosure, buildClosures,
   mkClosureApp
 ) where
@@ -215,12 +215,15 @@ polyVApply expr tys
 lookupPArrayFamInst :: Type -> VM (TyCon, [Type])
 lookupPArrayFamInst ty = builtin parrayTyCon >>= (`lookupFamInst` [ty])
 
 lookupPArrayFamInst :: Type -> VM (TyCon, [Type])
 lookupPArrayFamInst ty = builtin parrayTyCon >>= (`lookupFamInst` [ty])
 
+hoistBinding :: Var -> CoreExpr -> VM ()
+hoistBinding v e = updGEnv $ \env ->
+  env { global_bindings = (v,e) : global_bindings env }
+
 hoistExpr :: FastString -> CoreExpr -> VM Var
 hoistExpr fs expr
   = do
       var <- newLocalVar fs (exprType expr)
 hoistExpr :: FastString -> CoreExpr -> VM Var
 hoistExpr fs expr
   = do
       var <- newLocalVar fs (exprType expr)
-      updGEnv $ \env ->
-        env { global_bindings = (var, expr) : global_bindings env }
+      hoistBinding var expr
       return var
 
 hoistVExpr :: VExpr -> VM VVar
       return var
 
 hoistVExpr :: VExpr -> VM VVar