Module Simple_value_approx

type !'a boxed_int =
  1. | Int32 : int32 boxed_int
  2. | Int64 : int64 boxed_int
  3. | Nativeint : nativeint boxed_int
type value_string = {
  1. contents : string option;
  2. size : int;
}
type unresolved_value =
  1. | Set_of_closures_id of Set_of_closures_id.t
  2. | Symbol of Symbol.t
type unknown_because_of =
  1. | Unresolved_value of unresolved_value
  2. | Other
type t = private {
  1. descr : descr;
  2. var : Variable.t option;
  3. symbol : (Symbol.t * int option) option;
}
and descr = private
  1. | Value_block of Tag.t * t array
  2. | Value_int of int
  3. | Value_char of char
  4. | Value_float of float option
  5. | Value_boxed_int : 'a boxed_int * 'a -> descr
  6. | Value_set_of_closures of value_set_of_closures
  7. | Value_closure of value_closure
  8. | Value_string of value_string
  9. | Value_float_array of value_float_array
  10. | Value_unknown of unknown_because_of
  11. | Value_bottom
  12. | Value_extern of Export_id.t
  13. | Value_symbol of Symbol.t
  14. | Value_unresolved of unresolved_value
and value_closure = {
  1. set_of_closures : t;
  2. closure_id : Closure_id.t;
}
and function_declarations = private {
  1. is_classic_mode : bool;
  2. set_of_closures_id : Set_of_closures_id.t;
  3. set_of_closures_origin : Set_of_closures_origin.t;
  4. funs : function_declaration Variable.Map.t;
}
and function_body = private {
  1. free_variables : Variable.Set.t;
  2. free_symbols : Symbol.Set.t;
  3. stub : bool;
  4. dbg : Debuginfo.t;
  5. inline : Lambda.inline_attribute;
  6. specialise : Lambda.specialise_attribute;
  7. is_a_functor : bool;
  8. body : Flambda.t;
  9. poll : Lambda.poll_attribute;
}
and function_declaration = private {
  1. closure_origin : Closure_origin.t;
  2. params : Parameter.t list;
  3. function_body : function_body option;
}
and value_set_of_closures = private {
  1. function_decls : function_declarations;
  2. bound_vars : t Var_within_closure.Map.t;
  3. free_vars : Flambda.specialised_to Variable.Map.t;
  4. invariant_params : Variable.Set.t Variable.Map.t Lazy.t;
  5. recursive : Variable.Set.t Lazy.t;
  6. size : int option Variable.Map.t Lazy.t;
  7. specialised_args : Flambda.specialised_to Variable.Map.t;
  8. freshening : Freshening.Project_var.t;
  9. direct_call_surrogates : Closure_id.t Closure_id.Map.t;
}
and value_float_array_contents =
  1. | Contents of t array
  2. | Unknown_or_mutable
and value_float_array = {
  1. contents : value_float_array_contents;
  2. size : int;
}
val descr : t -> descr
val descrs : t list -> descr list
val print : Format.formatter -> t -> unit
val print_descr : Format.formatter -> descr -> unit
val print_value_set_of_closures : Format.formatter -> value_set_of_closures -> unit
val print_function_declarations : Format.formatter -> function_declarations -> unit
val function_declarations_approx : keep_body:(Variable.t -> Flambda.function_declaration -> bool) -> Flambda.function_declarations -> function_declarations
val create_value_set_of_closures : function_decls:function_declarations -> bound_vars:t Var_within_closure.Map.t -> free_vars:Flambda.specialised_to Variable.Map.t -> invariant_params:Variable.Set.t Variable.Map.t lazy_t -> recursive:Variable.Set.t Lazy.t -> specialised_args:Flambda.specialised_to Variable.Map.t -> freshening:Freshening.Project_var.t -> direct_call_surrogates:Closure_id.t Closure_id.Map.t -> value_set_of_closures
val update_freshening_of_value_set_of_closures : value_set_of_closures -> freshening:Freshening.Project_var.t -> value_set_of_closures
val value_unknown : unknown_because_of -> t
val value_int : int -> t
val value_char : char -> t
val value_float : float -> t
val value_any_float : t
val value_mutable_float_array : size:int -> t
val value_immutable_float_array : t array -> t
val value_string : int -> string option -> t
val value_boxed_int : 'i boxed_int -> 'i -> t
val value_block : Tag.t -> t array -> t
val value_extern : Export_id.t -> t
val value_symbol : Symbol.t -> t
val value_bottom : t
val value_unresolved : unresolved_value -> t
val value_closure : ?closure_var:Variable.t -> ?set_of_closures_var:Variable.t -> ?set_of_closures_symbol:Symbol.t -> value_set_of_closures -> Closure_id.t -> t
val value_set_of_closures : ?set_of_closures_var:Variable.t -> value_set_of_closures -> t
val make_const_int : int -> Flambda.t * t
val make_const_char : char -> Flambda.t * t
val make_const_bool : bool -> Flambda.t * t
val make_const_float : float -> Flambda.t * t
val make_const_boxed_int : 'i boxed_int -> 'i -> Flambda.t * t
val make_const_int_named : int -> Flambda.named * t
val make_const_char_named : char -> Flambda.named * t
val make_const_bool_named : bool -> Flambda.named * t
val make_const_float_named : float -> Flambda.named * t
val make_const_boxed_int_named : 'i boxed_int -> 'i -> Flambda.named * t
val augment_with_variable : t -> Variable.t -> t
val augment_with_symbol : t -> Symbol.t -> t
val augment_with_symbol_field : t -> Symbol.t -> int -> t
val replace_description : t -> descr -> t
val augment_with_kind : t -> Lambda.value_kind -> t
val augment_kind_with_approx : t -> Lambda.value_kind -> Lambda.value_kind
val equal_boxed_int : 'a boxed_int -> 'a -> 'b boxed_int -> 'b -> bool
val meet : really_import_approx:(t -> t) -> t -> t -> t
val known : t -> bool
val useful : t -> bool
val all_not_useful : t list -> bool
val warn_on_mutation : t -> bool
type simplification_summary =
  1. | Nothing_done
  2. | Replaced_term
