Module Flambda2_terms.Switch_expr
Representation of conditional control flow: the Switch expression.
Scrutinees of Switches are of kind Naked_immediate. There are no default cases. Switches always have at least two cases.
include Flambda2_terms.Expr_std.S with type t := Flambda2_terms.Switch_expr.t
val print : Stdlib.Format.formatter -> Flambda2_terms.Switch_expr.t -> unitinclude Flambda2_nominal.Contains_names.S
with type t := Flambda2_terms.Switch_expr.t
val free_names :
Flambda2_terms.Switch_expr.t ->
Flambda2_nominal.Name_occurrences.tCompute the free names of a term. Such computation covers all kinds of bindable names (variables, continuations, ...)
val apply_renaming :
Flambda2_terms.Switch_expr.t ->
Flambda2_nominal.Renaming.t ->
Flambda2_terms.Switch_expr.tApply a renaming throughout a term.
include Flambda2_nominal.Contains_ids.S
with type t := Flambda2_terms.Switch_expr.t
val ids_for_export :
Flambda2_terms.Switch_expr.t ->
Flambda2_nominal.Ids_for_export.tGather all table identifiers to export them.
val create :
condition_dbg:Debuginfo.t ->
scrutinee:Flambda2_term_basics.Simple.t ->
arms:Flambda2_terms.Apply_cont_expr.t Flambda2_numbers.Target_ocaml_int.Map.t ->
Flambda2_terms.Switch_expr.tval if_then_else :
machine_width:Target_system.Machine_width.t ->
condition_dbg:Debuginfo.t ->
scrutinee:Flambda2_term_basics.Simple.t ->
if_true:Flambda2_terms.Apply_cont_expr.t ->
if_false:Flambda2_terms.Apply_cont_expr.t ->
Flambda2_terms.Switch_expr.tCreate a Switch corresponding to a traditional if-then-else.
val scrutinee : Flambda2_terms.Switch_expr.t -> Flambda2_term_basics.Simple.tThe scrutinee of the switch.
val condition_dbg : Flambda2_terms.Switch_expr.t -> Debuginfo.tThe debuginfo to be used for the condition.
val iter :
Flambda2_terms.Switch_expr.t ->
f:
(Flambda2_numbers.Target_ocaml_int.t ->
Flambda2_terms.Apply_cont_expr.t ->
unit) ->
unitCall the given function f on each (discriminant, action) pair in the switch.
val arms :
Flambda2_terms.Switch_expr.t ->
Flambda2_terms.Apply_cont_expr.t Flambda2_numbers.Target_ocaml_int.Map.tWhat the switch will do for each possible value of the discriminant.
val num_arms : Flambda2_terms.Switch_expr.t -> intHow many cases the switch has. (Note that this is not the number of destinations reached by the switch, which may be a smaller number.)