setIdCgInfo,
setIdOccInfo,
-#ifdef DEBUG
+#ifdef OLD_STRICTNESS
idDemandInfo,
idStrictness,
idCprInfo,
idTyGenInfo,
idWorkerInfo,
idUnfolding,
- idSpecialisation,
+ idSpecialisation, idCoreRules,
idCgInfo,
idCafInfo,
idLBVarInfo,
idOccInfo,
-#ifdef DEBUG
+#ifdef OLD_STRICTNESS
newStrictnessFromOld -- Temporary
#endif
#include "HsVersions.h"
-import CoreSyn ( Unfolding, CoreRules )
+import CoreSyn ( Unfolding, CoreRules, IdCoreRule, rulesRules )
import BasicTypes ( Arity )
import Var ( Id, DictId,
isId, isExportedId, isSpecPragmaId, isLocalId,
import qualified Demand ( Demand )
import NewDemand ( Demand, StrictSig, topSig, isBottomingSig )
import Name ( Name, OccName,
- mkSysLocalName, mkLocalName,
+ mkSystemName, mkInternalName,
getOccName, getSrcLoc
)
import OccName ( EncodedFS, UserFS, mkWorkerOcc )
`setIdSpecialisation`,
`setInlinePragma`,
`idCafInfo`
-#ifdef DEBUG
+#ifdef OLD_STRICTNESS
,`idCprInfo`
,`setIdStrictness`
,`setIdDemandInfo`
-- for SysLocal, we assume the base name is already encoded, to avoid
-- re-encoding the same string over and over again.
-mkSysLocal fs uniq ty = mkLocalId (mkSysLocalName uniq fs) ty
-mkUserLocal occ uniq ty loc = mkLocalId (mkLocalName uniq occ loc) ty
+mkSysLocal fs uniq ty = mkLocalId (mkSystemName uniq fs) ty
+mkUserLocal occ uniq ty loc = mkLocalId (mkInternalName uniq occ loc) ty
mkVanillaGlobal = mkGlobalId VanillaGlobal
\end{code}
mkWildId ty = mkSysLocal FSLIT("wild") (mkBuiltinUnique 1) ty
mkWorkerId :: Unique -> Id -> Type -> Id
--- A worker gets a local name. CoreTidy will globalise it if necessary.
+-- A worker gets a local name. CoreTidy will externalise it if necessary.
mkWorkerId uniq unwrkr ty
= mkLocalId wkr_name ty
where
- wkr_name = mkLocalName uniq (mkWorkerOcc (getOccName unwrkr)) (getSrcLoc unwrkr)
+ wkr_name = mkInternalName uniq (mkWorkerOcc (getOccName unwrkr)) (getSrcLoc unwrkr)
-- "Template locals" typically used in unfoldings
mkTemplateLocals :: [Type] -> [Id]
setIdArity :: Id -> Arity -> Id
setIdArity id arity = modifyIdInfo (`setArityInfo` arity) id
-#ifdef DEBUG
+#ifdef OLD_STRICTNESS
---------------------------------
-- (OLD) STRICTNESS
idStrictness :: Id -> StrictnessInfo
setIdUnfolding :: Id -> Unfolding -> Id
setIdUnfolding id unfolding = modifyIdInfo (`setUnfoldingInfo` unfolding) id
-#ifdef DEBUG
+#ifdef OLD_STRICTNESS
---------------------------------
-- (OLD) DEMAND
idDemandInfo :: Id -> Demand.Demand
idSpecialisation :: Id -> CoreRules
idSpecialisation id = specInfo (idInfo id)
+idCoreRules :: Id -> [IdCoreRule]
+idCoreRules id = [(id,rule) | rule <- rulesRules (idSpecialisation id)]
+
setIdSpecialisation :: Id -> CoreRules -> Id
setIdSpecialisation id spec_info = modifyIdInfo (`setSpecInfo` spec_info) id
---------------------------------
-- CG INFO
idCgInfo :: Id -> CgInfo
-#ifdef DEBUG
+#ifdef OLD_STRICTNESS
idCgInfo id = case cgInfo (idInfo id) of
NoCgInfo -> pprPanic "idCgInfo" (ppr id)
info -> info
---------------------------------
-- CAF INFO
idCafInfo :: Id -> CafInfo
-#ifdef DEBUG
+#ifdef OLD_STRICTNESS
idCafInfo id = case cgInfo (idInfo id) of
NoCgInfo -> pprPanic "idCafInfo" (ppr id)
info -> cgCafInfo info
#endif
---------------------------------
-- CPR INFO
-#ifdef DEBUG
+#ifdef OLD_STRICTNESS
idCprInfo :: Id -> CprInfo
idCprInfo id = cprInfo (idInfo id)