summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Config
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2022-06-01 00:26:54 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2022-06-02 15:43:59 +0000
commit5a3fdcfd615b502f123bb31f42d22577d44748ac (patch)
treeb7f22192f7f62c64cc98f7778689f6609c3def2b /compiler/GHC/Driver/Config
parent1838c3d8ed53bdd6750037f5cbbce771369820d5 (diff)
downloadhaskell-5a3fdcfd615b502f123bb31f42d22577d44748ac.tar.gz
HsToCore.Coverage: Purge DynFlagswip/coverage-config
Finishes what !7467 (closed) started. Progress towards #17957
Diffstat (limited to 'compiler/GHC/Driver/Config')
-rw-r--r--compiler/GHC/Driver/Config/HsToCore/Ticks.hs28
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