-- Arity
ArityInfo,
- exactArity, unknownArity, hasArity,
- arityInfo, setArityInfo, ppArityInfo, arityLowerBound,
+ unknownArity,
+ arityInfo, setArityInfo, ppArityInfo,
-- New demand and strictness info
newStrictnessInfo, setNewStrictnessInfo, mkNewStrictnessInfo,
demandInfo, setDemandInfo,
-- Inline prags
- InlinePragInfo(..),
+ InlinePragInfo,
inlinePragInfo, setInlinePragInfo,
-- Occurrence info
-- CG info
CgInfo(..), cgInfo, setCgInfo, pprCgInfo,
- cgArity, cgCafInfo, vanillaCgInfo,
+ cgCafInfo, vanillaCgInfo,
CgInfoEnv, lookupCgInfo,
- setCgArity,
-- CAF info
CafInfo(..), ppCafInfo, setCafInfo, mayHaveCafRefs,
`setOccInfo`,
`setCgInfo`,
`setCafInfo`,
- `setCgArity`,
`setNewStrictnessInfo`,
`setNewDemandInfo`
-- infixl so you can say (id `set` a `set` b)
inlinePragInfo :: InlinePragInfo, -- Inline pragma
occInfo :: OccInfo, -- How it occurs
- newStrictnessInfo :: Maybe StrictSig,
+ newStrictnessInfo :: Maybe StrictSig, -- Reason for Maybe: the DmdAnal phase needs to
+ -- know whether whether this is the first visit,
+ -- so it can assign botSig. Other customers want
+ -- topSig. So Nothing is good.
newDemandInfo :: Demand
}
\begin{code}
setWorkerInfo info wk = wk `seq` info { workerInfo = wk }
-setSpecInfo info sp = PSEQ sp (info { specInfo = sp })
+setSpecInfo info sp = sp `seq` info { specInfo = sp }
setTyGenInfo info tg = tg `seq` info { tyGenInfo = tg }
setInlinePragInfo info pr = pr `seq` info { inlinePragInfo = pr }
setOccInfo info oc = oc `seq` info { occInfo = oc }
= info { unfoldingInfo = uf }
setDemandInfo info dd = info { demandInfo = dd }
-setArityInfo info ar = info { arityInfo = Just ar }
+setArityInfo info ar = info { arityInfo = ar }
setCgInfo info cg = info { cgInfo = cg }
setCprInfo info cp = info { cprInfo = cp }
setLBVarInfo info lb = info { lbvarInfo = lb }
}
noCafNoTyGenIdInfo = vanillaIdInfo `setTyGenInfo` TyGenNever
- `setCgInfo` (CgInfo 0 NoCafRefs)
+ `setCgInfo` CgInfo NoCafRefs
-- Used for built-in type Ids in MkId.
-- Many built-in things have fixed types, so we shouldn't
-- run around generalising them
besides the code-generator need arity info!)
\begin{code}
-type ArityInfo = Maybe Arity
+type ArityInfo = Arity
-- A partial application of this Id to up to n-1 value arguments
-- does essentially no work. That is not necessarily the
-- same as saying that it has n leading lambdas, because coerces
-- an extra lambda floats up to the binding site.
seqArity :: ArityInfo -> ()
-seqArity a = arityLowerBound a `seq` ()
+seqArity a = a `seq` ()
-exactArity = Just
-unknownArity = Nothing
+unknownArity = 0 :: Arity
-arityLowerBound :: ArityInfo -> Arity
-arityLowerBound Nothing = 0
-arityLowerBound (Just n) = n
-
-hasArity :: ArityInfo -> Bool
-hasArity Nothing = False
-hasArity other = True
-
-ppArityInfo Nothing = empty
-ppArityInfo (Just arity) = hsep [ptext SLIT("Arity"), int arity]
+ppArityInfo 0 = empty
+ppArityInfo n = hsep [ptext SLIT("Arity"), int n]
\end{code}
%************************************************************************
downstream, by the code generator.
\begin{code}
-data CgInfo = CgInfo
- !Arity -- Exact arity for calling purposes
- !CafInfo
-#ifdef DEBUG
+#ifndef DEBUG
+newtype CgInfo = CgInfo CafInfo -- We are back to only having CafRefs in CgInfo
+noCgInfo = panic "NoCgInfo!"
+#else
+data CgInfo = CgInfo CafInfo
| NoCgInfo -- In debug mode we don't want a black hole here
-- See Id.idCgInfo
-
-- noCgInfo is used for local Ids, which shouldn't need any CgInfo
noCgInfo = NoCgInfo
-#else
-noCgInfo = panic "NoCgInfo!"
#endif
-cgArity (CgInfo arity _) = arity
-cgCafInfo (CgInfo _ caf_info) = caf_info
-
-setCafInfo info caf_info =
- case cgInfo info of { CgInfo arity _ ->
- info `setCgInfo` CgInfo arity caf_info }
+cgCafInfo (CgInfo caf_info) = caf_info
-setCgArity info arity =
- case cgInfo info of { CgInfo _ caf_info ->
- info `setCgInfo` CgInfo arity caf_info }
+setCafInfo info caf_info = info `setCgInfo` CgInfo caf_info
seqCg c = c `seq` () -- fields are strict anyhow
-vanillaCgInfo = CgInfo 0 MayHaveCafRefs -- Definitely safe
+vanillaCgInfo = CgInfo MayHaveCafRefs -- Definitely safe
-- CafInfo is used to build Static Reference Tables (see simplStg/SRT.lhs).
seqCaf c = c `seq` ()
-pprCgInfo (CgInfo arity caf_info) = ppArity arity <+> ppCafInfo caf_info
+pprCgInfo (CgInfo caf_info) = ppCafInfo caf_info
ppArity 0 = empty
ppArity n = hsep [ptext SLIT("__A"), int n]