From 9579a855ecd50ddfb54dec3d0e1f25e57d54d968 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 8 Apr 2022 13:01:24 -0400 Subject: Move `backendSupportsSwitch` to `GHC.Driver.Config.Cmm` `Backend` is a CLI syntax notion `DynFlags` that shouldn't be used in specific components, only in the translation from `DynFlags`. ------------------------- Metric Decrease: T9630 ------------------------- --- compiler/GHC/Cmm/Switch.hs | 9 --------- compiler/GHC/Driver/Config/Cmm.hs | 8 +++++++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/compiler/GHC/Cmm/Switch.hs b/compiler/GHC/Cmm/Switch.hs index f8c6c674ef..42b01b36e3 100644 --- a/compiler/GHC/Cmm/Switch.hs +++ b/compiler/GHC/Cmm/Switch.hs @@ -8,14 +8,12 @@ module GHC.Cmm.Switch ( switchTargetsToList, eqSwitchTargetWith, SwitchPlan(..), - backendSupportsSwitch, createSwitchPlan, ) where import GHC.Prelude import GHC.Utils.Outputable -import GHC.Driver.Backend import GHC.Utils.Panic import GHC.Cmm.Dataflow.Label (Label) @@ -312,13 +310,6 @@ and slowed down all other cases making it not worthwhile. -} --- | Does the backend support switch out of the box? Then leave this to the --- backend! -backendSupportsSwitch :: Backend -> Bool -backendSupportsSwitch ViaC = True -backendSupportsSwitch LLVM = True -backendSupportsSwitch _ = False - -- | This function creates a SwitchPlan from a SwitchTargets value, breaking it -- down into smaller pieces suitable for code generation. createSwitchPlan :: SwitchTargets -> SwitchPlan diff --git a/compiler/GHC/Driver/Config/Cmm.hs b/compiler/GHC/Driver/Config/Cmm.hs index 38bab62048..810ec857e0 100644 --- a/compiler/GHC/Driver/Config/Cmm.hs +++ b/compiler/GHC/Driver/Config/Cmm.hs @@ -3,7 +3,6 @@ module GHC.Driver.Config.Cmm ) where import GHC.Cmm.Config -import GHC.Cmm.Switch (backendSupportsSwitch) import GHC.Driver.Session import GHC.Driver.Backend @@ -31,3 +30,10 @@ initCmmConfig dflags = CmmConfig case (platformArch platform, platformOS platform, positionIndependent dflags) of (ArchX86, OSDarwin, pic) -> pic _ -> False + +-- | Does the backend support switch out of the box? Then leave this to the +-- backend! +backendSupportsSwitch :: Backend -> Bool +backendSupportsSwitch ViaC = True +backendSupportsSwitch LLVM = True +backendSupportsSwitch _ = False -- cgit v1.2.1