module GHC.Driver.Config.Cmm ( initCmmConfig ) where import GHC.Cmm.Config import GHC.Cmm.Switch (backendSupportsSwitch) import GHC.Driver.Session import GHC.Driver.Backend import GHC.Platform import GHC.Prelude initCmmConfig :: DynFlags -> CmmConfig initCmmConfig :: DynFlags -> CmmConfig initCmmConfig DynFlags dflags = CmmConfig { cmmProfile :: Profile cmmProfile = DynFlags -> Profile targetProfile DynFlags dflags , cmmOptControlFlow :: Bool cmmOptControlFlow = GeneralFlag -> DynFlags -> Bool gopt GeneralFlag Opt_CmmControlFlow DynFlags dflags , cmmDoLinting :: Bool cmmDoLinting = GeneralFlag -> DynFlags -> Bool gopt GeneralFlag Opt_DoCmmLinting DynFlags dflags , cmmOptElimCommonBlks :: Bool cmmOptElimCommonBlks = GeneralFlag -> DynFlags -> Bool gopt GeneralFlag Opt_CmmElimCommonBlocks DynFlags dflags , cmmOptSink :: Bool cmmOptSink = GeneralFlag -> DynFlags -> Bool gopt GeneralFlag Opt_CmmSink DynFlags dflags , cmmGenStackUnwindInstr :: Bool cmmGenStackUnwindInstr = DynFlags -> Int debugLevel DynFlags dflags Int -> Int -> Bool forall a. Ord a => a -> a -> Bool > Int 0 , cmmExternalDynamicRefs :: Bool cmmExternalDynamicRefs = GeneralFlag -> DynFlags -> Bool gopt GeneralFlag Opt_ExternalDynamicRefs DynFlags dflags , cmmDoCmmSwitchPlans :: Bool cmmDoCmmSwitchPlans = Bool -> Bool not (Bool -> Bool) -> (DynFlags -> Bool) -> DynFlags -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c . Backend -> Bool backendSupportsSwitch (Backend -> Bool) -> (DynFlags -> Backend) -> DynFlags -> Bool forall b c a. (b -> c) -> (a -> b) -> a -> c . DynFlags -> Backend backend (DynFlags -> Bool) -> DynFlags -> Bool forall a b. (a -> b) -> a -> b $ DynFlags dflags , cmmSplitProcPoints :: Bool cmmSplitProcPoints = (DynFlags -> Backend backend DynFlags dflags Backend -> Backend -> Bool forall a. Eq a => a -> a -> Bool /= Backend NCG) Bool -> Bool -> Bool || Bool -> Bool not (Platform -> Bool platformTablesNextToCode Platform platform) Bool -> Bool -> Bool || Bool usingInconsistentPicReg } where platform :: Platform platform = DynFlags -> Platform targetPlatform DynFlags dflags usingInconsistentPicReg :: Bool usingInconsistentPicReg = case (Platform -> Arch platformArch Platform platform, Platform -> OS platformOS Platform platform, DynFlags -> Bool positionIndependent DynFlags dflags) of (Arch ArchX86, OS OSDarwin, Bool pic) -> Bool pic (Arch, OS, Bool) _ -> Bool False