X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=ghc%2Fcompiler%2FcprAnalysis%2FCprAnalyse.lhs;h=a41e62fb6cb9eea1b1b66bc6599d3cd6a6820fa5;hb=d8e8d85db6bf2b1fa0c0219f558507031dd59c26;hp=760d142cae4aecaf46eb04ec250f09f87fba0a7e;hpb=d057b483d3683839058fee62a4ca56c806108ef6;p=ghc-hetmet.git diff --git a/ghc/compiler/cprAnalysis/CprAnalyse.lhs b/ghc/compiler/cprAnalysis/CprAnalyse.lhs index 760d142..a41e62f 100644 --- a/ghc/compiler/cprAnalysis/CprAnalyse.lhs +++ b/ghc/compiler/cprAnalysis/CprAnalyse.lhs @@ -2,11 +2,16 @@ constructed product result} \begin{code} +#ifndef OLD_STRICTNESS +module CprAnalyse ( ) where + +#else + module CprAnalyse ( cprAnalyse ) where #include "HsVersions.h" -import CmdLineOpts ( DynFlags, DynFlag(..), dopt ) +import CmdLineOpts ( DynFlags, DynFlag(..) ) import CoreLint ( showPass, endPass ) import CoreSyn import CoreUtils ( exprIsValue ) @@ -91,10 +96,6 @@ data AbsVal = Top -- Not a constructed product -- we could use appropriate Tuple Vals deriving (Eq,Show) -isFun :: AbsVal -> Bool -isFun (Fun _) = True -isFun _ = False - -- For pretty debugging instance Outputable AbsVal where ppr Top = ptext SLIT("Top") @@ -251,11 +252,11 @@ cprAnalExpr rho (Type t) cprAnalCaseAlts :: CPREnv -> [CoreAlt] -> ([CoreAlt], AbsVal) cprAnalCaseAlts rho alts - = foldl anal_alt ([], Bot) alts + = foldr anal_alt ([], Bot) alts where - anal_alt :: ([CoreAlt], AbsVal) -> CoreAlt -> ([CoreAlt], AbsVal) - anal_alt (done, aval) (con, binds, exp) - = (done ++ [(con,binds,exp_cpr)], aval `lub` exp_aval) + anal_alt :: CoreAlt -> ([CoreAlt], AbsVal) -> ([CoreAlt], AbsVal) + anal_alt (con, binds, exp) (done, aval) + = ((con,binds,exp_cpr) : done, exp_aval `lub` aval) where (exp_cpr, exp_aval) = cprAnalExpr rho' exp rho' = rho `extendVarEnvList` (zip binds (repeat Top)) @@ -310,4 +311,5 @@ getCprAbsVal v = case idCprInfo v of arity = idArity v -- Imported (non-nullary) constructors will have the CPR property -- in their IdInfo, so no need to look at their unfolding +#endif /* OLD_STRICTNESS */ \end{code}