diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-08-29 00:10:44 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-08-29 00:10:44 +0100 |
commit | 41448969dad90e479e4eac3721fc5d5dd4968885 (patch) | |
tree | 2a0f5932617ef767802c15caed2df1d05eeb2f33 /compiler/main/TidyPgm.lhs | |
parent | baa7c0fd8cd9e4fc3b2a50085061c9e95bbb5f5d (diff) | |
download | haskell-41448969dad90e479e4eac3721fc5d5dd4968885.tar.gz |
Remove CPP from coreSyn/CoreUtils.lhs
Diffstat (limited to 'compiler/main/TidyPgm.lhs')
-rw-r--r-- | compiler/main/TidyPgm.lhs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/compiler/main/TidyPgm.lhs b/compiler/main/TidyPgm.lhs index 85127e63f6..bea9f14ee6 100644 --- a/compiler/main/TidyPgm.lhs +++ b/compiler/main/TidyPgm.lhs @@ -47,6 +47,7 @@ import Module import Packages( isDllName ) import HscTypes import Maybes +import Platform import UniqSupply import ErrUtils (Severity(..)) import Outputable @@ -1048,34 +1049,37 @@ tidyTopBinds hsc_env unfold_env init_occ_env binds $ initTcForLookup hsc_env (tcLookupGlobal mkIntegerName) return $ tidy mkIntegerId init_env binds where + platform = targetPlatform (hsc_dflags hsc_env) + init_env = (init_occ_env, emptyVarEnv) this_pkg = thisPackage (hsc_dflags hsc_env) tidy _ env [] = (env, []) - tidy mkIntegerId env (b:bs) = let (env1, b') = tidyTopBind this_pkg mkIntegerId unfold_env env b + tidy mkIntegerId env (b:bs) = let (env1, b') = tidyTopBind platform this_pkg mkIntegerId unfold_env env b (env2, bs') = tidy mkIntegerId env1 bs in (env2, b':bs') ------------------------ -tidyTopBind :: PackageId +tidyTopBind :: Platform + -> PackageId -> Id -> UnfoldEnv -> TidyEnv -> CoreBind -> (TidyEnv, CoreBind) -tidyTopBind this_pkg mkIntegerId unfold_env (occ_env,subst1) (NonRec bndr rhs) +tidyTopBind platform this_pkg mkIntegerId unfold_env (occ_env,subst1) (NonRec bndr rhs) = (tidy_env2, NonRec bndr' rhs') where Just (name',show_unfold) = lookupVarEnv unfold_env bndr - caf_info = hasCafRefs this_pkg (mkIntegerId, subst1) (idArity bndr) rhs + caf_info = hasCafRefs platform this_pkg (mkIntegerId, subst1) (idArity bndr) rhs (bndr', rhs') = tidyTopPair show_unfold tidy_env2 caf_info name' (bndr, rhs) subst2 = extendVarEnv subst1 bndr bndr' tidy_env2 = (occ_env, subst2) -tidyTopBind this_pkg mkIntegerId unfold_env (occ_env,subst1) (Rec prs) +tidyTopBind platform this_pkg mkIntegerId unfold_env (occ_env,subst1) (Rec prs) = (tidy_env2, Rec prs') where prs' = [ tidyTopPair show_unfold tidy_env2 caf_info name' (id,rhs) @@ -1092,7 +1096,7 @@ tidyTopBind this_pkg mkIntegerId unfold_env (occ_env,subst1) (Rec prs) -- the CafInfo for a recursive group says whether *any* rhs in -- the group may refer indirectly to a CAF (because then, they all do). caf_info - | or [ mayHaveCafRefs (hasCafRefs this_pkg (mkIntegerId, subst1) (idArity bndr) rhs) + | or [ mayHaveCafRefs (hasCafRefs platform this_pkg (mkIntegerId, subst1) (idArity bndr) rhs) | (bndr,rhs) <- prs ] = MayHaveCafRefs | otherwise = NoCafRefs @@ -1229,14 +1233,15 @@ it as a CAF. In these cases however, we would need to use an additional CAF list to keep track of non-collectable CAFs. \begin{code} -hasCafRefs :: PackageId -> (Id, VarEnv Var) -> Arity -> CoreExpr -> CafInfo -hasCafRefs this_pkg p arity expr +hasCafRefs :: Platform -> PackageId -> (Id, VarEnv Var) -> Arity -> CoreExpr + -> CafInfo +hasCafRefs platform this_pkg p arity expr | is_caf || mentions_cafs = MayHaveCafRefs | otherwise = NoCafRefs where mentions_cafs = isFastTrue (cafRefsE p expr) is_dynamic_name = isDllName this_pkg - is_caf = not (arity > 0 || rhsIsStatic is_dynamic_name expr) + is_caf = not (arity > 0 || rhsIsStatic platform is_dynamic_name expr) -- NB. we pass in the arity of the expression, which is expected -- to be calculated by exprArity. This is because exprArity |