1 -----------------------------------------------------------------------------
3 -- Code generation for coverage
5 -- (c) Galois Connections, Inc. 2006
7 -----------------------------------------------------------------------------
9 module CgHpc (cgTickBox, hpcTable) where
18 cgTickBox :: Module -> Int -> Code
20 let tick_box = (cmmIndex W64
21 (CmmLit $ CmmLabel $ mkHpcTicksLabel $ mod)
24 stmtsC [ CmmStore tick_box
25 (CmmMachOp (MO_Add W64)
26 [ CmmLoad tick_box b64
27 , CmmLit (CmmInt 1 W64)
31 hpcTable :: Module -> HpcInfo -> Code
32 hpcTable this_mod (HpcInfo hpc_tickCount _) = do
33 emitData Data $ [ CmmDataLabel (mkHpcTicksLabel this_mod)
35 [ CmmStaticLit (CmmInt 0 W64)
36 | _ <- take hpc_tickCount [0::Int ..]
39 hpcTable _ (NoHpcInfo {}) = error "TODO: impossible"