[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


no_register_coloring

Description:

Controls the use of a register to hold the values of more than one variable.

Compatibility:

This pragma is compatible with the following platform targets:

68K

PowerPC
NEC V800
Intel x86
MIPS
Embedded 68K

Prototype:
  #pragma no_register_coloring on | off | reset Remarks:

When the no_register_coloring pragma is off, the compiler performs register coloring. In this optimization, the compiler lets two or more variables share a register: it assigns different variables or parameters to the same register if you do not use the variables at the same time. In this example, the compilers could place i and j in the same register:


short i;
int j;

for (i=0; i<100;  i++) {   MyFunc(i);  }
for (j=0; j<1000; j++) {   OurFunc(j); }

However, if a line like the one below appears anywhere in the function, the compiler would realize that you're using i and j at the same time and place them in different registers:


int k = i + j;

If register coloring is on while you debug your project, it may appear as though there's something wrong with the variables sharing a register. In the example above, i and j would always have the same value. When i changes, j changes in the same way. When j changes, i changes in the same way. To avoid this confusion while debugging, turn off register coloring or declare the variables you want to watch as volatile.

The pragma corresponds to the Global Register Allocation option in the 68K Processor settings panel. To check whether this option is on, use __option (no_register_coloring), described in "Checking Options." By default, this option is off.


NOTE


See also "register_coloring."


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000