Commit 72f2257c authored by Sylvain Henry's avatar Sylvain Henry Committed by Marge Bot

Don't initialize plugins in the Core2Core pipeline

Some plugins can be added via TH (cf addCorePlugin). Initialize them in
the driver instead of in the Core2Core pipeline.
parent ecfd0278
Pipeline #27715 failed with stages
in 560 minutes and 57 seconds
......@@ -60,7 +60,6 @@ import GHC.Unit.Module.Env
import GHC.Unit.Module.ModGuts
import GHC.Unit.Module.Deps
import GHC.Runtime.Loader -- ( initializePlugins )
import GHC.Runtime.Context
import GHC.Types.SrcLoc
......@@ -88,17 +87,14 @@ core2core hsc_env guts@(ModGuts { mg_module = mod
, mg_loc = loc
, mg_deps = deps
, mg_rdr_env = rdr_env })
= do { -- make sure all plugins are loaded
; let builtin_passes = getCoreToDo dflags
= do { let builtin_passes = getCoreToDo dflags
orph_mods = mkModuleSet (mod : dep_orphs deps)
uniq_mask = 's'
;
; (guts2, stats) <- runCoreM hsc_env hpt_rule_base uniq_mask mod
orph_mods print_unqual loc $
do { hsc_env' <- getHscEnv
; hsc_env'' <- liftIO $ initializePlugins hsc_env'
; all_passes <- withPlugins hsc_env''
; all_passes <- withPlugins hsc_env'
installCoreToDos
builtin_passes
; runCorePasses all_passes guts }
......
......@@ -1426,16 +1426,22 @@ hscGetSafeMode tcg_env = do
-- Simplifiers
--------------------------------------------------------------
-- | Run Core2Core simplifier. The list of String is a list of (Core) plugin
-- module names added via TH (cf 'addCorePlugin').
hscSimplify :: HscEnv -> [String] -> ModGuts -> IO ModGuts
hscSimplify hsc_env plugins modguts =
runHsc hsc_env $ hscSimplify' plugins modguts
-- | Run Core2Core simplifier. The list of String is a list of (Core) plugin
-- module names added via TH (cf 'addCorePlugin').
hscSimplify' :: [String] -> ModGuts -> Hsc ModGuts
hscSimplify' plugins ds_result = do
hsc_env <- getHscEnv
let hsc_env_with_plugins = hsc_env
{ hsc_dflags = foldr addPluginModuleName (hsc_dflags hsc_env) plugins
}
hsc_env_with_plugins <- if null plugins -- fast path
then return hsc_env
else liftIO $ initializePlugins $ hsc_env
{ hsc_dflags = foldr addPluginModuleName (hsc_dflags hsc_env) plugins
}
{-# SCC "Core2Core" #-}
liftIO $ core2core hsc_env_with_plugins ds_result
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment