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 Expr_std.S with type t := t
val print : Format.formatter -> t -> unitinclude Flambda2_nominal.Contains_names.S with type t := t
val free_names : 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 : t -> Flambda2_nominal.Renaming.t -> tApply a renaming throughout a term.
include Flambda2_nominal.Contains_ids.S with type t := t
val ids_for_export : 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:Apply_cont_expr.t Flambda2_numbers.Target_ocaml_int.Map.t ->
tval if_then_else :
machine_width:Target_system.Machine_width.t ->
condition_dbg:Debuginfo.t ->
scrutinee:Flambda2_term_basics.Simple.t ->
if_true:Apply_cont_expr.t ->
if_false:Apply_cont_expr.t ->
tCreate a Switch corresponding to a traditional if-then-else.
val scrutinee : t -> Flambda2_term_basics.Simple.tThe scrutinee of the switch.
val condition_dbg : t -> Debuginfo.tThe debuginfo to be used for the condition.
val iter :
t ->
f:(Flambda2_numbers.Target_ocaml_int.t -> Apply_cont_expr.t -> unit) ->
unitCall the given function f on each (discriminant, action) pair in the switch.
val arms : t -> 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 : 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.)