Commit 150e0a93 authored by simonpj's avatar simonpj

[project @ 2000-12-08 12:56:00 by simonpj]

Get CAF info right
parent b302643c
......@@ -280,15 +280,6 @@ file, even if it's mentioned in some other interface unfolding.
\begin{code}
isImplicitId :: Id -> Bool
isImplicitId id
= ASSERT2( not (omit && nameIsLocallyDefined (idName id)
&& idTyGenInfo id /= TyGenNever),
ppr id )
-- mustn't omit type signature for a name whose type might change!
omit
where
omit = isImplicitId' id
isImplicitId' id
= case idFlavour id of
RecordSelId _ -> True -- Includes dictionary selectors
PrimOpId _ -> True
......@@ -298,13 +289,7 @@ isImplicitId' id
-- remember that all type and class decls appear in the interface file.
-- The dfun id must *not* be omitted, because it carries version info for
-- the instance decl
ConstantId -> False -- Ordinary Ids
DictFunId -> False
ExportedId -> False -- I don't think these happen
VanillaId -> False -- ditto
SpecPragmaId -> False -- ditto
other -> False
\end{code}
\begin{code}
......
......@@ -208,26 +208,33 @@ zapSpecPragInfo info = case flavourInfo info of
\begin{code}
vanillaIdInfo :: IdInfo
vanillaIdInfo = mkIdInfo VanillaId
-- Used for locally-defined Ids
-- We are going to calculate correct CAF information at the end
vanillaIdInfo = mkIdInfo VanillaId NoCafRefs
constantIdInfo :: IdInfo
constantIdInfo = mkIdInfo ConstantId
-- Used for imported Ids
-- The default is that they *do* have CAFs; an interface-file pragma
-- may say "oh no it doesn't", but in the absence of such a pragma
-- we'd better assume it does
constantIdInfo = mkIdInfo ConstantId MayHaveCafRefs
mkIdInfo :: IdFlavour -> IdInfo
mkIdInfo flv = IdInfo {
flavourInfo = flv,
arityInfo = UnknownArity,
demandInfo = wwLazy,
specInfo = emptyCoreRules,
tyGenInfo = noTyGenInfo,
workerInfo = NoWorker,
strictnessInfo = NoStrictnessInfo,
unfoldingInfo = noUnfolding,
cafInfo = NoCafRefs,
cprInfo = NoCPRInfo,
lbvarInfo = NoLBVarInfo,
inlinePragInfo = NoInlinePragInfo,
occInfo = NoOccInfo
mkIdInfo flv caf
= IdInfo {
flavourInfo = flv,
arityInfo = UnknownArity,
demandInfo = wwLazy,
specInfo = emptyCoreRules,
tyGenInfo = noTyGenInfo,
workerInfo = NoWorker,
strictnessInfo = NoStrictnessInfo,
unfoldingInfo = noUnfolding,
cafInfo = caf
cprInfo = NoCPRInfo,
lbvarInfo = NoLBVarInfo,
inlinePragInfo = NoInlinePragInfo,
occInfo = NoOccInfo
}
\end{code}
......
......@@ -94,10 +94,19 @@ binder
that all Ids are unique, rather than the weaker guarantee of
no clashes which the simplifier provides.
- Give the Id its final IdInfo; in ptic,
- Give each dynamic CCall occurrence a fresh unique; this is
rather like the cloning step above.
- Give the Id its UTTERLY FINAL IdInfo; in ptic,
* Its flavour becomes ConstantId, reflecting the fact that
from now on we regard it as a constant, not local, Id
* its unfolding, if it should have one
* its arity, computed from the number of visible lambdas
* its CAF info, computed from what is free in its RHS
Finally, substitute these new top-level binders consistently
throughout, including in unfoldings. We also tidy binders in
......
......@@ -206,7 +206,7 @@ tcAddImportedIdInfo env id
-- The Id must be returned without a data dependency on maybe_id
where
new_info = case tcLookupRecId_maybe env (idName id) of
Nothing -> constantIdInfo
Nothing -> pprTrace "tcAddIdInfo" (ppr id) constantIdInfo
Just imported_id -> idInfo imported_id
-- ToDo: could check that types are the same
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment