ghc-lib-parser-0.20220501: The GHC API, decoupled from GHC versions
Safe HaskellNone
LanguageHaskell2010

GHC.Types.Id.Info

Synopsis

The IdDetails type

data IdDetails Source #

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

The Id is a superclass selector, or class operation of a class

PrimOpId PrimOp

The Id is for a primitive operator

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), 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 StrictWorkerId if given CbvMarks. See Note [Strict Worker Ids]

StrictWorkerId [CbvMark]

An Id for a worker function, which expects some arguments to be passed both evaluated and tagged. See Note [Strict Worker Ids] See Note [Tag Inference]

Instances

Instances details
Outputable IdDetails Source # 
Instance details

Defined in GHC.Types.Id.Info

Methods

ppr :: IdDetails -> SDoc Source #

coVarDetails :: IdDetails Source #

Just a synonym for CoVarId. Written separately so it can be exported in the hs-boot file.

type JoinArity = Int Source #

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.

data RecSelParent Source #

Recursive Selector Parent

Instances

Instances details
Eq RecSelParent Source # 
Instance details

Defined in GHC.Types.Id.Info

Outputable RecSelParent Source # 
Instance details

Defined in GHC.Types.Id.Info

The IdInfo type

data IdInfo Source #

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.

Instances

Instances details
Outputable IdInfo Source # 
Instance details

Defined in GHC.Core.Ppr

Methods

ppr :: IdInfo -> SDoc Source #

vanillaIdInfo :: IdInfo Source #

Basic IdInfo that carries no useful information whatsoever

noCafIdInfo :: IdInfo Source #

More informative IdInfo we can use when we know the Id has no CAF references

The OneShotInfo type

data OneShotInfo Source #

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

NoOneShotInfo

No information

OneShotLam

The lambda is applied at most once.

Instances

Instances details
Eq OneShotInfo Source # 
Instance details

Defined in GHC.Types.Basic

Outputable OneShotInfo Source # 
Instance details

Defined in GHC.Types.Basic

Methods

ppr :: OneShotInfo -> SDoc Source #

oneShotInfo :: IdInfo -> OneShotInfo Source #

Info about a lambda-bound variable, if the Id is one

noOneShotInfo :: OneShotInfo Source #

It is always safe to assume that an Id has no lambda-bound variable information

Zapping various forms of Info

zapLamInfo :: IdInfo -> Maybe IdInfo Source #

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

zapFragileInfo :: IdInfo -> Maybe IdInfo Source #

Zap info that depends on free variables

zapDemandInfo :: IdInfo -> Maybe IdInfo Source #

Remove all demand info on the IdInfo

zapUsageInfo :: IdInfo -> Maybe IdInfo Source #

Remove usage (but not strictness) info on the IdInfo

zapUsageEnvInfo :: IdInfo -> Maybe IdInfo Source #

Remove usage environment info from the strictness signature on the IdInfo

The ArityInfo type

type ArityInfo = Arity Source #

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].

unknownArity :: Arity Source #

It is always safe to assume that an Id has an arity of 0

arityInfo :: IdInfo -> ArityInfo Source #

Id arity, as computed by GHC.Core.Opt.Arity. Specifies how many arguments this Id has to be applied to before it doesn any meaningful work.

callArityInfo :: IdInfo -> ArityInfo Source #

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

dmdSigInfo :: IdInfo -> DmdSig Source #

A strictness signature. Digests how a function uses its arguments if applied to at least arityInfo arguments.

cprSigInfo :: IdInfo -> CprSig Source #

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

demandInfo :: IdInfo -> Demand Source #

ID demand information

Unfolding Info

realUnfoldingInfo :: IdInfo -> Unfolding Source #

The Ids unfolding

unfoldingInfo :: IdInfo -> Unfolding Source #

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.

hasInlineUnfolding :: IdInfo -> Bool Source #

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

type InlinePragInfo = InlinePragma Source #

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

inlinePragInfo :: IdInfo -> InlinePragma Source #

Any inline pragma attached to the Id

The OccInfo type

data OccInfo Source #

identifier Occurrence Information

Constructors

ManyOccs

There are many occurrences, or unknown occurrences

IAmDead

Marks unused variables. Sometimes useful for lambda and case-bound variables.

OneOcc

Occurs exactly once (per branch), not inside a rule

IAmALoopBreaker

This identifier breaks a loop of mutually recursive functions. The field marks whether it is only a loop breaker due to a reference in a rule

Fields

Instances

Instances details
Eq OccInfo Source # 
Instance details

Defined in GHC.Types.Basic

Methods

(==) :: OccInfo -> OccInfo -> Bool #

(/=) :: OccInfo -> OccInfo -> Bool #

Outputable OccInfo Source # 
Instance details

Defined in GHC.Types.Basic

Methods

ppr :: OccInfo -> SDoc Source #

occInfo :: IdInfo -> OccInfo Source #

How the Id occurs in the program

data InsideLam Source #

Inside Lambda

Constructors

IsInsideLam

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

NotInsideLam 

Instances

Instances details
Eq InsideLam Source # 
Instance details

Defined in GHC.Types.Basic

Semigroup InsideLam Source #

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

Instance details

Defined in GHC.Types.Basic

Monoid InsideLam Source # 
Instance details

Defined in GHC.Types.Basic

data TailCallInfo Source #

Instances

Instances details
Eq TailCallInfo Source # 
Instance details

Defined in GHC.Types.Basic

Outputable TailCallInfo Source # 
Instance details

Defined in GHC.Types.Basic

The RuleInfo type

data RuleInfo Source #

Rule Information

Records the specializations of this Id that we know about in the form of rewrite CoreRules that target them

Constructors

RuleInfo [CoreRule] DVarSet 

emptyRuleInfo :: RuleInfo Source #

Assume that no specializations exist: always safe

ruleInfoFreeVars :: RuleInfo -> DVarSet Source #

Retrieve the locally-defined free variables of both the left and right hand sides of the specialization rules

setRuleInfoHead :: Name -> RuleInfo -> RuleInfo Source #

Change the name of the function the rule is keyed on all of the CoreRules

ruleInfo :: IdInfo -> RuleInfo Source #

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

The CAFInfo type

data CafInfo Source #

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.

Instances

Instances details
Eq CafInfo Source # 
Instance details

Defined in GHC.Types.Id.Info

Methods

(==) :: CafInfo -> CafInfo -> Bool #

(/=) :: CafInfo -> CafInfo -> Bool #

Ord CafInfo Source # 
Instance details

Defined in GHC.Types.Id.Info

Outputable CafInfo Source # 
Instance details

Defined in GHC.Types.Id.Info

Methods

ppr :: CafInfo -> SDoc Source #

cafInfo :: IdInfo -> CafInfo Source #

Id CAF info

The LambdaFormInfo type

data LambdaFormInfo Source #

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.

Instances

Instances details
Outputable LambdaFormInfo Source # 
Instance details

Defined in GHC.StgToCmm.Types

Tick-box Info

data TickBoxOp Source #

Tick box for Hpc-style coverage

Constructors

TickBox Module !TickBoxId 

Instances

Instances details
Outputable TickBoxOp Source # 
Instance details

Defined in GHC.Types.Id.Info

Methods

ppr :: TickBoxOp -> SDoc Source #