diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2022-02-06 07:59:19 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2022-06-15 18:05:35 +0000 |
commit | 59bc600871eb23d3cf83025a3c05dbb3a14b033a (patch) | |
tree | 5db39dca53d25d42fe517042ecbda813cddcc940 /compiler/GHC/Driver/Main.hs | |
parent | ac83899dcb5931913699d191f2c46780483ed07e (diff) | |
download | haskell-59bc600871eb23d3cf83025a3c05dbb3a14b033a.tar.gz |
CoreToStg.Prep: Get rid of `DynFlags` and `HscEnv`wip/no-dyn-flags-core-cmm
The call sites in `Driver.Main` are duplicative, but this is good,
because the next step is to remove `InteractiveContext` from `Core.Lint`
into `Core.Lint.Interactive`.
Also further clean up `Core.Lint` to use a better configuration record
than the one we initially added.
Diffstat (limited to 'compiler/GHC/Driver/Main.hs')
-rw-r--r-- | compiler/GHC/Driver/Main.hs | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs index 7db9b62331..2936630db8 100644 --- a/compiler/GHC/Driver/Main.hs +++ b/compiler/GHC/Driver/Main.hs @@ -113,6 +113,7 @@ import GHC.Driver.Errors.Types import GHC.Driver.CodeOutput import GHC.Driver.Config.Cmm.Parser (initCmmParserConfig) import GHC.Driver.Config.Core.Lint ( endPassHscEnvIO, lintInteractiveExpr ) +import GHC.Driver.Config.CoreToStg.Prep import GHC.Driver.Config.Logger (initLogFlags) import GHC.Driver.Config.Parser (initParserOpts) import GHC.Driver.Config.Stg.Ppr (initStgPprOpts) @@ -1689,9 +1690,13 @@ hscGenHardCode hsc_env cgguts location output_filename = do ------------------- -- PREPARE FOR CODE GENERATION -- Do saturation and convert to A-normal form - (prepd_binds) <- {-# SCC "CorePrep" #-} - corePrepPgm hsc_env this_mod location - core_binds data_tycons + (prepd_binds) <- {-# SCC "CorePrep" #-} do + cp_cfg <- initCorePrepConfig hsc_env + corePrepPgm + (hsc_logger hsc_env) + cp_cfg + (initCorePrepPgmConfig (hsc_IC hsc_env) (hsc_dflags hsc_env)) + this_mod location core_binds data_tycons ----------------- Convert to STG ------------------ (stg_binds, denv, (caf_ccs, caf_cc_stacks)) @@ -1768,8 +1773,13 @@ hscInteractive hsc_env cgguts location = do ------------------- -- PREPARE FOR CODE GENERATION -- Do saturation and convert to A-normal form - prepd_binds <- {-# SCC "CorePrep" #-} - corePrepPgm hsc_env this_mod location core_binds data_tycons + prepd_binds <- {-# SCC "CorePrep" #-} do + cp_cfg <- initCorePrepConfig hsc_env + corePrepPgm + (hsc_logger hsc_env) + cp_cfg + (initCorePrepPgmConfig (hsc_IC hsc_env) (hsc_dflags hsc_env)) + this_mod location core_binds data_tycons (stg_binds, _infotable_prov, _caf_ccs__caf_cc_stacks) <- {-# SCC "CoreToStg" #-} @@ -2110,8 +2120,13 @@ hscParsedDecls hsc_env decls = runInteractiveHsc hsc_env $ do {- Prepare For Code Generation -} -- Do saturation and convert to A-normal form - prepd_binds <- {-# SCC "CorePrep" #-} - liftIO $ corePrepPgm hsc_env this_mod iNTERACTIVELoc core_binds data_tycons + prepd_binds <- {-# SCC "CorePrep" #-} liftIO $ do + cp_cfg <- initCorePrepConfig hsc_env + corePrepPgm + (hsc_logger hsc_env) + cp_cfg + (initCorePrepPgmConfig (hsc_IC hsc_env) (hsc_dflags hsc_env)) + this_mod iNTERACTIVELoc core_binds data_tycons (stg_binds, _infotable_prov, _caf_ccs__caf_cc_stacks) <- {-# SCC "CoreToStg" #-} @@ -2327,7 +2342,10 @@ hscCompileCoreExpr' hsc_env srcspan ds_expr ; let tidy_expr = tidyExpr emptyTidyEnv simpl_expr {- Prepare for codegen -} - ; prepd_expr <- corePrepExpr hsc_env tidy_expr + ; cp_cfg <- initCorePrepConfig hsc_env + ; prepd_expr <- corePrepExpr + (hsc_logger hsc_env) cp_cfg + tidy_expr {- Lint if necessary -} ; lintInteractiveExpr (text "hscCompileExpr") hsc_env prepd_expr |