HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-9.10.3GHC2021

GHC.Types.Id.Info

  • 16 types
  • 66 values
  • Packageghc-9.10.3
  • Exports82
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceInfo.hs

The IdDetails type

11 declarations
datadata IdDetails
#

Identifier Details

The IdDetails of an Id give stable, and necessary, information about the Id.

Constructors

  • VanillaId
  • RecSelId

    The Id for a record selector

  • DataConWorkId DataCon

    The Id is for a data constructor worker

  • DataConWrapId DataCon

    The Id is for a data constructor wrapper

  • ClassOpId Class Bool

    The Id is a superclass selector or class operation

  • RepPolyId

    A representation-polymorphic pseudo-op.

    • id_concrete_tvs :: ConcreteTyVars

      Which type variables of this representation-polymorphic 'Id should be instantiated to concrete type variables?

      See Note [Representation-polymorphism checking built-ins] in GHC.Tc.Gen.Head.

  • PrimOpId

    The Id is for a primitive operator.

    • id_primop :: PrimOp
    • id_concrete_tvs :: ConcreteTyVars

      Which type variables of this representation-polymorphic 'Id should be instantiated to concrete type variables?

      See Note [Representation-polymorphism checking built-ins] in GHC.Tc.Gen.Head.

  • FCallId ForeignCall

    The Id is for a foreign call. Type will be simple: no type families, newtypes, etc

  • TickBoxOpId TickBoxOp

    The Id is for a HPC tick box (both traditional and binary)

  • DFunId Bool

    A dictionary function. Bool = True = the class has only one method, so may be implemented with a newtype, so it might be bad to be strict on this dictionary

  • CoVarId

    A coercion variable This only covers un-lifted coercions, of type (t1 ~# t2) or (t1 ~R# t2), not their lifted variants

  • JoinId JoinArity (Maybe [CbvMark])

    An Id for a join point taking n arguments Note [Join points] in GHC.Core Can also work as a WorkerLikeId if given CbvMarks. See Note [CBV Function Ids] The [CbvMark] is always empty (and ignored) until after Tidy.

  • WorkerLikeId [CbvMark]

    An Id for a worker like function, which might expect some arguments to be passed both evaluated and tagged. Worker like functions are create by W/W and SpecConstr and we can expect that they aren't used unapplied. See Note [CBV Function Ids] See Note [Tag Inference] The [CbvMark] is always empty (and ignored) until after Tidy for ids from the current module.

Instances1Outputable
typetype JoinArity = Int
#

The number of arguments that a join point takes. Unlike the arity of a function, this is a purely syntactic property and is fixed when the join point is created (or converted from a value). Both type and value arguments are counted.

datadata RecSelParent
#

Parent of a record selector function.

Either the parent TyCon or PatSyn depending on the origin of the record selector.

For a data family, this is the instance TyCon, **not** the family TyCon.

Constructors

Instances3Eq, Data, Outputable

The IdInfo type

3 declarations
datadata IdInfo
#

Identifier Information

An IdInfo gives optional information about an Id. If present it never lies, but it may not be present, in which case there is always a conservative assumption which can be made.

Two Ids may have different info even though they have the same Unique (and are hence the same Id); for example, one might lack the properties attached to the other.

Most of the IdInfo gives information about the value, or definition, of the Id, independent of its usage. Exceptions to this are demandInfo, occInfo, oneShotInfo and callArityInfo.

Performance note: when we update IdInfo, we have to reallocate this entire record, so it is a good idea not to let this data structure get too big.

Instances1Outputable

The OneShotInfo type

datadata OneShotInfo
#

If the Id is a lambda-bound variable then it may have lambda-bound variable info. Sometimes we know whether the lambda binding this variable is a "one-shot" lambda; that is, whether it is applied at most once.

This information may be useful in optimisation, as computations may safely be floated inside such a lambda without risk of duplicating work.

See also Note [OneShotInfo overview] above.

Constructors

Instances2Eq, Outputable

Zapping various forms of Info

valuezapLamInfo :: IdInfo -> Maybe IdInfo
#

This is used to remove information on lambda binders that we have setup as part of a lambda group, assuming they will be applied all at once, but turn out to be part of an unsaturated lambda as in e.g:

(\x1. \x2. e) arg1

Lazify (remove the top-level demand, only) the demand in IdInfo Keep nested demands; see Note [Floatifying demand info when floating] in GHC.Core.Opt.SetLevels

The ArityInfo type

typetype ArityInfo = Arity
#

Arity Information

An ArityInfo of n tells us that 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 may get in the way.

The arity might increase later in the compilation process, if an extra lambda floats up to the binding site.

Invariant: the Arity of an Id must never exceed the number of value arguments that appear in the type of the Id. See Note [Arity and function types].

How this is called. This is the number of arguments to which a binding can be eta-expanded without losing any sharing. n = all calls have at least n arguments

Demand and strictness Info

valuedmdSigInfo :: IdInfo -> DmdSig
#

A strictness signature. Describes how a function uses its arguments See Note [idArity varies independently of dmdTypeDepth] in GHC.Core.Opt.DmdAnal

valuecprSigInfo :: IdInfo -> CprSig
#

Information on whether the function will ultimately return a freshly allocated constructor.

Unfolding Info

Essentially returns the realUnfoldingInfo field, but does not expose the unfolding of a strong loop breaker.

This is the right thing to call if you plan to decide whether an unfolding will inline.

True of a non-loop-breaker Id that has a stable unfolding that is (a) always inlined; that is, with an UnfWhen guidance, or (b) a DFunUnfolding which never needs to be inlined

The InlinePragInfo type

Inline Pragma Information

Tells when the inlining is active. When it is active the thing may be inlined, depending on how big it is.

If there was an INLINE pragma, then as a separate matter, the RHS will have been made to look small with a Core inline Note

The default InlinePragInfo is AlwaysActive, so the info serves entirely as a way to inhibit inlining until we want it

The OccInfo type

datadata OccInfo
#

identifier Occurrence Information

Constructors

Instances2Eq, Outputable
datadata InsideLam
#

Inside Lambda

Constructors

  • IsInsideLam

    Occurs inside a non-linear lambda Substituting a redex for this occurrence is dangerous because it might duplicate work.

  • NotInsideLam
Instances3Eq, Semigroup, Monoid
  • Eq InsideLamDefined in ghc-9.10.3 · GHC.Types.Basic
  • Semigroup InsideLamDefined in ghc-9.10.3 · GHC.Types.Basic

    If any occurrence of an identifier is inside a lambda, then the occurrence info of that identifier marks it as occurring inside a lambda

  • Monoid InsideLamDefined in ghc-9.10.3 · GHC.Types.Basic

The RuleInfo type

valueruleInfo :: IdInfo -> RuleInfo
#

Specialisations of the Ids function which exist. See Note [Specialisations and RULES in IdInfo]

The CAFInfo type

datadata CafInfo
#

Constant applicative form Information

Records whether an Id makes Constant Applicative Form references

Constructors

  • MayHaveCafRefs

    Indicates that the Id is for either:

    1. A function or static constructor that refers to one or more CAFs, or

    2. A real live CAF

  • NoCafRefs

    A function or static constructor that refers to no CAFs.

Instances3Eq, Ord, Outputable

The LambdaFormInfo type

datadata LambdaFormInfo
#

Information about an identifier, from the code generator's point of view. Every identifier is bound to a LambdaFormInfo in the environment, which gives the code generator enough info to be able to tail call or return that identifier.

Instances1Outputable

If lfInfo = Just info, then the info is guaranteed correct. If lfInfo = Nothing, then we do not have a LambdaFormInfo for this Id, so (for imported Ids) we make a conservative version. See Note [The LFInfo of Imported Ids] in GHC.StgToCmm.Closure For locally-defined Ids other than DataCons, the lfInfo field is always Nothing. See also Note [LFInfo of DataCon workers and wrappers]

Tick-box Info