Commit 89eb9e92 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Add traceSmpl for simplifier tracing, now that the simplifier has the IO monad

parent 9ea2b666
......@@ -202,6 +202,7 @@ data DumpFlag
| Opt_D_dump_inlinings
| Opt_D_dump_rule_firings
| Opt_D_dump_rule_rewrites
| Opt_D_dump_simpl_trace
| Opt_D_dump_occur_anal
| Opt_D_dump_parsed
| Opt_D_dump_rn
......@@ -1428,6 +1429,7 @@ dopt f dflags = (fromEnum f `IntSet.member` dumpFlags dflags)
enableIfVerbose Opt_D_dump_splices = False
enableIfVerbose Opt_D_dump_rule_firings = False
enableIfVerbose Opt_D_dump_rule_rewrites = False
enableIfVerbose Opt_D_dump_simpl_trace = False
enableIfVerbose Opt_D_dump_rtti = False
enableIfVerbose Opt_D_dump_inlinings = False
enableIfVerbose Opt_D_dump_core_stats = False
......@@ -2091,6 +2093,7 @@ dynamic_flags = [
, Flag "ddump-inlinings" (setDumpFlag Opt_D_dump_inlinings)
, Flag "ddump-rule-firings" (setDumpFlag Opt_D_dump_rule_firings)
, Flag "ddump-rule-rewrites" (setDumpFlag Opt_D_dump_rule_rewrites)
, Flag "ddump-simpl-trace" (setDumpFlag Opt_D_dump_simpl_trace)
, Flag "ddump-occur-anal" (setDumpFlag Opt_D_dump_occur_anal)
, Flag "ddump-parsed" (setDumpFlag Opt_D_dump_parsed)
, Flag "ddump-rn" (setDumpFlag Opt_D_dump_rn)
......
......@@ -7,7 +7,7 @@
module SimplMonad (
-- The monad
SimplM,
initSmpl,
initSmpl, traceSmpl,
getSimplRules, getFamEnvs,
-- Unique supply
......@@ -29,6 +29,7 @@ import CoreMonad
import Outputable
import FastString
import MonadUtils
import Control.Monad ( when )
\end{code}
%************************************************************************
......@@ -121,6 +122,13 @@ thenSmpl_ m k
-- {-# SPECIALIZE mapM :: (a -> SimplM b) -> [a] -> SimplM [b] #-}
-- {-# SPECIALIZE mapAndUnzipM :: (a -> SimplM (b, c)) -> [a] -> SimplM ([b],[c]) #-}
-- {-# SPECIALIZE mapAccumLM :: (acc -> b -> SimplM (acc,c)) -> acc -> [b] -> SimplM (acc, [c]) #-}
traceSmpl :: String -> SDoc -> SimplM ()
traceSmpl herald doc
= do { dflags <- getDynFlags
; when (dopt Opt_D_dump_simpl_trace dflags) $ liftIO $
printInfoForUser dflags alwaysQualify $
hang (text herald) 2 doc }
\end{code}
......
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