ghc-9.10.3: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Core.Opt.Simplify.Utils

# Documentation

rebuildLam :: SimplEnv -> [OutBndr] -> OutExpr -> SimplCont -> SimplM OutExpr Source #

mkCase :: SimplMode -> OutExpr -> OutId -> OutType -> [OutAlt] -> SimplM OutExpr Source #

prepareAlts :: OutExpr -> InId -> [InAlt] -> SimplM ([AltCon], [InAlt]) Source #

tryEtaExpandRhs :: SimplEnv -> BindContext -> OutId -> OutExpr -> SimplM (ArityType, OutExpr) Source #

wantEtaExpansion :: CoreExpr -> Bool Source #

preInlineUnconditionally :: SimplEnv -> TopLevelFlag -> InId -> InExpr -> StaticEnv -> Maybe SimplEnv Source #

postInlineUnconditionally :: SimplEnv -> BindContext -> OutId -> OccInfo -> OutExpr -> Bool Source #

activeUnfolding :: SimplMode -> Id -> Bool Source #

activeRule :: SimplMode -> Activation -> Bool Source #

getUnfoldingInRuleMatch :: SimplEnv -> InScopeEnv Source #

updModeForStableUnfoldings :: Activation -> SimplMode -> SimplMode Source #

updModeForRules :: SimplMode -> SimplMode Source #

data BindContext Source #

Constructors

BC_Let TopLevelFlag RecFlag |
BC_Join RecFlag SimplCont |

bindContextLevel :: BindContext -> TopLevelFlag Source #

data SimplCont Source #

Constructors

Stop | Stop[e] = e

Fields

- OutType

  Type of the hole

- CallCtxt

  Tells if there is something interesting about the syntactic context, and hence the inliner should be a bit keener (see interestingCallContext) Specifically: This is an argument of a function that has RULES Inlining the call might allow the rule to fire Never ValAppCxt (use ApplyToVal instead) or CaseCtxt (use Select instead)

- SubDemand

  The evaluation context of e. Tells how e is evaluated. This fuels eta-expansion or eta-reduction without looking at lambda bodies, for example.

  See Note [Eta reduction based on evaluation context] The evaluation context for other SimplConts can be reconstructed with `contEvalContext`

CastIt OutCoercion SimplCont |
ApplyToVal |

Fields

- sc_dup :: DupFlag
- sc_hole_ty :: OutType
- sc_arg :: InExpr
- sc_env :: StaticEnv
- sc_cont :: SimplCont

ApplyToTy |

Fields

- sc_arg_ty :: OutType
- sc_hole_ty :: OutType
- sc_cont :: SimplCont

Select |

Fields

- sc_dup :: DupFlag
- sc_bndr :: InId
- sc_alts :: [InAlt]
- sc_env :: StaticEnv
- sc_cont :: SimplCont

StrictBind |

Fields

- sc_dup :: DupFlag
- sc_from :: FromWhat
- sc_bndr :: InId
- sc_body :: InExpr
- sc_env :: StaticEnv
- sc_cont :: SimplCont

StrictArg |

Fields

- sc_dup :: DupFlag
- sc_fun :: ArgInfo
- sc_fun_ty :: OutType
- sc_cont :: SimplCont

TickIt CoreTickish SimplCont |

#### Instances

Instances details

Outputable SimplCont Source # |
Instance details Defined in GHC.Core.Opt.Simplify.Utils Methods ppr :: SimplCont -> SDoc Source #

data DupFlag Source #

Constructors

NoDup |
Simplified |
OkToDup |

#### Instances

Instances details

Outputable DupFlag Source # |
Instance details Defined in GHC.Core.Opt.Simplify.Utils Methods ppr :: DupFlag -> SDoc Source #

data FromWhat Source #

Constructors

FromLet |
FromBeta Levity |

type StaticEnv = SimplEnv Source #

isSimplified :: DupFlag -> Bool Source #

contIsStop :: SimplCont -> Bool Source #

contIsDupable :: SimplCont -> Bool Source #

contResultType :: SimplCont -> OutType Source #

contHoleType :: SimplCont -> OutType Source #

contHoleScaling :: SimplCont -> Mult Source #

contIsTrivial :: SimplCont -> Bool Source #

contArgs :: SimplCont -> (Bool, [ArgSummary], SimplCont) Source #

contIsRhs :: SimplCont -> Maybe RecFlag Source #

countArgs :: SimplCont -> Int Source #

mkBoringStop :: OutType -> SimplCont Source #

mkRhsStop :: OutType -> RecFlag -> Demand -> SimplCont Source #

mkLazyArgStop :: OutType -> ArgInfo -> SimplCont Source #

interestingCallContext :: SimplEnv -> SimplCont -> CallCtxt Source #

data ArgInfo Source #

Constructors

ArgInfo |

Fields

- ai_fun :: OutId
- ai_args :: [ArgSpec]
- ai_rewrite :: RewriteCall
- ai_encl :: Bool
- ai_dmds :: [Demand]
- ai_discs :: [Int]

#### Instances

Instances details

Outputable ArgInfo Source # |
Instance details Defined in GHC.Core.Opt.Simplify.Utils Methods ppr :: ArgInfo -> SDoc Source #

data ArgSpec Source #

Constructors

ValArg |

Fields

- as_dmd :: Demand
- as_arg :: OutExpr
- as_hole_ty :: OutType

TyArg |

Fields

- as_arg_ty :: OutType
- as_hole_ty :: OutType

CastBy OutCoercion |

#### Instances

Instances details

Outputable ArgSpec Source # |
Instance details Defined in GHC.Core.Opt.Simplify.Utils Methods ppr :: ArgSpec -> SDoc Source #

data RewriteCall Source #

Constructors

TryRules FullArgCount [CoreRule] |
TryInlining |
TryNothing |

mkArgInfo :: SimplEnv -> RuleEnv -> Id -> SimplCont -> ArgInfo Source #

addValArgTo :: ArgInfo -> OutExpr -> OutType -> ArgInfo Source #

addCastTo :: ArgInfo -> OutCoercion -> ArgInfo Source #

addTyArgTo :: ArgInfo -> OutType -> OutType -> ArgInfo Source #

argInfoExpr :: OutId -> [ArgSpec] -> OutExpr Source #

argInfoAppArgs :: [ArgSpec] -> [OutExpr] Source #

pushSimplifiedArgs :: SimplEnv -> [ArgSpec] -> SimplCont -> SimplCont Source #

pushSimplifiedRevArgs :: SimplEnv -> [ArgSpec] -> SimplCont -> SimplCont Source #

isStrictArgInfo :: ArgInfo -> Bool Source #

lazyArgContext :: ArgInfo -> CallCtxt Source #

abstractFloats :: UnfoldingOpts -> TopLevelFlag -> [OutTyVar] -> SimplFloats -> OutExpr -> SimplM ([OutBind], OutExpr) Source #

isExitJoinId :: Var -> Bool Source #