Microchip Technology SW006023-2N Data Sheet

Page of 238
MPLAB
®
 XC32 C/C++ COMPILER
USER’S GUIDE
 2012 Microchip Technology Inc.
DS51686E-page 205
Appendix 20. Deprecated Features
20.1
INTRODUCTION
The features described below are considered to be obsolete and have been replaced 
with more advanced functionality. Projects which depend on deprecated features will 
work properly with versions of the language tools cited. The use of a deprecated 
feature will result in a warning; programmers are encouraged to revise their projects in 
order to eliminate any dependency on deprecated features. Support for these features 
may be removed entirely in future versions of the language tools.
Deprecated features covered are:
20.2
VARIABLES IN SPECIFIED REGISTERS
The compiler allows you to put a few global variables into specified hardware registers.
You can also specify the register in which an ordinary register variable should be 
allocated. 
• Global register variables reserve registers throughout the program. This may be 
useful in programs such as programming language interpreters which have a 
couple of global variables that are accessed very often.
• Local register variables in specific registers do not reserve the registers. The 
compiler’s data flow analysis is capable of determining where the specified 
registers contain live values, and where they are available for other uses. Stores 
into local register variables may be deleted when they appear to be unused. 
References to local register variables may be deleted, moved or simplified. 
These local variables are sometimes convenient for use with the extended inline 
assembly (see Chapter 14. “Mixing C/C++ and Assembly Language”), if you want 
to write one output of the assembler instruction directly into a particular register. (This 
will work provided the register you specify fits the constraints specified for that operand 
in the inline assembly statement). 
20.2.1
Defining Global Register Variables
You can define a global register variable like this: 
register int *foo asm ("w8");
Here w8 is the name of the register which should be used. Choose a register that is 
normally saved and restored by function calls (W8-W13), so that library routines will not 
clobber it.
Note:
Using too many registers, in particular register W0, may impair the ability of 
the 32-bit compiler to compile. It is not recommended that registers be 
placed into fixed registers.