Go to the previous, next section.

Branch and Jump Instructions

The in_bj class is used to hold branch and jump instructions. This class includes a field to specify the label symbol at the branch target and an optional source operand that is used for conditional branches. The target and set_target methods are used to access the label symbol for the branch target. This label must be defined in the scope where the branch occurs, and it must be within the same procedure. The src_op and set_src_op methods access the optional source operand field. The dst operand is unused for all branch and jump instructions and the result type should always be the SUIF void type. The branch and jump opcodes are described below:

jmp
Unconditional jump. The source operand is unused. The flow of control is unconditionally transferred to the code at the target label.

btrue
Branch if true. If the source operand, which must have an signed integer type, contains a true (non-zero) value, the flow of control is transferred to the code at the target label. Otherwise, it continues with the next instruction in sequential order.

bfalse
Branch if false. If the source operand contains a false (zero) value, the flow of control is transferred to the code at the target label. Otherwise, it continues with the next instruction in sequential order. The source operand must have an signed integer type.

Go to the previous, next section.