package ocaml-base-compiler

  1. Overview
  2. Docs
type t

Result structures approximately follow the evaluation order of the program. They are returned by the simplification algorithm acting on an Flambda subexpression.

val create : unit -> t
val approx : t -> Simple_value_approx.t

The approximation of the subexpression that has just been simplified.

val set_approx : t -> Simple_value_approx.t -> t

Set the approximation of the subexpression that has just been simplified. Typically used just before returning from a case of the simplification algorithm.

val meet_approx : t -> Env.t -> Simple_value_approx.t -> t

Set the approximation of the subexpression to the meet of the current return approximation and the provided one. Typically used just before returning from a branch case of the simplification algorithm.

val used_static_exceptions : t -> Static_exception.Set.t

All static exceptions for which use_staticfail has been called on the given result structure.

val use_static_exception : t -> Static_exception.t -> t

Mark that the given static exception has been used.

val exit_scope_catch : t -> Static_exception.t -> t

Mark that we are moving up out of the scope of a static-catch block that catches the given static exception identifier. This has the effect of removing the identifier from the used_staticfail set.

val benefit : t -> Inlining_cost.Benefit.t

The benefit to be gained by inlining the subexpression whose simplification yielded the given result structure.

val map_benefit : t -> (Inlining_cost.Benefit.t -> Inlining_cost.Benefit.t) -> t

Apply a transformation to the inlining benefit stored within the given result structure.

val add_benefit : t -> Inlining_cost.Benefit.t -> t

Add some benefit to the inlining benefit stored within the given result structure.

val reset_benefit : t -> t

Set the benefit of inlining the subexpression corresponding to the given result structure to zero.

val set_inlining_threshold : t -> Inlining_cost.Threshold.t option -> t
val add_inlining_threshold : t -> Inlining_cost.Threshold.t -> t
val sub_inlining_threshold : t -> Inlining_cost.Threshold.t -> t
val inlining_threshold : t -> Inlining_cost.Threshold.t option
val seen_direct_application : t -> t
val num_direct_applications : t -> int