GENERAL: USING REGISTERS WHEN CALLING AN ASSEMBLER FUNCTION
Information in this article applies to:
I am calling an assembler function foo from the main function in C and the compiler avoids using registers in the main function for operating on local variables. When I comment out the function call it uses the registers.
How can I make the compiler use the registers to obtain smaller and faster code?
In your assembler function you need to specify which registers are modified by the function. In addition you need to turn global register optimization on.
Modify your assembler code to use the REGUSE directive. For example:
$REGUSE foo (ACC, R0)
will specify that the function foo only modifies the accumulator and R0.
To turn on Global Register Optimization, choose Make from the Options menu in µVision. Click on the Misc tab and check the 'Register Optimization' option.
The following Discussion Forum threads may provide information related to this topic.
Last Reviewed: Friday, July 27, 2001
of your data.