|
|||||||||||
|
Technical Support Support Resources
Product Information |
GENERAL: PROGRAM STRUCTURE FOR REGISTER OPTIMIZATIONInformation in this article applies to:
QUESTIONI have a problem with the code efficiency of my application. In my program, I have several small interface functions, but despite the fact that I am using Global Register Optimization, the calling functions seem to assume that these interface functions are using all CPU registers. The interface functions are pretty small and use almost no CPU registers. What is the reason for that behavior? ANSWERThe compiler generates the functions in the same order as they appear in the C source file. It is, therefore, important that the interface functions are in the C source before they are used. Otherwise, the Compiler does not know the function code and has to assume maximum register usage. Therefore, the program structure inside a C source module should be:
void my_simple_func1 (void) {
:
}
void my_simple_func2 (void) {
:
}
void my_complex_func (void) {
:
my_simple_func1 ();
my_simple_func2 ();
:
}
For optimum register allocation, it is important that the functions which are called by other functions are coded in the C source file. MORE INFORMATION
FORUM THREADSThe following Discussion Forum threads may provide information related to this topic. Last Reviewed: Wednesday, June 30, 2004 | ||||||||||
|
|||||||||||
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.