diff doc/manual/callconvs/callconv_arm64.tex @ 404:524fdca405bf

- some doc/manual callconv clarifications for arm
author Tassilo Philipp
date Wed, 07 Apr 2021 18:39:46 +0200
parents bac52ab8869f
children b47168dacba6
line wrap: on
line diff
--- a/doc/manual/callconvs/callconv_arm64.tex	Wed Apr 07 17:55:59 2021 +0200
+++ b/doc/manual/callconvs/callconv_arm64.tex	Wed Apr 07 18:39:46 2021 +0200
@@ -44,7 +44,8 @@
 zero register for all other instructions {\bf xzr/wzr}, and {\bf pc}, the
 program counter. Additionally, there are thirty-two 128 bit registers {\bf v0-v31},
 to be used as SIMD and floating point registers, referred to as {\bf q0-q31}, {\bf d0-d31}
-and {\bf s0-s31}, respectively, depending on their use:\\
+and {\bf s0-s31}, respectively (in contrast to AArch32, those do not overlap multiple
+narrower registers), depending on their use:\\
 
 \begin{table}[h]
 \begin{tabular*}{0.95\textwidth}{3 B}
@@ -61,6 +62,10 @@
 {\bf x30}     & permanent, link register\\
 {\bf sp}      & permanent, stack pointer\\
 {\bf pc}      & program counter\\
+{\bf v0}      & scratch, first float parameter, float return value\\
+{\bf v1-v7}   & scratch, float parameters\\
+{\bf v8-v15}  & lower 64 bits are permanent, scratch\\
+{\bf v16-v31} & scratch\\
 \end{tabular*}
 \caption{Register usage on arm64}
 \end{table}
@@ -74,7 +79,8 @@
 \item first 8 floating point arguments are passed using d0-d7
 \item subsequent parameters are pushed onto the stack
 \item if the callee takes the address of one of the parameters and uses it to address other parameters (e.g. varargs) it has to copy - in its prolog - the first 8 integer and 8 floating-point registers to a reserved stack area adjacent to the other parameters on the stack (only the unnamed integer parameters require saving, though)
-\item structures and unions are passed by value, with the first four words of the parameters in r0-r3
+\item structures and unions up to 16 bytes in size are passed by value (after rounding up the size to the nearest multiple of 8), as a sequence of dwords
+\item for a structure or union larger than 16 bytes in size, a pointer to it is passed
 \item if return value is a structure, a pointer pointing to the return value's space is passed in r0, the first parameter in r1, etc... (see {\bf return values})
 \item stack is required to be throughout eight-byte aligned
 \end{itemize}