diff options
Diffstat (limited to 'compiler/GHC/Driver/Config')
-rw-r--r-- | compiler/GHC/Driver/Config/HsToCore/Ticks.hs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Config/HsToCore/Ticks.hs b/compiler/GHC/Driver/Config/HsToCore/Ticks.hs new file mode 100644 index 0000000000..1f98a7e2eb --- /dev/null +++ b/compiler/GHC/Driver/Config/HsToCore/Ticks.hs @@ -0,0 +1,28 @@ +module GHC.Driver.Config.HsToCore.Ticks + ( initTicksConfig + ) +where + +import GHC.Prelude + +import Data.Maybe (catMaybes) + +import GHC.Driver.Backend +import GHC.Driver.Session +import GHC.HsToCore.Ticks + +initTicksConfig :: DynFlags -> TicksConfig +initTicksConfig dflags = TicksConfig + { ticks_passes = coveragePasses dflags + , ticks_profAuto = profAuto dflags + , ticks_countEntries = gopt Opt_ProfCountEntries dflags + } + +coveragePasses :: DynFlags -> [TickishType] +coveragePasses dflags = catMaybes + [ ifA Breakpoints $ backendWantsBreakpointTicks $ backend dflags + , ifA HpcTicks $ gopt Opt_Hpc dflags + , ifA ProfNotes $ sccProfilingEnabled dflags && profAuto dflags /= NoProfAuto + , ifA SourceNotes $ needSourceNotes dflags + ] + where ifA x cond = if cond then Just x else Nothing |