diff --git a/compiler/GHC/Driver/Main.hs b/compiler/GHC/Driver/Main.hs index 45df4946e04c9575736cbad618472f2cc82c6337..b83320f25699a1d63369f9136ef49faa64aed68a 100644 --- a/compiler/GHC/Driver/Main.hs +++ b/compiler/GHC/Driver/Main.hs @@ -1797,9 +1797,14 @@ hscGenHardCode hsc_env cgguts location output_filename = do (late_cc_binds, late_local_ccs, cc_state) <- if gopt Opt_ProfLateCcs dflags && not (gopt Opt_ProfLateInlineCcs dflags) - then {-# SCC lateCC #-} do - (binds, late_ccs, cc_state) <- addLateCostCentresPgm dflags logger this_mod core_binds - return ( binds, (S.toList late_ccs `mappend` local_ccs ), cc_state) + then + withTiming + logger + (text "LateCCs"<+>brackets (ppr this_mod)) + (const ()) + $ {-# SCC lateCC #-} do + (binds, late_ccs, cc_state) <- addLateCostCentresPgm dflags logger this_mod core_binds + return ( binds, (S.toList late_ccs `mappend` local_ccs ), cc_state) else return (core_binds, local_ccs, newCostCentreState) @@ -1819,15 +1824,19 @@ hscGenHardCode hsc_env cgguts location output_filename = do } , _ ) <- - {-# SCC "latePlugins" #-} - withPlugins (hsc_plugins hsc_env) - (($ hsc_env) . latePlugin) - ( cgguts - { cg_binds = late_cc_binds - , cg_ccs = late_local_ccs - } - , cc_state - ) + {-# SCC latePlugins #-} + withTiming + logger + (text "LatePlugins"<+>brackets (ppr this_mod)) + (const ()) $ + withPlugins (hsc_plugins hsc_env) + (($ hsc_env) . latePlugin) + ( cgguts + { cg_binds = late_cc_binds + , cg_ccs = late_local_ccs + } + , cc_state + ) let hooks = hsc_hooks hsc_env diff --git a/compiler/GHC/Driver/Plugins.hs b/compiler/GHC/Driver/Plugins.hs index 017fdf743c50915c907a6bdb7809bcfe4818bfe0..7a268906d0ce5a4ecbd754d95041ff05b4511015 100644 --- a/compiler/GHC/Driver/Plugins.hs +++ b/compiler/GHC/Driver/Plugins.hs @@ -58,6 +58,10 @@ module GHC.Driver.Plugins ( -- | hole fit plugins allow plugins to change the behavior of valid hole -- fit suggestions , HoleFitPluginR + -- ** Late plugins + -- | Late plugins can access and modify the core of a module after + -- optimizations have been applied and after interface creation. + , LatePlugin -- * Internal , PluginWithArgs(..), pluginsWithArgs, pluginRecompile' @@ -90,7 +94,6 @@ import GHC.Hs import GHC.Types.Error (Messages) import GHC.Linker.Types import GHC.Types.CostCentre.State -import GHC.Types.CostCentre import GHC.Types.Unique.DFM import GHC.Unit.Module.ModGuts (CgGuts)