1 -----------------------------------------------------------------------------
3 -- Code generation for coverage
5 -- (c) Galois Connections, Inc. 2006
7 -----------------------------------------------------------------------------
9 module StgCmmHpc ( initHpc, mkTickBox ) where
22 mkTickBox :: Module -> Int -> CmmAGraph
24 = mkStore tick_box (CmmMachOp (MO_Add W64)
25 [ CmmLoad tick_box b64
26 , CmmLit (CmmInt 1 W64)
29 tick_box = cmmIndex W64
30 (CmmLit $ CmmLabel $ mkHpcTicksLabel $ mod)
33 initHpc :: Module -> HpcInfo -> FCode ()
34 -- Emit top-level tables for HPC and return code to initialise
35 initHpc _ (NoHpcInfo {})
37 initHpc this_mod (HpcInfo tickCount _hashNo)
39 do { emitData Data $ [ CmmDataLabel (mkHpcTicksLabel this_mod)
41 [ CmmStaticLit (CmmInt 0 W64)
42 | _ <- take tickCount [0::Int ..]