Use this panel to control compiler optimizations. The compiler's optimizer can apply any of its optimizations in either global or non-global optimization mode. You can apply global optimization at the end of the development cycle, after compiling and optimizing all source files individually or in groups.
The following table lists and describes the optimization options for RS08 compiler.
| Option | Description |
|---|---|
| No integral promotion on characters (-Cni) | Enhances character operation code density by omitting integral promotion. This option enables behavior that is not ANSI-C compliant. Code generated with this option set does not conform to ANSI standards. Code compiled with this option is not portable. Using this option is not recommended in most cases. |
| Loop unrolling (i[number]) (-Cu) | Enables loop unrolling with the following restrictions:
|
| Main Optimize Target: Optimize for | There are various points where the Compiler has to select between two possibilities: it can either generate fast, but large code, or small but slower code. The Compiler generally optimizes on code size. It often has to decide between a runtime routine or an expanded code. The programmer can decide whether to select between the slower and shorter or the faster and longer code sequence by setting a command line switch.
|
| Create sub-functions with common code | Performs the reverse of inlining. It detects common code parts in the generated code. The Compiler moves the common code to a different place and replaces all occurrences with a JSR to the moved code. At the end of the common code, the Compiler inserts an RTS instruction. The Compiler increases all SP uses by an address size. This optimization takes care of stack allocation, control flow, and of functions having arguments on the stack. Inline assembler code is never treated as common code. Options are:
|
| Alias analysis options | These four different options allow the programmer to control the alias behavior of the compiler. The option -oaaddr is the default because it is safe for all C programs. Use option -oaansi if the source code follows the ANSI C99 alias rules. If objects with different types never overlap in your program, use option -oatype. If your program doesn't have aliases at all, use option -oanone (or the ICG option -ona, which is supported for compatibility reasons). |
| Generate always near calls (-Obsr) | This option forces the compiler to always generate near calls, i.e. use BSR instruction instead of a JSR in order to reduce code size. Without this option the compiler checks the range of the call to determine if a BSR can be generated instead of a JSR. |
| Dynamic options configuration for functions (-OdocF) | Allows the Compiler to select from a set of options to reach the smallest code size for every function. Without this feature, you must set fixed Compiler switches over the whole compilation unit. With this feature, the Compiler finds the best option combination from a user-defined set for every function. |
| Inlining (C[n] or OFF) (-Oi) | Enables inline expansion. If there is a #pragma INLINE before a function definition, all calls of this function are replaced by the code of this function, if possible. Using the -Oi=c0 option switches off inlining. Functions marked with the #pragma INLINE are still inlined. To disable inlining, use the -Oi=OFF option. |
| Disable alias checking (-Ona) | Prevents the Compiler from redefining these variables, which lets you reuse already-loaded variables or equivalent constants. Use this option only when you are sure no real writes of aliases to a variable memory location will occur. |
| Disable branch optimizer (-OnB) | Disables all branch optimizations. |
| Do generate copy down information for zero values (-OnCopyDown) | Restricts the compiler from generating a copy down for i. The initialization with zero optimization shown for the arr array only works in the HIWARE format. The ELF format requires initializing the whole array to zero. |
| Disable CONST variable by constant replacement (-OnCsfVar) | Lets you switch OFF the replacement of CONST variable by the constant value. |
| Disable peephole optimization (-OnP) | Disables the whole peephole optimizer. To disable only a single peephole optimization, use the optional syntax -OnP=<char>. |
| Disable code generation for NULL Pointer to Member check (-OnPMNC) | Before assigning a pointer to a member in C++, you must ensure that the pointer to the member is not NULL in order to generate correct and safe code. In embedded systems development, the difficulty becomes generating the denser code while avoiding overhead whenever possible (this NULL check code is a good example). This option enables you to switch off the code generation for the NULL check. |
| Large return value type | Compiler supports this option even though returning a 'large' return value may be not as efficient as using an additional pointer. The Compiler introduces an additional parameter for the return value if the return value cannot be passed in registers. Options are:
|
| Disable far to near optimization | Disables the JSR to BSR optimization. The compiler checks the range of the call to determine if a BSR can be generated instead of a JSR. If -Onbsr is used this optimization will be disabled. |
| Disable reload from register optimization | Disables the low level register trace optimizations. If you use the option the code becomes more readable, but less optimal. |
| Disable tail call optimizations | Allows the compiler to remove all the entry and exit code from the current function.By default, the compiler replaces trailing calls (JSR/BSR) with JMP instructions if the function does not contain any other function calls. |
| Reuse locals of stack frame | Instructs the compiler to reuse the location of local variables/temporaries whenever possible. When used, the compiler analyzes which local variables are alive simultaneously. Based on that analysis the compiler selects the best memory layout for for variables. Two or more variables may end up sharing the same memory location. |