Commit 3bbd226e authored by chak@cse.unsw.edu.au.'s avatar chak@cse.unsw.edu.au.

Vectoriser gets all DPH library identifiers from Data.Array.Parallel.Prim

* No more use of hardcoded original names
* Initialisation of the desugarer monad loads 'Data.Array.Parallel.Prim' if -fdph-* given
* Initialisation of the vectoriser gets all built-in names from there
parent 9ada6542
......@@ -22,11 +22,11 @@ module DsMonad (
UniqSupply, newUniqueSupply,
getDOptsDs, getGhcModeDs, doptDs, woptDs,
dsLookupGlobal, dsLookupGlobalId, dsLookupDPHId, dsLookupTyCon, dsLookupDataCon,
assertDAPPLoaded, lookupDAPPRdrEnv, dsImportDecl, dsImportId, dsImportTyCon,
DsMetaEnv, DsMetaVal(..), dsLookupMetaEnv, dsExtendMetaEnv,
dsLoadModule,
-- Warnings
DsWarning, warnDs, failWithDs,
......@@ -41,6 +41,8 @@ import CoreSyn
import HsSyn
import TcIface
import LoadIface
import PrelNames
import Avail
import RdrName
import HscTypes
import Bag
......@@ -57,6 +59,8 @@ import NameEnv
import DynFlags
import ErrUtils
import FastString
import Maybes
import Control.Monad
import Data.IORef
\end{code}
......@@ -114,6 +118,7 @@ orFail _ _ = CanFail
Now the mondo monad magic (yes, @DsM@ is a silly name)---carry around
a @UniqueSupply@ and some annotations, which
presumably include source-file location information:
\begin{code}
type DsM result = TcRnIf DsGblEnv DsLclEnv result
......@@ -130,8 +135,11 @@ data DsGblEnv = DsGblEnv {
ds_mod :: Module, -- For SCC profiling
ds_unqual :: PrintUnqualified,
ds_msgs :: IORef Messages, -- Warning messages
ds_if_env :: (IfGblEnv, IfLclEnv) -- Used for looking up global,
ds_if_env :: (IfGblEnv, IfLclEnv), -- Used for looking up global,
-- possibly-imported things
ds_dph_env :: GlobalRdrEnv -- exported entities of 'Data.Array.Parallel.Prim' iff
-- '-fdph-*' flag was given (i.e., 'DynFlags.DPHBackend /=
-- DPHNone'); otherwise, empty
}
data DsLclEnv = DsLclEnv {
......@@ -152,18 +160,19 @@ data DsMetaVal
-- the PendingSplices on a HsBracketOut
initDs :: HscEnv
-> Module -> GlobalRdrEnv -> TypeEnv
-> DsM a
-> IO (Messages, Maybe a)
-> Module -> GlobalRdrEnv -> TypeEnv
-> DsM a
-> IO (Messages, Maybe a)
-- Print errors and warnings, if any arise
initDs hsc_env mod rdr_env type_env thing_inside
= do { msg_var <- newIORef (emptyBag, emptyBag)
; let dflags = hsc_dflags hsc_env
; (ds_gbl_env, ds_lcl_env) <- mkDsEnvs dflags mod rdr_env type_env msg_var
; let dflags = hsc_dflags hsc_env
(ds_gbl_env, ds_lcl_env) = mkDsEnvs dflags mod rdr_env type_env msg_var
; either_res <- initTcRnIf 'd' hsc_env ds_gbl_env ds_lcl_env $
tryM thing_inside -- Catch exceptions (= errors during desugaring)
loadDAPP dflags $
tryM thing_inside -- Catch exceptions (= errors during desugaring)
-- Display any errors and warnings
-- Note: if -Werror is used, we don't signal an error here.
......@@ -172,12 +181,31 @@ initDs hsc_env mod rdr_env type_env thing_inside
; let final_res | errorsFound dflags msgs = Nothing
| otherwise = case either_res of
Right res -> Just res
Left exn -> pprPanic "initDs" (text (show exn))
Left exn -> pprPanic "initDs" (text (show exn))
-- The (Left exn) case happens when the thing_inside throws
-- a UserError exception. Then it should have put an error
-- message in msg_var, so we just discard the exception
; return (msgs, final_res) }
; return (msgs, final_res)
}
where
-- Extend the global environment with a 'GlobalRdrEnv' containing the exported entities of
-- 'Data.Array.Parallel.Prim' if '-fdph-*' specified.
loadDAPP dflags thing_inside
| Just pkg <- dphPackageMaybe dflags
= do { rdr_env <- loadModule sdoc (dATA_ARRAY_PARALLEL_PRIM pkg)
; updGblEnv (\env -> env {ds_dph_env = rdr_env}) thing_inside
}
| otherwise
= do { ifXOptM Opt_ParallelArrays (liftIO $ fatalErrorMsg dflags $ ptext selectBackendErrPA)
; ifDOptM Opt_Vectorise (liftIO $ fatalErrorMsg dflags $ ptext selectBackendErrVect)
; thing_inside
}
sdoc = ptext (sLit "Internal Data Parallel Haskell interface 'Data.Array.Parallel.Prim'")
selectBackendErrVect = sLit "To use -fvectorise select a DPH backend with -fdph-par or -fdph-seq"
selectBackendErrPA = sLit "To use -XParallelArrays select a DPH backend with -fdph-par or -fdph-seq"
initDsTc :: DsM a -> TcM a
initDsTc thing_inside
......@@ -187,24 +215,54 @@ initDsTc thing_inside
; dflags <- getDOpts
; let type_env = tcg_type_env tcg_env
rdr_env = tcg_rdr_env tcg_env
; ds_envs <- liftIO $ mkDsEnvs dflags this_mod rdr_env type_env msg_var
; setEnvs ds_envs thing_inside }
ds_envs = mkDsEnvs dflags this_mod rdr_env type_env msg_var
; setEnvs ds_envs thing_inside
}
mkDsEnvs :: DynFlags -> Module -> GlobalRdrEnv -> TypeEnv -> IORef Messages -> IO (DsGblEnv, DsLclEnv)
mkDsEnvs :: DynFlags -> Module -> GlobalRdrEnv -> TypeEnv -> IORef Messages -> (DsGblEnv, DsLclEnv)
mkDsEnvs dflags mod rdr_env type_env msg_var
= do -- TODO: unnecessarily monadic
let if_genv = IfGblEnv { if_rec_types = Just (mod, return type_env) }
if_lenv = mkIfLclEnv mod (ptext (sLit "GHC error in desugarer lookup in") <+> ppr mod)
gbl_env = DsGblEnv { ds_mod = mod,
ds_if_env = (if_genv, if_lenv),
ds_unqual = mkPrintUnqualified dflags rdr_env,
ds_msgs = msg_var}
lcl_env = DsLclEnv { ds_meta = emptyNameEnv,
ds_loc = noSrcSpan }
return (gbl_env, lcl_env)
= let if_genv = IfGblEnv { if_rec_types = Just (mod, return type_env) }
if_lenv = mkIfLclEnv mod (ptext (sLit "GHC error in desugarer lookup in") <+> ppr mod)
gbl_env = DsGblEnv { ds_mod = mod
, ds_if_env = (if_genv, if_lenv)
, ds_unqual = mkPrintUnqualified dflags rdr_env
, ds_msgs = msg_var
, ds_dph_env = emptyGlobalRdrEnv
}
lcl_env = DsLclEnv { ds_meta = emptyNameEnv
, ds_loc = noSrcSpan
}
in (gbl_env, lcl_env)
-- Attempt to load the given module and return its exported entities if successful; otherwise, return an
-- empty environment. See "Note [Loading Data.Array.Parallel.Prim]".
--
loadModule :: SDoc -> Module -> DsM GlobalRdrEnv
loadModule doc mod
= do { env <- getGblEnv
; setEnvs (ds_if_env env) $ do
{ iface <- loadInterface doc mod ImportBySystem
; case iface of
Failed _err -> return $ mkGlobalRdrEnv []
Succeeded iface -> return $ mkGlobalRdrEnv . gresFromAvails prov . mi_exports $ iface
} }
where
prov = Imported [ImpSpec { is_decl = imp_spec, is_item = ImpAll }]
imp_spec = ImpDeclSpec { is_mod = name, is_qual = True,
is_dloc = wiredInSrcSpan, is_as = name }
name = moduleName mod
\end{code}
Note [Loading Data.Array.Parallel.Prim]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We generally attempt to load the interface of 'Data.Array.Parallel.Prim' when a DPH backend is selected.
However, while compiling packages containing a DPH backend, we will start out compiling the modules
'Data.Array.Parallel.Prim' depends on — i.e., when compiling these modules, the interface won't exist yet.
This is fine, as these modules do not use the vectoriser, but we need to ensure that GHC doesn't barf when
the interface is missing. Instead of an error message, we just put an empty 'GlobalRdrEnv' into the
'DsM' state.
%************************************************************************
%* *
Operations in the monad
......@@ -319,6 +377,51 @@ dsLookupDataCon name
= tyThingDataCon <$> dsLookupGlobal name
\end{code}
\begin{code}
-- Complain if 'Data.Array.Parallel.Prim' wasn't loaded (and we are about to use it).
--
-- See "Note [Loading Data.Array.Parallel.Prim]".
--
assertDAPPLoaded :: DsM ()
assertDAPPLoaded
= do { env <- ds_dph_env <$> getGblEnv
; when (null $ occEnvElts env) $
panic "'Data.Array.Parallel.Prim' not available; probably missing dependencies in DPH package"
}
-- Look up a name exported by 'Data.Array.Parallel.Prim'.
--
lookupDAPPRdrEnv :: OccName -> DsM Name
lookupDAPPRdrEnv occ
= do { env <- ds_dph_env <$> getGblEnv
; let gres = lookupGlobalRdrEnv env occ
; case gres of
[] -> pprPanic "Name not found in 'Data.Array.Parallel.Prim':" (ppr occ)
[gre] -> return $ gre_name gre
_ -> pprPanic "Multiple definitions in 'Data.Array.Parallel.Prim':" (ppr occ)
}
-- Find the thing repferred to by an imported name.
--
dsImportDecl :: Name -> DsM TyThing
dsImportDecl name
= do { env <- getGblEnv
; setEnvs (ds_if_env env) $ do
{ mb_thing <- importDecl name
; case mb_thing of
Failed err -> failIfM err
Succeeded thing -> return thing
} }
dsImportId :: Name -> DsM Id
dsImportId name
= tyThingId <$> dsImportDecl name
dsImportTyCon :: Name -> DsM TyCon
dsImportTyCon name
= tyThingTyCon <$> dsImportDecl name
\end{code}
\begin{code}
dsLookupMetaEnv :: Name -> DsM (Maybe DsMetaVal)
dsLookupMetaEnv name = do { env <- getLclEnv; return (lookupNameEnv (ds_meta env) name) }
......@@ -327,13 +430,3 @@ dsExtendMetaEnv :: DsMetaEnv -> DsM a -> DsM a
dsExtendMetaEnv menv thing_inside
= updLclEnv (\env -> env { ds_meta = ds_meta env `plusNameEnv` menv }) thing_inside
\end{code}
\begin{code}
dsLoadModule :: SDoc -> Module -> DsM ()
dsLoadModule doc mod
= do { env <- getGblEnv
; setEnvs (ds_if_env env)
(loadSysInterface doc mod >> return ())
}
\end{code}
......@@ -459,7 +459,6 @@ Library
Util
Vectorise.Builtins.Base
Vectorise.Builtins.Initialise
Vectorise.Builtins.Modules
Vectorise.Builtins
Vectorise.Monad.Base
Vectorise.Monad.Naming
......
......@@ -64,7 +64,6 @@ import Util
import FastString
import Control.Monad
import Data.List
\end{code}
This module takes
......@@ -724,13 +723,11 @@ tcIfaceVectInfo mod typeEnv (IfaceVectInfo
; vVars <- mapM vectVarMapping vars
; tyConRes1 <- mapM vectTyConMapping tycons
; tyConRes2 <- mapM (vectTyConReuseMapping scalarTyConsSet) tyconsReuse
; let (vTyCons, vDataCons, vPAs, vIsos) = unzip4 (tyConRes1 ++ tyConRes2)
; let (vTyCons, vDataCons) = unzip (tyConRes1 ++ tyConRes2)
; return $ VectInfo
{ vectInfoVar = mkVarEnv vVars
, vectInfoTyCon = mkNameEnv vTyCons
, vectInfoDataCon = mkNameEnv (concat vDataCons)
, vectInfoPADFun = mkNameEnv (catMaybes vPAs)
, vectInfoIso = mkNameEnv (catMaybes vIsos)
, vectInfoScalarVars = mkVarSet (map lookupVar scalarVars)
, vectInfoScalarTyCons = scalarTyConsSet
}
......@@ -748,44 +745,31 @@ tcIfaceVectInfo mod typeEnv (IfaceVectInfo
}
vectTyConMapping name
= do { vName <- lookupOrig mod (mkLocalisedOccName mod mkVectTyConOcc name)
; paName <- lookupOrig mod (mkLocalisedOccName mod mkPADFunOcc name)
; isoName <- lookupOrig mod (mkLocalisedOccName mod mkVectIsoOcc name)
-- FIXME: we will need to use tcIfaceTyCon/tcIfaceExtId on some of these (but depends
-- on how we exactly define the 'VECTORISE type' pragma to work)
; let { tycon = lookupTyCon name
; vTycon = lookupTyCon vName
; paTycon = lookupVar paName
; isoTycon = lookupVar isoName
}
; vDataCons <- mapM vectDataConMapping (tyConDataCons tycon)
; return ( (name, (tycon, vTycon)) -- (T, T_v)
, vDataCons -- list of (Ci, Ci_v)
, Just (vName, (vTycon, paTycon)) -- (T_v, paT)
, Just (name, (tycon, isoTycon)) -- (T, isoT)
)
}
vectTyConReuseMapping scalarNames name
= do { paName <- lookupOrig mod (mkLocalisedOccName mod mkPADFunOcc name)
; isoName <- lookupOrig mod (mkLocalisedOccName mod mkVectIsoOcc name)
; tycon <- forkM (text ("vect reuse tycon") <+> ppr name) $
= do { tycon <- forkM (text ("vect reuse tycon") <+> ppr name) $
tcIfaceTyCon (IfaceTc name) -- somewhat naughty for wired in tycons, but ok
; if name `elemNameSet` scalarNames
then do
{ return ( (name, (tycon, tycon)) -- scalar type constructors expose no data...
, [] -- ...constructors and have no PA and ISO vars...
, Nothing -- ...see "Note [Pragmas to vectorise tycons]" in..
, Nothing -- ...'Vectorise.Type.Env'
)
{ return ( (name, (tycon, tycon)) -- scalar type constructors expose no data..
, [] -- ..constructors see..
) -- .."Note [Pragmas to vectorise tycons]"..
-- ..in 'Vectorise.Type.Env'
} else do
{ let { paTycon = lookupVar paName
; isoTycon = lookupVar isoName
; vDataCons = [ (dataConName dc, (dc, dc))
{ let { vDataCons = [ (dataConName dc, (dc, dc))
| dc <- tyConDataCons tycon]
}
; return ( (name, (tycon, tycon)) -- (T, T)
, vDataCons -- list of (Ci, Ci)
, Just (name, (tycon, paTycon)) -- (T, paT)
, Just (name, (tycon, isoTycon)) -- (T, isoT)
)
}}
vectDataConMapping datacon
......
......@@ -1910,8 +1910,6 @@ data VectInfo
{ vectInfoVar :: VarEnv (Var , Var ) -- ^ @(f, f_v)@ keyed on @f@
, vectInfoTyCon :: NameEnv (TyCon , TyCon) -- ^ @(T, T_v)@ keyed on @T@
, vectInfoDataCon :: NameEnv (DataCon, DataCon) -- ^ @(C, C_v)@ keyed on @C@
, vectInfoPADFun :: NameEnv (TyCon , Var) -- ^ @(T_v, paT)@ keyed on @T_v@
, vectInfoIso :: NameEnv (TyCon , Var) -- ^ @(T, isoT)@ keyed on @T@
, vectInfoScalarVars :: VarSet -- ^ set of purely scalar variables
, vectInfoScalarTyCons :: NameSet -- ^ set of scalar type constructors
}
......@@ -1937,16 +1935,13 @@ data IfaceVectInfo
noVectInfo :: VectInfo
noVectInfo
= VectInfo emptyVarEnv emptyNameEnv emptyNameEnv emptyNameEnv emptyNameEnv emptyVarSet
emptyNameSet
= VectInfo emptyVarEnv emptyNameEnv emptyNameEnv emptyVarSet emptyNameSet
plusVectInfo :: VectInfo -> VectInfo -> VectInfo
plusVectInfo vi1 vi2 =
VectInfo (vectInfoVar vi1 `plusVarEnv` vectInfoVar vi2)
(vectInfoTyCon vi1 `plusNameEnv` vectInfoTyCon vi2)
(vectInfoDataCon vi1 `plusNameEnv` vectInfoDataCon vi2)
(vectInfoPADFun vi1 `plusNameEnv` vectInfoPADFun vi2)
(vectInfoIso vi1 `plusNameEnv` vectInfoIso vi2)
(vectInfoScalarVars vi1 `unionVarSet` vectInfoScalarVars vi2)
(vectInfoScalarTyCons vi1 `unionNameSets` vectInfoScalarTyCons vi2)
......@@ -1961,8 +1956,6 @@ instance Outputable VectInfo where
[ ptext (sLit "variables :") <+> ppr (vectInfoVar info)
, ptext (sLit "tycons :") <+> ppr (vectInfoTyCon info)
, ptext (sLit "datacons :") <+> ppr (vectInfoDataCon info)
, ptext (sLit "PA dfuns :") <+> ppr (vectInfoPADFun info)
, ptext (sLit "iso :") <+> ppr (vectInfoIso info)
, ptext (sLit "scalar vars :") <+> ppr (vectInfoScalarVars info)
, ptext (sLit "scalar tycons :") <+> ppr (vectInfoScalarTyCons info)
]
......
......@@ -494,13 +494,9 @@ tidyInstances tidy_dfun ispecs
\begin{code}
tidyVectInfo :: TidyEnv -> VectInfo -> VectInfo
tidyVectInfo (_, var_env) info@(VectInfo { vectInfoVar = vars
, vectInfoPADFun = pas
, vectInfoIso = isos
, vectInfoScalarVars = scalarVars
})
= info { vectInfoVar = tidy_vars
, vectInfoPADFun = tidy_pas
, vectInfoIso = tidy_isos
, vectInfoScalarVars = tidy_scalarVars
}
where
......@@ -512,11 +508,6 @@ tidyVectInfo (_, var_env) info@(VectInfo { vectInfoVar = vars
, isExportedId tidy_var_v
]
tidy_pas = mapNameEnv tidy_snd_var pas
tidy_isos = mapNameEnv tidy_snd_var isos
tidy_snd_var (x, var) = (x, lookup_var var)
tidy_scalarVars = mkVarSet [ lookup_var var
| var <- varSetElems scalarVars
, isGlobalId var || isExportedId var]
......
......@@ -399,6 +399,9 @@ rANDOM = mkBaseModule (fsLit "System.Random")
gHC_EXTS = mkBaseModule (fsLit "GHC.Exts")
cONTROL_EXCEPTION_BASE = mkBaseModule (fsLit "Control.Exception.Base")
dATA_ARRAY_PARALLEL_PRIM :: PackageId -> Module
dATA_ARRAY_PARALLEL_PRIM pkg = mkModule pkg (mkModuleNameFS (fsLit "Data.Array.Parallel.Prim"))
gHC_PARR :: PackageId -> Module
gHC_PARR pkg = mkModule pkg (mkModuleNameFS (fsLit "Data.Array.Parallel"))
......
-- Types and functions declared in the DPH packages and used by the vectoriser.
-- Types and functions declared in 'Data.Array.Parallel.Prim' and used by the vectoriser.
--
-- The @Builtins@ structure holds the name of all the things in the DPH packages that appear in
-- code generated by the vectoriser. We can get specific things using the selectors, which print a
-- civilized panic message if the specified thing cannot be found.
-- The @Builtins@ structure holds the name of all the things in 'Data.Array.Parallel.Prim' that appear in
-- code generated by the vectoriser.
module Vectorise.Builtins (
-- * Builtins
Builtins(..),
indexBuiltin,
-- * Wrapped selectors
parray_PrimTyCon,
selTy,
selReplicate,
selPick,
selTags,
selElements,
sumTyCon,
prodTyCon,
prodDataCon,
replicatePD_PrimVar,
emptyPD_PrimVar,
packByTagPD_PrimVar,
combinePDVar,
combinePD_PrimVar,
scalarZip,
closureCtrFun,
-- * Initialisation
initBuiltins, initBuiltinVars, initBuiltinTyCons,
initBuiltinPAs, initBuiltinPRs,
-- * Lookup
primMethod,
primPArray
initBuiltins, initBuiltinVars, initBuiltinTyCons
) where
import Vectorise.Builtins.Base
import Vectorise.Builtins.Modules
import Vectorise.Builtins.Initialise
import TysPrim
import IfaceEnv
import TyCon
import DsMonad
import NameEnv
import Name
import Var
import Control.Monad
-- |Lookup a method function given its name and instance type.
--
primMethod :: TyCon -> String -> Builtins -> DsM (Maybe Var)
primMethod tycon method (Builtins { dphModules = mods })
| Just suffix <- lookupNameEnv prim_ty_cons (tyConName tycon)
= liftM Just
$ dsLookupGlobalId =<< lookupOrig (dph_Unboxed mods)
(mkVarOcc $ method ++ suffix)
| otherwise = return Nothing
-- |Lookup the representation type we use for PArrays that contain a given element type.
--
primPArray :: TyCon -> Builtins -> DsM (Maybe TyCon)
primPArray tycon (Builtins { dphModules = mods })
| Just suffix <- lookupNameEnv prim_ty_cons (tyConName tycon)
= liftM Just
$ dsLookupTyCon =<< lookupOrig (dph_Unboxed mods)
(mkTcOcc $ "PArray" ++ suffix)
| otherwise = return Nothing
prim_ty_cons :: NameEnv String
prim_ty_cons = mkNameEnv [mk_prim intPrimTyCon]
where
mk_prim tycon = (tyConName tycon, '_' : getOccString tycon)
-- | Builtin types and functions used by the vectoriser. These are all defined in the DPH package.
-- |Builtin types and functions used by the vectoriser. These are all defined in
-- 'Data.Array.Parallel.Prim'.
module Vectorise.Builtins.Base (
-- * Hard config
......@@ -6,26 +7,30 @@ module Vectorise.Builtins.Base (
mAX_DPH_SUM,
mAX_DPH_COMBINE,
mAX_DPH_SCALAR_ARGS,
aLL_DPH_PRIM_TYCONS,
-- * Builtins
Builtins(..),
indexBuiltin,
-- * Projections
selTy,
parray_PrimTyCon,
selTy,
selReplicate,
selPick,
selTags,
selElements,
sumTyCon,
prodTyCon,
prodDataCon,
replicatePD_PrimVar,
emptyPD_PrimVar,
packByTagPD_PrimVar,
combinePDVar,
combinePD_PrimVar,
scalarZip,
closureCtrFun
) where
import Vectorise.Builtins.Modules
import TysPrim
import BasicTypes
import Class
import CoreSyn
......@@ -33,11 +38,15 @@ import TysWiredIn
import Type
import TyCon
import DataCon
import NameEnv
import Name
import Outputable
import Data.Array
-- Numbers of things exported by the DPH library.
-- Cardinality of the various families of types and functions exported by the DPH library.
mAX_DPH_PROD :: Int
mAX_DPH_PROD = 5
......@@ -50,114 +59,83 @@ mAX_DPH_COMBINE = 2
mAX_DPH_SCALAR_ARGS :: Int
mAX_DPH_SCALAR_ARGS = 3
-- Types from 'GHC.Prim' supported by DPH
--
aLL_DPH_PRIM_TYCONS :: [Name]
aLL_DPH_PRIM_TYCONS = map tyConName [intPrimTyCon, {- floatPrimTyCon, -} doublePrimTyCon]
-- | Holds the names of the builtin types and functions used by the vectoriser.
-- |Holds the names of the types and functions from 'Data.Array.Parallel.Prim' that are used by the
-- vectoriser.
--
data Builtins
= Builtins
{ dphModules :: Modules
-- From dph-common:Data.Array.Parallel.Lifted.PArray
, parrayTyCon :: TyCon -- ^ PArray
, parrayDataCon :: DataCon -- ^ PArray
, pdataTyCon :: TyCon -- ^ PData
, paClass :: Class -- ^ PA
, paTyCon :: TyCon -- ^ PA
, paDataCon :: DataCon -- ^ PA
, paPRSel :: Var -- ^ PA
, preprTyCon :: TyCon -- ^ PRepr
, prClass :: Class -- ^ PR
, prTyCon :: TyCon -- ^ PR
, prDataCon :: DataCon -- ^ PR
, replicatePDVar :: Var -- ^ replicatePD
, emptyPDVar :: Var -- ^ emptyPD
, packByTagPDVar :: Var -- ^ packByTagPD
, combinePDVars :: Array Int Var -- ^ combinePD
, scalarClass :: Class -- ^ Scalar
-- From dph-common:Data.Array.Parallel.Lifted.Closure
, closureTyCon :: TyCon -- ^ :->
, closureVar :: Var -- ^ closure
, applyVar :: Var -- ^ $:
, liftedClosureVar :: Var -- ^ liftedClosure
, liftedApplyVar :: Var -- ^ liftedApply
, closureCtrFuns :: Array Int Var -- ^ closure1 .. closure2
-- From dph-common:Data.Array.Parallel.Lifted.Repr
, voidTyCon :: TyCon -- ^ Void
, wrapTyCon :: TyCon -- ^ Wrap
, sumTyCons :: Array Int TyCon -- ^ Sum2 .. Sum3
, voidVar :: Var -- ^ void
, pvoidVar :: Var -- ^ pvoid
, fromVoidVar :: Var -- ^ fromVoid
, punitVar :: Var -- ^ punit
-- From dph-common:Data.Array.Parallel.Lifted.Selector
, selTys :: Array Int Type -- ^ Sel2
, selReplicates :: Array Int CoreExpr -- ^ replicate2
, selPicks :: Array Int CoreExpr -- ^ pick2
, selTagss :: Array Int CoreExpr -- ^ tagsSel2
, selEls :: Array (Int, Int) CoreExpr -- ^ elementsSel2_0 .. elementsSel_2_1
-- From dph-common:Data.Array.Parallel.Lifted.Scalar
-- NOTE: map is counted as a zipWith fn with one argument array.
, scalarZips :: Array Int Var -- ^ map, zipWith, zipWith3
-- A Fresh variable
, liftingContext :: Var -- ^ lc
{ parrayTyCon :: TyCon -- ^ PArray
, parray_PrimTyCons :: NameEnv TyCon -- ^ PArray_Int# etc.
, pdataTyCon :: TyCon -- ^ PData
, prClass :: Class -- ^ PR
, prTyCon :: TyCon -- ^ PR
, preprTyCon :: TyCon -- ^ PRepr
, paClass :: Class -- ^ PA
, paTyCon :: TyCon -- ^ PA
, paDataCon :: DataCon -- ^ PA
, paPRSel :: Var -- ^ PA
, replicatePDVar :: Var -- ^ replicatePD
, replicatePD_PrimVars :: NameEnv Var -- ^ replicatePD_Int# etc.
, emptyPDVar :: Var -- ^ emptyPD
, emptyPD_PrimVars :: NameEnv Var -- ^ emptyPD_Int# etc.
, packByTagPDVar :: Var -- ^ packByTagPD
, packByTagPD_PrimVars :: NameEnv Var -- ^ packByTagPD_Int# etc.
, combinePDVars :: Array Int Var -- ^ combinePD
, combinePD_PrimVarss :: Array Int (NameEnv Var) -- ^ combine2PD_Int# etc.
, scalarClass :: Class -- ^ Scalar
, scalarZips :: Array Int Var -- ^ map, zipWith, zipWith3
, voidTyCon :: TyCon -- ^ Void
, voidVar :: Var -- ^ void
, fromVoidVar :: Var -- ^ fromVoid
, sumTyCons :: Array Int TyCon -- ^ Sum2 .. Sum3
, wrapTyCon :: TyCon -- ^ Wrap