From 9fdc7deb77d8f8131782eeba0c875a5020ba9c94 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 18 Nov 2003 09:26:36 +0000 Subject: [PATCH 1/1] [project @ 2003-11-18 09:26:36 by simonmar] Restore a couple of functions that are used in ASSERTs. --- ghc/compiler/stgSyn/StgSyn.lhs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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) -- 1.7.10.4