Mercurial > pub > dyncall > dyncall
comparison doc/manual/callconvs/callconv_arm64.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 | 0fc22b5feac7 |
children |
comparison
equal
deleted
inserted
replaced
498:fd9ba3a6d348 | 499:fc614cb865c6 |
---|---|
77 \item subsequent parameters are pushed onto the stack | 77 \item subsequent parameters are pushed onto the stack |
78 \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 | 78 \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 |
79 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) | 79 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) |
80 \item aggregates (struct, union) with 1 to 4 identical floating-point members (either float or double) are passed field-by-field (8-byte aligned if passed via stack), except if passed as a vararg | 80 \item aggregates (struct, union) with 1 to 4 identical floating-point members (either float or double) are passed field-by-field (8-byte aligned if passed via stack), except if passed as a vararg |
81 \item other aggregates (struct, union) \textgreater\ 16 bytes in size are passed indirectly, as a pointer to a copy (if needed) | 81 \item other aggregates (struct, union) \textgreater\ 16 bytes in size are passed indirectly, as a pointer to a copy (if needed) |
82 \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 | |
82 \item all other aggregates (struct, union), after rounding up the size to the nearest multiple of 8, are passed as a sequence of dwords, like integers | 83 \item all other aggregates (struct, union), after rounding up the size to the nearest multiple of 8, are passed as a sequence of dwords, like integers |
83 \item aggregates are never split across registers and stack, so if not enough registers are available an aggregated is passed via the stack (for aggregates that | 84 \item aggregates are never split across registers and stack, so if not enough registers are available an aggregated is passed via the stack (for aggregates that |
84 would've been passed as floating point values, any still unused float registers will be skipped for any subsequent arg) | 85 would've been passed as floating point values, any still unused float registers will be skipped for any subsequent arg) |
85 \item stack is required throughout to be eight-byte aligned | 86 \item stack is required throughout to be eight-byte aligned |
86 \end{itemize} | 87 \end{itemize} |
88 \paragraph{Return values} | 89 \paragraph{Return values} |
89 | 90 |
90 \begin{itemize} | 91 \begin{itemize} |
91 \item integer return values use x0 | 92 \item integer return values use x0 |
92 \item floating-point return values use d0 | 93 \item floating-point return values use d0 |
94 \item for {\it non-trivial} C++ aggregates, the caller allocates space, passes pointer to it to the callee via x8, and callee writes return value to this space; the ptr to the aggregate is returned in x0 | |
93 \item aggregates (struct, union) that would be passed via registers if passed as a first param, are returned via those registers | 95 \item aggregates (struct, union) that would be passed via registers if passed as a first param, are returned via those registers |
94 \item for aggregates not returnable via registers (e.g. if regs exhausted, or \textgreater\ 16b, ...), the caller allocates space, passes pointer to it to the callee through | 96 \item for aggregates not returnable via registers (e.g. if regs exhausted, or \textgreater\ 16b, ...), the caller allocates space, passes pointer to it to the callee through |
95 x8, and callee writes return value to this space (note that this is not a hidden first param, as x8 is not used for passing params); the ptr to the aggregate is returned in x0 | 97 x8, and callee writes return value to this space (note that this is not a hidden first param, as x8 is not used for passing params); the ptr to the aggregate is returned in x0 |
96 \end{itemize} | 98 \end{itemize} |
97 | 99 |