CODE GENERATION
Function
-CswMinLF<number>
<number>: a number in the range of 0 - 100 denoting the minimum load factor
Backend-dependent
None
None
Allows the Compiler to use tables for switch statements.
Normally the Compiler uses a table for switches with more than about 8 labels and if the table is filled between 80% (minimum load factor of 80) and 100% (maximum load factor of 100). If there are not enough labels for a table or the table is not filled, a branch tree is generated (tree of if-else-if-else). This branch tree is like an `unrolled' binary search in a table which quickly evaluates the associated label for a switch expression.
Using a branch tree instead of a table improves code execution speed, but may increase code size. In addition, because the branch tree itself uses no special runtime routine for switch expression evaluation, debugging is more seamless.
Specifying a load factor means that tables are generated in specific `fuel' status:
The table in the following listing is filled to 90% (labels for `0' to `9', except for `5').
switch(i) { case 0: ... case 1: ... case 2: ... case 3: ... case 4: ... // case 5: ... case 6: ... case 7: ... case 8: ... case 9: ... default }
Assuming that the maximum load factor is set to 100% and the minimum load factor for the above case is set to 90%, this still generates a table. But setting the minimum load factor to 95% produces a branch tree.
To guarantee that tables are generated for switches with full tables only, set the minimum and maximum table load factors to 100:
-CswMinLF100-CswMaxLF100.
Compiler options :