CoreUnfold

ghc-8.0.0.20160204: 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 :: Maybe Arity -> CoreExpr -> Unfolding
- mkInlinableUnfolding :: DynFlags -> CoreExpr -> Unfolding
- mkWwInlineRule :: CoreExpr -> Arity -> Unfolding
- mkCompulsoryUnfolding :: CoreExpr -> Unfolding
- mkDFunUnfolding :: [Var] -> DataCon -> [CoreExpr] -> Unfolding
- specUnfolding :: DynFlags -> Subst -> [Var] -> [CoreExpr] -> Unfolding -> Unfolding
- data ArgSummary
  - = TrivArg
  - | NonTrivArg
  - | ValueArg
- couldBeSmallEnoughToInline :: DynFlags -> Int -> CoreExpr -> Bool
- inlineBoringOk :: CoreExpr -> Bool
- certainlyWillInline :: DynFlags -> Unfolding -> 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 Source

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

data UnfoldingGuidance Source

`UnfoldingGuidance` says when unfolding should take place

Instances

Eq UnfoldingGuidance |
Methods (==) :: UnfoldingGuidance -> UnfoldingGuidance -> Bool (/=) :: UnfoldingGuidance -> UnfoldingGuidance -> Bool

noUnfolding :: Unfolding Source

There is no known `Unfolding`

mkImplicitUnfolding :: DynFlags -> CoreExpr -> Unfolding Source

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

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

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

mkSimpleUnfolding :: DynFlags -> CoreExpr -> Unfolding Source

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

mkInlineUnfolding :: Maybe Arity -> CoreExpr -> Unfolding Source

mkInlinableUnfolding :: DynFlags -> CoreExpr -> Unfolding Source

mkWwInlineRule :: CoreExpr -> Arity -> Unfolding Source

mkCompulsoryUnfolding :: CoreExpr -> Unfolding Source

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

specUnfolding :: DynFlags -> Subst -> [Var] -> [CoreExpr] -> Unfolding -> Unfolding Source

data ArgSummary Source

Constructors

TrivArg |
NonTrivArg |
ValueArg |

Instances

Outputable ArgSummary |
Methods ppr :: ArgSummary -> SDoc Source pprPrec :: Rational -> ArgSummary -> SDoc Source

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

inlineBoringOk :: CoreExpr -> Bool Source

certainlyWillInline :: DynFlags -> Unfolding -> Maybe Unfolding Source

smallEnoughToInline :: DynFlags -> Unfolding -> Bool Source

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

data CallCtxt Source

Constructors

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

Instances

Outputable CallCtxt |
Methods ppr :: CallCtxt -> SDoc Source pprPrec :: Rational -> CallCtxt -> SDoc Source

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

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-qantified* type args of `dc`

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