X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FcoreSyn%2FCoreTidy.lhs;h=c825a6a0aadd31fd7ff25f636179899ece35b10d;hb=6677029a5084f59b4cd35d76ce3f19b154f2ac87;hp=adf10d1041ef46436b0decde9f08f96ca3669dcf;hpb=23a4e1f05b1f3aff98b8e3e0e7f735f6dc3e7713;p=ghc-hetmet.git diff --git a/ghc/compiler/coreSyn/CoreTidy.lhs b/ghc/compiler/coreSyn/CoreTidy.lhs index adf10d1..c825a6a 100644 --- a/ghc/compiler/coreSyn/CoreTidy.lhs +++ b/ghc/compiler/coreSyn/CoreTidy.lhs @@ -19,8 +19,9 @@ module CoreTidy ( import CoreSyn import CoreUtils ( exprArity ) import PprCore ( pprIdRules ) -import Id ( Id, mkUserLocal, idInfo, setIdInfo, idUnique, idType, idCoreRules ) -import IdInfo ( vanillaIdInfo, setArityInfo, +import Id ( Id, mkUserLocal, idInfo, setIdInfo, idUnique, + idType, idCoreRules ) +import IdInfo ( setArityInfo, vanillaIdInfo, newStrictnessInfo, setAllStrictnessInfo, newDemandInfo, setNewDemandInfo ) import Type ( tidyType, tidyTyVarBndr ) @@ -50,11 +51,11 @@ tidyBind :: TidyEnv -> (TidyEnv, CoreBind) tidyBind env (NonRec bndr rhs) - = tidyLetBndr env (bndr,rhs) =: \ (env', bndr') -> + = tidyLetBndr env (bndr,rhs) =: \ (env', bndr') -> (env', NonRec bndr' (tidyExpr env' rhs)) tidyBind env (Rec prs) - = mapAccumL tidyLetBndr env prs =: \ (env', bndrs') -> + = mapAccumL tidyLetBndr env prs =: \ (env', bndrs') -> map (tidyExpr env') (map snd prs) =: \ rhss' -> (env', Rec (zip bndrs' rhss')) @@ -135,8 +136,9 @@ tidyLetBndr env (id,rhs) where ((tidy_env,var_env), new_id) = tidyIdBndr env id - -- We need to keep around any interesting strictness and demand info - -- because later on we may need to use it when converting to A-normal form. + -- We need to keep around any interesting strictness and + -- demand info because later on we may need to use it when + -- converting to A-normal form. -- eg. -- f (g x), where f is strict in its argument, will be converted -- into case (g x) of z -> f z by CorePrep, but only if f still @@ -146,9 +148,10 @@ tidyLetBndr env (id,rhs) -- CorePrep to turn the let into a case. -- -- Similarly arity info for eta expansion in CorePrep + -- final_id = new_id `setIdInfo` new_info idinfo = idInfo id - new_info = vanillaIdInfo + new_info = vanillaIdInfo `setArityInfo` exprArity rhs `setAllStrictnessInfo` newStrictnessInfo idinfo `setNewDemandInfo` newDemandInfo idinfo @@ -168,11 +171,12 @@ tidyIdBndr env@(tidy_env, var_env) id -- The SrcLoc isn't important now, -- though we could extract it from the Id -- - -- All nested Ids now have the same IdInfo, namely none, + -- All nested Ids now have the same IdInfo, namely vanillaIdInfo, -- which should save some space. -- But note that tidyLetBndr puts some of it back. ty' = tidyType env (idType id) id' = mkUserLocal occ' (idUnique id) ty' noSrcLoc + `setIdInfo` vanillaIdInfo var_env' = extendVarEnv var_env id id' in ((tidy_env', var_env'), id') @@ -182,5 +186,3 @@ tidyIdBndr env@(tidy_env, var_env) id \begin{code} m =: k = m `seq` k m \end{code} - -