X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FsimplCore%2FSimplMonad.lhs;h=8a02b174e85631ff8b76f49c5a9804a5de0f98f7;hb=1baa2b524831211cb66317194216d41325d65f1c;hp=c4676599f8479f76170de298235bacede56f2a77;hpb=78260da4deee97a866ba83f8d73a8284b371f405;p=ghc-hetmet.git diff --git a/compiler/simplCore/SimplMonad.lhs b/compiler/simplCore/SimplMonad.lhs index c467659..8a02b17 100644 --- a/compiler/simplCore/SimplMonad.lhs +++ b/compiler/simplCore/SimplMonad.lhs @@ -21,7 +21,7 @@ module SimplMonad ( -- Switch checker SwitchChecker, SwitchResult(..), getSimplIntSwitch, - isAmongSimpl, intSwitchSet, switchIsOn + isAmongSimpl, intSwitchSet, switchIsOn, allOffSwitchChecker ) where import Id ( Id, mkSysLocal ) @@ -177,17 +177,22 @@ plusSimplCount :: SimplCount -> SimplCount -> SimplCount \end{code} \begin{code} -data SimplCount = VerySimplZero -- These two are used when - | VerySimplNonZero -- we are only interested in - -- termination info - - | SimplCount { - ticks :: !Int, -- Total ticks - details :: !TickCounts, -- How many of each type - n_log :: !Int, -- N - log1 :: [Tick], -- Last N events; <= opt_HistorySize - log2 :: [Tick] -- Last opt_HistorySize events before that - } +data SimplCount + = VerySimplZero -- These two are used when + | VerySimplNonZero -- we are only interested in + -- termination info + + | SimplCount { + ticks :: !Int, -- Total ticks + details :: !TickCounts, -- How many of each type + + n_log :: !Int, -- N + log1 :: [Tick], -- Last N events; <= opt_HistorySize, + -- most recent first + log2 :: [Tick] -- Last opt_HistorySize events before that + -- Having log1, log2 lets us accumulate the + -- recent history reasonably efficiently + } type TickCounts = FiniteMap Tick Int @@ -243,10 +248,10 @@ pprSimplCount VerySimplZero = ptext (sLit "Total ticks: ZERO!") pprSimplCount VerySimplNonZero = ptext (sLit "Total ticks: NON-ZERO!") pprSimplCount (SimplCount { ticks = tks, details = dts, log1 = l1, log2 = l2 }) = vcat [ptext (sLit "Total ticks: ") <+> int tks, - text "", + blankLine, pprTickCounts (fmToList dts), if verboseSimplStats then - vcat [text "", + vcat [blankLine, ptext (sLit "Log (most recent first)"), nest 4 (vcat (map ppr l1) $$ vcat (map ppr l2))] else empty @@ -267,12 +272,8 @@ pprTickCounts ((tick1,n1):ticks) tot_n = sum [n | (_,n) <- real_these] pprTCDetails :: [(Tick, Int)] -> SDoc -pprTCDetails ticks@((tick,_):_) - | verboseSimplStats || isRuleFired tick +pprTCDetails ticks = nest 4 (vcat [int n <+> pprTickCts tick | (tick,n) <- ticks]) - | otherwise - = empty -pprTCDetails [] = panic "pprTCDetails []" \end{code} %************************************************************************ @@ -306,10 +307,6 @@ data Tick | BottomFound | SimplifierDone -- Ticked at each iteration of the simplifier -isRuleFired :: Tick -> Bool -isRuleFired (RuleFired _) = True -isRuleFired _ = False - instance Outputable Tick where ppr tick = text (tickString tick) <+> pprTickCts tick @@ -380,11 +377,8 @@ pprTickCts _ = empty cmpTick :: Tick -> Tick -> Ordering cmpTick a b = case (tickToTag a `compare` tickToTag b) of GT -> GT - EQ | isRuleFired a || verboseSimplStats -> cmpEqTick a b - | otherwise -> EQ + EQ -> cmpEqTick a b LT -> LT - -- Always distinguish RuleFired, so that the stats - -- can report them even in non-verbose mode cmpEqTick :: Tick -> Tick -> Ordering cmpEqTick (PreInlineUnconditionally a) (PreInlineUnconditionally b) = a `compare` b @@ -419,6 +413,9 @@ data SwitchResult | SwString FastString -- nothing or a String | SwInt Int -- nothing or an Int +allOffSwitchChecker :: SwitchChecker +allOffSwitchChecker _ = SwBool False + isAmongSimpl :: [SimplifierSwitch] -> SimplifierSwitch -> SwitchResult isAmongSimpl on_switches -- Switches mentioned later occur *earlier* -- in the list; defaults right at the end.