Linkage convention for argument passing

The system linkage convention takes advantage of the large number of registers available. The linkage convention passes arguments in both GPRs and FPRs. Two fixed lists, R3-R10 and FP1-FP13, specify the GPRs and FPRs available for argument passing.

When there are more argument words than available argument GPRs and FPRs, the remaining words are passed in storage on the stack. The values in storage are the same as if they were in registers.

In a 64-bit environment, the size of the parameter area is sufficient to contain all the arguments passed on any call statement from a procedure that is associated with the stack frame. Although not all the arguments for a particular call actually appear in storage, it is convenient to consider them as forming a list in this area, each one occupying one or more words.

For call by reference (as is the default for Fortran), the address of the argument is passed in a register. The following information refers to call by value, as in C or as in Fortran when %VAL is used. For purposes of their appearance in the list, arguments are classified as floating-point values or non-floating-point values:

In a 32-bit Environment

In a 64-bit environment

Argument passing rules (by value)

From the following illustration, we state these rules:

Here is an example of a call to a function:

f(%val(l1), %val(l2), %val(l3),  %val(l4),  %val(l5),  %val(l6), %val(l7),
          %val(d1), %val(f1), %val(c1), %val(d2), %val(s1), %val(cx2))

where:

Figure 8. Storage mapping of parm area on the stack in 32-bit environment
Storage mapping of parm area on the stack in 32-bit environment
Figure 9. Storage mapping of parm area on the stack in 64-bit environment
Storage mapping of parm area on the stack in 64-bit environment

Order of arguments in argument list

The argument list is constructed in the following order. Items in the same bullet appear in the same order as in the procedure declaration, whether or not argument keywords are used in the call.


1.
There may be other items in this list during Fortran-Fortran calls. However, they will not be visible to non-Fortran procedures that follow the calling rules in this section.