SPRUI04F july 2015 – april 2023
A function (parent function) performs the following tasks when it calls another function (child function).
A function (parent function) performs the following tasks when it calls another function (child function):
If arguments are passed to a function, up to the first ten arguments are placed in registers A4, B4, A6, B6, A8, B8, A10, B10, A12, and B12. If longs, long longs, doubles, or long doubles are passed, they are placed in register pairs A5:A4, B5:B4, A7:A6, and so on.
The C6600 __x128_t type object is aligned to a 64-bit or 128-bit boundary. (See the note in Section 8.6.2.) However, for C6600, if multiple __x128_t arguments are passed, the next __x128_t argument is passed in the first available quad, where the list of available quads has the ordering: A7:A6:A5:A4, B7:B6:B5:B4, A11:A10:A9:A8, B11:B10:B9:B8. If there are no more available quads, the __x128_t goes onto the stack. A subsequent 32-bit, 40-bit, or 64-bit argument can take the first available register or register pair even if an earlier __x128_t argument has been put on the stack.
Any remaining arguments are placed on the stack (that is, the stack pointer points to the next free location; SP + offset points to the eleventh argument, and so on, assuming for C6600 an __x128_t is not passed.) Arguments placed on the stack must be aligned to a value appropriate for their size. An argument that is not declared in a prototype and whose size is less than the size of int is passed as an int. An argument that is a float is passed as double if it has no prototype declared.
A structure argument is passed as the address of the structure. It is up to the called function to make a local copy.
For a function declared with an ellipsis indicating that it is called with varying numbers of arguments, the convention is slightly modified. The last explicitly declared argument is passed on the stack, so that its stack address can act as a reference for accessing the undeclared arguments.
Figure 8-10 shows the register argument conventions.