type simplification_result = Flambda.t * simplification_summary * t
type simplification_result_named = Flambda.named * simplification_summary * t
val simplify : t -> Flambda.t -> simplification_result
val simplify_using_env : t -> is_present_in_env:(Variable.t -> bool) -> Flambda.t -> simplification_result
val simplify_named : t -> Flambda.named -> simplification_result_named
val simplify_named_using_env : t -> is_present_in_env:(Variable.t -> bool) -> Flambda.named -> simplification_result_named
val simplify_var_to_var_using_env : t -> is_present_in_env:(Variable.t -> bool) -> Variable.t option
val simplify_var : t -> (Flambda.named * t) option
type get_field_result =
  1. | Ok of t
  2. | Unreachable
val get_field : t -> field_index:int -> get_field_result
type checked_approx_for_block =
  1. | Wrong
  2. | Ok of Tag.t * t array
val check_approx_for_block : t -> checked_approx_for_block
val approx_for_bound_var : value_set_of_closures -> Var_within_closure.t -> t
val freshen_and_check_closure_id : value_set_of_closures -> Closure_id.t -> Closure_id.t
type strict_checked_approx_for_set_of_closures =
  1. | Wrong
  2. | Ok of Variable.t option * value_set_of_closures
val strict_check_approx_for_set_of_closures : t -> strict_checked_approx_for_set_of_closures
type checked_approx_for_set_of_closures =
  1. | Wrong
  2. | Unresolved of unresolved_value
  3. | Unknown
  4. | Unknown_because_of_unresolved_value of unresolved_value
  5. | Ok of Variable.t option * value_set_of_closures
val check_approx_for_set_of_closures : t -> checked_approx_for_set_of_closures
type checked_approx_for_closure =
  1. | Wrong
  2. | Ok of value_closure * Variable.t option * Symbol.t option * value_set_of_closures
val check_approx_for_closure : t -> checked_approx_for_closure
type checked_approx_for_closure_allowing_unresolved =
  1. | Wrong
  2. | Unresolved of unresolved_value
  3. | Unknown
  4. | Unknown_because_of_unresolved_value of unresolved_value
  5. | Ok of value_closure * Variable.t option * Symbol.t option * value_set_of_closures
val check_approx_for_closure_allowing_unresolved : t -> checked_approx_for_closure_allowing_unresolved
val check_approx_for_float : t -> float option
val float_array_as_constant : value_float_array -> float list option
val check_approx_for_string : t -> string option
type switch_branch_selection =
  1. | Cannot_be_taken
  2. | Can_be_taken
  3. | Must_be_taken
val potentially_taken_const_switch_branch : t -> int -> switch_branch_selection
val potentially_taken_block_switch_branch : t -> int -> switch_branch_selection
val function_arity : function_declaration -> int
val update_function_declaration_body : function_declaration -> (Flambda.t -> Flambda.t) -> function_declaration
val clear_function_bodies : function_declarations -> function_declarations