ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Core.Opt.Simplify.Utils

# Documentation

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

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

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

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

wantEtaExpansion :: CoreExpr -> Bool #

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

postInlineUnconditionally :: SimplEnv -> BindContext -> InId -> OutId -> OutExpr -> Bool #

activeRule :: SimplMode -> Activation -> Bool #

getUnfoldingInRuleMatch :: SimplEnv -> InScopeEnv #

updModeForStableUnfoldings :: Activation -> SimplMode -> SimplMode #

updModeForRules :: SimplMode -> SimplMode #

data BindContext #

Constructors

BC_Let TopLevelFlag RecFlag |
BC_Join RecFlag SimplCont |

bindContextLevel :: BindContext -> TopLevelFlag #

data SimplCont #

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 |
Fields sc_co :: OutCoercion sc_opt :: Bool sc_cont :: 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 # |
Instance details Defined in GHC.Core.Opt.Simplify.Utils Methods ppr :: SimplCont -> SDoc #

data DupFlag #

Constructors

NoDup |
Simplified |
OkToDup |

#### Instances

Instances details

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

data FromWhat #

Constructors

FromLet |
FromBeta Levity |

type StaticEnv = SimplEnv #

isSimplified :: DupFlag -> Bool #

contIsStop :: SimplCont -> Bool #

contIsDupable :: SimplCont -> Bool #

contResultType :: SimplCont -> OutType #

contHoleType :: SimplCont -> OutType #

contHoleScaling :: SimplCont -> Mult #

contIsTrivial :: SimplCont -> Bool #

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

contIsRhs :: SimplCont -> Maybe RecFlag #

countArgs :: SimplCont -> Int #

contOutArgs :: SimplEnv -> SimplCont -> [OutExpr] #

dropContArgs :: FullArgCount -> SimplCont -> SimplCont #

mkBoringStop :: OutType -> SimplCont #

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

mkLazyArgStop :: OutType -> ArgInfo -> SimplCont #

interestingCallContext :: SimplEnv -> SimplCont -> CallCtxt #

data ArgInfo #

Constructors

ArgInfo |
Fields ai_fun :: OutId ai_args :: [ArgSpec] ai_rules :: [CoreRule] ai_encl :: Bool ai_dmds :: [Demand] ai_discs :: [Int]

#### Instances

Instances details

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

data ArgSpec #

Constructors

ValArg |
Fields as_dmd :: Demand as_arg :: OutExpr as_hole_ty :: OutType
TyArg |
Fields as_arg_ty :: OutType as_hole_ty :: OutType

#### Instances

Instances details

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

mkArgInfo :: SimplEnv -> Id -> [CoreRule] -> SimplCont -> ArgInfo #

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

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

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

argSpecArg :: ArgSpec -> OutExpr #

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

isStrictArgInfo :: ArgInfo -> Bool #

lazyArgContext :: ArgInfo -> CallCtxt #

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

isExitJoinId :: Var -> Bool #