X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fiface%2FTcIface.lhs;h=1f846d37fbfc2a66faad66120df9644f37d727ba;hb=5e4375adca19f66803c3ad47fb1ba2c2ac6b4b62;hp=2ec9de97a0068681314ab900c7ddfe297787e82b;hpb=c86161c5cf11de77e911fcb9e1e2bd1f8bd80b42;p=ghc-hetmet.git diff --git a/compiler/iface/TcIface.lhs b/compiler/iface/TcIface.lhs index 2ec9de9..1f846d3 100644 --- a/compiler/iface/TcIface.lhs +++ b/compiler/iface/TcIface.lhs @@ -46,8 +46,9 @@ import VarEnv import Name import NameEnv import OccurAnal ( occurAnalyseExpr ) +import Demand ( isBottomingSig ) import Module -import LazyUniqFM +import UniqFM import UniqSupply import Outputable import ErrUtils @@ -1003,17 +1004,30 @@ tcIdInfo ignore_prags name ty info \begin{code} tcUnfolding :: Name -> Type -> IdInfo -> IfaceUnfolding -> IfL Unfolding -tcUnfolding name _ _ (IfCoreUnfold if_expr) +tcUnfolding name _ info (IfCoreUnfold if_expr) = do { mb_expr <- tcPragExpr name if_expr ; return (case mb_expr of Nothing -> NoUnfolding - Just expr -> mkTopUnfolding expr) } + Just expr -> mkTopUnfolding is_bottoming expr) } + where + -- Strictness should occur before unfolding! + is_bottoming = case strictnessInfo info of + Just sig -> isBottomingSig sig + Nothing -> False + +tcUnfolding name _ _ (IfCompulsory if_expr) + = do { mb_expr <- tcPragExpr name if_expr + ; return (case mb_expr of + Nothing -> NoUnfolding + Just expr -> mkCompulsoryUnfolding expr) } -tcUnfolding name _ _ (IfInlineRule arity unsat_ok if_expr) +tcUnfolding name _ _ (IfInlineRule arity unsat_ok boring_ok if_expr) = do { mb_expr <- tcPragExpr name if_expr ; return (case mb_expr of Nothing -> NoUnfolding - Just expr -> mkInlineRule unsat_ok expr arity) } + Just expr -> mkCoreUnfolding True InlineRule expr arity + (UnfWhen unsat_ok boring_ok)) + } tcUnfolding name ty info (IfWrapper arity wkr) = do { mb_wkr_id <- forkM_maybe doc (tcIfaceExtId wkr) @@ -1029,8 +1043,8 @@ tcUnfolding name ty info (IfWrapper arity wkr) (initUs_ us (mkWrapper ty strict_sig) wkr_id) arity - -- We are relying here on strictness info always appearing - -- before worker info, fingers crossed .... + -- Again we rely here on strictness info always appearing + -- before unfolding strict_sig = case strictnessInfo info of Just sig -> sig Nothing -> pprPanic "Worker info but no strictness for" (ppr wkr) @@ -1039,11 +1053,9 @@ tcUnfolding name dfun_ty _ (IfDFunUnfold ops) = do { mb_ops1 <- forkM_maybe doc $ mapM tcIfaceExpr ops ; return (case mb_ops1 of Nothing -> noUnfolding - Just ops1 -> DFunUnfolding data_con ops1) } + Just ops1 -> mkDFunUnfolding dfun_ty ops1) } where doc = text "Class ops for dfun" <+> ppr name - (_, cls, _) = tcSplitDFunTy dfun_ty - data_con = classDataCon cls \end{code} For unfoldings we try to do the job lazily, so that we never type check