From: Roman Leshchinskiy Date: Tue, 7 Aug 2007 02:28:18 +0000 (+0000) Subject: Utility functions for accessing the RdrEnv during vectorisation X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=97b95db074dec279235866b910a46fc0c7d62fae Utility functions for accessing the RdrEnv during vectorisation --- diff --git a/compiler/vectorise/VectMonad.hs b/compiler/vectorise/VectMonad.hs index 56efb2b..36e0d97 100644 --- a/compiler/vectorise/VectMonad.hs +++ b/compiler/vectorise/VectMonad.hs @@ -312,6 +312,21 @@ inBind id p = do updLEnv $ \env -> env { local_bind_name = occNameFS (getOccName id) } p +lookupRdrName :: RdrName -> VM Name +lookupRdrName rdr_name + = do + rdr_env <- readGEnv global_rdr_env + case lookupGRE_RdrName rdr_name rdr_env of + [gre] -> return (gre_name gre) + [] -> pprPanic "VectMonad.lookupRdrName: not found" (ppr rdr_name) + _ -> pprPanic "VectMonad.lookupRdrName: ambiguous" (ppr rdr_name) + +lookupRdrVar :: RdrName -> VM Var +lookupRdrVar rdr_name + = do + name <- lookupRdrName rdr_name + liftDs (dsLookupGlobalId name) + cloneName :: (OccName -> OccName) -> Name -> VM Name cloneName mk_occ name = liftM make (liftDs newUnique) where