]> git.ipfire.org Git - thirdparty/gcc.git/blob
6ece8a4577b02f168dd41c4fe9e7a10ef3db9e00
[thirdparty/gcc.git] /
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: arguments in registers, registers arguments
7
8 .. _register-arguments:
9
10 Passing Arguments in Registers
11 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
13 This section describes the macros which let you control how various
14 types of arguments are passed in registers or how they are arranged in
15 the stack.
16
17 .. include:: ../tm.rst.in
18 :start-after: [TARGET_FUNCTION_ARG]
19 :end-before: [TARGET_FUNCTION_ARG]
20
21
22 .. include:: ../tm.rst.in
23 :start-after: [TARGET_MUST_PASS_IN_STACK]
24 :end-before: [TARGET_MUST_PASS_IN_STACK]
25
26
27 .. include:: ../tm.rst.in
28 :start-after: [TARGET_FUNCTION_INCOMING_ARG]
29 :end-before: [TARGET_FUNCTION_INCOMING_ARG]
30
31
32 .. include:: ../tm.rst.in
33 :start-after: [TARGET_USE_PSEUDO_PIC_REG]
34 :end-before: [TARGET_USE_PSEUDO_PIC_REG]
35
36
37 .. include:: ../tm.rst.in
38 :start-after: [TARGET_INIT_PIC_REG]
39 :end-before: [TARGET_INIT_PIC_REG]
40
41
42 .. include:: ../tm.rst.in
43 :start-after: [TARGET_ARG_PARTIAL_BYTES]
44 :end-before: [TARGET_ARG_PARTIAL_BYTES]
45
46
47 .. include:: ../tm.rst.in
48 :start-after: [TARGET_PASS_BY_REFERENCE]
49 :end-before: [TARGET_PASS_BY_REFERENCE]
50
51
52 .. include:: ../tm.rst.in
53 :start-after: [TARGET_CALLEE_COPIES]
54 :end-before: [TARGET_CALLEE_COPIES]
55
56
57 .. c:macro:: CUMULATIVE_ARGS
58
59 A C type for declaring a variable that is used as the first argument
60 of ``TARGET_FUNCTION_ARG`` and other related values. For some
61 target machines, the type ``int`` suffices and can hold the number
62 of bytes of argument so far.
63
64 There is no need to record in ``CUMULATIVE_ARGS`` anything about the
65 arguments that have been passed on the stack. The compiler has other
66 variables to keep track of that. For target machines on which all
67 arguments are passed on the stack, there is no need to store anything in
68 ``CUMULATIVE_ARGS`` ; however, the data structure must exist and
69 should not be empty, so use ``int``.
70
71 .. c:macro:: OVERRIDE_ABI_FORMAT (fndecl)
72
73 If defined, this macro is called before generating any code for a
74 function, but after the :samp:`{cfun}` descriptor for the function has been
75 created. The back end may use this macro to update :samp:`{cfun}` to
76 reflect an ABI other than that which would normally be used by default.
77 If the compiler is generating code for a compiler-generated function,
78 :samp:`{fndecl}` may be ``NULL``.
79
80 .. c:macro:: INIT_CUMULATIVE_ARGS (cum, fntype, libname, fndecl, n_named_args)
81
82 A C statement (sans semicolon) for initializing the variable
83 :samp:`{cum}` for the state at the beginning of the argument list. The
84 variable has type ``CUMULATIVE_ARGS``. The value of :samp:`{fntype}`
85 is the tree node for the data type of the function which will receive
86 the args, or 0 if the args are to a compiler support library function.
87 For direct calls that are not libcalls, :samp:`{fndecl}` contain the
88 declaration node of the function. :samp:`{fndecl}` is also set when
89 ``INIT_CUMULATIVE_ARGS`` is used to find arguments for the function
90 being compiled. :samp:`{n_named_args}` is set to the number of named
91 arguments, including a structure return address if it is passed as a
92 parameter, when making a call. When processing incoming arguments,
93 :samp:`{n_named_args}` is set to -1.
94
95 When processing a call to a compiler support library function,
96 :samp:`{libname}` identifies which one. It is a ``symbol_ref`` rtx which
97 contains the name of the function, as a string. :samp:`{libname}` is 0 when
98 an ordinary C function call is being processed. Thus, each time this
99 macro is called, either :samp:`{libname}` or :samp:`{fntype}` is nonzero, but
100 never both of them at once.
101
102 .. c:macro:: INIT_CUMULATIVE_LIBCALL_ARGS (cum, mode, libname)
103
104 Like ``INIT_CUMULATIVE_ARGS`` but only used for outgoing libcalls,
105 it gets a ``MODE`` argument instead of :samp:`{fntype}`, that would be
106 ``NULL``. :samp:`{indirect}` would always be zero, too. If this macro
107 is not defined, ``INIT_CUMULATIVE_ARGS (cum, NULL_RTX, libname,
108 0)`` is used instead.
109
110 .. c:macro:: INIT_CUMULATIVE_INCOMING_ARGS (cum, fntype, libname)
111
112 Like ``INIT_CUMULATIVE_ARGS`` but overrides it for the purposes of
113 finding the arguments for the function being compiled. If this macro is
114 undefined, ``INIT_CUMULATIVE_ARGS`` is used instead.
115
116 The value passed for :samp:`{libname}` is always 0, since library routines
117 with special calling conventions are never compiled with GCC. The
118 argument :samp:`{libname}` exists for symmetry with
119 ``INIT_CUMULATIVE_ARGS``.
120
121 .. could use "this macro" in place of @code{INIT_CUMULATIVE_ARGS}, maybe.
122
123 .. -mew 5feb93 i switched the order of the sentences. -mew 10feb93
124
125 .. include:: ../tm.rst.in
126 :start-after: [TARGET_FUNCTION_ARG_ADVANCE]
127 :end-before: [TARGET_FUNCTION_ARG_ADVANCE]
128
129
130 .. include:: ../tm.rst.in
131 :start-after: [TARGET_FUNCTION_ARG_OFFSET]
132 :end-before: [TARGET_FUNCTION_ARG_OFFSET]
133
134
135 .. include:: ../tm.rst.in
136 :start-after: [TARGET_FUNCTION_ARG_PADDING]
137 :end-before: [TARGET_FUNCTION_ARG_PADDING]
138
139
140 .. c:macro:: PAD_VARARGS_DOWN
141
142 If defined, a C expression which determines whether the default
143 implementation of va_arg will attempt to pad down before reading the
144 next argument, if that argument is smaller than its aligned space as
145 controlled by ``PARM_BOUNDARY``. If this macro is not defined, all such
146 arguments are padded down if ``BYTES_BIG_ENDIAN`` is true.
147
148 .. c:macro:: BLOCK_REG_PADDING (mode, type, first)
149
150 Specify padding for the last element of a block move between registers and
151 memory. :samp:`{first}` is nonzero if this is the only element. Defining this
152 macro allows better control of register function parameters on big-endian
153 machines, without using ``PARALLEL`` rtl. In particular,
154 ``MUST_PASS_IN_STACK`` need not test padding and mode of types in
155 registers, as there is no longer a "wrong" part of a register; For example,
156 a three byte aggregate may be passed in the high part of a register if so
157 required.
158
159 .. include:: ../tm.rst.in
160 :start-after: [TARGET_FUNCTION_ARG_BOUNDARY]
161 :end-before: [TARGET_FUNCTION_ARG_BOUNDARY]
162
163
164 .. include:: ../tm.rst.in
165 :start-after: [TARGET_FUNCTION_ARG_ROUND_BOUNDARY]
166 :end-before: [TARGET_FUNCTION_ARG_ROUND_BOUNDARY]
167
168
169 .. c:macro:: FUNCTION_ARG_REGNO_P (regno)
170
171 A C expression that is nonzero if :samp:`{regno}` is the number of a hard
172 register in which function arguments are sometimes passed. This does
173 *not* include implicit arguments such as the static chain and
174 the structure-value address. On many machines, no registers can be
175 used for this purpose since all function arguments are pushed on the
176 stack.
177
178 .. include:: ../tm.rst.in
179 :start-after: [TARGET_SPLIT_COMPLEX_ARG]
180 :end-before: [TARGET_SPLIT_COMPLEX_ARG]
181
182
183 .. include:: ../tm.rst.in
184 :start-after: [TARGET_BUILD_BUILTIN_VA_LIST]
185 :end-before: [TARGET_BUILD_BUILTIN_VA_LIST]
186
187
188 .. include:: ../tm.rst.in
189 :start-after: [TARGET_ENUM_VA_LIST_P]
190 :end-before: [TARGET_ENUM_VA_LIST_P]
191
192
193 .. include:: ../tm.rst.in
194 :start-after: [TARGET_FN_ABI_VA_LIST]
195 :end-before: [TARGET_FN_ABI_VA_LIST]
196
197
198 .. include:: ../tm.rst.in
199 :start-after: [TARGET_CANONICAL_VA_LIST_TYPE]
200 :end-before: [TARGET_CANONICAL_VA_LIST_TYPE]
201
202
203 .. include:: ../tm.rst.in
204 :start-after: [TARGET_GIMPLIFY_VA_ARG_EXPR]
205 :end-before: [TARGET_GIMPLIFY_VA_ARG_EXPR]
206
207
208 .. include:: ../tm.rst.in
209 :start-after: [TARGET_VALID_POINTER_MODE]
210 :end-before: [TARGET_VALID_POINTER_MODE]
211
212
213 .. include:: ../tm.rst.in
214 :start-after: [TARGET_REF_MAY_ALIAS_ERRNO]
215 :end-before: [TARGET_REF_MAY_ALIAS_ERRNO]
216
217
218 .. include:: ../tm.rst.in
219 :start-after: [TARGET_TRANSLATE_MODE_ATTRIBUTE]
220 :end-before: [TARGET_TRANSLATE_MODE_ATTRIBUTE]
221
222
223 .. include:: ../tm.rst.in
224 :start-after: [TARGET_SCALAR_MODE_SUPPORTED_P]
225 :end-before: [TARGET_SCALAR_MODE_SUPPORTED_P]
226
227
228 .. include:: ../tm.rst.in
229 :start-after: [TARGET_VECTOR_MODE_SUPPORTED_P]
230 :end-before: [TARGET_VECTOR_MODE_SUPPORTED_P]
231
232
233 .. include:: ../tm.rst.in
234 :start-after: [TARGET_COMPATIBLE_VECTOR_TYPES_P]
235 :end-before: [TARGET_COMPATIBLE_VECTOR_TYPES_P]
236
237
238 .. include:: ../tm.rst.in
239 :start-after: [TARGET_ARRAY_MODE]
240 :end-before: [TARGET_ARRAY_MODE]
241
242
243 .. include:: ../tm.rst.in
244 :start-after: [TARGET_ARRAY_MODE_SUPPORTED_P]
245 :end-before: [TARGET_ARRAY_MODE_SUPPORTED_P]
246
247
248 .. include:: ../tm.rst.in
249 :start-after: [TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P]
250 :end-before: [TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P]
251
252
253 .. include:: ../tm.rst.in
254 :start-after: [TARGET_FLOATN_MODE]
255 :end-before: [TARGET_FLOATN_MODE]
256
257
258 .. include:: ../tm.rst.in
259 :start-after: [TARGET_FLOATN_BUILTIN_P]
260 :end-before: [TARGET_FLOATN_BUILTIN_P]
261
262
263 .. include:: ../tm.rst.in
264 :start-after: [TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P]
265 :end-before: [TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P]