Everything

-case


< Compile Options / Optimize Options >

[Format]

-case={ ifthen | table | auto }

 

-

[Default]

The default for this option is case=auto.

[Description]

-

This option specifies the expansion method of the switch statement.

-

When case=ifthen is specified, the switch statement is expanded using the if_then method, which repeats, for each case label, comparison between the value of the evaluation expression in the switch statement and the case label value. If they match, execution jumps to the statement of the case label. This method increases the object code size depending on the number of case labels in the switch statement.

-

When case=table is specified, the switch statement is expanded by using the table method, where the case label jump destinations are stored in a branch table so that a jump to the statement of the case label that matches the expression for evaluation in the switch statement is made through a single access to the branch table. With this method, the size of the branch table increases with the number of case labels in the switch statement, but the performance in execution remains the same. The branch table is output to a section for areas holding switch statements for branch tables.

-

When case=auto is specified, the compiler automatically selects the if_then method or table method.

-

When case=auto is specified, the compiler might convert the switch statement to a table lookup in addition to selecting the output format. Examples of switch statements that can be converted to table lookups are those in which a constant is assigned to the same variable in all case clauses. The table created by conversion is allocated to a section of a literal area. [V3.07.00 or later]

[Remarks]

-

The branch table created when case=table has been specified will be output to section W when the nostuff option is specified and will be output to section W, W_2, or W_1 according to the size of the switch statement when the nostuff option is not specified.