Commit 3f6da561 authored by Joachim Breitner's avatar Joachim Breitner

New flag: -ddump-strsigs

The existing flag -ddump-stranal dumps the full Core, which is very
verbose and not always helpful. This adds a more concise output (one
line per top-level bind) that is faster to read, and especially more
suitable to be used when writing test cases for the strictness analiser.
parent 8528165d
......@@ -242,6 +242,7 @@ data DumpFlag
| Opt_D_dump_prep
| Opt_D_dump_stg
| Opt_D_dump_stranal
| Opt_D_dump_strsigs
| Opt_D_dump_tc
| Opt_D_dump_types
| Opt_D_dump_rules
......@@ -2311,6 +2312,7 @@ dynamic_flags = [
, Flag "ddump-prep" (setDumpFlag Opt_D_dump_prep)
, Flag "ddump-stg" (setDumpFlag Opt_D_dump_stg)
, Flag "ddump-stranal" (setDumpFlag Opt_D_dump_stranal)
, Flag "ddump-strsigs" (setDumpFlag Opt_D_dump_strsigs)
, Flag "ddump-tc" (setDumpFlag Opt_D_dump_tc)
, Flag "ddump-types" (setDumpFlag Opt_D_dump_types)
, Flag "ddump-rules" (setDumpFlag Opt_D_dump_rules)
......
......@@ -35,6 +35,7 @@ import Util
import Maybes ( isJust, orElse )
import TysWiredIn ( unboxedPairDataCon )
import TysPrim ( realWorldStatePrimTy )
import ErrUtils ( dumpIfSet_dyn )
\end{code}
%************************************************************************
......@@ -48,6 +49,8 @@ dmdAnalProgram :: DynFlags -> CoreProgram -> IO CoreProgram
dmdAnalProgram dflags binds
= do {
let { binds_plus_dmds = do_prog binds } ;
dumpIfSet_dyn dflags Opt_D_dump_strsigs "Strictness signatures" $
dumpStrSig binds_plus_dmds ;
return binds_plus_dmds
}
where
......@@ -1100,6 +1103,15 @@ set_idDemandInfo env id dmd
set_idStrictness :: AnalEnv -> Id -> StrictSig -> Id
set_idStrictness env id sig
= setIdStrictness id (zapStrictSig (ae_dflags env) sig)
dumpStrSig :: CoreProgram -> SDoc
dumpStrSig binds = vcat (concatMap goBind binds)
where
goBind (NonRec i _) = [ goId i ]
goBind (Rec bs) = map (goId . fst) bs
goId id | isExportedId id = ppr id <> colon <+> pprIfaceStrictSig (idStrictness id)
| otherwise = empty
\end{code}
Note [Initial CPR for strict binders]
......
......@@ -200,6 +200,16 @@
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-ddump-strsigs</option>:
<indexterm><primary><option>-ddump-strsigs</option></primary></indexterm>
</term>
<listitem>
<para>strictness signatures</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-ddump-cse</option>:
......
......@@ -2816,6 +2816,12 @@
<entry>dynamic</entry>
<entry>-</entry>
</row>
<row>
<entry><option>-ddump-strsigs</option></entry>
<entry>Dump strictness signatures</entry>
<entry>dynamic</entry>
<entry>-</entry>
</row>
<row>
<entry><option>-ddump-tc</option></entry>
<entry>Dump typechecker output</entry>
......
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