#### 12.7.26 `GIMPLE_SWITCH`

— GIMPLE function: gimple gimple_build_switch (unsigned nlabels, tree index, tree default_label, ...)

> Build a `GIMPLE_SWITCH` statement. `NLABELS` are the number of labels excluding the default label. The default label is passed in `DEFAULT_LABEL`. The rest of the arguments are trees representing the labels. Each label is a tree of code `CASE_LABEL_EXPR`.

— GIMPLE function: gimple gimple_build_switch_vec (tree index, tree default_label, `VEC`(tree,heap) *args)

> This function is an alternate way of building `GIMPLE_SWITCH` statements. `INDEX` and `DEFAULT_LABEL` are as in gimple_build_switch. `ARGS` is a vector of `CASE_LABEL_EXPR` trees that contain the labels.

— GIMPLE function: unsigned gimple_switch_num_labels (gimple g)

> Return the number of labels associated with the switch statement `G`.

— GIMPLE function: void gimple_switch_set_num_labels (gimple g, unsigned nlabels)

> Set `NLABELS` to be the number of labels for the switch statement `G`.

— GIMPLE function: tree gimple_switch_index (gimple g)

> Return the index variable used by the switch statement `G`.

— GIMPLE function: void gimple_switch_set_index (gimple g, tree index)

> Set `INDEX` to be the index variable for switch statement `G`.

— GIMPLE function: tree gimple_switch_label (gimple g, unsigned index)

> Return the label numbered `INDEX`. The default label is 0, followed by any labels in a switch statement.

— GIMPLE function: void gimple_switch_set_label (gimple g, unsigned index, tree label)

> Set the label number `INDEX` to `LABEL`. 0 is always the default label.

— GIMPLE function: tree gimple_switch_default_label (gimple g)

> Return the default label for a switch statement.

— GIMPLE function: void gimple_switch_set_default_label (gimple g, tree label)

> Set the default label for a switch statement.