diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2022-06-01 00:26:54 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2022-06-02 15:43:59 +0000 |
commit | 5a3fdcfd615b502f123bb31f42d22577d44748ac (patch) | |
tree | b7f22192f7f62c64cc98f7778689f6609c3def2b /compiler/GHC/Driver | |
parent | 1838c3d8ed53bdd6750037f5cbbce771369820d5 (diff) | |
download | haskell-wip/coverage-config.tar.gz |
HsToCore.Coverage: Purge DynFlagswip/coverage-config
Finishes what !7467 (closed) started.
Progress towards #17957
Diffstat (limited to 'compiler/GHC/Driver')
-rw-r--r-- | compiler/GHC/Driver/Config/HsToCore/Ticks.hs | 28 | ||||
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 9 |
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' |