i960 Processor Compiler User's Guide
11-16
11
Variable Shadowing
The compiler may place a memory object in a register throughout a
single-entry, single-exit region (such as a loop) when it can determine that
the following are all true:
• There are no references to memory within the region that could
overlap the candidate memory object.
• The address of the candidate is a compile-time constant, or it is
constant throughout the single-entry, single-exit region and a
reference to the object's address is guaranteed to happen at least once
whenever the code for the region is executed.
• There are no calls within the region.
In the following example, global migration causes
p to be loaded once at
the beginning of the loop and stored once at the exit point.
static int*p;
while (*p != '\0')
p++;
Without this optimization, the program loads and stores p once for each
iteration of the loop.
Register Use
The compiler can use registers to speed up data access. Register
optimizations are as follows:
• local variable promotion
• register management
• register spilling