-- New demand and strictness info
newStrictnessInfo, setNewStrictnessInfo,
newDemandInfo, setNewDemandInfo, pprNewStrictness,
+ setAllStrictnessInfo,
+#ifdef OLD_STRICTNESS
-- Strictness; imported from Demand
StrictnessInfo(..),
mkStrictnessInfo, noStrictnessInfo,
ppStrictnessInfo,isBottomingStrictness,
- setAllStrictnessInfo,
+#endif
-- Worker
WorkerInfo(..), workerExists, wrapperArity, workerId,
import CoreSyn
-import TyCon ( TyCon )
import Class ( Class )
import PrimOp ( PrimOp )
-#ifdef OLD_STRICTNESS
-import Name ( Name )
-#endif
import Var ( Id )
import BasicTypes ( OccInfo(..), isFragileOcc, isDeadOcc, seqOccInfo, isLoopBreaker,
InsideLam, insideLam, notInsideLam,
Activation(..)
)
import DataCon ( DataCon )
+import TyCon ( TyCon, FieldLabel )
import ForeignCall ( ForeignCall )
-import FieldLabel ( FieldLabel )
-import Demand hiding( Demand, seqDemand )
-import qualified Demand
import NewDemand
import Outputable
import Maybe ( isJust )
+
#ifdef OLD_STRICTNESS
+import Name ( Name )
+import Demand hiding( Demand, seqDemand )
+import qualified Demand
import Util ( listLengthCmp )
import List ( replicate )
#endif
data GlobalIdDetails
= VanillaGlobal -- Imported from elsewhere, a default method Id.
- | GenericOpId TyCon -- The to/from operations of a
- | RecordSelId FieldLabel -- The Id for a record selector
+ | RecordSelId TyCon FieldLabel -- The Id for a record selector
+
| DataConWorkId DataCon -- The Id for a data constructor *worker*
| DataConWrapId DataCon -- The Id for a data constructor *wrapper*
-- [the only reasons we need to know is so that
instance Outputable GlobalIdDetails where
ppr NotGlobalId = ptext SLIT("[***NotGlobalId***]")
ppr VanillaGlobal = ptext SLIT("[GlobalId]")
- ppr (GenericOpId _) = ptext SLIT("[GenericOp]")
ppr (DataConWorkId _) = ptext SLIT("[DataCon]")
ppr (DataConWrapId _) = ptext SLIT("[DataConWrapper]")
ppr (ClassOpId _) = ptext SLIT("[ClassOp]")
ppr (PrimOpId _) = ptext SLIT("[PrimOp]")
ppr (FCallId _) = ptext SLIT("[ForeignCall]")
- ppr (RecordSelId _) = ptext SLIT("[RecSel]")
+ ppr (RecordSelId _ _) = ptext SLIT("[RecSel]")
\end{code}
info { unfoldingInfo = uf } -- (In this case the demand-zapping is redundant.)
setUnfoldingInfo info uf
- | isEvaldUnfolding uf
- -- If the unfolding is a value, the demand info may
- -- go pear-shaped, so we nuke it. Example:
- -- let x = (a,b) in
- -- case x of (p,q) -> h p q x
- -- Here x is certainly demanded. But after we've nuked
- -- the case, we'll get just
- -- let x = (a,b) in h a b x
- -- and now x is not demanded (I'm assuming h is lazy)
- -- This really happens. The solution here is a bit ad hoc...
- = info { unfoldingInfo = uf, newDemandInfo = Nothing }
-
- | otherwise
-- We do *not* seq on the unfolding info, For some reason, doing so
-- actually increases residency significantly.
= info { unfoldingInfo = uf }
data WorkerInfo = NoWorker
| HasWorker Id Arity
-- The Arity is the arity of the *wrapper* at the moment of the
- -- w/w split. See comments in MkIface.ifaceId, with the 'Worker' code.
+ -- w/w split. See notes above.
seqWorker :: WorkerInfo -> ()
seqWorker (HasWorker id a) = id `seq` a `seq` ()