i960 Processor Compiler User's Guide
7-18
7
argument block. The calling function is responsible for the creation of an
argument block if one is needed. When an argument block is created it
must contain enough space at the beginning to store all the possible
parameter registers
g0-g11. Thus the first 48 bytes of an argument block
are reserved for storing these registers. The first parameter passed in the
argument block starts at an address 48 bytes above the base of the
argument block.
Return Values
All return values four or fewer words in length are returned in registers
g0-g3. For return values larger than four words the calling function must
pass a pointer to a memory area to store the return value. This value is
passed in register
g13. The called function returns such a value by
copying the value into the memory area pointed to by
g13.
ic960 R4.5 implements a special return mechanism for functions returning
long double, when generating code for ic960 R2.0 compatibility, and for a
processor with on-chip floating-point support. In such a case the return
value is returned in the
fp0 register.
Compiler Implementation
For compatibility with past implementations, the compiler allows some
leniency in the implementation of the standard calling convention.
The compiler is more relaxed about the call-preserved status of
g8-g11
across a function call. At a function call, the compiler assumes that the
called function may change
g8-g11 if any parameters are passed in an
argument block, or if any parameters were passed in any of the registers
g8-g11. However, the compiler properly implements the calling
convention on the called function side, preserving
g8-g11 as necessary to
satisfy the calling convention.