changeset 479:a55506bf924e

- mips32/eabi doc: adding info about aggregates
author Tassilo Philipp
date Tue, 01 Mar 2022 09:29:21 +0100
parents 6c72cb768099
children cc78e34958e5
files doc/manual/callconvs/callconv_mips32.tex
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/manual/callconvs/callconv_mips32.tex	Tue Mar 01 00:16:50 2022 +0100
+++ b/doc/manual/callconvs/callconv_mips32.tex	Tue Mar 01 09:29:21 2022 +0100
@@ -88,12 +88,17 @@
 \item if either integer or float registers are used up, the stack is used
 \item if the callee takes the address of one of the parameters and uses it to address other unnamed parameters (e.g. varargs) it has to copy - in its prolog - the the argument registers to a reserved stack area adjacent to the other parameters on the stack (only the unnamed integer parameters require saving, though) % @@@ seems to *ONLY* spill with varargs, never for any other reason
 \item float registers don't seem to ever need to be saved that way, because floats passed to an ellipsis function are promoted to doubles, which in turn are passed in a? register pairs, so only \$a0-\$a7 are need to be spilled
+\item aggregates (struct, union) \textless=\ 32bit are passed like an integer
+\item all other aggregates (struct, union) are passed indirectly, as a pointer to a copy (if needed, and for vararg arguments required to be copied by the caller) of the struct
 \end{itemize}
 
 \paragraph{Return values}
 
 \begin{itemize}
 \item results are returned in \$v0 (32-bit), \$v0 and \$v1 (64-bit), \$f0 or \$f0 and \$f2 (2 $\times$ 32 bit float e.g. complex)
+\item aggregates (struct, union) \textless=\ 64bit are returned like an integer (aligned within the register according to endianness)
+\item all other aggregates (struct, union) are returned in a space allocated by the caller, with a pointer to it
+passed as first parameter to the function called (meaning in \%a0)
 \end{itemize}
 
 \paragraph{Stack layout}