
5-22
Motorola DSP56000 Family Optimizing C Compiler User’s Manual
For More Information On This Product,
Go to: www.freescale.com
Motorola
#pragma Directive
mac
macr
x0,y0,a x:(r0)+,x0y:(r4)+,y0
x0,x0,a (r0)-
movep
a,y:output
end
C:\> g56k -S data.c
C:\> g56k -c fir.asm
C:\> g56k -c data.asm
C:\> g56k fir.cln data.cln
5.2.6 Specifying Registers for Variables
DSP56KCC allows the programmer to identify a specific register for local and global
variables, but due to the limited number of registers available, this may not have a positive
effect on run-time performance. With this in mind, this feature should be used sparingly.
Both global and local variables are candidates for promotion to specific registers and
syntactically they look the same:
register int *ptr
_ _
asm(“r5”);
By specifying a specific register for a local or global variable, the programmer is reserving
the register for the variable’s entire scope (global for the entire program, local for the
function in which they are declared). This means that the compiler will not use the register
for any other purpose and the register
will not be saved and restored
by the C function
call.
5.2.7 Optimizer Effects on Code
All in-line assembly code is visible to the optimizer and as such it is possible that the
optimizer will convert it into a new form or eliminate it entirely if it is determined to be
unreachable or dead. In order to guarantee that code is not removed by the optimizer, the
ANSI keyword volatile must be used.
_ _
asm
volatile
( … );
5.3 #pragma Directive
The purpose of this section is to explain the proper techniques for manipulating the
assembler’s run-time and load-time counters while programming in the C language.
Currently the Motorola DSP assemblers allow the programmer to specify both a run-time
location and a load-time location for any object; however, there is no corresponding
concept within C. The generic #pragma facility is used to add this capability rather than
F
Freescale Semiconductor, Inc.
n
.