comparison doc/manual/callconvs/callconv_ppc64.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 ead041d93e36
children 0909837648d2
comparison
equal deleted inserted replaced
498:fd9ba3a6d348 499:fc614cb865c6
103 needed - e.g. varargs), meaning a minimum of 64 bytes to hold gpr3-gpr10 103 needed - e.g. varargs), meaning a minimum of 64 bytes to hold gpr3-gpr10
104 \item all nonvector parameters are aligned on 8-byte boundaries 104 \item all nonvector parameters are aligned on 8-byte boundaries
105 \item vector parameters are aligned on 16-byte boundaries 105 \item vector parameters are aligned on 16-byte boundaries
106 \item integer parameters \textless\ 64 bit are right-justified (meaning occupy higher-address bytes) in their 8-byte slot on the stack, requiring extra-care for big-endian targets 106 \item integer parameters \textless\ 64 bit are right-justified (meaning occupy higher-address bytes) in their 8-byte slot on the stack, requiring extra-care for big-endian targets
107 \item aggregates (struct, union) are passed as a sequence of doublewords (following above rules for doublewords) 107 \item aggregates (struct, union) are passed as a sequence of doublewords (following above rules for doublewords)
108 \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
108 \end{itemize} 109 \end{itemize}
109 110
110 111
111 \paragraph{Return values} 112 \paragraph{Return values}
112 113
113 \begin{itemize} 114 \begin{itemize}
114 \item return values of integer \textless=\ 32bit or pointer type use gpr3 and are zero or sign extended depending on their type 115 \item return values of integer \textless=\ 32bit or pointer type use gpr3 and are zero or sign extended depending on their type
115 \item 64 bit integers use gpr3 116 \item 64 bit integers use gpr3
116 \item floating point values are returned via fpr1 117 \item floating point values are returned via fpr1
117 \item for aggregates (struct, union) of any size, a secret first parameter with an address 118 \item for any aggregate (struct, union), the caller allocates space, passes pointer to it to the callee as a hidden first param
118 to a caller allocated space is passed to the function (in gpr3), which is written to by the callee 119 (meaning in gpr3), and callee writes return value to this space; the ptr to the aggregate is returned in gpr3
119 \end{itemize} 120 \end{itemize}
120 121
121 122
122 \paragraph{Stack layout} 123 \paragraph{Stack layout}
123 124