[commit: ghc] master: Some improvements on CoreToDos passed to plugins (bcd55a9)
git at git.haskell.org
git at git.haskell.org
Sun Nov 29 22:26:12 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/bcd55a94f234f5efa4bb4fd24429dafc79d93106/ghc
>---------------------------------------------------------------
commit bcd55a94f234f5efa4bb4fd24429dafc79d93106
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date: Sun Nov 29 22:49:46 2015 +0100
Some improvements on CoreToDos passed to plugins
This patch does two improvements:
- We now show ToDos in `CoreDoPasses`. This is pretty important,
otherwise `CoreDoPasses` makes debugging impossible in some cases.
- Before running ToDos we run a cleanup pass on ToDos to remove
`CoreDoNothing`s and flatten `CoreDoPasses`. This removes a lot of
noise from `[CoreToDo]` argument passed to plugins.
Reviewers: simonpj, bgamari, austin
Reviewed By: bgamari, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1548
>---------------------------------------------------------------
bcd55a94f234f5efa4bb4fd24429dafc79d93106
compiler/simplCore/CoreMonad.hs | 2 +-
compiler/simplCore/SimplCore.hs | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/compiler/simplCore/CoreMonad.hs b/compiler/simplCore/CoreMonad.hs
index ce5286d..fa72834 100644
--- a/compiler/simplCore/CoreMonad.hs
+++ b/compiler/simplCore/CoreMonad.hs
@@ -169,7 +169,7 @@ instance Outputable CoreToDo where
ppr CoreDoPrintCore = ptext (sLit "Print core")
ppr (CoreDoRuleCheck {}) = ptext (sLit "Rule check")
ppr CoreDoNothing = ptext (sLit "CoreDoNothing")
- ppr (CoreDoPasses {}) = ptext (sLit "CoreDoPasses")
+ ppr (CoreDoPasses passes) = ptext (sLit "CoreDoPasses") <+> ppr passes
pprPassDetails :: CoreToDo -> SDoc
pprPassDetails (CoreDoSimplify n md) = vcat [ ptext (sLit "Max iterations =") <+> int n
diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs
index 9207cf4..8670e30 100644
--- a/compiler/simplCore/SimplCore.hs
+++ b/compiler/simplCore/SimplCore.hs
@@ -109,7 +109,7 @@ core2core hsc_env guts@(ModGuts { mg_module = mod
getCoreToDo :: DynFlags -> [CoreToDo]
getCoreToDo dflags
- = core_todo
+ = flatten_todos core_todo
where
opt_level = optLevel dflags
phases = simplPhases dflags
@@ -322,6 +322,13 @@ getCoreToDo dflags
maybe_rule_check (Phase 0)
]
+ -- Remove 'CoreDoNothing' and flatten 'CoreDoPasses' for clarity.
+ flatten_todos [] = []
+ flatten_todos (CoreDoNothing : rest) = flatten_todos rest
+ flatten_todos (CoreDoPasses passes : rest) =
+ flatten_todos passes ++ flatten_todos rest
+ flatten_todos (todo : rest) = todo : flatten_todos rest
+
-- Loading plugins
addPluginPasses :: [CoreToDo] -> CoreM [CoreToDo]
More information about the ghc-commits
mailing list