X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FsimplCore%2FBinderInfo.lhs;fp=ghc%2Fcompiler%2FsimplCore%2FBinderInfo.lhs;h=ebf64d75e70b6ae85f0be2981522b3ca376e7339;hb=6c381e873e222417d9a67aeec77b9555eca7b7a8;hp=d89991631df6d7656b8a29b622dbfb57e807a335;hpb=8147a9f0bcc48ef0db1e91f8b985a4f5c3fed560;p=ghc-hetmet.git diff --git a/ghc/compiler/simplCore/BinderInfo.lhs b/ghc/compiler/simplCore/BinderInfo.lhs index d899916..ebf64d7 100644 --- a/ghc/compiler/simplCore/BinderInfo.lhs +++ b/ghc/compiler/simplCore/BinderInfo.lhs @@ -1,5 +1,5 @@ % -% (c) The GRASP/AQUA Project, Glasgow University, 1992-1995 +% (c) The GRASP/AQUA Project, Glasgow University, 1992-1996 % %************************************************************************ %* * @@ -8,7 +8,6 @@ %************************************************************************ \begin{code} - #include "HsVersions.h" module BinderInfo ( @@ -23,16 +22,14 @@ module BinderInfo ( markMany, markDangerousToDup, markInsideSCC, getBinderInfoArity, setBinderInfoArityToZero, - + isFun, isDupDanger -- for Simon Marlow deforestation ) where -IMPORT_Trace -- ToDo: rm (debugging) +import Ubiq{-uitous-} -import PlainCore -import Outputable import Pretty -import Util -- for pragmas only +import Util ( panic ) \end{code} The @BinderInfo@ describes how a variable is used in a given scope. @@ -86,7 +83,7 @@ data FunOrArg -- When combining branches of a case, only report FunOcc if -- both branches are FunOccs -data DuplicationDanger +data DuplicationDanger = DupDanger -- Inside a non-linear lambda (that is, a lambda which -- is sure to be instantiated only once), or inside -- the rhs of an INLINE-pragma'd thing. Either way, @@ -114,12 +111,12 @@ oneTextualOcc ok_to_dup (OneOcc _ _ _ n_alts _) = n_alts <= 1 || ok_to_dup oneTextualOcc _ other = False \end{code} -@safeSingleOcc@ detects single occurences of values that are safe to +@safeSingleOcc@ detects single occurences of values that are safe to inline, {\em including} ones in an argument position. \begin{code} oneSafeOcc :: Bool -> BinderInfo -> Bool -oneSafeOcc ok_to_dup (OneOcc _ NoDupDanger NotInsideSCC n_alts _) +oneSafeOcc ok_to_dup (OneOcc _ NoDupDanger NotInsideSCC n_alts _) = n_alts <= 1 || ok_to_dup oneSafeOcc _ other = False \end{code} @@ -173,12 +170,12 @@ markInsideSCC (OneOcc posn dup_danger _ n_alts ar) = OneOcc posn dup_danger InsideSCC n_alts ar markInsideSCC other = other -combineBinderInfo, combineAltsBinderInfo +combineBinderInfo, combineAltsBinderInfo :: BinderInfo -> BinderInfo -> BinderInfo combineBinderInfo DeadCode info2 = info2 combineBinderInfo info1 DeadCode = info1 -combineBinderInfo info1 info2 +combineBinderInfo info1 info2 = ManyOcc (min (getBinderInfoArity info1) (getBinderInfoArity info2)) combineAltsBinderInfo DeadCode info2 = info2