[commit: ghc] wip/js-hoopl-cleanup: Simplify backwards analysis (3135172)

git at git.haskell.org git at git.haskell.org
Thu Feb 11 09:05:57 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/js-hoopl-cleanup
Link       : http://ghc.haskell.org/trac/ghc/changeset/31351724ddea0a42792ae7e5a9a4e60a94108734/ghc

>---------------------------------------------------------------

commit 31351724ddea0a42792ae7e5a9a4e60a94108734
Author: Jan Stolarek <jan.stolarek at p.lodz.pl>
Date:   Mon Jan 18 21:24:15 2016 +0100

    Simplify backwards analysis


>---------------------------------------------------------------

31351724ddea0a42792ae7e5a9a4e60a94108734
 compiler/cmm/CmmUtils.hs       |  4 +---
 compiler/cmm/Hoopl/Dataflow.hs | 15 ++++++---------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/compiler/cmm/CmmUtils.hs b/compiler/cmm/CmmUtils.hs
index ef24923..018e8ea 100644
--- a/compiler/cmm/CmmUtils.hs
+++ b/compiler/cmm/CmmUtils.hs
@@ -588,8 +588,6 @@ dataflowAnalFwdBlocks :: NonLocal n =>
                 -> FwdPass UniqSM n f
                 -> UniqSM (BlockEnv f)
 dataflowAnalFwdBlocks (CmmGraph {g_entry=entry, g_graph=graph}) facts fwd = do
---  (graph, facts, NothingO) <- analyzeAndRewriteFwd fwd (JustC [entry]) graph (mkFactBase (fp_lattice fwd) facts)
---  return facts
   return (analyzeFwdBlocks fwd entry graph (mkFactBase (fp_lattice fwd) facts))
 
 dataflowAnalBwd :: NonLocal n =>
@@ -597,7 +595,7 @@ dataflowAnalBwd :: NonLocal n =>
                 -> BwdPass UniqSM n f
                 -> BlockEnv f
 dataflowAnalBwd (CmmGraph {g_entry=entry, g_graph=graph}) facts bwd =
-  analyzeBwd bwd (JustC [entry]) graph (mkFactBase (bp_lattice bwd) facts)
+  analyzeBwd bwd entry graph (mkFactBase (bp_lattice bwd) facts)
 
 dataflowPassBwd :: NonLocal n =>
                    GenCmmGraph n -> [(BlockId, f)]
diff --git a/compiler/cmm/Hoopl/Dataflow.hs b/compiler/cmm/Hoopl/Dataflow.hs
index 6b38608..660617f 100644
--- a/compiler/cmm/Hoopl/Dataflow.hs
+++ b/compiler/cmm/Hoopl/Dataflow.hs
@@ -296,20 +296,17 @@ analyzeFwdBlocks FwdPass { fp_lattice = lattice,
 analyzeBwd
    :: forall n f.  NonLocal n =>
       BwdPass UniqSM n f
-   -> MaybeC C [Label]
+   -> Label
    -> Graph n C C -> FactBase f
    -> FactBase f
 analyzeBwd BwdPass { bp_lattice  = lattice,
                      bp_transfer = BwdTransfer3 (ftr, mtr, ltr) }
-          (JustC entries)
-          (GMany NothingO blockmap NothingO) in_fact = body entries in_fact
+          entry
+          (GMany NothingO blockmap NothingO) in_fact
+   = fixpointAnal Bwd (fact_join lattice) do_block [entry] blockmap in_fact
    where
-    body  :: [Label] -> FactBase f -> FactBase f
-    body entries f
-         = fixpointAnal Bwd (fact_join lattice) do_block entries blockmap f
-         where
-           do_block :: Block n C C -> FactBase f -> FactBase f
-           do_block b fb = mapSingleton (entryLabel b) (block b fb)
+    do_block :: Block n C C -> FactBase f -> FactBase f
+    do_block b fb = mapSingleton (entryLabel b) (block b fb)
 
     -- NB. eta-expand block, GHC can't do this by itself.  See #5809.
     block :: forall e x . Block n e x -> Fact x f -> f



More information about the ghc-commits mailing list