CoreUnfold

ghc-8.6.3: The GHC API

Safe Haskell | None
Language | Haskell2010

CoreUnfold

Synopsis

- data Unfolding
- data UnfoldingGuidance
- noUnfolding :: Unfolding
- mkImplicitUnfolding :: DynFlags -> CoreExpr -> Unfolding
- mkUnfolding :: DynFlags -> UnfoldingSource -> Bool -> Bool -> CoreExpr -> Unfolding
- mkCoreUnfolding :: UnfoldingSource -> Bool -> CoreExpr -> UnfoldingGuidance -> Unfolding
- mkTopUnfolding :: DynFlags -> Bool -> CoreExpr -> Unfolding
- mkSimpleUnfolding :: DynFlags -> CoreExpr -> Unfolding
- mkWorkerUnfolding :: DynFlags -> (CoreExpr -> CoreExpr) -> Unfolding -> Unfolding
- mkInlineUnfolding :: CoreExpr -> Unfolding
- mkInlineUnfoldingWithArity :: Arity -> CoreExpr -> Unfolding
- mkInlinableUnfolding :: DynFlags -> CoreExpr -> Unfolding
- mkWwInlineRule :: DynFlags -> CoreExpr -> Arity -> Unfolding
- mkCompulsoryUnfolding :: CoreExpr -> Unfolding
- mkDFunUnfolding :: [Var] -> DataCon -> [CoreExpr] -> Unfolding
- specUnfolding :: DynFlags -> [Var] -> (CoreExpr -> CoreExpr) -> Arity -> Unfolding -> Unfolding
- data ArgSummary
  - = TrivArg
  - | NonTrivArg
  - | ValueArg
- couldBeSmallEnoughToInline :: DynFlags -> Int -> CoreExpr -> Bool
- inlineBoringOk :: CoreExpr -> Bool
- certainlyWillInline :: DynFlags -> IdInfo -> Maybe Unfolding
- smallEnoughToInline :: DynFlags -> Unfolding -> Bool
- callSiteInline :: DynFlags -> Id -> Bool -> Bool -> [ArgSummary] -> CallCtxt -> Maybe CoreExpr
- data CallCtxt
  - = BoringCtxt
  - | RhsCtxt
  - | DiscArgCtxt
  - | RuleArgCtxt
  - | ValAppCtxt
  - | CaseCtxt
- exprIsConApp_maybe :: InScopeEnv -> CoreExpr -> Maybe (DataCon, [Type], [CoreExpr])
- exprIsLiteral_maybe :: InScopeEnv -> CoreExpr -> Maybe Literal

# Documentation

data Unfolding #

Records the unfolding of an identifier, which is approximately the form the identifier would have if we substituted its definition in for the identifier. This type should be treated as abstract everywhere except in CoreUnfold

Instances

Outputable Unfolding # |
Instance details Defined in PprCore Methods ppr :: Unfolding -> SDoc # pprPrec :: Rational -> Unfolding -> SDoc #

data UnfoldingGuidance #

`UnfoldingGuidance` says when unfolding should take place

Instances

Eq UnfoldingGuidance # |
Instance details Defined in CoreSyn Methods (==) :: UnfoldingGuidance -> UnfoldingGuidance -> Bool # (/=) :: UnfoldingGuidance -> UnfoldingGuidance -> Bool #
Outputable UnfoldingGuidance # |
Instance details Defined in PprCore Methods ppr :: UnfoldingGuidance -> SDoc # pprPrec :: Rational -> UnfoldingGuidance -> SDoc #

noUnfolding :: Unfolding #

There is no known `Unfolding`

mkImplicitUnfolding :: DynFlags -> CoreExpr -> Unfolding #

mkUnfolding :: DynFlags -> UnfoldingSource -> Bool -> Bool -> CoreExpr -> Unfolding #

mkCoreUnfolding :: UnfoldingSource -> Bool -> CoreExpr -> UnfoldingGuidance -> Unfolding #

mkTopUnfolding :: DynFlags -> Bool -> CoreExpr -> Unfolding #

mkSimpleUnfolding :: DynFlags -> CoreExpr -> Unfolding #

mkWorkerUnfolding :: DynFlags -> (CoreExpr -> CoreExpr) -> Unfolding -> Unfolding #

mkInlineUnfolding :: CoreExpr -> Unfolding #

Make an unfolding that may be used unsaturated (ug_unsat_ok = unSaturatedOk) and that is reported as having its manifest arity (the number of outer lambdas applications will resolve before doing any work).

mkInlineUnfoldingWithArity :: Arity -> CoreExpr -> Unfolding #

Make an unfolding that will be used once the RHS has been saturated to the given arity.

mkInlinableUnfolding :: DynFlags -> CoreExpr -> Unfolding #

mkWwInlineRule :: DynFlags -> CoreExpr -> Arity -> Unfolding #

mkCompulsoryUnfolding :: CoreExpr -> Unfolding #

mkDFunUnfolding :: [Var] -> DataCon -> [CoreExpr] -> Unfolding #

specUnfolding :: DynFlags -> [Var] -> (CoreExpr -> CoreExpr) -> Arity -> Unfolding -> Unfolding #

data ArgSummary #

Constructors

TrivArg |
NonTrivArg |
ValueArg |

Instances

Outputable ArgSummary # |
Instance details Defined in CoreUnfold Methods ppr :: ArgSummary -> SDoc # pprPrec :: Rational -> ArgSummary -> SDoc #

couldBeSmallEnoughToInline :: DynFlags -> Int -> CoreExpr -> Bool #

inlineBoringOk :: CoreExpr -> Bool #

certainlyWillInline :: DynFlags -> IdInfo -> Maybe Unfolding #

smallEnoughToInline :: DynFlags -> Unfolding -> Bool #

callSiteInline :: DynFlags -> Id -> Bool -> Bool -> [ArgSummary] -> CallCtxt -> Maybe CoreExpr #

data CallCtxt #

Constructors

BoringCtxt |
RhsCtxt |
DiscArgCtxt |
RuleArgCtxt |
ValAppCtxt |
CaseCtxt |

Instances

Outputable CallCtxt # |
Instance details Defined in CoreUnfold Methods ppr :: CallCtxt -> SDoc # pprPrec :: Rational -> CallCtxt -> SDoc #

exprIsConApp_maybe :: InScopeEnv -> CoreExpr -> Maybe (DataCon, [Type], [CoreExpr]) #

Returns `Just (dc, [t1..tk], [x1..xn])` if the argument expression is a *saturated* constructor application of the form `dc t1..tk x1 .. xn`, where t1..tk are the *universally-quantified* type args of `dc`

exprIsLiteral_maybe :: InScopeEnv -> CoreExpr -> Maybe Literal #