HORIZON HASKELLDocslts/ghc-9.14.xb2f3bfd2026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · b2f3bfd · 2026-10-11

Moduleghc-9.14.1GHC2021

GHC.HsToCore.Coverage

  • 2 values
  • Packageghc-9.14.1
  • Exports2
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceCoverage.hs
valuehpcInitCode :: Platform -> Module -> HpcInfo -> CStub
#

Create HPC initialization C code for a module

Each module compiled with -fhpc declares an initialisation function of the form `hpc_init_module()`, which is emitted into the _stub.c file and annotated with attribute((constructor)) so that it gets executed at startup time.

The function's purpose is to call hs_hpc_module to register this module with the RTS, and it looks something like this:

static void hpc_init_Main(void) __attribute__((constructor));
static void hpc_init_Main(void)
{
  extern StgWord64 _hpc_tickboxes_Main_hpc[];
  hs_hpc_module("Main",8,1150288664,_hpc_tickboxes_Main_hpc);
}