summaryrefslogtreecommitdiff
path: root/compiler/vectorise/Vectorise.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/vectorise/Vectorise.hs')
-rw-r--r--compiler/vectorise/Vectorise.hs24
1 files changed, 15 insertions, 9 deletions
diff --git a/compiler/vectorise/Vectorise.hs b/compiler/vectorise/Vectorise.hs
index f5795424da..1d54b3803d 100644
--- a/compiler/vectorise/Vectorise.hs
+++ b/compiler/vectorise/Vectorise.hs
@@ -1,3 +1,9 @@
+-- Main entry point to the vectoriser. It is invoked iff the option '-fvectorise' is passed.
+--
+-- This module provides the function 'vectorise', which vectorises an entire (desugared) module.
+-- It vectorises all type declarations and value bindings. It also processes all VECTORISE pragmas
+-- (aka vectorisation declarations), which can lead to the vectorisation of imported data types
+-- and the enrichment of imported functions with vectorised versions.
module Vectorise ( vectorise )
where
@@ -55,22 +61,22 @@ vectoriseIO hsc_env guts
-- | Vectorise a single module, in the VM monad.
--
vectModule :: ModGuts -> VM ModGuts
-vectModule guts@(ModGuts { mg_types = types
- , mg_binds = binds
- , mg_fam_insts = fam_insts
+vectModule guts@(ModGuts { mg_types = types
+ , mg_binds = binds
+ , mg_fam_insts = fam_insts
+ , mg_vect_decls = vect_decls
})
= do { dumpOptVt Opt_D_dump_vt_trace "Before vectorisation" $
pprCoreBindings binds
- -- Vectorise the type environment.
- -- This may add new TyCons and DataCons.
- ; (types', new_fam_insts, tc_binds) <- vectTypeEnv types
+ -- Vectorise the type environment. This will add vectorised type constructors, their
+ -- representaions, and the conrresponding data constructors. Moreover, we produce
+ -- bindings for dfuns and family instances of the classes and type families used in the
+ -- DPH library to represent array types.
+ ; (types', new_fam_insts, tc_binds) <- vectTypeEnv types [vd | vd@(VectType _ _) <- vect_decls]
; (_, fam_inst_env) <- readGEnv global_fam_inst_env
- -- dicts <- mapM buildPADict pa_insts
- -- workers <- mapM vectDataConWorkers pa_insts
-
-- Vectorise all the top level bindings.
; binds' <- mapM vectTopBind binds