Added a pragma {-# NOVECTORISE f #-} that suppresses vectorisation of toplevel variab...
[ghc-hetmet.git] / compiler / vectorise / Vectorise / Env.hs
index fe7be1f..97bb5ae 100644 (file)
@@ -77,52 +77,56 @@ emptyLocalEnv = LocalEnv {
 --
 data GlobalEnv 
         = GlobalEnv
-        -- |Mapping from global variables to their vectorised versions — aka the /vectorisation
-        --  map/.
         { global_vars           :: VarEnv Var
+          -- ^Mapping from global variables to their vectorised versions — aka the /vectorisation
+          -- map/.
 
-        -- |Mapping from global variables that have a vectorisation declaration to the right-hand
-        --  side of that declaration and its type.  This mapping only applies to non-scalar
-        --  vectorisation declarations.  All variables with a scalar vectorisation declaration are
-        --  mentioned in 'global_scalars_vars'.
         , global_vect_decls     :: VarEnv (Type, CoreExpr)
+          -- ^Mapping from global variables that have a vectorisation declaration to the right-hand
+          -- side of that declaration and its type.  This mapping only applies to non-scalar
+          -- vectorisation declarations.  All variables with a scalar vectorisation declaration are
+          -- mentioned in 'global_scalars_vars'.
 
-        -- |Purely scalar variables. Code which mentions only these variables doesn't have to be
-        --  lifted.  This includes variables from the current module that have a scalar
-        --  vectorisation declaration and those that the vectoriser determines to be scalar.
         , global_scalar_vars    :: VarSet
+          -- ^Purely scalar variables. Code which mentions only these variables doesn't have to be
+          -- lifted.  This includes variables from the current module that have a scalar
+          -- vectorisation declaration and those that the vectoriser determines to be scalar.
 
-        -- |Type constructors whose values can only contain scalar data.  Scalar code may only
-        -- operate on such data.
         , global_scalar_tycons  :: NameSet
+          -- ^Type constructors whose values can only contain scalar data.  Scalar code may only
+          -- operate on such data.
+        
+        , global_novect_vars    :: VarSet
+          -- ^Variables that are not vectorised.  (They may be referenced in the right-hand sides
+          -- of vectorisation declarations, though.)
 
-        -- |Exported variables which have a vectorised version.
         , global_exported_vars  :: VarEnv (Var, Var)
+          -- ^Exported variables which have a vectorised version.
 
-        -- |Mapping from TyCons to their vectorised versions.
-        --  TyCons which do not have to be vectorised are mapped to themselves.
         , global_tycons         :: NameEnv TyCon
+          -- ^Mapping from TyCons to their vectorised versions.
+          -- TyCons which do not have to be vectorised are mapped to themselves.
 
-        -- |Mapping from DataCons to their vectorised versions.
         , global_datacons       :: NameEnv DataCon
+          -- ^Mapping from DataCons to their vectorised versions.
 
-        -- |Mapping from TyCons to their PA dfuns.
         , global_pa_funs        :: NameEnv Var
+          -- ^Mapping from TyCons to their PA dfuns.
 
-        -- |Mapping from TyCons to their PR dfuns.
         , global_pr_funs        :: NameEnv Var
+          -- ^Mapping from TyCons to their PR dfuns.
 
-        -- |Mapping from unboxed TyCons to their boxed versions.
         , global_boxed_tycons   :: NameEnv TyCon
+          -- ^Mapping from unboxed TyCons to their boxed versions.
 
-        -- |External package inst-env & home-package inst-env for class instances.
         , global_inst_env       :: (InstEnv, InstEnv)
+          -- ^External package inst-env & home-package inst-env for class instances.
 
-        -- |External package inst-env & home-package inst-env for family instances.
         , global_fam_inst_env   :: FamInstEnvs
+          -- ^External package inst-env & home-package inst-env for family instances.
 
-        -- |Hoisted bindings.
         , global_bindings       :: [(Var, CoreExpr)]
+          -- ^Hoisted bindings.
         }
 
 -- |Create an initial global environment.
@@ -134,6 +138,7 @@ initGlobalEnv info vectDecls instEnvs famInstEnvs
   , global_vect_decls    = mkVarEnv vects
   , global_scalar_vars   = vectInfoScalarVars   info `extendVarSetList` scalars
   , global_scalar_tycons = vectInfoScalarTyCons info
+  , global_novect_vars   = mkVarSet novects
   , global_exported_vars = emptyVarEnv
   , global_tycons        = mapNameEnv snd $ vectInfoTyCon info
   , global_datacons      = mapNameEnv snd $ vectInfoDataCon info
@@ -147,6 +152,7 @@ initGlobalEnv info vectDecls instEnvs famInstEnvs
   where
     vects   = [(var, (varType var, exp)) | Vect var (Just exp) <- vectDecls]
     scalars = [var                       | Vect var Nothing    <- vectDecls]
+    novects = [var                       | NoVect var          <- vectDecls]
 
 
 -- Operators on Global Environments -------------------------------------------