mi_insts = insts,
mi_fam_insts = fam_insts,
mi_rules = rules,
- mi_rule_vers = rule_vers }) = do
+ mi_rule_vers = rule_vers,
+ mi_vect_info = vect_info }) = do
put_ bh mod
put_ bh is_boot
put_ bh mod_vers
put_ bh fam_insts
lazyPut bh rules
put_ bh rule_vers
+ put_ bh vect_info
get bh = do
mod_name <- get bh
fam_insts <- {-# SCC "bin_fam_insts" #-} get bh
rules <- {-# SCC "bin_rules" #-} lazyGet bh
rule_vers <- get bh
+ vect_info <- get bh
return (ModIface {
mi_module = mod_name,
mi_boot = is_boot,
mi_fam_insts = fam_insts,
mi_rules = rules,
mi_rule_vers = rule_vers,
+ mi_vect_info = vect_info,
-- And build the cached values
mi_dep_fn = mkIfaceDepCache deprecs,
mi_fix_fn = mkIfaceFixCache fixities,
a7 <- get bh
return (IfaceRule a1 a2 a3 a4 a5 a6 a7)
+instance Binary IfaceVectInfo where
+ put_ bh (IfaceVectInfo a1) = do
+ put_ bh a1
+ get bh = do
+ a1 <- get bh
+ return (IfaceVectInfo a1)
+
import FamInstEnv
import Name
import NameEnv
+import NameSet
import MkId
import Module
import OccName
--
-- The main thing is to add the ModIface to the PIT, but
-- we also take the
- -- IfaceDecls, IfaceInst, IfaceRules
+ -- IfaceDecls, IfaceInst, IfaceFamInst, IfaceRules, IfaceVectInfo
-- out of the ModIface and put them into the big EPS pools
-- NB: *first* we do loadDecl, so that the provenance of all the locally-defined
mi_insts = panic "No mi_insts in PIT",
mi_fam_insts = panic "No mi_fam_insts in PIT",
mi_rules = panic "No mi_rules in PIT"
- } }
+ }
+ ; new_eps_vect_info =
+ VectInfo {
+ vectInfoCCVar = mkNameSet
+ (ifaceVectInfoCCVar . mi_vect_info $ iface)
+ }
+ }
; updateEps_ $ \ eps ->
eps {
new_eps_insts,
eps_fam_inst_env = extendFamInstEnvList (eps_fam_inst_env eps)
new_eps_fam_insts,
+ eps_vect_info = plusVectInfo (eps_vect_info eps)
+ new_eps_vect_info,
eps_mod_fam_inst_env
= let
fam_inst_env =
-- Initialise the EPS rule pool with the built-in rules
eps_mod_fam_inst_env
= emptyModuleEnv,
+ eps_vect_info = noVectInfo,
eps_stats = EpsStats { n_ifaces_in = 0, n_decls_in = 0, n_decls_out = 0
, n_insts_in = 0, n_insts_out = 0
, n_rules_in = length builtinRules, n_rules_out = 0 }
mg_deps = deps,
mg_rdr_env = rdr_env,
mg_fix_env = fix_env,
- mg_deprecs = src_deprecs })
+ mg_deprecs = src_deprecs,
+ mg_vect_info = vect_info })
(ModDetails{ md_insts = insts,
md_fam_insts = fam_insts,
md_rules = rules,
mi_decls = deliberatelyOmitted "decls",
mi_ver_fn = deliberatelyOmitted "ver_fn",
+ mi_vect_info = flattenVectInfo vect_info,
+
-- And build the cached values
mi_dep_fn = mkIfaceDepCache deprecs,
mi_fix_fn = mkIfaceFixCache fixities }
deliberatelyOmitted x = panic ("Deliberately omitted: " ++ x)
ifFamInstTcName = ifaceTyConName . ifFamInstTyCon
+ flattenVectInfo (VectInfo ccVar) = IfaceVectInfo (nameSetToList ccVar)
+
-----------------------------
writeIfaceFile :: DynFlags -> ModLocation -> ModIface -> IO ()
writeIfaceFile dflags location new_iface
ModBreaks (..), BreakIndex, emptyModBreaks,
-- Vectorisation information
- VectInfo(..), noVectInfo
+ VectInfo(..), IfaceVectInfo(..), noVectInfo, plusVectInfo,
+ noIfaceVectInfo
) where
#include "HsVersions.h"
-- instances (for classes and families)
-- combined
+ -- Vectorisation information
+ mi_vect_info :: !IfaceVectInfo,
+
-- Cached environments for easy lookup
-- These are computed (lazily) from other fields
-- and are not put into the interface file
mi_decls = [],
mi_globals = Nothing,
mi_rule_vers = initialVersion,
+ mi_vect_info = noIfaceVectInfo,
mi_dep_fn = emptyIfaceDepCache,
mi_fix_fn = emptyIfaceFixCache,
mi_ver_fn = emptyIfaceVerCache
type PackageRuleBase = RuleBase
type PackageInstEnv = InstEnv
type PackageFamInstEnv = FamInstEnv
+type PackageVectInfo = VectInfo
data ExternalPackageState
= EPS {
-- modules
eps_fam_inst_env :: !PackageFamInstEnv,-- Ditto FamInstEnv
eps_rule_base :: !PackageRuleBase, -- Ditto RuleEnv
+ eps_vect_info :: !PackageVectInfo, -- Ditto VectInfo
eps_mod_fam_inst_env :: !(ModuleEnv FamInstEnv), -- identifies family
- -- instances of each mod
-
+ -- instances of each mod
eps_stats :: !EpsStats
}
%* *
%************************************************************************
+The following information is generated and consumed by the vectorisation
+subsystem. It communicates the vectorisation status of declarations from one
+module to another.
+
\begin{code}
-data VectInfo = VectInfo {
- vectInfoCCVar :: NameSet
- }
+-- ModGuts version
+data VectInfo = VectInfo {
+ vectInfoCCVar :: NameSet
+ }
+
+-- ModIface version
+data IfaceVectInfo = IfaceVectInfo {
+ ifaceVectInfoCCVar :: [Name]
+ }
noVectInfo :: VectInfo
noVectInfo = VectInfo emptyNameSet
+
+plusVectInfo :: VectInfo -> VectInfo -> VectInfo
+plusVectInfo vi1 vi2 =
+ VectInfo (vectInfoCCVar vi1 `unionNameSets` vectInfoCCVar vi2)
+
+noIfaceVectInfo :: IfaceVectInfo
+noIfaceVectInfo = IfaceVectInfo []
\end{code}
%************************************************************************