module GHC.Driver.Config.Cmm ( initCmmConfig ) where import GHC.Cmm.Config import GHC.Driver.DynFlags 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 , cmmOptThreadSanitizer :: Bool cmmOptThreadSanitizer = GeneralFlag -> DynFlags -> Bool gopt GeneralFlag Opt_CmmThreadSanitizer 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 (Backend -> Bool backendHasNativeSwitch (DynFlags -> Backend backend DynFlags dflags)) Bool -> Bool -> Bool || Platform -> Arch platformArch Platform platform Arch -> Arch -> Bool forall a. Eq a => a -> a -> Bool == Arch ArchWasm32 , cmmSplitProcPoints :: Bool cmmSplitProcPoints = Bool -> Bool not (Backend -> Bool backendSupportsUnsplitProcPoints (DynFlags -> Backend backend DynFlags dflags)) 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