| OPTIMIZE_ROM_CALLS

Previous | Advanced Options of TIGCC | Next

In nostub mode, if you put

    #define OPTIMIZE_ROM_CALLS

at the beginning of the program, the compiler will reserve one processor register (a5) to keep the base address of TIOS jump table in it. This will make all calls to TIOS routines smaller and faster. The disadvantage of this method lies in the fact that the a5 register is fully reserved during the execution of the program, so the compiler will have one register less for internal manipulations. The consequence is that it sometimes can produce somewhat longer code when compiling a particular expression or statement. Generally, the use of `OPTIMIZE_ROM_CALLS` usually leads to shorter and faster code, but this does not always need to be true. It is best to try it and see how it performs in a particular program.
If you define `OPTIMIZE_ROM_CALLS` in one file, you must also define it in every file that uses a function from this file.
Note: Avoid `OPTIMIZE_ROM_CALLS` in a program which may change its flow asynchronously in an unpredictable way (an event-driven program, for example). Such programs are mainly all programs which use some kind of callback function (like programs which use OSVRegisterTimer, complex dialogs with callback functions, the function vcbprintf etc.). There may also be some problems with floating point arithmetic.