X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fvectorise%2FVectMonad.hs;fp=compiler%2Fvectorise%2FVectMonad.hs;h=fc4577df7bcd0e5c8ef72b1ecae4a55a4d5e6090;hp=2649716b0b02eadb622e5207860353334a9413e2;hb=112780e06ecd41c7469317a08187ea8335ee3c54;hpb=5ee7f0e66649ef31c2fcb2528399b57eba5651db diff --git a/compiler/vectorise/VectMonad.hs b/compiler/vectorise/VectMonad.hs index 2649716..fc4577d 100644 --- a/compiler/vectorise/VectMonad.hs +++ b/compiler/vectorise/VectMonad.hs @@ -439,6 +439,8 @@ newTyVar fs k u <- liftDs newUnique return $ mkTyVar (mkSysTvName u fs) k + +-- | Add a mapping between a global var and its vectorised version to the state. defGlobalVar :: Var -> Var -> VM () defGlobalVar v v' = updGEnv $ \env -> env { global_vars = extendVarEnv (global_vars env) v v' @@ -448,14 +450,14 @@ defGlobalVar v v' = updGEnv $ \env -> upd env | isExportedId v = extendVarEnv env v (v, v') | otherwise = env +-- Var ------------------------------------------------------------------------ -- | Lookup the vectorised and\/or lifted versions of this variable. -- If it's in the global environment we get the vectorised version. -- If it's in the local environment we get both the vectorised and lifted version. -- lookupVar :: Var -> VM (Scope Var (Var, Var)) lookupVar v - = do - r <- readLEnv $ \env -> lookupVarEnv (local_vars env) v + = do r <- readLEnv $ \env -> lookupVarEnv (local_vars env) v case r of Just e -> return (Local e) Nothing -> liftM Global @@ -581,6 +583,8 @@ lookupFamInst tycon tys (ppr $ mkTyConApp tycon tys) } + +-- | Run a vectorisation computation. initV :: PackageId -> HscEnv -> ModGuts -> VectInfo -> VM a -> IO (Maybe (VectInfo, a)) initV pkg hsc_env guts info p = do