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 {
-- instances
--
, global_fam_inst_env :: FamInstEnvs
-- Hoisted bindings
, global_bindings :: [(Var, CoreExpr)]
}
data LocalEnv = LocalEnv {
......@@ -131,9 +134,6 @@ data LocalEnv = LocalEnv {
-- Mapping from tyvars to their PA dictionaries
, local_tyvar_pa :: VarEnv CoreExpr
-- Hoisted bindings
, local_bindings :: [(Var, CoreExpr)]
}
......@@ -146,12 +146,12 @@ initGlobalEnv info instEnvs famInstEnvs
, global_tycon_pa = emptyNameEnv
, global_inst_env = instEnvs
, global_fam_inst_env = famInstEnvs
, global_bindings = []
}
emptyLocalEnv = LocalEnv {
local_vars = emptyVarEnv
, local_tyvar_pa = emptyVarEnv
, local_bindings = []
}
-- FIXME
......
......@@ -115,7 +115,7 @@ 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
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