diff options
author | doyougnu <jeffrey.young@iohk.io> | 2021-12-14 13:04:17 -0800 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-12-22 00:12:27 -0500 |
commit | 1a596d069991255e196621d06a046f60359f3129 (patch) | |
tree | 899cf688c007b92e4d96b839f18d0579eb9793e2 /compiler/GHC/Driver/Config | |
parent | ff657a81ae5ebd4ea4628ca8ebc88dce3ecbe0ef (diff) | |
download | haskell-1a596d069991255e196621d06a046f60359f3129.tar.gz |
Cmm: DynFlags to CmmConfig refactor
add files GHC.Cmm.Config, GHC.Driver.Config.Cmm
Cmm: DynFlag references --> CmmConfig
Cmm.Pipeline: reorder imports, add handshake
Cmm: DynFlag references --> CmmConfig
Cmm.Pipeline: DynFlag references --> CmmConfig
Cmm.LayoutStack: DynFlag references -> CmmConfig
Cmm.Info.Build: DynFlag references -> CmmConfig
Cmm.Config: use profile to retrieve platform
Cmm.CLabel: unpack NCGConfig in labelDynamic
Cmm.Config: reduce CmmConfig surface area
Cmm.Config: add cmmDoCmmSwitchPlans field
Cmm.Config: correct cmmDoCmmSwitchPlans flag
The original implementation dispatches work in cmmImplementSwitchPlans
in an `otherwise` branch, hence we must add a not to correctly dispatch
Cmm.Config: add cmmSplitProcPoints simplify Config
remove cmmBackend, and cmmPosInd
Cmm.CmmToAsm: move ncgLabelDynamic to CmmToAsm
Cmm.CLabel: remove cmmLabelDynamic function
Cmm.Config: rename cmmOptDoLinting -> cmmDoLinting
testsuite: update CountDepsAst CountDepsParser
Diffstat (limited to 'compiler/GHC/Driver/Config')
-rw-r--r-- | compiler/GHC/Driver/Config/Cmm.hs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Config/Cmm.hs b/compiler/GHC/Driver/Config/Cmm.hs new file mode 100644 index 0000000000..38bab62048 --- /dev/null +++ b/compiler/GHC/Driver/Config/Cmm.hs @@ -0,0 +1,33 @@ +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 dflags = CmmConfig + { cmmProfile = targetProfile dflags + , cmmOptControlFlow = gopt Opt_CmmControlFlow dflags + , cmmDoLinting = gopt Opt_DoCmmLinting dflags + , cmmOptElimCommonBlks = gopt Opt_CmmElimCommonBlocks dflags + , cmmOptSink = gopt Opt_CmmSink dflags + , cmmGenStackUnwindInstr = debugLevel dflags > 0 + , cmmExternalDynamicRefs = gopt Opt_ExternalDynamicRefs dflags + , cmmDoCmmSwitchPlans = not . backendSupportsSwitch . backend $ dflags + , cmmSplitProcPoints = (backend dflags /= NCG) + || not (platformTablesNextToCode platform) + || usingInconsistentPicReg + } + where platform = targetPlatform dflags + usingInconsistentPicReg = + case (platformArch platform, platformOS platform, positionIndependent dflags) + of (ArchX86, OSDarwin, pic) -> pic + _ -> False |