From: simonpj Date: Fri, 8 Dec 2000 12:56:01 +0000 (+0000) Subject: [project @ 2000-12-08 12:56:00 by simonpj] X-Git-Tag: Approximately_9120_patches~3156 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=150e0a93f0187c4982644ac5bce776cc96b0d65d [project @ 2000-12-08 12:56:00 by simonpj] Get CAF info right --- diff --git a/ghc/compiler/basicTypes/Id.lhs b/ghc/compiler/basicTypes/Id.lhs index 4026676..5c9f6e8 100644 --- a/ghc/compiler/basicTypes/Id.lhs +++ b/ghc/compiler/basicTypes/Id.lhs @@ -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} diff --git a/ghc/compiler/basicTypes/IdInfo.lhs b/ghc/compiler/basicTypes/IdInfo.lhs index aaf1ed8..32b3441 100644 --- a/ghc/compiler/basicTypes/IdInfo.lhs +++ b/ghc/compiler/basicTypes/IdInfo.lhs @@ -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} diff --git a/ghc/compiler/coreSyn/CoreTidy.lhs b/ghc/compiler/coreSyn/CoreTidy.lhs index 9873779..f607d13 100644 --- a/ghc/compiler/coreSyn/CoreTidy.lhs +++ b/ghc/compiler/coreSyn/CoreTidy.lhs @@ -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 diff --git a/ghc/compiler/typecheck/TcEnv.lhs b/ghc/compiler/typecheck/TcEnv.lhs index f38d126..0dbc636 100644 --- a/ghc/compiler/typecheck/TcEnv.lhs +++ b/ghc/compiler/typecheck/TcEnv.lhs @@ -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