Next: , Previous: Loops, Up: Statements Selection Statements

A simple selection statement, such as the C if statement, is expressed in GIMPLE using a void COND_EXPR. If only one branch is used, the other is filled with an empty statement.

Normally, the condition expression is reduced to a simple comparison. If it is a shortcut (&& or ||) expression, however, we try to break up the if into multiple ifs so that the implied shortcut is taken directly, much like the transformation done by do_jump in the RTL expander.

A SWITCH_EXPR in GIMPLE contains the condition and a TREE_VEC of CASE_LABEL_EXPRs describing the case values and corresponding LABEL_DECLs to jump to. The body of the switch is moved after the SWITCH_EXPR.