X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fvectorise%2FVectUtils.hs;h=199ef68e093c2d3ea349460ab99a1456285d3e85;hb=c6eadadbefe2ec5709e9d31893f79c4ff78754b4;hp=5b70bf4fdf2e8531d0cb0cdf99a30c419e6d982b;hpb=35380dd876960a2e88e8743545615040f08b4f27;p=ghc-hetmet.git diff --git a/compiler/vectorise/VectUtils.hs b/compiler/vectorise/VectUtils.hs index 5b70bf4..199ef68 100644 --- a/compiler/vectorise/VectUtils.hs +++ b/compiler/vectorise/VectUtils.hs @@ -4,7 +4,7 @@ module VectUtils ( mkPADictType, mkPArrayType, paDictArgType, paDictOfType, lookupPArrayFamInst, - hoistExpr + hoistExpr, takeHoisted ) where #include "HsVersions.h" @@ -115,7 +115,14 @@ hoistExpr :: FastString -> CoreExpr -> VM Var hoistExpr fs expr = do var <- newLocalVar fs (exprType expr) - updLEnv $ \env -> - env { local_bindings = (var, expr) : local_bindings env } + updGEnv $ \env -> + env { global_bindings = (var, expr) : global_bindings env } return var +takeHoisted :: VM [(Var, CoreExpr)] +takeHoisted + = do + env <- readGEnv id + setGEnv $ env { global_bindings = [] } + return $ global_bindings env +