X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FBasicTypes.lhs;h=35c57f36f34a1eb6ba014c89dea65c968fe58eec;hb=e68a891932d615590d9b1ab5752ada8142db5053;hp=d1ad0be91e1beabc5a4bda280c9d17d9a6123751;hpb=a35f75aa20bf0a329be0b782986c3e12155b4d49;p=ghc-hetmet.git diff --git a/compiler/basicTypes/BasicTypes.lhs b/compiler/basicTypes/BasicTypes.lhs index d1ad0be..35c57f3 100644 --- a/compiler/basicTypes/BasicTypes.lhs +++ b/compiler/basicTypes/BasicTypes.lhs @@ -1,4 +1,5 @@ % +% (c) The University of Glasgow 2006 % (c) The GRASP/AQUA Project, Glasgow University, 1997-1998 % \section[BasicTypes]{Miscellanous types} @@ -235,7 +236,7 @@ isBoxed Unboxed = False %* * %************************************************************************ -\begin{code} +\begin{code} data RecFlag = Recursive | NonRecursive deriving( Eq ) @@ -367,8 +368,6 @@ defn of OccInfo here, safely at the bottom data OccInfo = NoOccInfo -- Many occurrences, or unknown - | RulesOnly -- Occurs only in the RHS of one or more rules - | IAmDead -- Marks unused variables. Sometimes useful for -- lambda and case-bound variables. @@ -379,31 +378,14 @@ data OccInfo | IAmALoopBreaker -- Used by the occurrence analyser to mark loop-breakers -- in a group of recursive definitions - !Bool -- True <=> This loop breaker occurs only the RHS of a RULE -\end{code} - -Note [RulesOnly] -~~~~~~~~~~~~~~~~ -The RulesOnly constructor records if an Id occurs only in the RHS of a Rule. -Similarly, the boolean in IAmLoopbreaker True if the only reason the Id is a -loop-breaker only because of recursion through a RULE. In that case, -we can ignore the loop-breaker-ness for inlining purposes. Example -(from GHC.Enum): + !RulesOnly -- True <=> This loop breaker mentions the other binders + -- in its recursive group only in its RULES, not + -- in its rhs + -- See OccurAnal Note [RulesOnly] - eftInt :: Int# -> Int# -> [Int] - eftInt x y = ...(non-recursive)... - - {-# INLINE [0] eftIntFB #-} - eftIntFB :: (Int -> r -> r) -> r -> Int# -> Int# -> r - eftIntFB c n x y = ...(non-recursive)... - - {-# RULES - "eftInt" [~1] forall x y. eftInt x y = build (\ c n -> eftIntFB c n x y) - "eftIntList" [1] eftIntFB (:) [] = eftInt - #-} +type RulesOnly = Bool +\end{code} -The two look mutually recursive only because of their RULES; -we don't want that to inhibit inlining! \begin{code} isNoOcc :: OccInfo -> Bool @@ -455,7 +437,6 @@ isFragileOcc other = False instance Outputable OccInfo where -- only used for debugging; never parsed. KSW 1999-07 ppr NoOccInfo = empty - ppr RulesOnly = ptext SLIT("RulesOnly") ppr (IAmALoopBreaker ro) = ptext SLIT("LoopBreaker") <> if ro then char '!' else empty ppr IAmDead = ptext SLIT("Dead") ppr (OneOcc inside_lam one_branch int_cxt)