jon.recoil.org

Module Flambda2_simplify.Flow_acc

Dataflow analysis.

This module aims mainly at tracking uses of variables (other things may be added later on), with the aim of:

Type alias for convenience.

Normalize an accumulator before begin processed. Does two things:

  • "Consume" the extra args of an accumulator in order to add them to the regular args and parameters in the continuation info of each continuation
  • Rewrite the callsites of specialized continuations
val wrong_dummy_toplevel_cont_name : string

A name for the incorrec tdummy toplevel cont used to initialize the acc.

val empty : unit -> Flambda2_simplify.Flow_acc.t

Empty uses

Initialize the analysis so that the stack consists of a single toplevel continuation.

Add a new continuation on the stack. Used when entering a continuation handler.

Pop the current top of the stack. Used when exiting the current continuation handler.

That variable is defined in the current handler

Add a variable binding from the current handler.

val record_let_binding : rewrite_id:Flambda2_identifiers.Named_rewrite_id.t -> generate_phantom_lets:bool -> let_bound:Flambda2_bound_identifiers.Bound_pattern.t -> simplified_defining_expr:Flambda2_simplify.Simplified_named.t -> Flambda2_simplify.Flow_acc.t -> Flambda2_simplify.Flow_acc.t

Record a let-binding

Add a variable binding to the symbol. Projections might get recorded multiple times.

Add a symbol binding from the current handler.

Add a code id binding from the current handler.

Add name occurrences used in the body of the current continuation's handler, *excluding* uses in apply_cont expressions, which are tracked separately.

Add the given continuation as being used as the return continuation for a function call.

Add, for the current continuation handler, uses for an apply cont of the given continuation with given arguments occurrences.