summaryrefslogtreecommitdiff
path: root/compiler/cmm/CLabel.hs
diff options
context:
space:
mode:
authorandy@galois.com <unknown>2006-10-24 21:29:07 +0000
committerandy@galois.com <unknown>2006-10-24 21:29:07 +0000
commitd5934bbb856aa0aa620c9b2e0fa51c90a1a5a048 (patch)
tree065c061d4ff87a6ca8bff6a3a4b0fe205728e066 /compiler/cmm/CLabel.hs
parent33b8b60e0aa925962cd11a8be98d9818666d58a0 (diff)
downloadhaskell-d5934bbb856aa0aa620c9b2e0fa51c90a1a5a048.tar.gz
Haskell Program Coverage
This large checkin is the new ghc version of Haskell Program Coverage, an expression-level coverage tool for Haskell. Parts: - Hpc.[ch] - small runtime support for Hpc; reading/writing *.tix files. - Coverage.lhs - Annotates the HsSyn with coverage tickboxes. - New Note's in Core, - TickBox -- ticked on entry to sub-expression - BinaryTickBox -- ticked on exit to sub-expression, depending -- on the boolean result. - New Stg level TickBox (no BinaryTickBoxes, though) You can run the coverage tool with -fhpc at compile time. Main must be compiled with -fhpc.
Diffstat (limited to 'compiler/cmm/CLabel.hs')
-rw-r--r--compiler/cmm/CLabel.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
index f6c5148e35..54abe2351b 100644
--- a/compiler/cmm/CLabel.hs
+++ b/compiler/cmm/CLabel.hs
@@ -93,6 +93,9 @@ module CLabel (
mkPicBaseLabel,
mkDeadStripPreventer,
+ mkHpcTicksLabel,
+ mkHpcModuleNameLabel,
+
infoLblToEntryLbl, entryLblToInfoLbl,
needsCDecl, isAsmTemp, externallyVisibleCLabel,
CLabelType(..), labelType, labelDynamic,
@@ -205,6 +208,9 @@ data CLabel
| DeadStripPreventer CLabel
-- label before an info table to prevent excessive dead-stripping on darwin
+ | HpcTicksLabel Module -- Per-module table of tick locations
+ | HpcModuleNameLabel -- Per-module name of the module for Hpc
+
deriving (Eq, Ord)
data IdLabelInfo
@@ -402,6 +408,11 @@ mkRtsApFastLabel str = RtsLabel (RtsApFast str)
mkRtsSlowTickyCtrLabel :: String -> CLabel
mkRtsSlowTickyCtrLabel pat = RtsLabel (RtsSlowTickyCtr pat)
+ -- Coverage
+
+mkHpcTicksLabel = HpcTicksLabel
+mkHpcModuleNameLabel = HpcModuleNameLabel
+
-- Dynamic linking
mkDynamicLinkerLabel :: DynamicLinkerLabelInfo -> CLabel -> CLabel
@@ -473,6 +484,8 @@ needsCDecl (RtsLabel _) = False
needsCDecl (ForeignLabel _ _ _) = False
needsCDecl (CC_Label _) = True
needsCDecl (CCS_Label _) = True
+needsCDecl (HpcTicksLabel _) = True
+needsCDecl HpcModuleNameLabel = False
-- Whether the label is an assembler temporary:
@@ -501,6 +514,8 @@ externallyVisibleCLabel (DynIdLabel name _) = isExternalName name
externallyVisibleCLabel (CC_Label _) = True
externallyVisibleCLabel (CCS_Label _) = True
externallyVisibleCLabel (DynamicLinkerLabel _ _) = False
+externallyVisibleCLabel (HpcTicksLabel _) = True
+externallyVisibleCLabel HpcModuleNameLabel = False
-- -----------------------------------------------------------------------------
-- Finding the "type" of a CLabel
@@ -761,6 +776,12 @@ pprCLbl (ModuleInitLabel mod way _)
pprCLbl (PlainModuleInitLabel mod _)
= ptext SLIT("__stginit_") <> ppr mod
+pprCLbl (HpcTicksLabel mod)
+ = ptext SLIT("_tickboxes_") <> ppr mod <> ptext SLIT("_hpc")
+
+pprCLbl HpcModuleNameLabel
+ = ptext SLIT("_hpc_module_name_str")
+
ppIdFlavor :: IdLabelInfo -> SDoc
ppIdFlavor x = pp_cSEP <>
(case x of