You copied the Doc URL to your clipboard.

Methods of minimizing function parameter passing overhead

There are several ways in which you can minimize the overhead of passing parameters to functions.

For example:

  • In AArch64 state, 8 integer and 8 floating-point arguments (16 in total) can be passed efficiently. In AArch32 state, ensure that functions take four or fewer arguments if each argument is a word or less in size.
  • In C++, ensure that nonstatic member functions take fewer arguments than the efficient limit, because in AArch32 state the implicit this pointer argument is usually passed in R0.
  • Ensure that a function does a significant amount of work if it requires more than the efficient limit of arguments. The work that the function does then outweighs the cost of passing the stacked arguments.
  • Put related arguments in a structure, and pass a pointer to the structure in any function call. Pointing to a structure reduces the number of parameters and increases readability.
  • For AArch32 state, minimize the number of long long parameters, because these use two argument registers that have to be aligned on an even register index.
  • For AArch32 state, minimize the number of double parameters when using software floating-point.
Was this page helpful? Yes No