never executed always true always false
    1 -- | Subsystem configuration
    2 module GHC.Driver.Config
    3    ( initOptCoercionOpts
    4    , initSimpleOpts
    5    , initBCOOpts
    6    , initEvalOpts
    7    )
    8 where
    9 
   10 import GHC.Prelude
   11 
   12 import GHC.Driver.Session
   13 import GHC.Core.SimpleOpt
   14 import GHC.Core.Coercion.Opt
   15 import GHC.Runtime.Interpreter (BCOOpts(..))
   16 import GHCi.Message (EvalOpts(..))
   17 
   18 import GHC.Conc (getNumProcessors)
   19 import Control.Monad.IO.Class
   20 
   21 -- | Initialise coercion optimiser configuration from DynFlags
   22 initOptCoercionOpts :: DynFlags -> OptCoercionOpts
   23 initOptCoercionOpts dflags = OptCoercionOpts
   24    { optCoercionEnabled = not (hasNoOptCoercion dflags)
   25    }
   26 
   27 -- | Initialise Simple optimiser configuration from DynFlags
   28 initSimpleOpts :: DynFlags -> SimpleOpts
   29 initSimpleOpts dflags = SimpleOpts
   30    { so_uf_opts = unfoldingOpts dflags
   31    , so_co_opts = initOptCoercionOpts dflags
   32    }
   33 
   34 -- | Extract BCO options from DynFlags
   35 initBCOOpts :: DynFlags -> IO BCOOpts
   36 initBCOOpts dflags = do
   37   -- Serializing ResolvedBCO is expensive, so if we're in parallel mode
   38   -- (-j<n>) parallelise the serialization.
   39   n_jobs <- case parMakeCount dflags of
   40               Nothing -> liftIO getNumProcessors
   41               Just n  -> return n
   42   return $ BCOOpts n_jobs
   43 
   44 -- | Extract GHCi options from DynFlags and step
   45 initEvalOpts :: DynFlags -> Bool -> EvalOpts
   46 initEvalOpts dflags step =
   47   EvalOpts
   48     { useSandboxThread = gopt Opt_GhciSandbox dflags
   49     , singleStep       = step
   50     , breakOnException = gopt Opt_BreakOnException dflags
   51     , breakOnError     = gopt Opt_BreakOnError dflags
   52     }
   53