Commit b6fc60f5 authored by rl@cse.unsw.edu.au's avatar rl@cse.unsw.edu.au
Browse files

Store hoisted bindings in the global environment during vectorisation

parent 9685c129
...@@ -121,6 +121,9 @@ data GlobalEnv = GlobalEnv { ...@@ -121,6 +121,9 @@ data GlobalEnv = GlobalEnv {
-- instances -- instances
-- --
, global_fam_inst_env :: FamInstEnvs , global_fam_inst_env :: FamInstEnvs
-- Hoisted bindings
, global_bindings :: [(Var, CoreExpr)]
} }
data LocalEnv = LocalEnv { data LocalEnv = LocalEnv {
...@@ -131,9 +134,6 @@ data LocalEnv = LocalEnv { ...@@ -131,9 +134,6 @@ data LocalEnv = LocalEnv {
-- Mapping from tyvars to their PA dictionaries -- Mapping from tyvars to their PA dictionaries
, local_tyvar_pa :: VarEnv CoreExpr , local_tyvar_pa :: VarEnv CoreExpr
-- Hoisted bindings
, local_bindings :: [(Var, CoreExpr)]
} }
...@@ -146,12 +146,12 @@ initGlobalEnv info instEnvs famInstEnvs ...@@ -146,12 +146,12 @@ initGlobalEnv info instEnvs famInstEnvs
, global_tycon_pa = emptyNameEnv , global_tycon_pa = emptyNameEnv
, global_inst_env = instEnvs , global_inst_env = instEnvs
, global_fam_inst_env = famInstEnvs , global_fam_inst_env = famInstEnvs
, global_bindings = []
} }
emptyLocalEnv = LocalEnv { emptyLocalEnv = LocalEnv {
local_vars = emptyVarEnv local_vars = emptyVarEnv
, local_tyvar_pa = emptyVarEnv , local_tyvar_pa = emptyVarEnv
, local_bindings = []
} }
-- FIXME -- FIXME
......
...@@ -115,7 +115,7 @@ hoistExpr :: FastString -> CoreExpr -> VM Var ...@@ -115,7 +115,7 @@ hoistExpr :: FastString -> CoreExpr -> VM Var
hoistExpr fs expr hoistExpr fs expr
= do = do
var <- newLocalVar fs (exprType expr) var <- newLocalVar fs (exprType expr)
updLEnv $ \env -> updGEnv $ \env ->
env { local_bindings = (var, expr) : local_bindings env } env { global_bindings = (var, expr) : global_bindings env }
return var return var
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment