type subst = t
val empty : t
The freshening that does nothing. This is the unique inactive freshening.
val is_empty : t -> bool
val activate : t -> t
Activate the freshening. Without activation, operations to request freshenings have no effect (cf. the documentation below for
add_variable
). As such, the inactive renaming is unique.
val empty_preserving_activation_state : t -> t
Given the inactive freshening, return the same; otherwise, return an empty active freshening.
val add_variable : t -> Variable.t -> Variable.t * t
add_variable t var
Ift
is active: It returns a fresh variablenew_var
and addsvar
->new_var
to the freshening. If a renamingother_var
->var
orsymbol
->var
was already present int
, it will also addother_var
->new_var
andsymbol
->new_var
. Ift
is inactive, this is the identity.
val add_variables' : t -> Variable.t list -> Variable.t list * t
Like
add_variable
, but for multiple variables, each freshened separately.
val add_variables : t -> (Variable.t * 'a) list -> (Variable.t * 'a) list * t
Like
add_variables'
, but passes through the second component of the input list unchanged.
val add_mutable_variable : t -> Mutable_variable.t -> Mutable_variable.t * t
Like
add_variable
, but for mutable variables.
val add_static_exception : t -> Static_exception.t -> Static_exception.t * t
As for
add_variable
, but for static exception identifiers.
val apply_variable : t -> Variable.t -> Variable.t
apply_variable t var
applies the fresheningt
tovar
. If no renaming is specified int
forvar
it is returned unchanged.
val apply_mutable_variable : t -> Mutable_variable.t -> Mutable_variable.t
As for
apply_variable
, but for mutable variables.
val apply_static_exception : t -> Static_exception.t -> Static_exception.t
As for
apply_variable
, but for static exception identifiers.
val rewrite_recursive_calls_with_symbols : t -> Flambda.function_declarations -> make_closure_symbol:(Closure_id.t -> Symbol.t) -> Flambda.function_declarations
Replace recursive accesses to the closures in the set through
Symbol
by the correspondingVar
. This is used to recover the recursive call when importing code from another compilation unit.If the renaming is inactive, this is the identity.
module Project_var : sig ... end
val apply_function_decls_and_free_vars : t -> (Flambda.specialised_to * 'a) Variable.Map.t -> Flambda.function_declarations -> only_freshen_parameters:bool -> (Flambda.specialised_to * 'a) Variable.Map.t * Flambda.function_declarations * t * Project_var.t
val does_not_freshen : t -> Variable.t list -> bool
val print : Stdlib.Format.formatter -> t -> unit
val freshen_projection_relation : Flambda.specialised_to Variable.Map.t -> freshening:t -> closure_freshening:Project_var.t -> Flambda.specialised_to Variable.Map.t
N.B. This does not freshen the domain of the supplied map, only the range.
val freshen_projection_relation' : (Flambda.specialised_to * 'a) Variable.Map.t -> freshening:t -> closure_freshening:Project_var.t -> (Flambda.specialised_to * 'a) Variable.Map.t