diff options
author | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2011-10-24 14:48:34 +1100 |
---|---|---|
committer | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2011-10-25 14:50:01 +1100 |
commit | 3bbd226eb5cc4f1ff92535936da144bbfb4426d1 (patch) | |
tree | 21b0def0b4ea0b1a45e48be309de0ad8e123d0b1 /compiler/vectorise/Vectorise/Utils/Base.hs | |
parent | 9ada6542bad350664b6991b33dc675daac999793 (diff) | |
download | haskell-3bbd226eb5cc4f1ff92535936da144bbfb4426d1.tar.gz |
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
Diffstat (limited to 'compiler/vectorise/Vectorise/Utils/Base.hs')
-rw-r--r-- | compiler/vectorise/Vectorise/Utils/Base.hs | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/compiler/vectorise/Vectorise/Utils/Base.hs b/compiler/vectorise/Vectorise/Utils/Base.hs index d41be1e87a..e87c7ca96f 100644 --- a/compiler/vectorise/Vectorise/Utils/Base.hs +++ b/compiler/vectorise/Vectorise/Utils/Base.hs @@ -1,27 +1,26 @@ - module Vectorise.Utils.Base ( - voidType, - newLocalVVar, - - mkDataConTagLit, - mkDataConTag, dataConTagZ, - mkBuiltinTyConApp, - mkBuiltinTyConApps, - mkWrapType, - mkClosureTypes, - mkPReprType, - mkPArrayType, splitPrimTyCon, - mkPArray, - mkPDataType, - mkBuiltinCo, - mkVScrut, - - preprSynTyCon, - pdataReprTyCon, - pdataReprDataCon, - prDFunOfTyCon -) -where + voidType, + newLocalVVar, + + mkDataConTagLit, + mkDataConTag, dataConTagZ, + mkBuiltinTyConApp, + mkBuiltinTyConApps, + mkWrapType, + mkClosureTypes, + mkPReprType, + mkPArrayType, splitPrimTyCon, + mkPArray, + mkPDataType, + mkBuiltinCo, + mkVScrut, + + preprSynTyCon, + pdataReprTyCon, + pdataReprDataCon, + prDFunOfTyCon +) where + import Vectorise.Monad import Vectorise.Vect import Vectorise.Builtins @@ -96,24 +95,23 @@ mkPReprType :: Type -> VM Type mkPReprType ty = mkBuiltinTyConApp preprTyCon [ty] ------ +-- |Wrap a type into 'PArray', treating unboxed types specially. +-- mkPArrayType :: Type -> VM Type mkPArrayType ty | Just tycon <- splitPrimTyCon ty - = do - r <- lookupPrimPArray tycon - case r of - Just arr -> return $ mkTyConApp arr [] - Nothing -> cantVectorise "Primitive tycon not vectorised" (ppr tycon) - + = do { arr <- builtin (parray_PrimTyCon tycon) + ; return $ mkTyConApp arr [] + } mkPArrayType ty = mkBuiltinTyConApp parrayTyCon [ty] +-- |Checks if a type constructor is defined in 'GHC.Prim' (e.g., 'Int#'); if so, returns it. +-- splitPrimTyCon :: Type -> Maybe TyCon splitPrimTyCon ty | Just (tycon, []) <- splitTyConApp_maybe ty , isPrimTyCon tycon = Just tycon - | otherwise = Nothing |