X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FId.lhs;h=61a39f1fa06ee1491c1153fa261154e1e3976900;hb=7739158ff9d983f80cb269f3c7cb38108e72e8ec;hp=cc9587e0361d49b729305219665f4daff0db0be3;hpb=7e84448c9ed32f4fdc3de3155913bafd416898af;p=ghc-hetmet.git diff --git a/compiler/basicTypes/Id.lhs b/compiler/basicTypes/Id.lhs index cc9587e..61a39f1 100644 --- a/compiler/basicTypes/Id.lhs +++ b/compiler/basicTypes/Id.lhs @@ -25,7 +25,7 @@ module Id ( zapLamIdInfo, zapDemandIdInfo, zapFragileIdInfo, -- Predicates - isImplicitId, isDeadBinder, isDictId, + isImplicitId, isDeadBinder, isDictId, isStrictId, isExportedId, isLocalId, isGlobalId, isRecordSelector, isNaughtyRecordSelector, isClassOpId_maybe, @@ -33,6 +33,7 @@ module Id ( isFCallId, isFCallId_maybe, isDataConWorkId, isDataConWorkId_maybe, isDataConId_maybe, idDataCon, isBottomingId, idIsFrom, + isTickBoxOp, isTickBoxOp_maybe, hasNoBinding, -- Inline pragma stuff @@ -313,6 +314,19 @@ isDeadBinder bndr | isId bndr = isDeadOcc (idOccInfo bndr) | otherwise = False -- TyVars count as not dead \end{code} +\begin{code} +isTickBoxOp :: Id -> Bool +isTickBoxOp id = + case globalIdDetails id of + TickBoxOpId tick -> True + _ -> False + +isTickBoxOp_maybe :: Id -> Maybe TickBoxOp +isTickBoxOp_maybe id = + case globalIdDetails id of + TickBoxOpId tick -> Just tick + _ -> Nothing +\end{code} %************************************************************************ %* * @@ -354,6 +368,20 @@ setIdNewStrictness id sig = modifyIdInfo (`setNewStrictnessInfo` Just sig) id zapIdNewStrictness :: Id -> Id zapIdNewStrictness id = modifyIdInfo (`setNewStrictnessInfo` Nothing) id +\end{code} + +This predicate says whether the id has a strict demand placed on it or +has a type such that it can always be evaluated strictly (e.g., an +unlifted type, but see the comment for isStrictType). We need to +check separately whether has a so-called "strict type" because if +the demand for hasn't been computed yet but has a strict +type, we still want (isStrictId ) to be True. +\begin{code} +isStrictId :: Id -> Bool +isStrictId id + = ASSERT2( isId id, text "isStrictId: not an id: " <+> ppr id ) + (isStrictDmd (idNewDemandInfo id)) || + (isStrictType (idType id)) --------------------------------- -- WORKER ID