Module Flambda2_simplify.Are_lifting_conts
ontinuation Lifting Status
Continuation lifting is done in simplify on the way down. Considering a term of the form:
* let_cont k x = * let_cont k' y = * ... * in * .. * in * ..
The decision to lift continuations (e.g. k') out of another (e.g. k), is made once Simplify has reached the bottom of the handler of k **but** has not yet explored the handler of k'. The t type represente the current decision about lifting of continuations:
- it is set to
No_liftingat top-level (because continuations cannot be lifted above the top-level) - it is set to
Analyzingwhen going downwards through the handler of a continuation. - when we make the choice of whether to lift or not
1, if we do decide to lift, we set it toLifting_out_of.
See occurrences of the constructors in simplify_let_cont_expr and the associated comments for more details.
1: typically when we simplify leafs of expressions, so mostly in simplify_switch because that will be the interesting case for the match-in-match optimisation.
type t = private | Not_lifting| Analyzing of {continuation : Flambda2_identifiers.Continuation.t;is_exn_handler : bool;uses : Flambda2_simplify.Continuation_uses.t;
}| Lifting_out_of of {continuation : Flambda2_identifiers.Continuation.t;
}
The current continuation lifting status, stored in the dacc.
val print :
Stdlib.Format.formatter ->
Flambda2_simplify.Are_lifting_conts.t ->
unitPrinting function.
val no_lifting : Flambda2_simplify.Are_lifting_conts.tPrevent any lifting of continuation.
val think_about_lifting_out_of :
is_exn_handler:bool ->
Flambda2_identifiers.Continuation.t ->
Flambda2_simplify.Continuation_uses.t ->
Flambda2_simplify.Are_lifting_conts.tDelay the choice of lifting until the leaf of a continuation's handler.
val lift_continuations_out_of :
Flambda2_identifiers.Continuation.t ->
Flambda2_simplify.Are_lifting_conts.tInstruct simplify_let_cont to lift continuations.