 RealView Compiler User's Guide |
|
| Minimizing parameter passing overhead4.3.1. Minimizing parameter passing overheadThere are several ways in which you can minimize the overhead of passing parameters to functions. For example: Ensure that functions take four or fewer arguments, each a word or less in size. Registers R0-R3 can then be used in place of the stack for passing the parameters. NoteIn C++, non-static member functions have an implicit this pointer argument, which is usually passed in R0. Therefore only three more registers are available for passing additional arguments in this case. Ensure that a function does a significant amount of work if it requires more than four arguments, so that the cost of passing the stacked arguments is outweighed. Put related arguments in a structure, and pass a pointer to the structure in any function call. This reduces the number of parameters and increases readability. Minimize the number of long long parameters, as these take two argument words. Minimize the number of double parameters if software floating-point is enabled. Avoid functions with a variable number of parameters. Functions taking a variable number of arguments effectively pass all their arguments on the stack.
|
|