-CswMinSLB: Minimum Number of Labels for Switch Search Tables

Group

CODE GENERATION

Scope

Function

Syntax
  -CswMinSLB<number> 
  
Arguments

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

Default

Backend-dependent

Defines

None

Pragmas

None

Description

Allows the Compiler to use tables for switch statements.

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

The Compiler implements switch tables in different ways. When almost all case entries in some range are given, the Compiler uses a table containing only branch targets. Densely populated branch target tables improve efficiency because the Compiler accesses only the correct entry. When large holes exist in some areas, a table form can still be used.

Encoding the case entry and its corresponding branch target into a table creates a search table. Accessing a search table requires a complex runtime routine to check all entries until it finds the matching one. Search tables execute slowly.

Using a search table improves code density, but the execution time increases. Every data request from a search table requires checking every entry until the correct entry is located. For a dense table, the compiler computes the right offset and accesses the table. In addition, note that all backends that implement search tables use a complex runtime routine. This complicates debugging.

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

See also

Compiler options :