summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Driver')
-rw-r--r--compiler/GHC/Driver/Config/HsToCore/Ticks.hs28
-rw-r--r--compiler/GHC/Driver/Session.hs9
2 files changed, 29 insertions, 8 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
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index e200bd46bb..af4301cce7 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -246,6 +246,7 @@ import GHC.Types.Error (DiagnosticReason(..))
import GHC.Types.SrcLoc
import GHC.Types.SafeHaskell
import GHC.Types.Basic ( IntWithInf, treatZeroAsInf )
+import GHC.Types.ProfAuto
import qualified GHC.Types.FieldLabel as FieldLabel
import GHC.Data.FastString
import GHC.Utils.TmpFs
@@ -759,14 +760,6 @@ instance (Monad m, HasDynFlags m) => HasDynFlags (ExceptT e m) where
class ContainsDynFlags t where
extractDynFlags :: t -> DynFlags
-data ProfAuto
- = NoProfAuto -- ^ no SCC annotations added
- | ProfAutoAll -- ^ top-level and nested functions are annotated
- | ProfAutoTop -- ^ top-level functions annotated only
- | ProfAutoExports -- ^ exported functions annotated only
- | ProfAutoCalls -- ^ annotate call-sites
- deriving (Eq,Enum)
-
-----------------------------------------------------------------------------
-- Accessessors from 'DynFlags'