summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CoreUtils.hs
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2019-01-28 16:49:04 +0100
committerSebastian Graf <sebastian.graf@kit.edu>2020-02-12 11:00:58 +0100
commit059c3c9d7c84fc37c69e9f414ff736d47081e72c (patch)
treeda3c17ac002b9c6d31542af78553769fd40d5d65 /compiler/coreSyn/CoreUtils.hs
parentf0c0ee7d9a942a19361e72553cd08f42cc12b04a (diff)
downloadhaskell-059c3c9d7c84fc37c69e9f414ff736d47081e72c.tar.gz
Separate CPR analysis from the Demand analyserwip/sep-cpr
The reasons for that can be found in the wiki: https://gitlab.haskell.org/ghc/ghc/wikis/nested-cpr/split-off-cpr We now run CPR after demand analysis (except for after the final demand analysis run just before code gen). CPR got its own dump flags (`-ddump-cpr-anal`, `-ddump-cpr-signatures`), but not its own flag to activate/deactivate. It will run with `-fstrictness`/`-fworker-wrapper`. As explained on the wiki page, this step is necessary for a sane Nested CPR analysis. And it has quite positive impact on compiler performance: Metric Decrease: T9233 T9675 T9961 T15263
Diffstat (limited to 'compiler/coreSyn/CoreUtils.hs')
-rw-r--r--compiler/coreSyn/CoreUtils.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs
index e073078766..cde9dc0e45 100644
--- a/compiler/coreSyn/CoreUtils.hs
+++ b/compiler/coreSyn/CoreUtils.hs
@@ -54,7 +54,10 @@ module CoreUtils (
collectMakeStaticArgs,
-- * Join points
- isJoinBind
+ isJoinBind,
+
+ -- * Dumping stuff
+ dumpIdInfoOfProgram
) where
#include "HsVersions.h"
@@ -2550,3 +2553,12 @@ isJoinBind :: CoreBind -> Bool
isJoinBind (NonRec b _) = isJoinId b
isJoinBind (Rec ((b, _) : _)) = isJoinId b
isJoinBind _ = False
+
+dumpIdInfoOfProgram :: (IdInfo -> SDoc) -> CoreProgram -> SDoc
+dumpIdInfoOfProgram ppr_id_info binds = vcat (map printId ids)
+ where
+ ids = sortBy (stableNameCmp `on` getName) (concatMap getIds binds)
+ getIds (NonRec i _) = [ i ]
+ getIds (Rec bs) = map fst bs
+ printId id | isExportedId id = ppr id <> colon <+> (ppr_id_info (idInfo id))
+ | otherwise = empty