diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-03-01 16:37:59 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-03-15 10:57:10 -0400 |
commit | 2e82465fff5851f00449131fdc8bacd3ca95f90f (patch) | |
tree | cb8c8f57b1c1bf9950c514d91286b3a5463778f4 /compiler/GHC/Driver | |
parent | dd6ffe6be742cf3ec98406704fef53ad86cc1560 (diff) | |
download | haskell-2e82465fff5851f00449131fdc8bacd3ca95f90f.tar.gz |
Refactor CmmToAsm (disentangle DynFlags)
This patch disentangles a bit more DynFlags from the native code
generator (CmmToAsm).
In more details:
- add a new NCGConfig datatype in GHC.CmmToAsm.Config which contains the
configuration of a native code generation session
- explicitly pass NCGConfig/Platform arguments when necessary
- as a consequence `sdocWithPlatform` is gone and there are only a few
`sdocWithDynFlags` left
- remove the use of `unsafeGlobalDynFlags` from GHC.CmmToAsm.CFG
- remove `sdocDebugLevel` (now we pass the debug level via NCGConfig)
There are still some places where DynFlags is used, especially because
of pretty-printing (CLabel), because of Cmm helpers (such as
`cmmExprType`) and because of `Outputable` instance for the
instructions. These are left for future refactoring as this patch is
already big.
Diffstat (limited to 'compiler/GHC/Driver')
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 97dd1a6f07..ac0bbbd286 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -235,7 +235,7 @@ module GHC.Driver.Session ( initSDocContext, -- * Make use of the Cmm CFG - CfgWeights(..), backendMaintainsCfg + CfgWeights(..) ) where #include "HsVersions.h" @@ -852,12 +852,6 @@ parseCfgWeights s oldWeights = ",likelyCondWeight=900,unlikelyCondWeight=300" ++ ",infoTablePenalty=300,backEdgeBonus=400" -backendMaintainsCfg :: DynFlags -> Bool -backendMaintainsCfg dflags = case (platformArch $ targetPlatform dflags) of - -- ArchX86 -- Should work but not tested so disabled currently. - ArchX86_64 -> True - _otherwise -> False - class HasDynFlags m where getDynFlags :: m DynFlags @@ -5226,7 +5220,6 @@ initSDocContext dflags style = SDC , sdocLineLength = pprCols dflags , sdocCanUseUnicode = useUnicode dflags , sdocHexWordLiterals = gopt Opt_HexWordLiterals dflags - , sdocDebugLevel = debugLevel dflags , sdocPprDebug = dopt Opt_D_ppr_debug dflags , sdocPrintUnicodeSyntax = gopt Opt_PrintUnicodeSyntax dflags , sdocPrintCaseAsLet = gopt Opt_PprCaseAsLet dflags |