diff options
| author | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2011-11-25 22:57:40 +1100 |
|---|---|---|
| committer | Manuel M T Chakravarty <chak@cse.unsw.edu.au> | 2011-11-25 23:03:01 +1100 |
| commit | 18aae18503442276e14a47eabf4786bc7210662e (patch) | |
| tree | dfc556a1b047c0031342db4b8e8d429b5f230613 /compiler/vectorise/Vectorise/Env.hs | |
| parent | 498467cf44e871a6abdb1e16714f6e91c7b10a80 (diff) | |
| download | haskell-18aae18503442276e14a47eabf4786bc7210662e.tar.gz | |
Fix newtype wrapper for 'PData[s] (Wrap a)' and fix VECTORISE type and instance pragmas
* Correct usage of new type wrappers from MkId
* 'VECTORISE [SCALAR] type T = S' didn't work correctly across module boundaries
* Clean up 'VECTORISE SCALAR instance'
Diffstat (limited to 'compiler/vectorise/Vectorise/Env.hs')
| -rw-r--r-- | compiler/vectorise/Vectorise/Env.hs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/compiler/vectorise/Vectorise/Env.hs b/compiler/vectorise/Vectorise/Env.hs index 64ab075cef..ffaf388b31 100644 --- a/compiler/vectorise/Vectorise/Env.hs +++ b/compiler/vectorise/Vectorise/Env.hs @@ -129,6 +129,10 @@ data GlobalEnv -- |Create an initial global environment. -- +-- We add scalar variables and type constructors identified by vectorisation pragmas already here +-- to the global table, so that we can query scalarness during vectorisation, and especially, when +-- vectorising the scalar entities' definitions themselves. +-- initGlobalEnv :: VectInfo -> [CoreVect] -> (InstEnv, InstEnv) -> FamInstEnvs -> GlobalEnv initGlobalEnv info vectDecls instEnvs famInstEnvs = GlobalEnv @@ -151,10 +155,16 @@ initGlobalEnv info vectDecls instEnvs famInstEnvs -- FIXME: we currently only allow RHSes consisting of a -- single variable to be able to obtain the type without -- inference — see also 'TcBinds.tcVect' - scalar_vars = [var | Vect var Nothing <- vectDecls] ++ - [var | VectInst True var <- vectDecls] - novects = [var | NoVect var <- vectDecls] - scalar_tycons = [tyConName tycon | VectType True tycon _ <- vectDecls] + scalar_vars = [var | Vect var Nothing <- vectDecls] ++ + [var | VectInst var <- vectDecls] + novects = [var | NoVect var <- vectDecls] + scalar_tycons = [tyConName tycon | VectType True tycon Nothing <- vectDecls] ++ + [tyConName tycon | VectType _ tycon (Just tycon') <- vectDecls + , tycon == tycon'] + -- - for 'VectType True tycon Nothing', we checked that the type does not + -- contain arrays (or type variables that could be instatiated to arrays) + -- - for 'VectType _ tycon (Just tycon')', where the two tycons are the same, + -- we also know that there can be no embedded arrays -- Operators on Global Environments ------------------------------------------- @@ -207,7 +217,7 @@ modVectInfo env mg_ids mg_tyCons vectDecls info } where vectIds = [id | Vect id _ <- vectDecls] ++ - [id | VectInst _ id <- vectDecls] + [id | VectInst id <- vectDecls] vectTypeTyCons = [tycon | VectType _ tycon _ <- vectDecls] ++ [tycon | VectClass tycon <- vectDecls] vectDataCons = concatMap tyConDataCons vectTypeTyCons |
