diff doc/manual/callconvs/callconv_mips32.tex @ 478:6c72cb768099

callconv doc: - mips o32 update w/ regards to aggregates - mips o32 disas examples - sparc64 doc fixes
author Tassilo Philipp
date Tue, 01 Mar 2022 00:16:50 +0100
parents b47168dacba6
children a55506bf924e
line wrap: on
line diff
--- a/doc/manual/callconvs/callconv_mips32.tex	Sun Feb 27 13:53:18 2022 +0100
+++ b/doc/manual/callconvs/callconv_mips32.tex	Tue Mar 01 00:16:50 2022 +0100
@@ -1,6 +1,6 @@
 %//////////////////////////////////////////////////////////////////////////////
 %
-% Copyright (c) 2007-2019 Daniel Adler <dadler@uni-goettingen.de>, 
+% Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>, 
 %                         Tassilo Philipp <tphilipp@potion-studios.com>
 %
 % Permission to use, copy, modify, and distribute this software for any
@@ -88,6 +88,11 @@
 \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
+\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)
 \end{itemize}
 
@@ -168,9 +173,17 @@
 \item only on hard-float targets: if the very first call argument is a float, up to 2 floats or doubles can be passed via \$f12 and \$f14, respectively, for first and second argument
 \item only on hard-float targets: if any arguments are passed via float registers, skip \$a0-\$a3 for subsequent arguments as if the values were passed via them
 \item only on hard-float targets: note that if the first argument is not a float, but the second, it'll get passed via the \$a? registers
+\item single precision float parameters (32 bit) are right-justified in their 8-byte slot on the stack on big endian targets, as they aren't promoted % @@@ verify
+\item aggregates (struct, union) are passed as a sequence of words like integers, no matter the fields or if hard-float target (splitting across registers and stack is allowed)
+\end{itemize}
+
+\paragraph{Return values}
+
+\begin{itemize}
 \item results are returned in \$v0 and \$v1, with \$v0 for all values \textless\ 64bit (only integer on hard-float targets)
 \item only on hard-float targets: floating point results are returned in \$f0 (32-bit float), or \$f0 and \$f3 (64bit float)
-\item single precision float parameters (32 bit) are right-justified in their 8-byte slot on the stack on big endian targets, as they aren't promoted @@@
+\item aggregates (struct, union) of any size 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}