Haskell Program Coverage
[ghc-hetmet.git] / compiler / main / HscTypes.lhs
index 399184a..4dc7894 100644 (file)
@@ -58,7 +58,8 @@ module HscTypes (
        -- Linker stuff
        Linkable(..), isObjectLinkable,
        Unlinked(..), CompiledByteCode,
-       isObject, nameOfObject, isInterpretable, byteCodeOfObject
+       isObject, nameOfObject, isInterpretable, byteCodeOfObject,
+        HpcInfo, noHpcInfo
     ) where
 
 #include "HsVersions.h"
@@ -440,12 +441,12 @@ data ModIface
 -- Should be able to construct ModDetails from mi_decls in ModIface
 data ModDetails
    = ModDetails {
-       -- The next three fields are created by the typechecker
-       md_exports  :: [AvailInfo],
-        md_types    :: !TypeEnv,
-        md_fam_insts :: ![FamInst],    -- Cached value extracted from md_types
-        md_insts    :: ![Instance],    -- Dfun-ids for the instances in this module
-        md_rules    :: ![CoreRule]     -- Domain may include Ids from other modules
+       -- The next two fields are created by the typechecker
+       md_exports   :: [AvailInfo],
+        md_types     :: !TypeEnv,
+        md_insts     :: ![Instance],   -- Dfun-ids for the instances in this module
+        md_fam_insts :: ![FamInst],
+        md_rules     :: ![CoreRule]    -- Domain may include Ids from other modules
      }
 
 emptyModDetails = ModDetails { md_types = emptyTypeEnv,
@@ -480,7 +481,8 @@ data ModGuts
        mg_fam_insts :: ![FamInst],      -- Instances 
         mg_rules     :: ![CoreRule],    -- Rules from this module
        mg_binds     :: ![CoreBind],     -- Bindings for this module
-       mg_foreign   :: !ForeignStubs
+       mg_foreign   :: !ForeignStubs,
+       mg_hpc_info  :: !HpcInfo         -- info about coverage tick boxes
     }
 
 -- The ModGuts takes on several slightly different forms:
@@ -517,7 +519,8 @@ data CgGuts
                -- initialisation code
 
        cg_foreign  :: !ForeignStubs,   
-       cg_dep_pkgs :: ![PackageId]     -- Used to generate #includes for C code gen
+       cg_dep_pkgs :: ![PackageId],    -- Used to generate #includes for C code gen
+        cg_hpc_info :: !HpcInfo         -- info about coverage tick boxes
     }
 
 -----------------------------------
@@ -857,11 +860,8 @@ instance Outputable n => Outputable (GenAvailInfo n) where
    ppr = pprAvail
 
 pprAvail :: Outputable n => GenAvailInfo n -> SDoc
-pprAvail (AvailTC n ns) = ppr n <> case {- filter (/= n) -} ns of
-                                       []  -> empty
-                                       ns' -> braces (hsep (punctuate comma (map ppr ns')))
-
-pprAvail (Avail n) = ppr n
+pprAvail (Avail n)      = ppr n
+pprAvail (AvailTC n ns) = ppr n <> braces (hsep (punctuate comma (map ppr ns)))
 \end{code}
 
 \begin{code}
@@ -1011,6 +1011,9 @@ data ExternalPackageState
        eps_fam_inst_env :: !PackageFamInstEnv,-- Ditto FamInstEnv
        eps_rule_base    :: !PackageRuleBase,  -- Ditto RuleEnv
 
+        eps_mod_fam_inst_env :: !(ModuleEnv FamInstEnv), -- identifies family
+                                                      -- instances of each mod
+
        eps_stats :: !EpsStats
   }
 
@@ -1139,6 +1142,19 @@ showModMsg target recomp mod_summary
 
 %************************************************************************
 %*                                                                     *
+\subsection{Hpc Support}
+%*                                                                     *
+%************************************************************************
+
+\begin{code}
+type HpcInfo = Int             -- just the number of ticks in a module
+
+noHpcInfo :: HpcInfo
+noHpcInfo = 0                  -- default = 0
+\end{code}
+
+%************************************************************************
+%*                                                                     *
 \subsection{Linkable stuff}
 %*                                                                     *
 %************************************************************************