X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2FbasicTypes%2FIdInfo.lhs;fp=ghc%2Fcompiler%2FbasicTypes%2FIdInfo.lhs;h=7555cc2874a7d9e3b480ac1975c0e064cf75e294;hb=957bf3756ffd56f5329a2aabe1022d6f996dd641;hp=5dd58543e7950b3a2a75f3a8a305f22f24f09785;hpb=e8f681e4b0294bf44ba50df80559112c769242ce;p=ghc-hetmet.git diff --git a/ghc/compiler/basicTypes/IdInfo.lhs b/ghc/compiler/basicTypes/IdInfo.lhs index 5dd5854..7555cc2 100644 --- a/ghc/compiler/basicTypes/IdInfo.lhs +++ b/ghc/compiler/basicTypes/IdInfo.lhs @@ -80,7 +80,7 @@ module IdInfo ( import CoreSyn -import Type ( Type, usOnce, eqUsage ) +import Type ( Type ) import PrimOp ( PrimOp ) import NameEnv ( NameEnv, lookupNameEnv ) import Name ( Name ) @@ -94,7 +94,6 @@ import BasicTypes ( OccInfo(..), isFragileOcc, isDeadOcc, seqOccInfo, isLoopBrea import DataCon ( DataCon ) import ForeignCall ( ForeignCall ) import FieldLabel ( FieldLabel ) -import Type ( usOnce ) import Demand hiding( Demand, seqDemand ) import qualified Demand import NewDemand @@ -642,42 +641,28 @@ instance Show CprInfo where %************************************************************************ If the @Id@ is a lambda-bound variable then it may have lambda-bound -var info. The usage analysis (UsageSP) detects whether the lambda -binding this var is a ``one-shot'' lambda; that is, whether it is -applied at most once. +var info. Sometimes we know whether the lambda binding this var is a +``one-shot'' lambda; that is, whether it is applied at most once. This information may be useful in optimisation, as computations may safely be floated inside such a lambda without risk of duplicating work. \begin{code} -data LBVarInfo - = NoLBVarInfo - - | LBVarInfo Type -- The lambda that binds this Id has this usage - -- annotation (i.e., if ==usOnce, then the - -- lambda is applied at most once). - -- The annotation's kind must be `$' - -- HACK ALERT! placing this info here is a short-term hack, - -- but it minimises changes to the rest of the compiler. - -- Hack agreed by SLPJ/KSW 1999-04. +data LBVarInfo = NoLBVarInfo + | IsOneShotLambda -- The lambda is applied at most once). seqLBVar l = l `seq` () \end{code} \begin{code} -hasNoLBVarInfo NoLBVarInfo = True -hasNoLBVarInfo other = False +hasNoLBVarInfo NoLBVarInfo = True +hasNoLBVarInfo IsOneShotLambda = False noLBVarInfo = NoLBVarInfo --- not safe to print or parse LBVarInfo because it is not really a --- property of the definition, but a property of the context. pprLBVarInfo NoLBVarInfo = empty -pprLBVarInfo (LBVarInfo u) | u `eqUsage` usOnce - = ptext SLIT("OneShot") - | otherwise - = empty +pprLBVarInfo IsOneShotLambda = ptext SLIT("OneShot") instance Outputable LBVarInfo where ppr = pprLBVarInfo