-CswMinLB: Minimum Number of Labels for Switch Tables

Group

CODE GENERATION

Scope

Function

Syntax
  -CswMinLB<number> 
  
Arguments

<number>: a positive number denoting the number of labels.

Default

Backend-dependent

Defines

None

Pragmas

None

Description

Using this option changes the default strategy of the Compiler to use tables for switch statements.

Note: This option is only available if the compiler supports switch tables.

Normally the Compiler uses a table for switches with more than about eight labels. When there are not enough labels for a table, the Compiler generates a branch tree (tree of if-else-if-else). This branch tree, like an `unrolled' binary search in a table, quickly evaluates the associated label for a switch expression.

Using a branch tree instead of a table may increase the code execution speed, but probably increases the code size also. In addition, because the branch tree itself uses no special runtime routine for switch expression evaluation, debugging may be much easier.

To disable any tables for switch statements, set the minimum number of labels needed for a table to a high value (for example, 9999):

-CswMinLB9999 -CswMinSLB9999.

When disabling simple tables it usually makes sense also to disable search tables with the -CswMinSLB option.

See also

Compiler options :