|ARM Technical Support Knowledge Articles|
Applies to: General Topics
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 uVision. Click on the Misc tab and check the 'Register Optimization' option.
Article last edited on: 2001-07-27 00:00:00
Did you find this article helpful? Yes No
How can we improve this article?