Microchip Technology XC8 Standard Compiler (Workstation) SW006021-1 SW006021-1 User Manual

Product codes
SW006021-1
Page of 518
MPLAB
®
 XC8 C Compiler User’s Guide
DS52053B-page 188
 2012 Microchip Technology Inc.
5.8.8.1
BANK SELECTION WITHIN FUNCTIONS
A function can, and may, return with any RAM bank selected. See 
Section 5.5.1 “Address Spaces” for more information on RAM banks.
The compiler tracks the bank selections made in the generated code associated with 
each function, even across function calls to other functions. If the bank that is selected 
when a function returns can be determined, the compiler will use this information to try 
to remove redundant bank selection instructions which might otherwise be inserted into 
the generated code.
The compiler will not be able to track the bank selected by routines written in assembly, 
even if they are called from C code. The compiler will make no assumptions about the 
selected bank when such routines return.
The “Tracked objects” section associated with each function and which is shown in the 
assembly list file relates to this bank tracking mechanism. See 6.5 “Assembly-Level 
Optimizations”
 fo
r more information of the content of these files.