From: simonmar Date: Tue, 18 Nov 2003 09:26:36 +0000 (+0000) Subject: [project @ 2003-11-18 09:26:36 by simonmar] X-Git-Tag: Approx_11550_changesets_converted~231 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=9fdc7deb77d8f8131782eeba0c875a5020ba9c94;hp=12e244ccac8f2215dcbdaceafe587a15b3f7bcf4;p=ghc-hetmet.git [project @ 2003-11-18 09:26:36 by simonmar] Restore a couple of functions that are used in ASSERTs. --- diff --git a/ghc/compiler/stgSyn/StgSyn.lhs b/ghc/compiler/stgSyn/StgSyn.lhs index 40fbef7..c4f08bc 100644 --- a/ghc/compiler/stgSyn/StgSyn.lhs +++ b/ghc/compiler/stgSyn/StgSyn.lhs @@ -33,7 +33,7 @@ module StgSyn ( SRT(..), -- utils - stgArgHasCafRefs, + stgBindHasCafRefs, stgArgHasCafRefs, stgRhsArity, isDllConApp, isStgTypeArg, stgArgType, @@ -396,6 +396,19 @@ The second flavour of right-hand-side is for constructors (simple but important) \end{code} \begin{code} +stgRhsArity :: StgRhs -> Int +stgRhsArity (StgRhsClosure _ _ _ _ _ bndrs _) = count isId bndrs + -- The arity never includes type parameters, so + -- when keeping type arguments and binders in the Stg syntax + -- (opt_RuntimeTypes) we have to fliter out the type binders. +stgRhsArity (StgRhsCon _ _ _) = 0 +\end{code} + +\begin{code} +stgBindHasCafRefs :: GenStgBinding bndr Id -> Bool +stgBindHasCafRefs (StgNonRec _ rhs) = rhsHasCafRefs rhs +stgBindHasCafRefs (StgRec binds) = any rhsHasCafRefs (map snd binds) + rhsHasCafRefs (StgRhsClosure _ _ _ upd srt _ _) = isUpdatable upd || nonEmptySRT srt rhsHasCafRefs (StgRhsCon _ _ args)