diff options
author | Michal Terepeta <michal.terepeta@gmail.com> | 2016-11-02 15:05:19 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-11-02 15:42:01 -0400 |
commit | dc4d59621dff31908dc7646082a2c5a362deb10f (patch) | |
tree | 063ce7e359630cb9d7a9849fe948f283de86abc7 /compiler/cmm/CmmProcPoint.hs | |
parent | 6fecb7e784daabe3f62ef8090e7019d7ad384080 (diff) | |
download | haskell-dc4d59621dff31908dc7646082a2c5a362deb10f.tar.gz |
Hoopl/Dataflow: make the module more self-contained
This makes the GHC's Dataflow module more self-contained by also
forking the `DataflowLattice` (instead of only the analysis
algorithm). Effects/benefits:
- We no longer need to use the deprecated Hoopl functions (and can
remove `-fno-warn-warnings-deprecations` from two modules).
- We can remove the unnecessary `Label` parameter of `JoinFun` (already
ignored in all our implementations).
- We no longer mix Hoopl's `Dataflow` module and GHC's one.
- We can replace some calls to lazy folds in Hoopl with the strict ones
(see `joinOutFacts` and `mkFactBase`).
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
Test Plan: validate
Reviewers: austin, simonmar, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2660
Diffstat (limited to 'compiler/cmm/CmmProcPoint.hs')
-rw-r--r-- | compiler/cmm/CmmProcPoint.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/cmm/CmmProcPoint.hs b/compiler/cmm/CmmProcPoint.hs index e409fc42a1..9459a1058c 100644 --- a/compiler/cmm/CmmProcPoint.hs +++ b/compiler/cmm/CmmProcPoint.hs @@ -155,14 +155,14 @@ forward = mkFTransfer3 first middle last last l x = mkFactBase lattice $ map (\id -> (id, x)) (successors l) lattice :: DataflowLattice Status -lattice = DataflowLattice "direct proc-point reachability" unreached add_to +lattice = DataflowLattice unreached add_to where unreached = ReachedBy setEmpty - add_to _ (OldFact ProcPoint) _ = (NoChange, ProcPoint) - add_to _ _ (NewFact ProcPoint) = (SomeChange, ProcPoint) + add_to (OldFact ProcPoint) _ = NotChanged ProcPoint + add_to _ (NewFact ProcPoint) = Changed ProcPoint -- because of previous case - add_to _ (OldFact (ReachedBy p)) (NewFact (ReachedBy p')) - | setSize union > setSize p = (SomeChange, ReachedBy union) - | otherwise = (NoChange, ReachedBy p) + add_to (OldFact (ReachedBy p)) (NewFact (ReachedBy p')) + | setSize union > setSize p = Changed (ReachedBy union) + | otherwise = NotChanged (ReachedBy p) where union = setUnion p' p |