Everything
4.1.4 Register mode

The CC-RH provides three register modes. By specifying these register modes efficiently, the contents of some registers do not need to be saved or restored when an interrupt occurs or the task is switched. As a result, the processing speed can be improved. The register modes are specified by using the register mode specification option (-Xreg_mode) of the CC-RH. This function reduces the number of registers internally used by the CC-RH on a step-by-step basis. As a result, the following effects can be expected:

-

The registers not used can be used for the application program (that is, a source program in assembly language).

-

The overhead required for saving and restoring registers can be reduced.

Caution

In an application program that has many variables to be allocated to registers by the CC-RH, the variables so far allocated to a register are accessed from memory when a register mode has been specified. As a result, the processing speed may drop.

 

Next table and next Figure show the three register modes supplied by the CC-RH.

Table 4.7

Register Modes Supplied by CC-RH

Register Modes

Work Registers

Register Variable Registers

32-register mode (Default)

r10 to r19

r20 to r29

22-register mode

r10 to r14

r25 to r29

common register mode

r10 to r14

r25 to r29

 

Figure 4.8

Register Modes and Usable Registers

 

Specification example on command line

> ccrh -Xreg_mode=22 file.c <- compiled in 22-register mode