X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fcmm%2FDFMonad.hs;h=4db3b966afe67c3a8fe6bb6847606ed1121de2cd;hb=31a9d04804d9cacda35695c5397590516b964964;hp=0bce264de6fc510570bc9b2c6abaf6b08e86b708;hpb=6d38e24ea3da7ca9b435e9b1e59b2de8fcd91da4;p=ghc-hetmet.git diff --git a/compiler/cmm/DFMonad.hs b/compiler/cmm/DFMonad.hs index 0bce264..4db3b96 100644 --- a/compiler/cmm/DFMonad.hs +++ b/compiler/cmm/DFMonad.hs @@ -45,11 +45,11 @@ conjunction with the join, so we have [[fact_add_to]]: -} data DataflowLattice a = DataflowLattice { - fact_name :: String, -- documentation - fact_bot :: a, -- lattice bottom element - fact_add_to :: a -> a -> TxRes a, -- lattice join and compare + fact_name :: String, -- documentation + fact_bot :: a, -- lattice bottom element + fact_add_to :: a -> a -> TxRes a, -- lattice join and compare -- ^ compute join of two args; something changed iff join is greater than 2nd arg - fact_do_logging :: Bool -- log changes + fact_do_logging :: Bool -- log changes } @@ -136,15 +136,11 @@ instance Monad m => DataflowAnalysis (DFM' m) where getExitFact = DFM' get where get _ s = return (df_exit_fact s, s) setExitFact a = - do old <- getExitFact - DataflowLattice { fact_add_to = add_fact - , fact_name = name, fact_do_logging = log } <- lattice - case add_fact a old of - TxRes NoChange _ -> return () - TxRes SomeChange join -> DFM' $ \_ s -> - let debug = if log then pprTrace else \_ _ a -> a - in debug name (pprSetFact "exit" old a join) $ - return ((), s { df_exit_fact = join, df_facts_change = SomeChange }) + do DataflowLattice { fact_name = name, fact_do_logging = log} <- lattice + DFM' $ \_ s -> + let debug = if log then pprTrace else \_ _ a -> a + in debug name (pprSetFact "exit" a a a) $ + return ((), s { df_exit_fact = a }) getAllFacts = DFM' f where f _ s = return (df_facts s, s) setAllFacts env = DFM' f