Workshop
The following page content corresponds to the products marketed in Japan.
If you do not live in Japan, please
| ||
It's possible and desirable to boost the performance of applications for SuperH microcomputers by properly applying IDE Build options. When using the High-performance Embedded Workshop (HEW) integrated development environment, selecting the best optimization conditions significantly improves the efficiency of the applications that run on these popular RISC chips. | ||
| Choosing the right compiler options helps maximize system performance | ||
A good integrated development environment (IDE) gives system developers a common graphical user interface (GUI) for hardware and software development tools such as a text editor, C/C++ compiler, link editor, and emulator. IDEs have many option settings that, when set properly, can have a significant impact on the performance of the resulting system. To support the SuperH line of microcomputers — and our other device families as well — Renesas supplies our powerful, easy-to-use High-performance Embedded Workshop (HEW) IDE. Seminars and tutorials help customers make the best use of this vitally important development tool, which offers numerous operational options for accommodating the diverse requirements of a broad span of applications. The following three Build options (compiler options) can be extremely effective for improving processing speeds: [1] Optimization for Access to External Variables Please be aware that Build options [1] and [3] do more than just boost optimize processing speed; they can also reduce memory usage. All of these options are available in HEW versions 9.3 and above. | ||
| ||
| Select [Inter-module] to apply your settings throughout your system! | ||
The [External Variables] Build option setting relates to access to variables with a wide scope (global variables and external variables). Such variables are defined outside functions that can be referenced by any function in the application program. We strongly recommend that you select this option when using variables with a wide scope (see Screen 1). For example, if you compile a program containing five external variables and do not select this option, the resulting assembly-language program will contain five separate address load instructions (shown in blue). This is because a separate address is allocated for each external variable (shown in red). However, when you choose the [Optimize External Variable Access] option, the compiler combines the five external variables into a single package (structure) so that only one address load instruction is required. This brings a commensurate improvement in the application's processing speed and memory usage. An improvement of roughly 10% to 20% in processing speed is possible (see Figure 1). Because selecting this option will never make the program run slower, it's best to think of it as a mandatory option for SuperH microcomputer application development. | ||
| ||
| ||
| ||
It is essential to consider the exact requirements of the application when specifying how you direct the compiler to optimize the object code. Three different optimization methods are available, depending on whether you want to optimize for memory size or processing speed (see Screen 2). Of course, memory size and processing speed are conflicting objectives, so saving memory space results in a slower processing speed, whereas improving speed causes the program to require more memory space. The default setting is [Optimize for both speed and size], whereby your code is optimized in a way that balances speed and memory size. In contrast, selecting [Optimize for Size] reduces the required memory size at the cost of some loss of processing speed. Alternatively, selecting [Optimize for Speed] improves processing speed but increases the required memory size (see Figure 2). The generally recommended setting here is [Optimize for Speed]. The reason we recommend this option is that most systems that use the SuperH microcomputer tend to have adequate memory capacity. Another related option reduces the number of iterations used to execute loop statements by a factor of between 2 and 32 times. The default is 2. To set this option, select the [Optimize] category and then click the [Details] button at the bottom right to open the window for specifying Advanced optimization settings. From this window, select the [Miscellaneous] tab, then select [Custom] in the setting for specifying the maximum number of loop iterations to expand, and next specify the value you want by using the counter field on the right. For example, specifying "4" causes only one-fourth as many loop iterations to be performed. | ||
| ||
| ||
| ||
| Only the Renesas HEW IDE lets you perform code optimizations using the linker. Thus, the final option discussed here to be explained is a linker option that is unique to our development environment. | ||
Of the several linker options, the one likely to have the greatest effect is [Reallocate registers] (see Screen 3). Using this option improves processing speed by reducing the number of times the general-purpose registers are saved and restored. The SuperH microcomputer has 16 general-purpose registers: R0 to R15, with R15 being used as the stack pointer. The compiler determines how these registers are used inside each function. Specifically, R0 to R7 are used without being saved and restored, whereas R8 to R14 are saved and restored before being used. As a result, if it is deemed necessary to use R8 to R14 during the execution of the function, these registers are respectively saved and restored on exiting and entering the function in all circumstances. Note that the compiler must perform those operations because it generates instructions on a function-by-function basis. As a consequence, all systems will end up with some redundant general-purpose register save -and-restore processing. Despite this inevitability at the compiler level, though, you can do something to rectify the problem because the linker in the HEW IDE is "aware" of the relationship between function calls. The [Reallocate registers] option takes advantage of this fact to offer a solution. When you select this option, for example, if a function backs up and restores a particular register, the associated save and restore instructions can be deleted when linking, provided that the calling function does not use that register. Again, this linker option is a very effective optimization method, but it is only available in the Renesas development environment. When using HEW, we recommended that you always select the [Generate file for inter-module optimization] checkbox (see Screens 3 and 4). | ||
| ||
| ||
Related Content
Vol.13 and earlier
Japan English






