diff doc/manual/callconvs/callconv_mips32.tex @ 499:fc614cb865c6

- doc and disasexample additions specific to non-trivial C++ aggregates as return values (incl. fixes to doc and additional LSB specific PPC32 section)
author Tassilo Philipp
date Mon, 04 Apr 2022 15:50:52 +0200
parents a55506bf924e
children
line wrap: on
line diff
--- a/doc/manual/callconvs/callconv_mips32.tex	Wed Mar 23 15:33:09 2022 +0100
+++ b/doc/manual/callconvs/callconv_mips32.tex	Mon Apr 04 15:50:52 2022 +0200
@@ -89,6 +89,7 @@
 \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 {\it non-trivial} C++ aggregates (as defined by the language) of any size, are passed indirectly via a pointer to a copy of the aggregate
 \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}
 
@@ -96,9 +97,11 @@
 
 \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 for {\it non-trivial} C++ aggregates, the caller allocates space, passes pointer to it to the callee as a hidden first param
+(meaning in \%a0), and callee writes return value to this space; the ptr to the aggregate is returned in \%v0
 \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)
+passed as first parameter to the function called (meaning in \%a0); the ptr to the aggregate is returned in \%v0
 \end{itemize}
 
 \paragraph{Stack layout}
@@ -180,6 +183,7 @@
 \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)
+\item {\it non-trivial} C++ aggregates (as defined by the language) of any size, are passed indirectly via a pointer to a copy of the aggregate
 \end{itemize}
 
 \paragraph{Return values}
@@ -187,8 +191,8 @@
 \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 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)
+\item 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); the ptr to the aggregate is returned in \%v0
 \end{itemize}
 
 \paragraph{Stack layout}