-Xswitch


This option specifies the format in which the code of switch statements is to be output.

[Specification format]

-Xswitch=type

 

-

Interpretation when omitted

ccrh selects the optimum output format for each switch statement.

[Detailed description]

-

This option specifies the format in which the code of switch statements is to be output.

-

The items that can be specified as type are shown below.
An error will occur if any other item is specified.

ifelse

Outputs the code in the same format as the if-else statement along a string of case statements.

binary

Outputs the code in the binary search format.

Searches for a matching case statement by using a binary search algorithm.

If this item is selected when many labels are used, any case statement can be found at almost the same speed.

table

Outputs the code in a table jump format.

References a table indexed on the values in the case statements, and selects and processes case labels from the switch statement values.

The code will branch to all the case statements with about the same speed.

However, if case values are not used in succession, an unnecessary area will be created.

If the difference between the maximum and minimum values of the case labels exceeds 8192, then this option is ignored, and the optimum output format for each switch statement is selected automatically.

 

-

An error will occur if type is omitted.

[Example of use]

-

To output a code for the switch statement in the binary search format, describe as:

>ccrh -Xswitch=binary -Xcommon=rh850 main.c