X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FsimplCore%2FSimplify.lhs;h=d4a050499f45fddce5f38a92e1cc8662a4336583;hb=7f7b6cefcfbcf81ca3abd18c65498c5ba4860204;hp=376c7b9541b3cc79b39dc5b1ae612fc4adbc04b5;hpb=0835bc7710c69eb7b7f12b76efd9a8900b60f8a0;p=ghc-hetmet.git diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs index 376c7b9..d4a0504 100644 --- a/compiler/simplCore/Simplify.lhs +++ b/compiler/simplCore/Simplify.lhs @@ -8,9 +8,7 @@ module Simplify ( simplTopBinds, simplExpr ) where #include "HsVersions.h" -import DynFlags ( dopt, DynFlag(Opt_D_dump_inlinings), - SimplifierSwitch(..) - ) +import DynFlags import SimplMonad import Type hiding ( substTy, extendTvSubst ) import SimplEnv @@ -208,7 +206,8 @@ simplTopBinds env binds -- It's rather as if the top-level binders were imported. ; env <- simplRecBndrs env (bindersOfBinds binds) ; dflags <- getDOptsSmpl - ; let dump_flag = dopt Opt_D_dump_inlinings dflags + ; let dump_flag = dopt Opt_D_dump_inlinings dflags || + dopt Opt_D_dump_rule_firings dflags ; env' <- simpl_binds dump_flag env binds ; freeTick SimplifierDone ; return (getFloats env') } @@ -216,6 +215,9 @@ simplTopBinds env binds -- We need to track the zapped top-level binders, because -- they should have their fragile IdInfo zapped (notably occurrence info) -- That's why we run down binds and bndrs' simultaneously. + -- + -- The dump-flag emits a trace for each top-level binding, which + -- helps to locate the tracing for inlining and rule firing simpl_binds :: Bool -> SimplEnv -> [InBind] -> SimplM SimplEnv simpl_binds dump env [] = return env simpl_binds dump env (bind:binds) = do { env' <- trace dump bind $ @@ -357,7 +359,7 @@ simplNonRecX :: SimplEnv simplNonRecX env bndr new_rhs = do { (env, bndr') <- simplBinder env bndr ; completeNonRecX env NotTopLevel NonRecursive - (isStrictBndr bndr) bndr bndr' new_rhs } + (isStrictId bndr) bndr bndr' new_rhs } completeNonRecX :: SimplEnv -> TopLevelFlag -> RecFlag -> Bool @@ -410,7 +412,7 @@ becomes prepareRhs :: SimplEnv -> OutExpr -> SimplM (SimplEnv, OutExpr) -- Adds new floats to the env iff that allows us to return a good RHS -prepareRhs env (Cast rhs co) -- Note [Float coersions] +prepareRhs env (Cast rhs co) -- Note [Float coercions] = do { (env', rhs') <- makeTrivial env rhs ; return (env', Cast rhs' co) } @@ -735,8 +737,9 @@ simplCast env body co cont where addCoerce co cont = add_coerce co (coercionKind co) cont - add_coerce co (s1, k1) cont - | s1 `coreEqType` k1 = cont + add_coerce co (s1, k1) cont -- co :: ty~ty + | s1 `coreEqType` k1 = cont -- is a no-op + add_coerce co1 (s1, k2) (CoerceIt co2 cont) | (l1, t1) <- coercionKind co2 -- coerce T1 S1 (coerce S1 K1 e) @@ -839,7 +842,7 @@ simplNonRecE env bndr (rhs, rhs_se) (bndrs, body) cont = do { tick (PreInlineUnconditionally bndr) ; simplLam (extendIdSubst env bndr (mkContEx rhs_se rhs)) bndrs body cont } - | isStrictBndr bndr + | isStrictId bndr = do { simplExprF (rhs_se `setFloats` env) rhs (StrictBind bndr bndrs body env cont) } @@ -945,7 +948,7 @@ completeCall env var cont ; case maybe_rule of { Just (rule, rule_rhs) -> tick (RuleFired (ru_name rule)) `thenSmpl_` - (if dopt Opt_D_dump_inlinings dflags then + (if dopt Opt_D_dump_rule_firings dflags then pprTrace "Rule fired" (vcat [ text "Rule:" <+> ftext (ru_name rule), text "Before:" <+> ppr var <+> sep (map pprParendExpr args),