Interlanguage Calls - Parameter Passing

The RISC System/6000 linkage convention specifies the methods for parameter passing and whether return values are to be in FPRs, GPRs, or both. The GPRs and FPRs available for argument passing are specified in two fixed lists: R3-R10 and FP1-FP13.

Prototyping affects how parameters are passed and whether widening occurs:

Nonprototyped functions
In nonprototyped functions in the C and C++ languages, floating-point arguments are widened to double and integral types are widened to int.
Prototyped functions
No widening conversions occur except in arguments passed to an ellipsis function. Floating-point double arguments are only passed in FPRs. If an ellipsis is present in the prototype, floating-point double arguments are passed in both FPRs and GPRs.

When there are more argument words than available parameter 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. Space for more than 8 words of arguments (float and nonfloat) must be reserved on the stack even if all the arguments were passed in registers.

The size of the parameter area is sufficient to contain all the arguments passed on any call statement from a procedure associated with the stack frame. Although not all the arguments for a particular call actually appear in storage, they can be regarded as forming a list in this area, each one occupying one or more words.

The methods of passing parameters are as follows:



Interlanguage Calling Conventions
Corresponding Data Types
Use the Subroutine Linkage Conventions in Interlanguage Calls
Sample Program: C Calling Fortran