OSDN Git Service

* doc/tm.texi (Misc): Fix thinko.
[pf3gnuchains/gcc-fork.git] / gcc / doc / tm.texi
1 @c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001
2 @c Free Software Foundation, Inc.
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
5
6 @node Target Macros
7 @chapter Target Description Macros and Functions
8 @cindex machine description macros
9 @cindex target description macros
10 @cindex macros, target description
11 @cindex @file{tm.h} macros
12
13 In addition to the file @file{@var{machine}.md}, a machine description
14 includes a C header file conventionally given the name
15 @file{@var{machine}.h} and a C source file named @file{@var{machine}.c}.
16 The header file defines numerous macros that convey the information
17 about the target machine that does not fit into the scheme of the
18 @file{.md} file.  The file @file{tm.h} should be a link to
19 @file{@var{machine}.h}.  The header file @file{config.h} includes
20 @file{tm.h} and most compiler source files include @file{config.h}.  The
21 source file defines a variable @code{targetm}, which is a structure
22 containing pointers to functions and data relating to the target
23 machine.  @file{@var{machine}.c} should also contain their definitions,
24 if they are not defined elsewhere in GCC, and other functions called
25 through the macros defined in the @file{.h} file.
26
27 @menu
28 * Target Structure::    The @code{targetm} variable.
29 * Driver::              Controlling how the driver runs the compilation passes.
30 * Run-time Target::     Defining @samp{-m} options like @option{-m68000} and @option{-m68020}.
31 * Per-Function Data::   Defining data structures for per-function information.
32 * Storage Layout::      Defining sizes and alignments of data.
33 * Type Layout::         Defining sizes and properties of basic user data types.
34 * Escape Sequences::    Defining the value of target character escape sequences
35 * Registers::           Naming and describing the hardware registers.
36 * Register Classes::    Defining the classes of hardware registers.
37 * Stack and Calling::   Defining which way the stack grows and by how much.
38 * Varargs::             Defining the varargs macros.
39 * Trampolines::         Code set up at run time to enter a nested function.
40 * Library Calls::       Controlling how library routines are implicitly called.
41 * Addressing Modes::    Defining addressing modes valid for memory operands.
42 * Condition Code::      Defining how insns update the condition code.
43 * Costs::               Defining relative costs of different operations.
44 * Sections::            Dividing storage into text, data, and other sections.
45 * PIC::                 Macros for position independent code.
46 * Assembler Format::    Defining how to write insns and pseudo-ops to output.
47 * Debugging Info::      Defining the format of debugging output.
48 * Cross-compilation::   Handling floating point for cross-compilers.
49 * Mode Switching::      Insertion of mode-switching instructions.
50 * Misc::                Everything else.
51 @end menu
52
53 @node Target Structure
54 @section The Global @code{targetm} Variable
55 @cindex target hooks
56 @cindex target functions
57
58 @deftypevar {struct gcc_target} targetm
59 The target @file{.c} file must define the global @code{targetm} variable
60 which contains pointers to functions and data relating to the target
61 machine.  The variable is declared in @file{target.h};
62 @file{target-def.h} defines the macro @code{TARGET_INITIALIZER} which is
63 used to initialize the variable, and macros for the default initializers
64 for elements of the structure.  The @file{.c} file should override those
65 macros for which the default definition is inappropriate.  For example:
66 @smallexample
67 #include "target.h"
68 #include "target-def.h"
69
70 /* @r{Initialize the GCC target structure.}  */
71
72 #undef TARGET_VALID_TYPE_ATTRIBUTE
73 #define TARGET_VALID_TYPE_ATTRIBUTE @var{machine}_valid_type_attribute_p
74
75 struct gcc_target targetm = TARGET_INITIALIZER;
76 @end smallexample
77 @end deftypevar
78
79 Where a macro should be defined in the @file{.c} file in this manner to
80 form part of the @code{targetm} structure, it is documented below as a
81 ``Target Hook'' with a prototype.  Many macros will change in future
82 from being defined in the @file{.h} file to being part of the
83 @code{targetm} structure.
84
85 @node Driver
86 @section Controlling the Compilation Driver, @file{gcc}
87 @cindex driver
88 @cindex controlling the compilation driver
89
90 @c prevent bad page break with this line
91 You can control the compilation driver.
92
93 @table @code
94 @findex SWITCH_TAKES_ARG
95 @item SWITCH_TAKES_ARG (@var{char})
96 A C expression which determines whether the option @option{-@var{char}}
97 takes arguments.  The value should be the number of arguments that
98 option takes--zero, for many options.
99
100 By default, this macro is defined as
101 @code{DEFAULT_SWITCH_TAKES_ARG}, which handles the standard options
102 properly.  You need not define @code{SWITCH_TAKES_ARG} unless you
103 wish to add additional options which take arguments.  Any redefinition
104 should call @code{DEFAULT_SWITCH_TAKES_ARG} and then check for
105 additional options.
106
107 @findex WORD_SWITCH_TAKES_ARG
108 @item WORD_SWITCH_TAKES_ARG (@var{name})
109 A C expression which determines whether the option @option{-@var{name}}
110 takes arguments.  The value should be the number of arguments that
111 option takes--zero, for many options.  This macro rather than
112 @code{SWITCH_TAKES_ARG} is used for multi-character option names.
113
114 By default, this macro is defined as
115 @code{DEFAULT_WORD_SWITCH_TAKES_ARG}, which handles the standard options
116 properly.  You need not define @code{WORD_SWITCH_TAKES_ARG} unless you
117 wish to add additional options which take arguments.  Any redefinition
118 should call @code{DEFAULT_WORD_SWITCH_TAKES_ARG} and then check for
119 additional options.
120
121 @findex SWITCH_CURTAILS_COMPILATION
122 @item SWITCH_CURTAILS_COMPILATION (@var{char})
123 A C expression which determines whether the option @option{-@var{char}}
124 stops compilation before the generation of an executable.  The value is
125 boolean, non-zero if the option does stop an executable from being
126 generated, zero otherwise.
127
128 By default, this macro is defined as
129 @code{DEFAULT_SWITCH_CURTAILS_COMPILATION}, which handles the standard
130 options properly.  You need not define
131 @code{SWITCH_CURTAILS_COMPILATION} unless you wish to add additional
132 options which affect the generation of an executable.  Any redefinition
133 should call @code{DEFAULT_SWITCH_CURTAILS_COMPILATION} and then check
134 for additional options.
135
136 @findex SWITCHES_NEED_SPACES
137 @item SWITCHES_NEED_SPACES
138 A string-valued C expression which enumerates the options for which
139 the linker needs a space between the option and its argument.
140
141 If this macro is not defined, the default value is @code{""}.
142
143 @findex TARGET_OPTION_TRANSLATE_TABLE
144 @item TARGET_OPTION_TRANSLATE_TABLE
145 If defined, a list of pairs of strings, the first of which is a
146 potential command line target to the @file{gcc} driver program, and the
147 second of which is a space-separated (tabs and other whitespace are not
148 supported) list of options with which to replace the first option.  The
149 target defining this list is responsible for assuring that the results
150 are valid.  Replacement options may not be the @code{--opt} style, they
151 must be the @code{-opt} style.  It is the intention of this macro to
152 provide a mechanism for substitution that affects the multilibs chosen,
153 such as one option that enables many options, some of which select
154 multilibs.  Example nonsensical definition, where @code{-malt-abi},
155 @code{-EB}, and @code{-mspoo} cause different multilibs to be chosen:
156
157 @example
158 #define TARGET_OPTION_TRANSLATE_TABLE \
159 @{ "-fast",   "-march=fast-foo -malt-abi -I/usr/fast-foo" @}, \
160 @{ "-compat", "-EB -malign=4 -mspoo" @}
161 @end example
162
163 @findex CPP_SPEC
164 @item CPP_SPEC
165 A C string constant that tells the GCC driver program options to
166 pass to CPP@.  It can also specify how to translate options you
167 give to GCC into options for GCC to pass to the CPP@.
168
169 Do not define this macro if it does not need to do anything.
170
171 @findex CPLUSPLUS_CPP_SPEC
172 @item CPLUSPLUS_CPP_SPEC
173 This macro is just like @code{CPP_SPEC}, but is used for C++, rather
174 than C@.  If you do not define this macro, then the value of
175 @code{CPP_SPEC} (if any) will be used instead.
176
177 @findex NO_BUILTIN_SIZE_TYPE
178 @item NO_BUILTIN_SIZE_TYPE
179 If this macro is defined, the preprocessor will not define the built-in macro
180 @code{__SIZE_TYPE__}.  The macro @code{__SIZE_TYPE__} must then be defined
181 by @code{CPP_SPEC} instead.
182
183 This should be defined if @code{SIZE_TYPE} depends on target dependent flags
184 which are not accessible to the preprocessor.  Otherwise, it should not
185 be defined.
186
187 @findex NO_BUILTIN_PTRDIFF_TYPE
188 @item NO_BUILTIN_PTRDIFF_TYPE
189 If this macro is defined, the preprocessor will not define the built-in macro
190 @code{__PTRDIFF_TYPE__}.  The macro @code{__PTRDIFF_TYPE__} must then be
191 defined by @code{CPP_SPEC} instead.
192
193 This should be defined if @code{PTRDIFF_TYPE} depends on target dependent flags
194 which are not accessible to the preprocessor.  Otherwise, it should not
195 be defined.
196
197 @findex NO_BUILTIN_WCHAR_TYPE
198 @item NO_BUILTIN_WCHAR_TYPE
199 If this macro is defined, the preprocessor will not define the built-in macro
200 @code{__WCHAR_TYPE__}.  The macro @code{__WCHAR_TYPE__} must then be
201 defined by @code{CPP_SPEC} instead.
202
203 This should be defined if @code{WCHAR_TYPE} depends on target dependent flags
204 which are not accessible to the preprocessor.  Otherwise, it should not
205 be defined.
206
207 @findex NO_BUILTIN_WINT_TYPE
208 @item NO_BUILTIN_WINT_TYPE
209 If this macro is defined, the preprocessor will not define the built-in macro
210 @code{__WINT_TYPE__}.  The macro @code{__WINT_TYPE__} must then be
211 defined by @code{CPP_SPEC} instead.
212
213 This should be defined if @code{WINT_TYPE} depends on target dependent flags
214 which are not accessible to the preprocessor.  Otherwise, it should not
215 be defined.
216
217 @findex SIGNED_CHAR_SPEC
218 @item SIGNED_CHAR_SPEC
219 A C string constant that tells the GCC driver program options to
220 pass to CPP@.  By default, this macro is defined to pass the option
221 @option{-D__CHAR_UNSIGNED__} to CPP if @code{char} will be treated as
222 @code{unsigned char} by @code{cc1}.
223
224 Do not define this macro unless you need to override the default
225 definition.
226
227 @findex CC1_SPEC
228 @item CC1_SPEC
229 A C string constant that tells the GCC driver program options to
230 pass to @code{cc1}, @code{cc1plus}, @code{f771}, and the other language
231 front ends.
232 It can also specify how to translate options you give to GCC into options
233 for GCC to pass to front ends.
234
235 Do not define this macro if it does not need to do anything.
236
237 @findex CC1PLUS_SPEC
238 @item CC1PLUS_SPEC
239 A C string constant that tells the GCC driver program options to
240 pass to @code{cc1plus}.  It can also specify how to translate options you
241 give to GCC into options for GCC to pass to the @code{cc1plus}.
242
243 Do not define this macro if it does not need to do anything.
244 Note that everything defined in CC1_SPEC is already passed to
245 @code{cc1plus} so there is no need to duplicate the contents of
246 CC1_SPEC in CC1PLUS_SPEC@.
247
248 @findex ASM_SPEC
249 @item ASM_SPEC
250 A C string constant that tells the GCC driver program options to
251 pass to the assembler.  It can also specify how to translate options
252 you give to GCC into options for GCC to pass to the assembler.
253 See the file @file{sun3.h} for an example of this.
254
255 Do not define this macro if it does not need to do anything.
256
257 @findex ASM_FINAL_SPEC
258 @item ASM_FINAL_SPEC
259 A C string constant that tells the GCC driver program how to
260 run any programs which cleanup after the normal assembler.
261 Normally, this is not needed.  See the file @file{mips.h} for
262 an example of this.
263
264 Do not define this macro if it does not need to do anything.
265
266 @findex LINK_SPEC
267 @item LINK_SPEC
268 A C string constant that tells the GCC driver program options to
269 pass to the linker.  It can also specify how to translate options you
270 give to GCC into options for GCC to pass to the linker.
271
272 Do not define this macro if it does not need to do anything.
273
274 @findex LIB_SPEC
275 @item LIB_SPEC
276 Another C string constant used much like @code{LINK_SPEC}.  The difference
277 between the two is that @code{LIB_SPEC} is used at the end of the
278 command given to the linker.
279
280 If this macro is not defined, a default is provided that
281 loads the standard C library from the usual place.  See @file{gcc.c}.
282
283 @findex LIBGCC_SPEC
284 @item LIBGCC_SPEC
285 Another C string constant that tells the GCC driver program
286 how and when to place a reference to @file{libgcc.a} into the
287 linker command line.  This constant is placed both before and after
288 the value of @code{LIB_SPEC}.
289
290 If this macro is not defined, the GCC driver provides a default that
291 passes the string @option{-lgcc} to the linker.
292
293 @findex STARTFILE_SPEC
294 @item STARTFILE_SPEC
295 Another C string constant used much like @code{LINK_SPEC}.  The
296 difference between the two is that @code{STARTFILE_SPEC} is used at
297 the very beginning of the command given to the linker.
298
299 If this macro is not defined, a default is provided that loads the
300 standard C startup file from the usual place.  See @file{gcc.c}.
301
302 @findex ENDFILE_SPEC
303 @item ENDFILE_SPEC
304 Another C string constant used much like @code{LINK_SPEC}.  The
305 difference between the two is that @code{ENDFILE_SPEC} is used at
306 the very end of the command given to the linker.
307
308 Do not define this macro if it does not need to do anything.
309
310 @findex THREAD_MODEL_SPEC
311 @item THREAD_MODEL_SPEC
312 GCC @code{-v} will print the thread model GCC was configured to use.
313 However, this doesn't work on platforms that are multilibbed on thread
314 models, such as AIX 4.3.  On such platforms, define
315 @code{THREAD_MODEL_SPEC} such that it evaluates to a string without
316 blanks that names one of the recognized thread models.  @code{%*}, the
317 default value of this macro, will expand to the value of
318 @code{thread_file} set in @file{config.gcc}.
319
320 @findex EXTRA_SPECS
321 @item EXTRA_SPECS
322 Define this macro to provide additional specifications to put in the
323 @file{specs} file that can be used in various specifications like
324 @code{CC1_SPEC}.
325
326 The definition should be an initializer for an array of structures,
327 containing a string constant, that defines the specification name, and a
328 string constant that provides the specification.
329
330 Do not define this macro if it does not need to do anything.
331
332 @code{EXTRA_SPECS} is useful when an architecture contains several
333 related targets, which have various @code{@dots{}_SPECS} which are similar
334 to each other, and the maintainer would like one central place to keep
335 these definitions.
336
337 For example, the PowerPC System V.4 targets use @code{EXTRA_SPECS} to
338 define either @code{_CALL_SYSV} when the System V calling sequence is
339 used or @code{_CALL_AIX} when the older AIX-based calling sequence is
340 used.
341
342 The @file{config/rs6000/rs6000.h} target file defines:
343
344 @example
345 #define EXTRA_SPECS \
346   @{ "cpp_sysv_default", CPP_SYSV_DEFAULT @},
347
348 #define CPP_SYS_DEFAULT ""
349 @end example
350
351 The @file{config/rs6000/sysv.h} target file defines:
352 @smallexample
353 #undef CPP_SPEC
354 #define CPP_SPEC \
355 "%@{posix: -D_POSIX_SOURCE @} \
356 %@{mcall-sysv: -D_CALL_SYSV @} %@{mcall-aix: -D_CALL_AIX @} \
357 %@{!mcall-sysv: %@{!mcall-aix: %(cpp_sysv_default) @}@} \
358 %@{msoft-float: -D_SOFT_FLOAT@} %@{mcpu=403: -D_SOFT_FLOAT@}"
359
360 #undef CPP_SYSV_DEFAULT
361 #define CPP_SYSV_DEFAULT "-D_CALL_SYSV"
362 @end smallexample
363
364 while the @file{config/rs6000/eabiaix.h} target file defines
365 @code{CPP_SYSV_DEFAULT} as:
366
367 @smallexample
368 #undef CPP_SYSV_DEFAULT
369 #define CPP_SYSV_DEFAULT "-D_CALL_AIX"
370 @end smallexample
371
372 @findex LINK_LIBGCC_SPECIAL
373 @item LINK_LIBGCC_SPECIAL
374 Define this macro if the driver program should find the library
375 @file{libgcc.a} itself and should not pass @option{-L} options to the
376 linker.  If you do not define this macro, the driver program will pass
377 the argument @option{-lgcc} to tell the linker to do the search and will
378 pass @option{-L} options to it.
379
380 @findex LINK_LIBGCC_SPECIAL_1
381 @item LINK_LIBGCC_SPECIAL_1
382 Define this macro if the driver program should find the library
383 @file{libgcc.a}.  If you do not define this macro, the driver program will pass
384 the argument @option{-lgcc} to tell the linker to do the search.
385 This macro is similar to @code{LINK_LIBGCC_SPECIAL}, except that it does
386 not affect @option{-L} options.
387
388 @findex LINK_COMMAND_SPEC
389 @item LINK_COMMAND_SPEC
390 A C string constant giving the complete command line need to execute the
391 linker.  When you do this, you will need to update your port each time a
392 change is made to the link command line within @file{gcc.c}.  Therefore,
393 define this macro only if you need to completely redefine the command
394 line for invoking the linker and there is no other way to accomplish
395 the effect you need.
396
397 @findex LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
398 @item LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
399 A nonzero value causes collect2 to remove duplicate @option{-L@var{directory}} search
400 directories from linking commands.  Do not give it a nonzero value if
401 removing duplicate search directories changes the linker's semantics.
402
403 @findex MULTILIB_DEFAULTS
404 @item MULTILIB_DEFAULTS
405 Define this macro as a C expression for the initializer of an array of
406 string to tell the driver program which options are defaults for this
407 target and thus do not need to be handled specially when using
408 @code{MULTILIB_OPTIONS}.
409
410 Do not define this macro if @code{MULTILIB_OPTIONS} is not defined in
411 the target makefile fragment or if none of the options listed in
412 @code{MULTILIB_OPTIONS} are set by default.
413 @xref{Target Fragment}.
414
415 @findex RELATIVE_PREFIX_NOT_LINKDIR
416 @item RELATIVE_PREFIX_NOT_LINKDIR
417 Define this macro to tell @code{gcc} that it should only translate
418 a @option{-B} prefix into a @option{-L} linker option if the prefix
419 indicates an absolute file name.
420
421 @findex STANDARD_EXEC_PREFIX
422 @item STANDARD_EXEC_PREFIX
423 Define this macro as a C string constant if you wish to override the
424 standard choice of @file{/usr/local/lib/gcc-lib/} as the default prefix to
425 try when searching for the executable files of the compiler.
426
427 @findex MD_EXEC_PREFIX
428 @item MD_EXEC_PREFIX
429 If defined, this macro is an additional prefix to try after
430 @code{STANDARD_EXEC_PREFIX}.  @code{MD_EXEC_PREFIX} is not searched
431 when the @option{-b} option is used, or the compiler is built as a cross
432 compiler.  If you define @code{MD_EXEC_PREFIX}, then be sure to add it
433 to the list of directories used to find the assembler in @file{configure.in}.
434
435 @findex STANDARD_STARTFILE_PREFIX
436 @item STANDARD_STARTFILE_PREFIX
437 Define this macro as a C string constant if you wish to override the
438 standard choice of @file{/usr/local/lib/} as the default prefix to
439 try when searching for startup files such as @file{crt0.o}.
440
441 @findex MD_STARTFILE_PREFIX
442 @item MD_STARTFILE_PREFIX
443 If defined, this macro supplies an additional prefix to try after the
444 standard prefixes.  @code{MD_EXEC_PREFIX} is not searched when the
445 @option{-b} option is used, or when the compiler is built as a cross
446 compiler.
447
448 @findex MD_STARTFILE_PREFIX_1
449 @item MD_STARTFILE_PREFIX_1
450 If defined, this macro supplies yet another prefix to try after the
451 standard prefixes.  It is not searched when the @option{-b} option is
452 used, or when the compiler is built as a cross compiler.
453
454 @findex INIT_ENVIRONMENT
455 @item INIT_ENVIRONMENT
456 Define this macro as a C string constant if you wish to set environment
457 variables for programs called by the driver, such as the assembler and
458 loader.  The driver passes the value of this macro to @code{putenv} to
459 initialize the necessary environment variables.
460
461 @findex LOCAL_INCLUDE_DIR
462 @item LOCAL_INCLUDE_DIR
463 Define this macro as a C string constant if you wish to override the
464 standard choice of @file{/usr/local/include} as the default prefix to
465 try when searching for local header files.  @code{LOCAL_INCLUDE_DIR}
466 comes before @code{SYSTEM_INCLUDE_DIR} in the search order.
467
468 Cross compilers do not use this macro and do not search either
469 @file{/usr/local/include} or its replacement.
470
471 @findex MODIFY_TARGET_NAME
472 @item MODIFY_TARGET_NAME
473 Define this macro if you with to define command-line switches that modify the
474 default target name
475
476 For each switch, you can include a string to be appended to the first
477 part of the configuration name or a string to be deleted from the
478 configuration name, if present.  The definition should be an initializer
479 for an array of structures.  Each array element should have three
480 elements: the switch name (a string constant, including the initial
481 dash), one of the enumeration codes @code{ADD} or @code{DELETE} to
482 indicate whether the string should be inserted or deleted, and the string
483 to be inserted or deleted (a string constant).
484
485 For example, on a machine where @samp{64} at the end of the
486 configuration name denotes a 64-bit target and you want the @option{-32}
487 and @option{-64} switches to select between 32- and 64-bit targets, you would
488 code
489
490 @smallexample
491 #define MODIFY_TARGET_NAME \
492   @{ @{ "-32", DELETE, "64"@}, \
493      @{"-64", ADD, "64"@}@}
494 @end smallexample
495
496
497 @findex SYSTEM_INCLUDE_DIR
498 @item SYSTEM_INCLUDE_DIR
499 Define this macro as a C string constant if you wish to specify a
500 system-specific directory to search for header files before the standard
501 directory.  @code{SYSTEM_INCLUDE_DIR} comes before
502 @code{STANDARD_INCLUDE_DIR} in the search order.
503
504 Cross compilers do not use this macro and do not search the directory
505 specified.
506
507 @findex STANDARD_INCLUDE_DIR
508 @item STANDARD_INCLUDE_DIR
509 Define this macro as a C string constant if you wish to override the
510 standard choice of @file{/usr/include} as the default prefix to
511 try when searching for header files.
512
513 Cross compilers do not use this macro and do not search either
514 @file{/usr/include} or its replacement.
515
516 @findex STANDARD_INCLUDE_COMPONENT
517 @item STANDARD_INCLUDE_COMPONENT
518 The ``component'' corresponding to @code{STANDARD_INCLUDE_DIR}.
519 See @code{INCLUDE_DEFAULTS}, below, for the description of components.
520 If you do not define this macro, no component is used.
521
522 @findex INCLUDE_DEFAULTS
523 @item INCLUDE_DEFAULTS
524 Define this macro if you wish to override the entire default search path
525 for include files.  For a native compiler, the default search path
526 usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR},
527 @code{SYSTEM_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and
528 @code{STANDARD_INCLUDE_DIR}.  In addition, @code{GPLUSPLUS_INCLUDE_DIR}
529 and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile},
530 and specify private search areas for GCC@.  The directory
531 @code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs.
532
533 The definition should be an initializer for an array of structures.
534 Each array element should have four elements: the directory name (a
535 string constant), the component name (also a string constant), a flag
536 for C++-only directories,
537 and a flag showing that the includes in the directory don't need to be
538 wrapped in @code{extern @samp{C}} when compiling C++.  Mark the end of
539 the array with a null element.
540
541 The component name denotes what GNU package the include file is part of,
542 if any, in all upper-case letters.  For example, it might be @samp{GCC}
543 or @samp{BINUTILS}.  If the package is part of a vendor-supplied
544 operating system, code the component name as @samp{0}.
545
546 For example, here is the definition used for VAX/VMS:
547
548 @example
549 #define INCLUDE_DEFAULTS \
550 @{                                       \
551   @{ "GNU_GXX_INCLUDE:", "G++", 1, 1@},   \
552   @{ "GNU_CC_INCLUDE:", "GCC", 0, 0@},    \
553   @{ "SYS$SYSROOT:[SYSLIB.]", 0, 0, 0@},  \
554   @{ ".", 0, 0, 0@},                      \
555   @{ 0, 0, 0, 0@}                         \
556 @}
557 @end example
558 @end table
559
560 Here is the order of prefixes tried for exec files:
561
562 @enumerate
563 @item
564 Any prefixes specified by the user with @option{-B}.
565
566 @item
567 The environment variable @code{GCC_EXEC_PREFIX}, if any.
568
569 @item
570 The directories specified by the environment variable @code{COMPILER_PATH}.
571
572 @item
573 The macro @code{STANDARD_EXEC_PREFIX}.
574
575 @item
576 @file{/usr/lib/gcc/}.
577
578 @item
579 The macro @code{MD_EXEC_PREFIX}, if any.
580 @end enumerate
581
582 Here is the order of prefixes tried for startfiles:
583
584 @enumerate
585 @item
586 Any prefixes specified by the user with @option{-B}.
587
588 @item
589 The environment variable @code{GCC_EXEC_PREFIX}, if any.
590
591 @item
592 The directories specified by the environment variable @code{LIBRARY_PATH}
593 (or port-specific name; native only, cross compilers do not use this).
594
595 @item
596 The macro @code{STANDARD_EXEC_PREFIX}.
597
598 @item
599 @file{/usr/lib/gcc/}.
600
601 @item
602 The macro @code{MD_EXEC_PREFIX}, if any.
603
604 @item
605 The macro @code{MD_STARTFILE_PREFIX}, if any.
606
607 @item
608 The macro @code{STANDARD_STARTFILE_PREFIX}.
609
610 @item
611 @file{/lib/}.
612
613 @item
614 @file{/usr/lib/}.
615 @end enumerate
616
617 @node Run-time Target
618 @section Run-time Target Specification
619 @cindex run-time target specification
620 @cindex predefined macros
621 @cindex target specifications
622
623 @c prevent bad page break with this line
624 Here are run-time target specifications.
625
626 @table @code
627 @findex CPP_PREDEFINES
628 @item CPP_PREDEFINES
629 Define this to be a string constant containing @option{-D} options to
630 define the predefined macros that identify this machine and system.
631 These macros will be predefined unless the @option{-ansi} option (or a
632 @option{-std} option for strict ISO C conformance) is specified.
633
634 In addition, a parallel set of macros are predefined, whose names are
635 made by appending @samp{__} at the beginning and at the end.  These
636 @samp{__} macros are permitted by the ISO standard, so they are
637 predefined regardless of whether @option{-ansi} or a @option{-std} option
638 is specified.
639
640 For example, on the Sun, one can use the following value:
641
642 @smallexample
643 "-Dmc68000 -Dsun -Dunix"
644 @end smallexample
645
646 The result is to define the macros @code{__mc68000__}, @code{__sun__}
647 and @code{__unix__} unconditionally, and the macros @code{mc68000},
648 @code{sun} and @code{unix} provided @option{-ansi} is not specified.
649
650 @findex extern int target_flags
651 @item extern int target_flags;
652 This declaration should be present.
653
654 @cindex optional hardware or system features
655 @cindex features, optional, in system conventions
656 @item TARGET_@dots{}
657 This series of macros is to allow compiler command arguments to
658 enable or disable the use of optional features of the target machine.
659 For example, one machine description serves both the 68000 and
660 the 68020; a command argument tells the compiler whether it should
661 use 68020-only instructions or not.  This command argument works
662 by means of a macro @code{TARGET_68020} that tests a bit in
663 @code{target_flags}.
664
665 Define a macro @code{TARGET_@var{featurename}} for each such option.
666 Its definition should test a bit in @code{target_flags}.  It is
667 recommended that a helper macro @code{TARGET_MASK_@var{featurename}}
668 is defined for each bit-value to test, and used in
669 @code{TARGET_@var{featurename}} and @code{TARGET_SWITCHES}.  For
670 example:
671
672 @smallexample
673 #define TARGET_MASK_68020 1
674 #define TARGET_68020 (target_flags & TARGET_MASK_68020)
675 @end smallexample
676
677 One place where these macros are used is in the condition-expressions
678 of instruction patterns.  Note how @code{TARGET_68020} appears
679 frequently in the 68000 machine description file, @file{m68k.md}.
680 Another place they are used is in the definitions of the other
681 macros in the @file{@var{machine}.h} file.
682
683 @findex TARGET_SWITCHES
684 @item TARGET_SWITCHES
685 This macro defines names of command options to set and clear
686 bits in @code{target_flags}.  Its definition is an initializer
687 with a subgrouping for each command option.
688
689 Each subgrouping contains a string constant, that defines the option
690 name, a number, which contains the bits to set in
691 @code{target_flags}, and a second string which is the description
692 displayed by @option{--help}.  If the number is negative then the bits specified
693 by the number are cleared instead of being set.  If the description
694 string is present but empty, then no help information will be displayed
695 for that option, but it will not count as an undocumented option.  The
696 actual option name is made by appending @samp{-m} to the specified name.
697 Non-empty description strings should be marked with @code{N_(@dots{})} for
698 @command{xgettext}.  In addition to the description for @option{--help},
699 more detailed documentation for each option should be added to
700 @file{invoke.texi}.
701
702 One of the subgroupings should have a null string.  The number in
703 this grouping is the default value for @code{target_flags}.  Any
704 target options act starting with that value.
705
706 Here is an example which defines @option{-m68000} and @option{-m68020}
707 with opposite meanings, and picks the latter as the default:
708
709 @smallexample
710 #define TARGET_SWITCHES \
711   @{ @{ "68020", TARGET_MASK_68020, "" @},      \
712     @{ "68000", -TARGET_MASK_68020, \
713       N_("Compile for the 68000") @}, \
714     @{ "", TARGET_MASK_68020, "" @}@}
715 @end smallexample
716
717 @findex TARGET_OPTIONS
718 @item TARGET_OPTIONS
719 This macro is similar to @code{TARGET_SWITCHES} but defines names of command
720 options that have values.  Its definition is an initializer with a
721 subgrouping for each command option.
722
723 Each subgrouping contains a string constant, that defines the fixed part
724 of the option name, the address of a variable, and a description string
725 (which should again be marked with @code{N_(@dots{})}).
726 The variable, type @code{char *}, is set to the variable part of the
727 given option if the fixed part matches.  The actual option name is made
728 by appending @samp{-m} to the specified name.  Again, each option should
729 also be documented in @file{invoke.texi}.
730
731 Here is an example which defines @option{-mshort-data-@var{number}}.  If the
732 given option is @option{-mshort-data-512}, the variable @code{m88k_short_data}
733 will be set to the string @code{"512"}.
734
735 @smallexample
736 extern char *m88k_short_data;
737 #define TARGET_OPTIONS \
738  @{ @{ "short-data-", &m88k_short_data, \
739      N_("Specify the size of the short data section") @} @}
740 @end smallexample
741
742 @findex TARGET_VERSION
743 @item TARGET_VERSION
744 This macro is a C statement to print on @code{stderr} a string
745 describing the particular machine description choice.  Every machine
746 description should define @code{TARGET_VERSION}.  For example:
747
748 @smallexample
749 #ifdef MOTOROLA
750 #define TARGET_VERSION \
751   fprintf (stderr, " (68k, Motorola syntax)");
752 #else
753 #define TARGET_VERSION \
754   fprintf (stderr, " (68k, MIT syntax)");
755 #endif
756 @end smallexample
757
758 @findex OVERRIDE_OPTIONS
759 @item OVERRIDE_OPTIONS
760 Sometimes certain combinations of command options do not make sense on
761 a particular target machine.  You can define a macro
762 @code{OVERRIDE_OPTIONS} to take account of this.  This macro, if
763 defined, is executed once just after all the command options have been
764 parsed.
765
766 Don't use this macro to turn on various extra optimizations for
767 @option{-O}.  That is what @code{OPTIMIZATION_OPTIONS} is for.
768
769 @findex OPTIMIZATION_OPTIONS
770 @item OPTIMIZATION_OPTIONS (@var{level}, @var{size})
771 Some machines may desire to change what optimizations are performed for
772 various optimization levels.   This macro, if defined, is executed once
773 just after the optimization level is determined and before the remainder
774 of the command options have been parsed.  Values set in this macro are
775 used as the default values for the other command line options.
776
777 @var{level} is the optimization level specified; 2 if @option{-O2} is
778 specified, 1 if @option{-O} is specified, and 0 if neither is specified.
779
780 @var{size} is non-zero if @option{-Os} is specified and zero otherwise.
781
782 You should not use this macro to change options that are not
783 machine-specific.  These should uniformly selected by the same
784 optimization level on all supported machines.  Use this macro to enable
785 machine-specific optimizations.
786
787 @strong{Do not examine @code{write_symbols} in
788 this macro!} The debugging options are not supposed to alter the
789 generated code.
790
791 @findex CAN_DEBUG_WITHOUT_FP
792 @item CAN_DEBUG_WITHOUT_FP
793 Define this macro if debugging can be performed even without a frame
794 pointer.  If this macro is defined, GCC will turn on the
795 @option{-fomit-frame-pointer} option whenever @option{-O} is specified.
796 @end table
797
798 @node Per-Function Data
799 @section Defining data structures for per-function information.
800 @cindex per-function data
801 @cindex data structures
802
803 If the target needs to store information on a per-function basis, GCC
804 provides a macro and a couple of variables to allow this.  Note, just
805 using statics to store the information is a bad idea, since GCC supports
806 nested functions, so you can be halfway through encoding one function
807 when another one comes along.
808
809 GCC defines a data structure called @code{struct function} which
810 contains all of the data specific to an individual function.  This
811 structure contains a field called @code{machine} whose type is
812 @code{struct machine_function *}, which can be used by targets to point
813 to their own specific data.
814
815 If a target needs per-function specific data it should define the type
816 @code{struct machine_function} and also the macro
817 @code{INIT_EXPANDERS}.  This macro should be used to initialise some or
818 all of the function pointers @code{init_machine_status},
819 @code{free_machine_status} and @code{mark_machine_status}.  These
820 pointers are explained below.
821
822 One typical use of per-function, target specific data is to create an
823 RTX to hold the register containing the function's return address.  This
824 RTX can then be used to implement the @code{__builtin_return_address}
825 function, for level 0.
826
827 Note---earlier implementations of GCC used a single data area to hold
828 all of the per-function information.  Thus when processing of a nested
829 function began the old per-function data had to be pushed onto a
830 stack, and when the processing was finished, it had to be popped off the
831 stack.  GCC used to provide function pointers called
832 @code{save_machine_status} and @code{restore_machine_status} to handle
833 the saving and restoring of the target specific information.  Since the
834 single data area approach is no longer used, these pointers are no
835 longer supported.
836
837 The macro and function pointers are described below.
838
839 @table @code
840 @findex INIT_EXPANDERS
841 @item   INIT_EXPANDERS
842 Macro called to initialise any target specific information.  This macro
843 is called once per function, before generation of any RTL has begun.
844 The intention of this macro is to allow the initialisation of the
845 function pointers below.
846
847 @findex init_machine_status
848 @item   init_machine_status
849 This is a @code{void (*)(struct function *)} function pointer.  If this
850 pointer is non-NULL it will be called once per function, before function
851 compilation starts, in order to allow the target to perform any target
852 specific initialisation of the @code{struct function} structure.  It is
853 intended that this would be used to initialise the @code{machine} of
854 that structure.
855
856 @findex free_machine_status
857 @item   free_machine_status
858 This is a @code{void (*)(struct function *)} function pointer.  If this
859 pointer is non-NULL it will be called once per function, after the
860 function has been compiled, in order to allow any memory allocated
861 during the @code{init_machine_status} function call to be freed.
862
863 @findex mark_machine_status
864 @item   mark_machine_status
865 This is a @code{void (*)(struct function *)} function pointer.  If this
866 pointer is non-NULL it will be called once per function in order to mark
867 any data items in the @code{struct machine_function} structure which
868 need garbage collection.
869
870 @end table
871
872 @node Storage Layout
873 @section Storage Layout
874 @cindex storage layout
875
876 Note that the definitions of the macros in this table which are sizes or
877 alignments measured in bits do not need to be constant.  They can be C
878 expressions that refer to static variables, such as the @code{target_flags}.
879 @xref{Run-time Target}.
880
881 @table @code
882 @findex BITS_BIG_ENDIAN
883 @item BITS_BIG_ENDIAN
884 Define this macro to have the value 1 if the most significant bit in a
885 byte has the lowest number; otherwise define it to have the value zero.
886 This means that bit-field instructions count from the most significant
887 bit.  If the machine has no bit-field instructions, then this must still
888 be defined, but it doesn't matter which value it is defined to.  This
889 macro need not be a constant.
890
891 This macro does not affect the way structure fields are packed into
892 bytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}.
893
894 @findex BYTES_BIG_ENDIAN
895 @item BYTES_BIG_ENDIAN
896 Define this macro to have the value 1 if the most significant byte in a
897 word has the lowest number.  This macro need not be a constant.
898
899 @findex WORDS_BIG_ENDIAN
900 @item WORDS_BIG_ENDIAN
901 Define this macro to have the value 1 if, in a multiword object, the
902 most significant word has the lowest number.  This applies to both
903 memory locations and registers; GCC fundamentally assumes that the
904 order of words in memory is the same as the order in registers.  This
905 macro need not be a constant.
906
907 @findex LIBGCC2_WORDS_BIG_ENDIAN
908 @item LIBGCC2_WORDS_BIG_ENDIAN
909 Define this macro if @code{WORDS_BIG_ENDIAN} is not constant.  This must be a
910 constant value with the same meaning as @code{WORDS_BIG_ENDIAN}, which will be
911 used only when compiling @file{libgcc2.c}.  Typically the value will be set
912 based on preprocessor defines.
913
914 @findex FLOAT_WORDS_BIG_ENDIAN
915 @item FLOAT_WORDS_BIG_ENDIAN
916 Define this macro to have the value 1 if @code{DFmode}, @code{XFmode} or
917 @code{TFmode} floating point numbers are stored in memory with the word
918 containing the sign bit at the lowest address; otherwise define it to
919 have the value 0.  This macro need not be a constant.
920
921 You need not define this macro if the ordering is the same as for
922 multi-word integers.
923
924 @findex BITS_PER_UNIT
925 @item BITS_PER_UNIT
926 Define this macro to be the number of bits in an addressable storage
927 unit (byte); normally 8.
928
929 @findex BITS_PER_WORD
930 @item BITS_PER_WORD
931 Number of bits in a word; normally 32.
932
933 @findex MAX_BITS_PER_WORD
934 @item MAX_BITS_PER_WORD
935 Maximum number of bits in a word.  If this is undefined, the default is
936 @code{BITS_PER_WORD}.  Otherwise, it is the constant value that is the
937 largest value that @code{BITS_PER_WORD} can have at run-time.
938
939 @findex UNITS_PER_WORD
940 @item UNITS_PER_WORD
941 Number of storage units in a word; normally 4.
942
943 @findex MIN_UNITS_PER_WORD
944 @item MIN_UNITS_PER_WORD
945 Minimum number of units in a word.  If this is undefined, the default is
946 @code{UNITS_PER_WORD}.  Otherwise, it is the constant value that is the
947 smallest value that @code{UNITS_PER_WORD} can have at run-time.
948
949 @findex POINTER_SIZE
950 @item POINTER_SIZE
951 Width of a pointer, in bits.  You must specify a value no wider than the
952 width of @code{Pmode}.  If it is not equal to the width of @code{Pmode},
953 you must define @code{POINTERS_EXTEND_UNSIGNED}.
954
955 @findex POINTERS_EXTEND_UNSIGNED
956 @item POINTERS_EXTEND_UNSIGNED
957 A C expression whose value is nonzero if pointers that need to be
958 extended from being @code{POINTER_SIZE} bits wide to @code{Pmode} are to
959 be zero-extended and zero if they are to be sign-extended.
960
961 You need not define this macro if the @code{POINTER_SIZE} is equal
962 to the width of @code{Pmode}.
963
964 @findex PROMOTE_MODE
965 @item PROMOTE_MODE (@var{m}, @var{unsignedp}, @var{type})
966 A macro to update @var{m} and @var{unsignedp} when an object whose type
967 is @var{type} and which has the specified mode and signedness is to be
968 stored in a register.  This macro is only called when @var{type} is a
969 scalar type.
970
971 On most RISC machines, which only have operations that operate on a full
972 register, define this macro to set @var{m} to @code{word_mode} if
973 @var{m} is an integer mode narrower than @code{BITS_PER_WORD}.  In most
974 cases, only integer modes should be widened because wider-precision
975 floating-point operations are usually more expensive than their narrower
976 counterparts.
977
978 For most machines, the macro definition does not change @var{unsignedp}.
979 However, some machines, have instructions that preferentially handle
980 either signed or unsigned quantities of certain modes.  For example, on
981 the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
982 sign-extend the result to 64 bits.  On such machines, set
983 @var{unsignedp} according to which kind of extension is more efficient.
984
985 Do not define this macro if it would never modify @var{m}.
986
987 @findex PROMOTE_FUNCTION_ARGS
988 @item PROMOTE_FUNCTION_ARGS
989 Define this macro if the promotion described by @code{PROMOTE_MODE}
990 should also be done for outgoing function arguments.
991
992 @findex PROMOTE_FUNCTION_RETURN
993 @item PROMOTE_FUNCTION_RETURN
994 Define this macro if the promotion described by @code{PROMOTE_MODE}
995 should also be done for the return value of functions.
996
997 If this macro is defined, @code{FUNCTION_VALUE} must perform the same
998 promotions done by @code{PROMOTE_MODE}.
999
1000 @findex PROMOTE_FOR_CALL_ONLY
1001 @item PROMOTE_FOR_CALL_ONLY
1002 Define this macro if the promotion described by @code{PROMOTE_MODE}
1003 should @emph{only} be performed for outgoing function arguments or
1004 function return values, as specified by @code{PROMOTE_FUNCTION_ARGS}
1005 and @code{PROMOTE_FUNCTION_RETURN}, respectively.
1006
1007 @findex PARM_BOUNDARY
1008 @item PARM_BOUNDARY
1009 Normal alignment required for function parameters on the stack, in
1010 bits.  All stack parameters receive at least this much alignment
1011 regardless of data type.  On most machines, this is the same as the
1012 size of an integer.
1013
1014 @findex STACK_BOUNDARY
1015 @item STACK_BOUNDARY
1016 Define this macro if there is a guaranteed alignment for the stack
1017 pointer on this machine.  The definition is a C expression
1018 for the desired alignment (measured in bits).  This value is used as a
1019 default if @code{PREFERRED_STACK_BOUNDARY} is not defined.
1020
1021 @findex PREFERRED_STACK_BOUNDARY
1022 @item PREFERRED_STACK_BOUNDARY
1023 Define this macro if you wish to preserve a certain alignment for
1024 the stack pointer.  The definition is a C expression
1025 for the desired alignment (measured in bits).  If @code{STACK_BOUNDARY} is
1026 also defined, this macro must evaluate to a value equal to or larger
1027 than @code{STACK_BOUNDARY}.
1028
1029 @cindex @code{PUSH_ROUNDING}, interaction with @code{PREFERRED_STACK_BOUNDARY}
1030 If @code{PUSH_ROUNDING} is not defined, the stack will always be aligned
1031 to the specified boundary.  If @code{PUSH_ROUNDING} is defined and specifies
1032 a less strict alignment than @code{PREFERRED_STACK_BOUNDARY}, the stack may
1033 be momentarily unaligned while pushing arguments.
1034
1035 @findex FUNCTION_BOUNDARY
1036 @item FUNCTION_BOUNDARY
1037 Alignment required for a function entry point, in bits.
1038
1039 @findex BIGGEST_ALIGNMENT
1040 @item BIGGEST_ALIGNMENT
1041 Biggest alignment that any data type can require on this machine, in bits.
1042
1043 @findex MINIMUM_ATOMIC_ALIGNMENT
1044 @item MINIMUM_ATOMIC_ALIGNMENT
1045 If defined, the smallest alignment, in bits, that can be given to an
1046 object that can be referenced in one operation, without disturbing any
1047 nearby object.  Normally, this is @code{BITS_PER_UNIT}, but may be larger
1048 on machines that don't have byte or half-word store operations.
1049
1050 @findex BIGGEST_FIELD_ALIGNMENT
1051 @item BIGGEST_FIELD_ALIGNMENT
1052 Biggest alignment that any structure or union field can require on this
1053 machine, in bits.  If defined, this overrides @code{BIGGEST_ALIGNMENT} for
1054 structure and union fields only, unless the field alignment has been set
1055 by the @code{__attribute__ ((aligned (@var{n})))} construct.
1056
1057 @findex ADJUST_FIELD_ALIGN
1058 @item ADJUST_FIELD_ALIGN (@var{field}, @var{computed})
1059 An expression for the alignment of a structure field @var{field} if the
1060 alignment computed in the usual way is @var{computed}.  GCC uses
1061 this value instead of the value in @code{BIGGEST_ALIGNMENT} or
1062 @code{BIGGEST_FIELD_ALIGNMENT}, if defined, for structure fields only.
1063
1064 @findex MAX_OFILE_ALIGNMENT
1065 @item MAX_OFILE_ALIGNMENT
1066 Biggest alignment supported by the object file format of this machine.
1067 Use this macro to limit the alignment which can be specified using the
1068 @code{__attribute__ ((aligned (@var{n})))} construct.  If not defined,
1069 the default value is @code{BIGGEST_ALIGNMENT}.
1070
1071 @findex DATA_ALIGNMENT
1072 @item DATA_ALIGNMENT (@var{type}, @var{basic-align})
1073 If defined, a C expression to compute the alignment for a variable in
1074 the static store.  @var{type} is the data type, and @var{basic-align} is
1075 the alignment that the object would ordinarily have.  The value of this
1076 macro is used instead of that alignment to align the object.
1077
1078 If this macro is not defined, then @var{basic-align} is used.
1079
1080 @findex strcpy
1081 One use of this macro is to increase alignment of medium-size data to
1082 make it all fit in fewer cache lines.  Another is to cause character
1083 arrays to be word-aligned so that @code{strcpy} calls that copy
1084 constants to character arrays can be done inline.
1085
1086 @findex CONSTANT_ALIGNMENT
1087 @item CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})
1088 If defined, a C expression to compute the alignment given to a constant
1089 that is being placed in memory.  @var{constant} is the constant and
1090 @var{basic-align} is the alignment that the object would ordinarily
1091 have.  The value of this macro is used instead of that alignment to
1092 align the object.
1093
1094 If this macro is not defined, then @var{basic-align} is used.
1095
1096 The typical use of this macro is to increase alignment for string
1097 constants to be word aligned so that @code{strcpy} calls that copy
1098 constants can be done inline.
1099
1100 @findex LOCAL_ALIGNMENT
1101 @item LOCAL_ALIGNMENT (@var{type}, @var{basic-align})
1102 If defined, a C expression to compute the alignment for a variable in
1103 the local store.  @var{type} is the data type, and @var{basic-align} is
1104 the alignment that the object would ordinarily have.  The value of this
1105 macro is used instead of that alignment to align the object.
1106
1107 If this macro is not defined, then @var{basic-align} is used.
1108
1109 One use of this macro is to increase alignment of medium-size data to
1110 make it all fit in fewer cache lines.
1111
1112 @findex EMPTY_FIELD_BOUNDARY
1113 @item EMPTY_FIELD_BOUNDARY
1114 Alignment in bits to be given to a structure bit-field that follows an
1115 empty field such as @code{int : 0;}.
1116
1117 Note that @code{PCC_BITFIELD_TYPE_MATTERS} also affects the alignment
1118 that results from an empty field.
1119
1120 @findex STRUCTURE_SIZE_BOUNDARY
1121 @item STRUCTURE_SIZE_BOUNDARY
1122 Number of bits which any structure or union's size must be a multiple of.
1123 Each structure or union's size is rounded up to a multiple of this.
1124
1125 If you do not define this macro, the default is the same as
1126 @code{BITS_PER_UNIT}.
1127
1128 @findex STRICT_ALIGNMENT
1129 @item STRICT_ALIGNMENT
1130 Define this macro to be the value 1 if instructions will fail to work
1131 if given data not on the nominal alignment.  If instructions will merely
1132 go slower in that case, define this macro as 0.
1133
1134 @findex PCC_BITFIELD_TYPE_MATTERS
1135 @item PCC_BITFIELD_TYPE_MATTERS
1136 Define this if you wish to imitate the way many other C compilers handle
1137 alignment of bit-fields and the structures that contain them.
1138
1139 The behavior is that the type written for a bit-field (@code{int},
1140 @code{short}, or other integer type) imposes an alignment for the
1141 entire structure, as if the structure really did contain an ordinary
1142 field of that type.  In addition, the bit-field is placed within the
1143 structure so that it would fit within such a field, not crossing a
1144 boundary for it.
1145
1146 Thus, on most machines, a bit-field whose type is written as @code{int}
1147 would not cross a four-byte boundary, and would force four-byte
1148 alignment for the whole structure.  (The alignment used may not be four
1149 bytes; it is controlled by the other alignment parameters.)
1150
1151 If the macro is defined, its definition should be a C expression;
1152 a nonzero value for the expression enables this behavior.
1153
1154 Note that if this macro is not defined, or its value is zero, some
1155 bit-fields may cross more than one alignment boundary.  The compiler can
1156 support such references if there are @samp{insv}, @samp{extv}, and
1157 @samp{extzv} insns that can directly reference memory.
1158
1159 The other known way of making bit-fields work is to define
1160 @code{STRUCTURE_SIZE_BOUNDARY} as large as @code{BIGGEST_ALIGNMENT}.
1161 Then every structure can be accessed with fullwords.
1162
1163 Unless the machine has bit-field instructions or you define
1164 @code{STRUCTURE_SIZE_BOUNDARY} that way, you must define
1165 @code{PCC_BITFIELD_TYPE_MATTERS} to have a nonzero value.
1166
1167 If your aim is to make GCC use the same conventions for laying out
1168 bit-fields as are used by another compiler, here is how to investigate
1169 what the other compiler does.  Compile and run this program:
1170
1171 @example
1172 struct foo1
1173 @{
1174   char x;
1175   char :0;
1176   char y;
1177 @};
1178
1179 struct foo2
1180 @{
1181   char x;
1182   int :0;
1183   char y;
1184 @};
1185
1186 main ()
1187 @{
1188   printf ("Size of foo1 is %d\n",
1189           sizeof (struct foo1));
1190   printf ("Size of foo2 is %d\n",
1191           sizeof (struct foo2));
1192   exit (0);
1193 @}
1194 @end example
1195
1196 If this prints 2 and 5, then the compiler's behavior is what you would
1197 get from @code{PCC_BITFIELD_TYPE_MATTERS}.
1198
1199 @findex BITFIELD_NBYTES_LIMITED
1200 @item BITFIELD_NBYTES_LIMITED
1201 Like PCC_BITFIELD_TYPE_MATTERS except that its effect is limited to
1202 aligning a bit-field within the structure.
1203
1204 @findex MEMBER_TYPE_FORCES_BLK
1205 @item MEMBER_TYPE_FORCES_BLK (@var{field})
1206 Return 1 if a structure or array containing @var{field} should be accessed using
1207 @code{BLKMODE}.
1208
1209 Normally, this is not needed.  See the file @file{c4x.h} for an example
1210 of how to use this macro to prevent a structure having a floating point
1211 field from being accessed in an integer mode.
1212
1213 @findex ROUND_TYPE_SIZE
1214 @item ROUND_TYPE_SIZE (@var{type}, @var{computed}, @var{specified})
1215 Define this macro as an expression for the overall size of a type
1216 (given by @var{type} as a tree node) when the size computed in the
1217 usual way is @var{computed} and the alignment is @var{specified}.
1218
1219 The default is to round @var{computed} up to a multiple of @var{specified}.
1220
1221 @findex ROUND_TYPE_SIZE_UNIT
1222 @item ROUND_TYPE_SIZE_UNIT (@var{type}, @var{computed}, @var{specified})
1223 Similar to @code{ROUND_TYPE_SIZE}, but sizes and alignments are
1224 specified in units (bytes).  If you define @code{ROUND_TYPE_SIZE},
1225 you must also define this macro and they must be defined consistently
1226 with each other.
1227
1228 @findex ROUND_TYPE_ALIGN
1229 @item ROUND_TYPE_ALIGN (@var{type}, @var{computed}, @var{specified})
1230 Define this macro as an expression for the alignment of a type (given
1231 by @var{type} as a tree node) if the alignment computed in the usual
1232 way is @var{computed} and the alignment explicitly specified was
1233 @var{specified}.
1234
1235 The default is to use @var{specified} if it is larger; otherwise, use
1236 the smaller of @var{computed} and @code{BIGGEST_ALIGNMENT}
1237
1238 @findex MAX_FIXED_MODE_SIZE
1239 @item MAX_FIXED_MODE_SIZE
1240 An integer expression for the size in bits of the largest integer
1241 machine mode that should actually be used.  All integer machine modes of
1242 this size or smaller can be used for structures and unions with the
1243 appropriate sizes.  If this macro is undefined, @code{GET_MODE_BITSIZE
1244 (DImode)} is assumed.
1245
1246 @findex VECTOR_MODE_SUPPORTED_P
1247 @item VECTOR_MODE_SUPPORTED_P(@var{mode})
1248 Define this macro to be nonzero if the port is prepared to handle insns
1249 involving vector mode @var{mode}.  At the very least, it must have move
1250 patterns for this mode.
1251
1252 @findex STACK_SAVEAREA_MODE
1253 @item STACK_SAVEAREA_MODE (@var{save_level})
1254 If defined, an expression of type @code{enum machine_mode} that
1255 specifies the mode of the save area operand of a
1256 @code{save_stack_@var{level}} named pattern (@pxref{Standard Names}).
1257 @var{save_level} is one of @code{SAVE_BLOCK}, @code{SAVE_FUNCTION}, or
1258 @code{SAVE_NONLOCAL} and selects which of the three named patterns is
1259 having its mode specified.
1260
1261 You need not define this macro if it always returns @code{Pmode}.  You
1262 would most commonly define this macro if the
1263 @code{save_stack_@var{level}} patterns need to support both a 32- and a
1264 64-bit mode.
1265
1266 @findex STACK_SIZE_MODE
1267 @item STACK_SIZE_MODE
1268 If defined, an expression of type @code{enum machine_mode} that
1269 specifies the mode of the size increment operand of an
1270 @code{allocate_stack} named pattern (@pxref{Standard Names}).
1271
1272 You need not define this macro if it always returns @code{word_mode}.
1273 You would most commonly define this macro if the @code{allocate_stack}
1274 pattern needs to support both a 32- and a 64-bit mode.
1275
1276 @findex CHECK_FLOAT_VALUE
1277 @item CHECK_FLOAT_VALUE (@var{mode}, @var{value}, @var{overflow})
1278 A C statement to validate the value @var{value} (of type
1279 @code{double}) for mode @var{mode}.  This means that you check whether
1280 @var{value} fits within the possible range of values for mode
1281 @var{mode} on this target machine.  The mode @var{mode} is always
1282 a mode of class @code{MODE_FLOAT}.  @var{overflow} is nonzero if
1283 the value is already known to be out of range.
1284
1285 If @var{value} is not valid or if @var{overflow} is nonzero, you should
1286 set @var{overflow} to 1 and then assign some valid value to @var{value}.
1287 Allowing an invalid value to go through the compiler can produce
1288 incorrect assembler code which may even cause Unix assemblers to crash.
1289
1290 This macro need not be defined if there is no work for it to do.
1291
1292 @findex TARGET_FLOAT_FORMAT
1293 @item TARGET_FLOAT_FORMAT
1294 A code distinguishing the floating point format of the target machine.
1295 There are three defined values:
1296
1297 @table @code
1298 @findex IEEE_FLOAT_FORMAT
1299 @item IEEE_FLOAT_FORMAT
1300 This code indicates IEEE floating point.  It is the default; there is no
1301 need to define this macro when the format is IEEE@.
1302
1303 @findex VAX_FLOAT_FORMAT
1304 @item VAX_FLOAT_FORMAT
1305 This code indicates the peculiar format used on the Vax.
1306
1307 @findex UNKNOWN_FLOAT_FORMAT
1308 @item UNKNOWN_FLOAT_FORMAT
1309 This code indicates any other format.
1310 @end table
1311
1312 The value of this macro is compared with @code{HOST_FLOAT_FORMAT}
1313 (@pxref{Config}) to determine whether the target machine has the same
1314 format as the host machine.  If any other formats are actually in use on
1315 supported machines, new codes should be defined for them.
1316
1317 The ordering of the component words of floating point values stored in
1318 memory is controlled by @code{FLOAT_WORDS_BIG_ENDIAN} for the target
1319 machine and @code{HOST_FLOAT_WORDS_BIG_ENDIAN} for the host.
1320
1321 @findex DEFAULT_VTABLE_THUNKS
1322 @item DEFAULT_VTABLE_THUNKS
1323 GCC supports two ways of implementing C++ vtables:  traditional or with
1324 so-called ``thunks''.  The flag @option{-fvtable-thunk} chooses between them.
1325 Define this macro to be a C expression for the default value of that flag.
1326 If @code{DEFAULT_VTABLE_THUNKS} is 0, GCC uses the traditional
1327 implementation by default.  The ``thunk'' implementation is more efficient
1328 (especially if you have provided an implementation of
1329 @code{ASM_OUTPUT_MI_THUNK}, see @ref{Function Entry}), but is not binary
1330 compatible with code compiled using the traditional implementation.
1331 If you are writing a new port, define @code{DEFAULT_VTABLE_THUNKS} to 1.
1332
1333 If you do not define this macro, the default for @option{-fvtable-thunk} is 0.
1334 @end table
1335
1336 @node Type Layout
1337 @section Layout of Source Language Data Types
1338
1339 These macros define the sizes and other characteristics of the standard
1340 basic data types used in programs being compiled.  Unlike the macros in
1341 the previous section, these apply to specific features of C and related
1342 languages, rather than to fundamental aspects of storage layout.
1343
1344 @table @code
1345 @findex INT_TYPE_SIZE
1346 @item INT_TYPE_SIZE
1347 A C expression for the size in bits of the type @code{int} on the
1348 target machine.  If you don't define this, the default is one word.
1349
1350 @findex MAX_INT_TYPE_SIZE
1351 @item MAX_INT_TYPE_SIZE
1352 Maximum number for the size in bits of the type @code{int} on the target
1353 machine.  If this is undefined, the default is @code{INT_TYPE_SIZE}.
1354 Otherwise, it is the constant value that is the largest value that
1355 @code{INT_TYPE_SIZE} can have at run-time.  This is used in @code{cpp}.
1356
1357 @findex SHORT_TYPE_SIZE
1358 @item SHORT_TYPE_SIZE
1359 A C expression for the size in bits of the type @code{short} on the
1360 target machine.  If you don't define this, the default is half a word.
1361 (If this would be less than one storage unit, it is rounded up to one
1362 unit.)
1363
1364 @findex LONG_TYPE_SIZE
1365 @item LONG_TYPE_SIZE
1366 A C expression for the size in bits of the type @code{long} on the
1367 target machine.  If you don't define this, the default is one word.
1368
1369 @findex MAX_LONG_TYPE_SIZE
1370 @item MAX_LONG_TYPE_SIZE
1371 Maximum number for the size in bits of the type @code{long} on the
1372 target machine.  If this is undefined, the default is
1373 @code{LONG_TYPE_SIZE}.  Otherwise, it is the constant value that is the
1374 largest value that @code{LONG_TYPE_SIZE} can have at run-time.  This is
1375 used in @code{cpp}.
1376
1377 @findex LONG_LONG_TYPE_SIZE
1378 @item LONG_LONG_TYPE_SIZE
1379 A C expression for the size in bits of the type @code{long long} on the
1380 target machine.  If you don't define this, the default is two
1381 words.  If you want to support GNU Ada on your machine, the value of this
1382 macro must be at least 64.
1383
1384 @findex CHAR_TYPE_SIZE
1385 @item CHAR_TYPE_SIZE
1386 A C expression for the size in bits of the type @code{char} on the
1387 target machine.  If you don't define this, the default is
1388 @code{BITS_PER_UNIT}.
1389
1390 @findex MAX_CHAR_TYPE_SIZE
1391 @item MAX_CHAR_TYPE_SIZE
1392 Maximum number for the size in bits of the type @code{char} on the
1393 target machine.  If this is undefined, the default is
1394 @code{CHAR_TYPE_SIZE}.  Otherwise, it is the constant value that is the
1395 largest value that @code{CHAR_TYPE_SIZE} can have at run-time.  This is
1396 used in @code{cpp}.
1397
1398 @findex FLOAT_TYPE_SIZE
1399 @item FLOAT_TYPE_SIZE
1400 A C expression for the size in bits of the type @code{float} on the
1401 target machine.  If you don't define this, the default is one word.
1402
1403 @findex DOUBLE_TYPE_SIZE
1404 @item DOUBLE_TYPE_SIZE
1405 A C expression for the size in bits of the type @code{double} on the
1406 target machine.  If you don't define this, the default is two
1407 words.
1408
1409 @findex LONG_DOUBLE_TYPE_SIZE
1410 @item LONG_DOUBLE_TYPE_SIZE
1411 A C expression for the size in bits of the type @code{long double} on
1412 the target machine.  If you don't define this, the default is two
1413 words.
1414
1415 @findex MAX_LONG_DOUBLE_TYPE_SIZE
1416 Maximum number for the size in bits of the type @code{long double} on the
1417 target machine.  If this is undefined, the default is
1418 @code{LONG_DOUBLE_TYPE_SIZE}.  Otherwise, it is the constant value that is
1419 the largest value that @code{LONG_DOUBLE_TYPE_SIZE} can have at run-time.
1420 This is used in @code{cpp}.
1421
1422 @findex INTEL_EXTENDED_IEEE_FORMAT
1423 Define this macro to be 1 if the target machine uses 80-bit floating-point
1424 values with 128-bit size and alignment.  This is used in @file{real.c}.
1425
1426 @findex WIDEST_HARDWARE_FP_SIZE
1427 @item WIDEST_HARDWARE_FP_SIZE
1428 A C expression for the size in bits of the widest floating-point format
1429 supported by the hardware.  If you define this macro, you must specify a
1430 value less than or equal to the value of @code{LONG_DOUBLE_TYPE_SIZE}.
1431 If you do not define this macro, the value of @code{LONG_DOUBLE_TYPE_SIZE}
1432 is the default.
1433
1434 @findex DEFAULT_SIGNED_CHAR
1435 @item DEFAULT_SIGNED_CHAR
1436 An expression whose value is 1 or 0, according to whether the type
1437 @code{char} should be signed or unsigned by default.  The user can
1438 always override this default with the options @option{-fsigned-char}
1439 and @option{-funsigned-char}.
1440
1441 @findex DEFAULT_SHORT_ENUMS
1442 @item DEFAULT_SHORT_ENUMS
1443 A C expression to determine whether to give an @code{enum} type
1444 only as many bytes as it takes to represent the range of possible values
1445 of that type.  A nonzero value means to do that; a zero value means all
1446 @code{enum} types should be allocated like @code{int}.
1447
1448 If you don't define the macro, the default is 0.
1449
1450 @findex SIZE_TYPE
1451 @item SIZE_TYPE
1452 A C expression for a string describing the name of the data type to use
1453 for size values.  The typedef name @code{size_t} is defined using the
1454 contents of the string.
1455
1456 The string can contain more than one keyword.  If so, separate them with
1457 spaces, and write first any length keyword, then @code{unsigned} if
1458 appropriate, and finally @code{int}.  The string must exactly match one
1459 of the data type names defined in the function
1460 @code{init_decl_processing} in the file @file{c-decl.c}.  You may not
1461 omit @code{int} or change the order---that would cause the compiler to
1462 crash on startup.
1463
1464 If you don't define this macro, the default is @code{"long unsigned
1465 int"}.
1466
1467 @findex PTRDIFF_TYPE
1468 @item PTRDIFF_TYPE
1469 A C expression for a string describing the name of the data type to use
1470 for the result of subtracting two pointers.  The typedef name
1471 @code{ptrdiff_t} is defined using the contents of the string.  See
1472 @code{SIZE_TYPE} above for more information.
1473
1474 If you don't define this macro, the default is @code{"long int"}.
1475
1476 @findex WCHAR_TYPE
1477 @item WCHAR_TYPE
1478 A C expression for a string describing the name of the data type to use
1479 for wide characters.  The typedef name @code{wchar_t} is defined using
1480 the contents of the string.  See @code{SIZE_TYPE} above for more
1481 information.
1482
1483 If you don't define this macro, the default is @code{"int"}.
1484
1485 @findex WCHAR_TYPE_SIZE
1486 @item WCHAR_TYPE_SIZE
1487 A C expression for the size in bits of the data type for wide
1488 characters.  This is used in @code{cpp}, which cannot make use of
1489 @code{WCHAR_TYPE}.
1490
1491 @findex MAX_WCHAR_TYPE_SIZE
1492 @item MAX_WCHAR_TYPE_SIZE
1493 Maximum number for the size in bits of the data type for wide
1494 characters.  If this is undefined, the default is
1495 @code{WCHAR_TYPE_SIZE}.  Otherwise, it is the constant value that is the
1496 largest value that @code{WCHAR_TYPE_SIZE} can have at run-time.  This is
1497 used in @code{cpp}.
1498
1499 @findex GCOV_TYPE_SIZE
1500 @item GCOV_TYPE_SIZE
1501 A C expression for the size in bits of the type used for gcov counters on the
1502 target machine.  If you don't define this, the default is one
1503 @code{LONG_TYPE_SIZE} in case it is greater or equal to 64-bit and
1504 @code{LONG_LONG_TYPE_SIZE} otherwise.  You may want to re-define the type to
1505 ensure atomicity for counters in multithreaded programs.
1506
1507 @findex WINT_TYPE
1508 @item WINT_TYPE
1509 A C expression for a string describing the name of the data type to
1510 use for wide characters passed to @code{printf} and returned from
1511 @code{getwc}.  The typedef name @code{wint_t} is defined using the
1512 contents of the string.  See @code{SIZE_TYPE} above for more
1513 information.
1514
1515 If you don't define this macro, the default is @code{"unsigned int"}.
1516
1517 @findex INTMAX_TYPE
1518 @item INTMAX_TYPE
1519 A C expression for a string describing the name of the data type that
1520 can represent any value of any standard or extended signed integer type.
1521 The typedef name @code{intmax_t} is defined using the contents of the
1522 string.  See @code{SIZE_TYPE} above for more information.
1523
1524 If you don't define this macro, the default is the first of
1525 @code{"int"}, @code{"long int"}, or @code{"long long int"} that has as
1526 much precision as @code{long long int}.
1527
1528 @findex UINTMAX_TYPE
1529 @item UINTMAX_TYPE
1530 A C expression for a string describing the name of the data type that
1531 can represent any value of any standard or extended unsigned integer
1532 type.  The typedef name @code{uintmax_t} is defined using the contents
1533 of the string.  See @code{SIZE_TYPE} above for more information.
1534
1535 If you don't define this macro, the default is the first of
1536 @code{"unsigned int"}, @code{"long unsigned int"}, or @code{"long long
1537 unsigned int"} that has as much precision as @code{long long unsigned
1538 int}.
1539
1540 @findex OBJC_SELECTORS_WITHOUT_LABELS
1541 @item OBJC_SELECTORS_WITHOUT_LABELS
1542 Define this macro if the compiler can group all the selectors together
1543 into a vector and use just one label at the beginning of the vector.
1544 Otherwise, the compiler must give each selector its own assembler
1545 label.
1546
1547 On certain machines, it is important to have a separate label for each
1548 selector because this enables the linker to eliminate duplicate selectors.
1549
1550 @findex TARGET_PTRMEMFUNC_VBIT_LOCATION
1551 @item TARGET_PTRMEMFUNC_VBIT_LOCATION
1552 The C++ compiler represents a pointer-to-member-function with a struct
1553 that looks like:
1554
1555 @example
1556   struct @{
1557     union @{
1558       void (*fn)();
1559       ptrdiff_t vtable_index;
1560     @};
1561     ptrdiff_t delta;
1562   @};
1563 @end example
1564
1565 @noindent
1566 The C++ compiler must use one bit to indicate whether the function that
1567 will be called through a pointer-to-member-function is virtual.
1568 Normally, we assume that the low-order bit of a function pointer must
1569 always be zero.  Then, by ensuring that the vtable_index is odd, we can
1570 distinguish which variant of the union is in use.  But, on some
1571 platforms function pointers can be odd, and so this doesn't work.  In
1572 that case, we use the low-order bit of the @code{delta} field, and shift
1573 the remainder of the @code{delta} field to the left.
1574
1575 GCC will automatically make the right selection about where to store
1576 this bit using the @code{FUNCTION_BOUNDARY} setting for your platform.
1577 However, some platforms such as ARM/Thumb have @code{FUNCTION_BOUNDARY}
1578 set such that functions always start at even addresses, but the lowest
1579 bit of pointers to functions indicate whether the function at that
1580 address is in ARM or Thumb mode.  If this is the case of your
1581 architecture, you should define this macro to
1582 @code{ptrmemfunc_vbit_in_delta}.
1583
1584 In general, you should not have to define this macro.  On architectures
1585 in which function addresses are always even, according to
1586 @code{FUNCTION_BOUNDARY}, GCC will automatically define this macro to
1587 @code{ptrmemfunc_vbit_in_pfn}.
1588 @end table
1589
1590 @node Escape Sequences
1591 @section Target Character Escape Sequences
1592 @cindex escape sequences
1593
1594 By default, GCC assumes that the C character escape sequences take on
1595 their ASCII values for the target.  If this is not correct, you must
1596 explicitly define all of the macros below.
1597
1598 @table @code
1599 @findex TARGET_BELL
1600 @item TARGET_BELL
1601 A C constant expression for the integer value for escape sequence
1602 @samp{\a}.
1603
1604 @findex TARGET_ESC
1605 @item TARGET_ESC
1606 A C constant expression for the integer value of the target escape
1607 character.  As an extension, GCC evaluates the escape sequences
1608 @samp{\e} and @samp{\E} to this.
1609
1610 @findex TARGET_TAB
1611 @findex TARGET_BS
1612 @findex TARGET_NEWLINE
1613 @item TARGET_BS
1614 @itemx TARGET_TAB
1615 @itemx TARGET_NEWLINE
1616 C constant expressions for the integer values for escape sequences
1617 @samp{\b}, @samp{\t} and @samp{\n}.
1618
1619 @findex TARGET_VT
1620 @findex TARGET_FF
1621 @findex TARGET_CR
1622 @item TARGET_VT
1623 @itemx TARGET_FF
1624 @itemx TARGET_CR
1625 C constant expressions for the integer values for escape sequences
1626 @samp{\v}, @samp{\f} and @samp{\r}.
1627 @end table
1628
1629 @node Registers
1630 @section Register Usage
1631 @cindex register usage
1632
1633 This section explains how to describe what registers the target machine
1634 has, and how (in general) they can be used.
1635
1636 The description of which registers a specific instruction can use is
1637 done with register classes; see @ref{Register Classes}.  For information
1638 on using registers to access a stack frame, see @ref{Frame Registers}.
1639 For passing values in registers, see @ref{Register Arguments}.
1640 For returning values in registers, see @ref{Scalar Return}.
1641
1642 @menu
1643 * Register Basics::             Number and kinds of registers.
1644 * Allocation Order::            Order in which registers are allocated.
1645 * Values in Registers::         What kinds of values each reg can hold.
1646 * Leaf Functions::              Renumbering registers for leaf functions.
1647 * Stack Registers::             Handling a register stack such as 80387.
1648 @end menu
1649
1650 @node Register Basics
1651 @subsection Basic Characteristics of Registers
1652
1653 @c prevent bad page break with this line
1654 Registers have various characteristics.
1655
1656 @table @code
1657 @findex FIRST_PSEUDO_REGISTER
1658 @item FIRST_PSEUDO_REGISTER
1659 Number of hardware registers known to the compiler.  They receive
1660 numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first
1661 pseudo register's number really is assigned the number
1662 @code{FIRST_PSEUDO_REGISTER}.
1663
1664 @item FIXED_REGISTERS
1665 @findex FIXED_REGISTERS
1666 @cindex fixed register
1667 An initializer that says which registers are used for fixed purposes
1668 all throughout the compiled code and are therefore not available for
1669 general allocation.  These would include the stack pointer, the frame
1670 pointer (except on machines where that can be used as a general
1671 register when no frame pointer is needed), the program counter on
1672 machines where that is considered one of the addressable registers,
1673 and any other numbered register with a standard use.
1674
1675 This information is expressed as a sequence of numbers, separated by
1676 commas and surrounded by braces.  The @var{n}th number is 1 if
1677 register @var{n} is fixed, 0 otherwise.
1678
1679 The table initialized from this macro, and the table initialized by
1680 the following one, may be overridden at run time either automatically,
1681 by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by
1682 the user with the command options @option{-ffixed-@var{reg}},
1683 @option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}.
1684
1685 @findex CALL_USED_REGISTERS
1686 @item CALL_USED_REGISTERS
1687 @cindex call-used register
1688 @cindex call-clobbered register
1689 @cindex call-saved register
1690 Like @code{FIXED_REGISTERS} but has 1 for each register that is
1691 clobbered (in general) by function calls as well as for fixed
1692 registers.  This macro therefore identifies the registers that are not
1693 available for general allocation of values that must live across
1694 function calls.
1695
1696 If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler
1697 automatically saves it on function entry and restores it on function
1698 exit, if the register is used within the function.
1699
1700 @findex HARD_REGNO_CALL_PART_CLOBBERED
1701 @item HARD_REGNO_CALL_PART_CLOBBERED (@var{regno}, @var{mode})
1702 @cindex call-used register
1703 @cindex call-clobbered register
1704 @cindex call-saved register
1705 A C expression that is non-zero if it is not permissible to store a
1706 value of mode @var{mode} in hard register number @var{regno} across a
1707 call without some part of it being clobbered.  For most machines this
1708 macro need not be defined.  It is only required for machines that do not
1709 preserve the entire contents of a register across a call.
1710
1711 @findex CONDITIONAL_REGISTER_USAGE
1712 @findex fixed_regs
1713 @findex call_used_regs
1714 @item CONDITIONAL_REGISTER_USAGE
1715 Zero or more C statements that may conditionally modify five variables
1716 @code{fixed_regs}, @code{call_used_regs}, @code{global_regs},
1717 (these three are of type @code{char []}), @code{reg_names} (of type
1718 @code{const char * []}) and @code{reg_class_contents} (of type
1719 @code{HARD_REG_SET}).
1720 Before the macro is called @code{fixed_regs}, @code{call_used_regs}
1721 @code{reg_class_contents} and @code{reg_names} have been initialized
1722 from @code{FIXED_REGISTERS}, @code{CALL_USED_REGISTERS},
1723 @code{REG_CLASS_CONTENTS} and @code{REGISTER_NAMES}, respectively,
1724 @code{global_regs} has been cleared, and any @option{-ffixed-@var{reg}},
1725 @option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}} command
1726 options have been applied.
1727
1728 This is necessary in case the fixed or call-clobbered registers depend
1729 on target flags.
1730
1731 You need not define this macro if it has no work to do.
1732
1733 @cindex disabling certain registers
1734 @cindex controlling register usage
1735 If the usage of an entire class of registers depends on the target
1736 flags, you may indicate this to GCC by using this macro to modify
1737 @code{fixed_regs} and @code{call_used_regs} to 1 for each of the
1738 registers in the classes which should not be used by GCC@.  Also define
1739 the macro @code{REG_CLASS_FROM_LETTER} to return @code{NO_REGS} if it
1740 is called with a letter for a class that shouldn't be used.
1741
1742 (However, if this class is not included in @code{GENERAL_REGS} and all
1743 of the insn patterns whose constraints permit this class are
1744 controlled by target switches, then GCC will automatically avoid using
1745 these registers when the target switches are opposed to them.)
1746
1747 @findex NON_SAVING_SETJMP
1748 @item NON_SAVING_SETJMP
1749 If this macro is defined and has a nonzero value, it means that
1750 @code{setjmp} and related functions fail to save the registers, or that
1751 @code{longjmp} fails to restore them.  To compensate, the compiler
1752 avoids putting variables in registers in functions that use
1753 @code{setjmp}.
1754
1755 @findex INCOMING_REGNO
1756 @item INCOMING_REGNO (@var{out})
1757 Define this macro if the target machine has register windows.  This C
1758 expression returns the register number as seen by the called function
1759 corresponding to the register number @var{out} as seen by the calling
1760 function.  Return @var{out} if register number @var{out} is not an
1761 outbound register.
1762
1763 @findex OUTGOING_REGNO
1764 @item OUTGOING_REGNO (@var{in})
1765 Define this macro if the target machine has register windows.  This C
1766 expression returns the register number as seen by the calling function
1767 corresponding to the register number @var{in} as seen by the called
1768 function.  Return @var{in} if register number @var{in} is not an inbound
1769 register.
1770
1771 @findex LOCAL_REGNO
1772 @item LOCAL_REGNO (@var{regno})
1773 Define this macro if the target machine has register windows.  This C
1774 expression returns true if the register is call-saved but is in the
1775 register window.  Unlike most call-saved registers, such registers
1776 need not be explicitly restored on function exit or during non-local
1777 gotos.
1778
1779 @ignore
1780 @findex PC_REGNUM
1781 @item PC_REGNUM
1782 If the program counter has a register number, define this as that
1783 register number.  Otherwise, do not define it.
1784 @end ignore
1785 @end table
1786
1787 @node Allocation Order
1788 @subsection Order of Allocation of Registers
1789 @cindex order of register allocation
1790 @cindex register allocation order
1791
1792 @c prevent bad page break with this line
1793 Registers are allocated in order.
1794
1795 @table @code
1796 @findex REG_ALLOC_ORDER
1797 @item REG_ALLOC_ORDER
1798 If defined, an initializer for a vector of integers, containing the
1799 numbers of hard registers in the order in which GCC should prefer
1800 to use them (from most preferred to least).
1801
1802 If this macro is not defined, registers are used lowest numbered first
1803 (all else being equal).
1804
1805 One use of this macro is on machines where the highest numbered
1806 registers must always be saved and the save-multiple-registers
1807 instruction supports only sequences of consecutive registers.  On such
1808 machines, define @code{REG_ALLOC_ORDER} to be an initializer that lists
1809 the highest numbered allocable register first.
1810
1811 @findex ORDER_REGS_FOR_LOCAL_ALLOC
1812 @item ORDER_REGS_FOR_LOCAL_ALLOC
1813 A C statement (sans semicolon) to choose the order in which to allocate
1814 hard registers for pseudo-registers local to a basic block.
1815
1816 Store the desired register order in the array @code{reg_alloc_order}.
1817 Element 0 should be the register to allocate first; element 1, the next
1818 register; and so on.
1819
1820 The macro body should not assume anything about the contents of
1821 @code{reg_alloc_order} before execution of the macro.
1822
1823 On most machines, it is not necessary to define this macro.
1824 @end table
1825
1826 @node Values in Registers
1827 @subsection How Values Fit in Registers
1828
1829 This section discusses the macros that describe which kinds of values
1830 (specifically, which machine modes) each register can hold, and how many
1831 consecutive registers are needed for a given mode.
1832
1833 @table @code
1834 @findex HARD_REGNO_NREGS
1835 @item HARD_REGNO_NREGS (@var{regno}, @var{mode})
1836 A C expression for the number of consecutive hard registers, starting
1837 at register number @var{regno}, required to hold a value of mode
1838 @var{mode}.
1839
1840 On a machine where all registers are exactly one word, a suitable
1841 definition of this macro is
1842
1843 @smallexample
1844 #define HARD_REGNO_NREGS(REGNO, MODE)            \
1845    ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1)  \
1846     / UNITS_PER_WORD)
1847 @end smallexample
1848
1849 @findex HARD_REGNO_MODE_OK
1850 @item HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
1851 A C expression that is nonzero if it is permissible to store a value
1852 of mode @var{mode} in hard register number @var{regno} (or in several
1853 registers starting with that one).  For a machine where all registers
1854 are equivalent, a suitable definition is
1855
1856 @smallexample
1857 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
1858 @end smallexample
1859
1860 You need not include code to check for the numbers of fixed registers,
1861 because the allocation mechanism considers them to be always occupied.
1862
1863 @cindex register pairs
1864 On some machines, double-precision values must be kept in even/odd
1865 register pairs.  You can implement that by defining this macro to reject
1866 odd register numbers for such modes.
1867
1868 The minimum requirement for a mode to be OK in a register is that the
1869 @samp{mov@var{mode}} instruction pattern support moves between the
1870 register and other hard register in the same class and that moving a
1871 value into the register and back out not alter it.
1872
1873 Since the same instruction used to move @code{word_mode} will work for
1874 all narrower integer modes, it is not necessary on any machine for
1875 @code{HARD_REGNO_MODE_OK} to distinguish between these modes, provided
1876 you define patterns @samp{movhi}, etc., to take advantage of this.  This
1877 is useful because of the interaction between @code{HARD_REGNO_MODE_OK}
1878 and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes
1879 to be tieable.
1880
1881 Many machines have special registers for floating point arithmetic.
1882 Often people assume that floating point machine modes are allowed only
1883 in floating point registers.  This is not true.  Any registers that
1884 can hold integers can safely @emph{hold} a floating point machine
1885 mode, whether or not floating arithmetic can be done on it in those
1886 registers.  Integer move instructions can be used to move the values.
1887
1888 On some machines, though, the converse is true: fixed-point machine
1889 modes may not go in floating registers.  This is true if the floating
1890 registers normalize any value stored in them, because storing a
1891 non-floating value there would garble it.  In this case,
1892 @code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
1893 floating registers.  But if the floating registers do not automatically
1894 normalize, if you can store any bit pattern in one and retrieve it
1895 unchanged without a trap, then any machine mode may go in a floating
1896 register, so you can define this macro to say so.
1897
1898 The primary significance of special floating registers is rather that
1899 they are the registers acceptable in floating point arithmetic
1900 instructions.  However, this is of no concern to
1901 @code{HARD_REGNO_MODE_OK}.  You handle it by writing the proper
1902 constraints for those instructions.
1903
1904 On some machines, the floating registers are especially slow to access,
1905 so that it is better to store a value in a stack frame than in such a
1906 register if floating point arithmetic is not being done.  As long as the
1907 floating registers are not in class @code{GENERAL_REGS}, they will not
1908 be used unless some pattern's constraint asks for one.
1909
1910 @findex MODES_TIEABLE_P
1911 @item MODES_TIEABLE_P (@var{mode1}, @var{mode2})
1912 A C expression that is nonzero if a value of mode
1913 @var{mode1} is accessible in mode @var{mode2} without copying.
1914
1915 If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
1916 @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same for
1917 any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})}
1918 should be nonzero.  If they differ for any @var{r}, you should define
1919 this macro to return zero unless some other mechanism ensures the
1920 accessibility of the value in a narrower mode.
1921
1922 You should define this macro to return nonzero in as many cases as
1923 possible since doing so will allow GCC to perform better register
1924 allocation.
1925
1926 @findex AVOID_CCMODE_COPIES
1927 @item AVOID_CCMODE_COPIES
1928 Define this macro if the compiler should avoid copies to/from @code{CCmode}
1929 registers.  You should only define this macro if support for copying to/from
1930 @code{CCmode} is incomplete.
1931
1932 @findex SUBREG_REGNO_OFFSET
1933 @item SUBREG_REGNO_OFFSET
1934 Define this macro if the compiler needs to handle subregs in a non-standard
1935 way.  The macro returns the correct regno offset for mode @code{YMODE} given
1936 a subreg of type @code{XMODE}.
1937 This macro takes 4 parameters:
1938 @table @code
1939 @item XREGNO
1940 A regno of an inner hard subreg_reg (or what will become one).
1941 @item XMODE
1942 The mode of xregno.
1943 @item OFFSET
1944 The byte offset.
1945 @item YMODE
1946 The mode of a top level SUBREG (or what may become one).
1947 @end table
1948 The default function can be found in @file{rtlanal.c}, function
1949 @code{subreg_regno_offset}.  Normally this does not need to be defined.
1950 @end table
1951
1952 @node Leaf Functions
1953 @subsection Handling Leaf Functions
1954
1955 @cindex leaf functions
1956 @cindex functions, leaf
1957 On some machines, a leaf function (i.e., one which makes no calls) can run
1958 more efficiently if it does not make its own register window.  Often this
1959 means it is required to receive its arguments in the registers where they
1960 are passed by the caller, instead of the registers where they would
1961 normally arrive.
1962
1963 The special treatment for leaf functions generally applies only when
1964 other conditions are met; for example, often they may use only those
1965 registers for its own variables and temporaries.  We use the term ``leaf
1966 function'' to mean a function that is suitable for this special
1967 handling, so that functions with no calls are not necessarily ``leaf
1968 functions''.
1969
1970 GCC assigns register numbers before it knows whether the function is
1971 suitable for leaf function treatment.  So it needs to renumber the
1972 registers in order to output a leaf function.  The following macros
1973 accomplish this.
1974
1975 @table @code
1976 @findex LEAF_REGISTERS
1977 @item LEAF_REGISTERS
1978 Name of a char vector, indexed by hard register number, which
1979 contains 1 for a register that is allowable in a candidate for leaf
1980 function treatment.
1981
1982 If leaf function treatment involves renumbering the registers, then the
1983 registers marked here should be the ones before renumbering---those that
1984 GCC would ordinarily allocate.  The registers which will actually be
1985 used in the assembler code, after renumbering, should not be marked with 1
1986 in this vector.
1987
1988 Define this macro only if the target machine offers a way to optimize
1989 the treatment of leaf functions.
1990
1991 @findex LEAF_REG_REMAP
1992 @item LEAF_REG_REMAP (@var{regno})
1993 A C expression whose value is the register number to which @var{regno}
1994 should be renumbered, when a function is treated as a leaf function.
1995
1996 If @var{regno} is a register number which should not appear in a leaf
1997 function before renumbering, then the expression should yield @minus{}1, which
1998 will cause the compiler to abort.
1999
2000 Define this macro only if the target machine offers a way to optimize the
2001 treatment of leaf functions, and registers need to be renumbered to do
2002 this.
2003 @end table
2004
2005 @findex current_function_is_leaf
2006 @findex current_function_uses_only_leaf_regs
2007 Normally, @code{TARGET_ASM_FUNCTION_PROLOGUE} and
2008 @code{TARGET_ASM_FUNCTION_EPILOGUE} must treat leaf functions specially.
2009 They can test the C variable @code{current_function_is_leaf} which is
2010 nonzero for leaf functions.  @code{current_function_is_leaf} is set
2011 prior to local register allocation and is valid for the remaining
2012 compiler passes.  They can also test the C variable
2013 @code{current_function_uses_only_leaf_regs} which is nonzero for leaf
2014 functions which only use leaf registers.
2015 @code{current_function_uses_only_leaf_regs} is valid after reload and is
2016 only useful if @code{LEAF_REGISTERS} is defined.
2017 @c changed this to fix overfull.  ALSO:  why the "it" at the beginning
2018 @c of the next paragraph?!  --mew 2feb93
2019
2020 @node Stack Registers
2021 @subsection Registers That Form a Stack
2022
2023 There are special features to handle computers where some of the
2024 ``registers'' form a stack, as in the 80387 coprocessor for the 80386.
2025 Stack registers are normally written by pushing onto the stack, and are
2026 numbered relative to the top of the stack.
2027
2028 Currently, GCC can only handle one group of stack-like registers, and
2029 they must be consecutively numbered.
2030
2031 @table @code
2032 @findex STACK_REGS
2033 @item STACK_REGS
2034 Define this if the machine has any stack-like registers.
2035
2036 @findex FIRST_STACK_REG
2037 @item FIRST_STACK_REG
2038 The number of the first stack-like register.  This one is the top
2039 of the stack.
2040
2041 @findex LAST_STACK_REG
2042 @item LAST_STACK_REG
2043 The number of the last stack-like register.  This one is the bottom of
2044 the stack.
2045 @end table
2046
2047 @node Register Classes
2048 @section Register Classes
2049 @cindex register class definitions
2050 @cindex class definitions, register
2051
2052 On many machines, the numbered registers are not all equivalent.
2053 For example, certain registers may not be allowed for indexed addressing;
2054 certain registers may not be allowed in some instructions.  These machine
2055 restrictions are described to the compiler using @dfn{register classes}.
2056
2057 You define a number of register classes, giving each one a name and saying
2058 which of the registers belong to it.  Then you can specify register classes
2059 that are allowed as operands to particular instruction patterns.
2060
2061 @findex ALL_REGS
2062 @findex NO_REGS
2063 In general, each register will belong to several classes.  In fact, one
2064 class must be named @code{ALL_REGS} and contain all the registers.  Another
2065 class must be named @code{NO_REGS} and contain no registers.  Often the
2066 union of two classes will be another class; however, this is not required.
2067
2068 @findex GENERAL_REGS
2069 One of the classes must be named @code{GENERAL_REGS}.  There is nothing
2070 terribly special about the name, but the operand constraint letters
2071 @samp{r} and @samp{g} specify this class.  If @code{GENERAL_REGS} is
2072 the same as @code{ALL_REGS}, just define it as a macro which expands
2073 to @code{ALL_REGS}.
2074
2075 Order the classes so that if class @var{x} is contained in class @var{y}
2076 then @var{x} has a lower class number than @var{y}.
2077
2078 The way classes other than @code{GENERAL_REGS} are specified in operand
2079 constraints is through machine-dependent operand constraint letters.
2080 You can define such letters to correspond to various classes, then use
2081 them in operand constraints.
2082
2083 You should define a class for the union of two classes whenever some
2084 instruction allows both classes.  For example, if an instruction allows
2085 either a floating point (coprocessor) register or a general register for a
2086 certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS}
2087 which includes both of them.  Otherwise you will get suboptimal code.
2088
2089 You must also specify certain redundant information about the register
2090 classes: for each class, which classes contain it and which ones are
2091 contained in it; for each pair of classes, the largest class contained
2092 in their union.
2093
2094 When a value occupying several consecutive registers is expected in a
2095 certain class, all the registers used must belong to that class.
2096 Therefore, register classes cannot be used to enforce a requirement for
2097 a register pair to start with an even-numbered register.  The way to
2098 specify this requirement is with @code{HARD_REGNO_MODE_OK}.
2099
2100 Register classes used for input-operands of bitwise-and or shift
2101 instructions have a special requirement: each such class must have, for
2102 each fixed-point machine mode, a subclass whose registers can transfer that
2103 mode to or from memory.  For example, on some machines, the operations for
2104 single-byte values (@code{QImode}) are limited to certain registers.  When
2105 this is so, each register class that is used in a bitwise-and or shift
2106 instruction must have a subclass consisting of registers from which
2107 single-byte values can be loaded or stored.  This is so that
2108 @code{PREFERRED_RELOAD_CLASS} can always have a possible value to return.
2109
2110 @table @code
2111 @findex enum reg_class
2112 @item enum reg_class
2113 An enumeral type that must be defined with all the register class names
2114 as enumeral values.  @code{NO_REGS} must be first.  @code{ALL_REGS}
2115 must be the last register class, followed by one more enumeral value,
2116 @code{LIM_REG_CLASSES}, which is not a register class but rather
2117 tells how many classes there are.
2118
2119 Each register class has a number, which is the value of casting
2120 the class name to type @code{int}.  The number serves as an index
2121 in many of the tables described below.
2122
2123 @findex N_REG_CLASSES
2124 @item N_REG_CLASSES
2125 The number of distinct register classes, defined as follows:
2126
2127 @example
2128 #define N_REG_CLASSES (int) LIM_REG_CLASSES
2129 @end example
2130
2131 @findex REG_CLASS_NAMES
2132 @item REG_CLASS_NAMES
2133 An initializer containing the names of the register classes as C string
2134 constants.  These names are used in writing some of the debugging dumps.
2135
2136 @findex REG_CLASS_CONTENTS
2137 @item REG_CLASS_CONTENTS
2138 An initializer containing the contents of the register classes, as integers
2139 which are bit masks.  The @var{n}th integer specifies the contents of class
2140 @var{n}.  The way the integer @var{mask} is interpreted is that
2141 register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1.
2142
2143 When the machine has more than 32 registers, an integer does not suffice.
2144 Then the integers are replaced by sub-initializers, braced groupings containing
2145 several integers.  Each sub-initializer must be suitable as an initializer
2146 for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}.
2147 In this situation, the first integer in each sub-initializer corresponds to
2148 registers 0 through 31, the second integer to registers 32 through 63, and
2149 so on.
2150
2151 @findex REGNO_REG_CLASS
2152 @item REGNO_REG_CLASS (@var{regno})
2153 A C expression whose value is a register class containing hard register
2154 @var{regno}.  In general there is more than one such class; choose a class
2155 which is @dfn{minimal}, meaning that no smaller class also contains the
2156 register.
2157
2158 @findex BASE_REG_CLASS
2159 @item BASE_REG_CLASS
2160 A macro whose definition is the name of the class to which a valid
2161 base register must belong.  A base register is one used in an address
2162 which is the register value plus a displacement.
2163
2164 @findex INDEX_REG_CLASS
2165 @item INDEX_REG_CLASS
2166 A macro whose definition is the name of the class to which a valid
2167 index register must belong.  An index register is one used in an
2168 address where its value is either multiplied by a scale factor or
2169 added to another register (as well as added to a displacement).
2170
2171 @findex REG_CLASS_FROM_LETTER
2172 @item REG_CLASS_FROM_LETTER (@var{char})
2173 A C expression which defines the machine-dependent operand constraint
2174 letters for register classes.  If @var{char} is such a letter, the
2175 value should be the register class corresponding to it.  Otherwise,
2176 the value should be @code{NO_REGS}.  The register letter @samp{r},
2177 corresponding to class @code{GENERAL_REGS}, will not be passed
2178 to this macro; you do not need to handle it.
2179
2180 @findex REGNO_OK_FOR_BASE_P
2181 @item REGNO_OK_FOR_BASE_P (@var{num})
2182 A C expression which is nonzero if register number @var{num} is
2183 suitable for use as a base register in operand addresses.  It may be
2184 either a suitable hard register or a pseudo register that has been
2185 allocated such a hard register.
2186
2187 @findex REGNO_MODE_OK_FOR_BASE_P
2188 @item REGNO_MODE_OK_FOR_BASE_P (@var{num}, @var{mode})
2189 A C expression that is just like @code{REGNO_OK_FOR_BASE_P}, except that
2190 that expression may examine the mode of the memory reference in
2191 @var{mode}.  You should define this macro if the mode of the memory
2192 reference affects whether a register may be used as a base register.  If
2193 you define this macro, the compiler will use it instead of
2194 @code{REGNO_OK_FOR_BASE_P}.
2195
2196 @findex REGNO_OK_FOR_INDEX_P
2197 @item REGNO_OK_FOR_INDEX_P (@var{num})
2198 A C expression which is nonzero if register number @var{num} is
2199 suitable for use as an index register in operand addresses.  It may be
2200 either a suitable hard register or a pseudo register that has been
2201 allocated such a hard register.
2202
2203 The difference between an index register and a base register is that
2204 the index register may be scaled.  If an address involves the sum of
2205 two registers, neither one of them scaled, then either one may be
2206 labeled the ``base'' and the other the ``index''; but whichever
2207 labeling is used must fit the machine's constraints of which registers
2208 may serve in each capacity.  The compiler will try both labelings,
2209 looking for one that is valid, and will reload one or both registers
2210 only if neither labeling works.
2211
2212 @findex PREFERRED_RELOAD_CLASS
2213 @item PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
2214 A C expression that places additional restrictions on the register class
2215 to use when it is necessary to copy value @var{x} into a register in class
2216 @var{class}.  The value is a register class; perhaps @var{class}, or perhaps
2217 another, smaller class.  On many machines, the following definition is
2218 safe:
2219
2220 @example
2221 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
2222 @end example
2223
2224 Sometimes returning a more restrictive class makes better code.  For
2225 example, on the 68000, when @var{x} is an integer constant that is in range
2226 for a @samp{moveq} instruction, the value of this macro is always
2227 @code{DATA_REGS} as long as @var{class} includes the data registers.
2228 Requiring a data register guarantees that a @samp{moveq} will be used.
2229
2230 If @var{x} is a @code{const_double}, by returning @code{NO_REGS}
2231 you can force @var{x} into a memory constant.  This is useful on
2232 certain machines where immediate floating values cannot be loaded into
2233 certain kinds of registers.
2234
2235 @findex PREFERRED_OUTPUT_RELOAD_CLASS
2236 @item PREFERRED_OUTPUT_RELOAD_CLASS (@var{x}, @var{class})
2237 Like @code{PREFERRED_RELOAD_CLASS}, but for output reloads instead of
2238 input reloads.  If you don't define this macro, the default is to use
2239 @var{class}, unchanged.
2240
2241 @findex LIMIT_RELOAD_CLASS
2242 @item LIMIT_RELOAD_CLASS (@var{mode}, @var{class})
2243 A C expression that places additional restrictions on the register class
2244 to use when it is necessary to be able to hold a value of mode
2245 @var{mode} in a reload register for which class @var{class} would
2246 ordinarily be used.
2247
2248 Unlike @code{PREFERRED_RELOAD_CLASS}, this macro should be used when
2249 there are certain modes that simply can't go in certain reload classes.
2250
2251 The value is a register class; perhaps @var{class}, or perhaps another,
2252 smaller class.
2253
2254 Don't define this macro unless the target machine has limitations which
2255 require the macro to do something nontrivial.
2256
2257 @findex SECONDARY_RELOAD_CLASS
2258 @findex SECONDARY_INPUT_RELOAD_CLASS
2259 @findex SECONDARY_OUTPUT_RELOAD_CLASS
2260 @item SECONDARY_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
2261 @itemx SECONDARY_INPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
2262 @itemx SECONDARY_OUTPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
2263 Many machines have some registers that cannot be copied directly to or
2264 from memory or even from other types of registers.  An example is the
2265 @samp{MQ} register, which on most machines, can only be copied to or
2266 from general registers, but not memory.  Some machines allow copying all
2267 registers to and from memory, but require a scratch register for stores
2268 to some memory locations (e.g., those with symbolic address on the RT,
2269 and those with certain symbolic address on the Sparc when compiling
2270 PIC)@.  In some cases, both an intermediate and a scratch register are
2271 required.
2272
2273 You should define these macros to indicate to the reload phase that it may
2274 need to allocate at least one register for a reload in addition to the
2275 register to contain the data.  Specifically, if copying @var{x} to a
2276 register @var{class} in @var{mode} requires an intermediate register,
2277 you should define @code{SECONDARY_INPUT_RELOAD_CLASS} to return the
2278 largest register class all of whose registers can be used as
2279 intermediate registers or scratch registers.
2280
2281 If copying a register @var{class} in @var{mode} to @var{x} requires an
2282 intermediate or scratch register, @code{SECONDARY_OUTPUT_RELOAD_CLASS}
2283 should be defined to return the largest register class required.  If the
2284 requirements for input and output reloads are the same, the macro
2285 @code{SECONDARY_RELOAD_CLASS} should be used instead of defining both
2286 macros identically.
2287
2288 The values returned by these macros are often @code{GENERAL_REGS}.
2289 Return @code{NO_REGS} if no spare register is needed; i.e., if @var{x}
2290 can be directly copied to or from a register of @var{class} in
2291 @var{mode} without requiring a scratch register.  Do not define this
2292 macro if it would always return @code{NO_REGS}.
2293
2294 If a scratch register is required (either with or without an
2295 intermediate register), you should define patterns for
2296 @samp{reload_in@var{m}} or @samp{reload_out@var{m}}, as required
2297 (@pxref{Standard Names}.  These patterns, which will normally be
2298 implemented with a @code{define_expand}, should be similar to the
2299 @samp{mov@var{m}} patterns, except that operand 2 is the scratch
2300 register.
2301
2302 Define constraints for the reload register and scratch register that
2303 contain a single register class.  If the original reload register (whose
2304 class is @var{class}) can meet the constraint given in the pattern, the
2305 value returned by these macros is used for the class of the scratch
2306 register.  Otherwise, two additional reload registers are required.
2307 Their classes are obtained from the constraints in the insn pattern.
2308
2309 @var{x} might be a pseudo-register or a @code{subreg} of a
2310 pseudo-register, which could either be in a hard register or in memory.
2311 Use @code{true_regnum} to find out; it will return @minus{}1 if the pseudo is
2312 in memory and the hard register number if it is in a register.
2313
2314 These macros should not be used in the case where a particular class of
2315 registers can only be copied to memory and not to another class of
2316 registers.  In that case, secondary reload registers are not needed and
2317 would not be helpful.  Instead, a stack location must be used to perform
2318 the copy and the @code{mov@var{m}} pattern should use memory as a
2319 intermediate storage.  This case often occurs between floating-point and
2320 general registers.
2321
2322 @findex SECONDARY_MEMORY_NEEDED
2323 @item SECONDARY_MEMORY_NEEDED (@var{class1}, @var{class2}, @var{m})
2324 Certain machines have the property that some registers cannot be copied
2325 to some other registers without using memory.  Define this macro on
2326 those machines to be a C expression that is non-zero if objects of mode
2327 @var{m} in registers of @var{class1} can only be copied to registers of
2328 class @var{class2} by storing a register of @var{class1} into memory
2329 and loading that memory location into a register of @var{class2}.
2330
2331 Do not define this macro if its value would always be zero.
2332
2333 @findex SECONDARY_MEMORY_NEEDED_RTX
2334 @item SECONDARY_MEMORY_NEEDED_RTX (@var{mode})
2335 Normally when @code{SECONDARY_MEMORY_NEEDED} is defined, the compiler
2336 allocates a stack slot for a memory location needed for register copies.
2337 If this macro is defined, the compiler instead uses the memory location
2338 defined by this macro.
2339
2340 Do not define this macro if you do not define
2341 @code{SECONDARY_MEMORY_NEEDED}.
2342
2343 @findex SECONDARY_MEMORY_NEEDED_MODE
2344 @item SECONDARY_MEMORY_NEEDED_MODE (@var{mode})
2345 When the compiler needs a secondary memory location to copy between two
2346 registers of mode @var{mode}, it normally allocates sufficient memory to
2347 hold a quantity of @code{BITS_PER_WORD} bits and performs the store and
2348 load operations in a mode that many bits wide and whose class is the
2349 same as that of @var{mode}.
2350
2351 This is right thing to do on most machines because it ensures that all
2352 bits of the register are copied and prevents accesses to the registers
2353 in a narrower mode, which some machines prohibit for floating-point
2354 registers.
2355
2356 However, this default behavior is not correct on some machines, such as
2357 the DEC Alpha, that store short integers in floating-point registers
2358 differently than in integer registers.  On those machines, the default
2359 widening will not work correctly and you must define this macro to
2360 suppress that widening in some cases.  See the file @file{alpha.h} for
2361 details.
2362
2363 Do not define this macro if you do not define
2364 @code{SECONDARY_MEMORY_NEEDED} or if widening @var{mode} to a mode that
2365 is @code{BITS_PER_WORD} bits wide is correct for your machine.
2366
2367 @findex SMALL_REGISTER_CLASSES
2368 @item SMALL_REGISTER_CLASSES
2369 On some machines, it is risky to let hard registers live across arbitrary
2370 insns.  Typically, these machines have instructions that require values
2371 to be in specific registers (like an accumulator), and reload will fail
2372 if the required hard register is used for another purpose across such an
2373 insn.
2374
2375 Define @code{SMALL_REGISTER_CLASSES} to be an expression with a non-zero
2376 value on these machines.  When this macro has a non-zero value, the
2377 compiler will try to minimize the lifetime of hard registers.
2378
2379 It is always safe to define this macro with a non-zero value, but if you
2380 unnecessarily define it, you will reduce the amount of optimizations
2381 that can be performed in some cases.  If you do not define this macro
2382 with a non-zero value when it is required, the compiler will run out of
2383 spill registers and print a fatal error message.  For most machines, you
2384 should not define this macro at all.
2385
2386 @findex CLASS_LIKELY_SPILLED_P
2387 @item CLASS_LIKELY_SPILLED_P (@var{class})
2388 A C expression whose value is nonzero if pseudos that have been assigned
2389 to registers of class @var{class} would likely be spilled because
2390 registers of @var{class} are needed for spill registers.
2391
2392 The default value of this macro returns 1 if @var{class} has exactly one
2393 register and zero otherwise.  On most machines, this default should be
2394 used.  Only define this macro to some other expression if pseudos
2395 allocated by @file{local-alloc.c} end up in memory because their hard
2396 registers were needed for spill registers.  If this macro returns nonzero
2397 for those classes, those pseudos will only be allocated by
2398 @file{global.c}, which knows how to reallocate the pseudo to another
2399 register.  If there would not be another register available for
2400 reallocation, you should not change the definition of this macro since
2401 the only effect of such a definition would be to slow down register
2402 allocation.
2403
2404 @findex CLASS_MAX_NREGS
2405 @item CLASS_MAX_NREGS (@var{class}, @var{mode})
2406 A C expression for the maximum number of consecutive registers
2407 of class @var{class} needed to hold a value of mode @var{mode}.
2408
2409 This is closely related to the macro @code{HARD_REGNO_NREGS}.  In fact,
2410 the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})}
2411 should be the maximum value of @code{HARD_REGNO_NREGS (@var{regno},
2412 @var{mode})} for all @var{regno} values in the class @var{class}.
2413
2414 This macro helps control the handling of multiple-word values
2415 in the reload pass.
2416
2417 @item CLASS_CANNOT_CHANGE_MODE
2418 If defined, a C expression for a class that contains registers for
2419 which the compiler may not change modes arbitrarily.
2420
2421 @item CLASS_CANNOT_CHANGE_MODE_P(@var{from}, @var{to})
2422 A C expression that is true if, for a register in
2423 @code{CLASS_CANNOT_CHANGE_MODE}, the requested mode punning is illegal.
2424
2425 For the example, loading 32-bit integer or floating-point objects into
2426 floating-point registers on the Alpha extends them to 64-bits.
2427 Therefore loading a 64-bit object and then storing it as a 32-bit object
2428 does not store the low-order 32-bits, as would be the case for a normal
2429 register.  Therefore, @file{alpha.h} defines @code{CLASS_CANNOT_CHANGE_MODE}
2430 as @code{FLOAT_REGS} and @code{CLASS_CANNOT_CHANGE_MODE_P} restricts
2431 mode changes to same-size modes.
2432
2433 Compare this to IA-64, which extends floating-point values to 82-bits,
2434 and stores 64-bit integers in a different format than 64-bit doubles.
2435 Therefore @code{CLASS_CANNOT_CHANGE_MODE_P} is always true.
2436 @end table
2437
2438 Three other special macros describe which operands fit which constraint
2439 letters.
2440
2441 @table @code
2442 @findex CONST_OK_FOR_LETTER_P
2443 @item CONST_OK_FOR_LETTER_P (@var{value}, @var{c})
2444 A C expression that defines the machine-dependent operand constraint
2445 letters (@samp{I}, @samp{J}, @samp{K}, @dots{} @samp{P}) that specify
2446 particular ranges of integer values.  If @var{c} is one of those
2447 letters, the expression should check that @var{value}, an integer, is in
2448 the appropriate range and return 1 if so, 0 otherwise.  If @var{c} is
2449 not one of those letters, the value should be 0 regardless of
2450 @var{value}.
2451
2452 @findex CONST_DOUBLE_OK_FOR_LETTER_P
2453 @item CONST_DOUBLE_OK_FOR_LETTER_P (@var{value}, @var{c})
2454 A C expression that defines the machine-dependent operand constraint
2455 letters that specify particular ranges of @code{const_double} values
2456 (@samp{G} or @samp{H}).
2457
2458 If @var{c} is one of those letters, the expression should check that
2459 @var{value}, an RTX of code @code{const_double}, is in the appropriate
2460 range and return 1 if so, 0 otherwise.  If @var{c} is not one of those
2461 letters, the value should be 0 regardless of @var{value}.
2462
2463 @code{const_double} is used for all floating-point constants and for
2464 @code{DImode} fixed-point constants.  A given letter can accept either
2465 or both kinds of values.  It can use @code{GET_MODE} to distinguish
2466 between these kinds.
2467
2468 @findex EXTRA_CONSTRAINT
2469 @item EXTRA_CONSTRAINT (@var{value}, @var{c})
2470 A C expression that defines the optional machine-dependent constraint
2471 letters that can be used to segregate specific types of operands, usually
2472 memory references, for the target machine.  Any letter that is not
2473 elsewhere defined and not matched by @code{REG_CLASS_FROM_LETTER}
2474 may be used.  Normally this macro will not be defined.
2475
2476 If it is required for a particular target machine, it should return 1
2477 if @var{value} corresponds to the operand type represented by the
2478 constraint letter @var{c}.  If @var{c} is not defined as an extra
2479 constraint, the value returned should be 0 regardless of @var{value}.
2480
2481 For example, on the ROMP, load instructions cannot have their output
2482 in r0 if the memory reference contains a symbolic address.  Constraint
2483 letter @samp{Q} is defined as representing a memory address that does
2484 @emph{not} contain a symbolic address.  An alternative is specified with
2485 a @samp{Q} constraint on the input and @samp{r} on the output.  The next
2486 alternative specifies @samp{m} on the input and a register class that
2487 does not include r0 on the output.
2488 @end table
2489
2490 @node Stack and Calling
2491 @section Stack Layout and Calling Conventions
2492 @cindex calling conventions
2493
2494 @c prevent bad page break with this line
2495 This describes the stack layout and calling conventions.
2496
2497 @menu
2498 * Frame Layout::
2499 * Exception Handling::
2500 * Stack Checking::
2501 * Frame Registers::
2502 * Elimination::
2503 * Stack Arguments::
2504 * Register Arguments::
2505 * Scalar Return::
2506 * Aggregate Return::
2507 * Caller Saves::
2508 * Function Entry::
2509 * Profiling::
2510 * Inlining::
2511 * Tail Calling::
2512 @end menu
2513
2514 @node Frame Layout
2515 @subsection Basic Stack Layout
2516 @cindex stack frame layout
2517 @cindex frame layout
2518
2519 @c prevent bad page break with this line
2520 Here is the basic stack layout.
2521
2522 @table @code
2523 @findex STACK_GROWS_DOWNWARD
2524 @item STACK_GROWS_DOWNWARD
2525 Define this macro if pushing a word onto the stack moves the stack
2526 pointer to a smaller address.
2527
2528 When we say, ``define this macro if @dots{},'' it means that the
2529 compiler checks this macro only with @code{#ifdef} so the precise
2530 definition used does not matter.
2531
2532 @findex STACK_PUSH_CODE
2533 @item STACK_PUSH_CODE
2534
2535 This macro defines the operation used when something is pushed
2536 on the stack.  In RTL, a push operation will be
2537 @code{(set (mem (STACK_PUSH_CODE (reg sp))) ...)}
2538
2539 The choices are @code{PRE_DEC}, @code{POST_DEC}, @code{PRE_INC},
2540 and @code{POST_INC}.  Which of these is correct depends on
2541 the stack direction and on whether the stack pointer points
2542 to the last item on the stack or whether it points to the
2543 space for the next item on the stack.
2544
2545 The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} is
2546 defined, which is almost always right, and @code{PRE_INC} otherwise,
2547 which is often wrong.
2548
2549 @findex FRAME_GROWS_DOWNWARD
2550 @item FRAME_GROWS_DOWNWARD
2551 Define this macro if the addresses of local variable slots are at negative
2552 offsets from the frame pointer.
2553
2554 @findex ARGS_GROW_DOWNWARD
2555 @item ARGS_GROW_DOWNWARD
2556 Define this macro if successive arguments to a function occupy decreasing
2557 addresses on the stack.
2558
2559 @findex STARTING_FRAME_OFFSET
2560 @item STARTING_FRAME_OFFSET
2561 Offset from the frame pointer to the first local variable slot to be allocated.
2562
2563 If @code{FRAME_GROWS_DOWNWARD}, find the next slot's offset by
2564 subtracting the first slot's length from @code{STARTING_FRAME_OFFSET}.
2565 Otherwise, it is found by adding the length of the first slot to the
2566 value @code{STARTING_FRAME_OFFSET}.
2567 @c i'm not sure if the above is still correct.. had to change it to get
2568 @c rid of an overfull.  --mew 2feb93
2569
2570 @findex STACK_POINTER_OFFSET
2571 @item STACK_POINTER_OFFSET
2572 Offset from the stack pointer register to the first location at which
2573 outgoing arguments are placed.  If not specified, the default value of
2574 zero is used.  This is the proper value for most machines.
2575
2576 If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
2577 the first location at which outgoing arguments are placed.
2578
2579 @findex FIRST_PARM_OFFSET
2580 @item FIRST_PARM_OFFSET (@var{fundecl})
2581 Offset from the argument pointer register to the first argument's
2582 address.  On some machines it may depend on the data type of the
2583 function.
2584
2585 If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
2586 the first argument's address.
2587
2588 @findex STACK_DYNAMIC_OFFSET
2589 @item STACK_DYNAMIC_OFFSET (@var{fundecl})
2590 Offset from the stack pointer register to an item dynamically allocated
2591 on the stack, e.g., by @code{alloca}.
2592
2593 The default value for this macro is @code{STACK_POINTER_OFFSET} plus the
2594 length of the outgoing arguments.  The default is correct for most
2595 machines.  See @file{function.c} for details.
2596
2597 @findex DYNAMIC_CHAIN_ADDRESS
2598 @item DYNAMIC_CHAIN_ADDRESS (@var{frameaddr})
2599 A C expression whose value is RTL representing the address in a stack
2600 frame where the pointer to the caller's frame is stored.  Assume that
2601 @var{frameaddr} is an RTL expression for the address of the stack frame
2602 itself.
2603
2604 If you don't define this macro, the default is to return the value
2605 of @var{frameaddr}---that is, the stack frame address is also the
2606 address of the stack word that points to the previous frame.
2607
2608 @findex SETUP_FRAME_ADDRESSES
2609 @item SETUP_FRAME_ADDRESSES
2610 If defined, a C expression that produces the machine-specific code to
2611 setup the stack so that arbitrary frames can be accessed.  For example,
2612 on the Sparc, we must flush all of the register windows to the stack
2613 before we can access arbitrary stack frames.  You will seldom need to
2614 define this macro.
2615
2616 @findex BUILTIN_SETJMP_FRAME_VALUE
2617 @item BUILTIN_SETJMP_FRAME_VALUE
2618 If defined, a C expression that contains an rtx that is used to store
2619 the address of the current frame into the built in @code{setjmp} buffer.
2620 The default value, @code{virtual_stack_vars_rtx}, is correct for most
2621 machines.  One reason you may need to define this macro is if
2622 @code{hard_frame_pointer_rtx} is the appropriate value on your machine.
2623
2624 @findex RETURN_ADDR_RTX
2625 @item RETURN_ADDR_RTX (@var{count}, @var{frameaddr})
2626 A C expression whose value is RTL representing the value of the return
2627 address for the frame @var{count} steps up from the current frame, after
2628 the prologue.  @var{frameaddr} is the frame pointer of the @var{count}
2629 frame, or the frame pointer of the @var{count} @minus{} 1 frame if
2630 @code{RETURN_ADDR_IN_PREVIOUS_FRAME} is defined.
2631
2632 The value of the expression must always be the correct address when
2633 @var{count} is zero, but may be @code{NULL_RTX} if there is not way to
2634 determine the return address of other frames.
2635
2636 @findex RETURN_ADDR_IN_PREVIOUS_FRAME
2637 @item RETURN_ADDR_IN_PREVIOUS_FRAME
2638 Define this if the return address of a particular stack frame is accessed
2639 from the frame pointer of the previous stack frame.
2640
2641 @findex INCOMING_RETURN_ADDR_RTX
2642 @item INCOMING_RETURN_ADDR_RTX
2643 A C expression whose value is RTL representing the location of the
2644 incoming return address at the beginning of any function, before the
2645 prologue.  This RTL is either a @code{REG}, indicating that the return
2646 value is saved in @samp{REG}, or a @code{MEM} representing a location in
2647 the stack.
2648
2649 You only need to define this macro if you want to support call frame
2650 debugging information like that provided by DWARF 2.
2651
2652 If this RTL is a @code{REG}, you should also define
2653 @code{DWARF_FRAME_RETURN_COLUMN} to @code{DWARF_FRAME_REGNUM (REGNO)}.
2654
2655 @findex INCOMING_FRAME_SP_OFFSET
2656 @item INCOMING_FRAME_SP_OFFSET
2657 A C expression whose value is an integer giving the offset, in bytes,
2658 from the value of the stack pointer register to the top of the stack
2659 frame at the beginning of any function, before the prologue.  The top of
2660 the frame is defined to be the value of the stack pointer in the
2661 previous frame, just before the call instruction.
2662
2663 You only need to define this macro if you want to support call frame
2664 debugging information like that provided by DWARF 2.
2665
2666 @findex ARG_POINTER_CFA_OFFSET
2667 @item ARG_POINTER_CFA_OFFSET (@var{fundecl})
2668 A C expression whose value is an integer giving the offset, in bytes,
2669 from the argument pointer to the canonical frame address (cfa).  The
2670 final value should coincide with that calculated by
2671 @code{INCOMING_FRAME_SP_OFFSET}.  Which is unfortunately not usable
2672 during virtual register instantiation.
2673
2674 The default value for this macro is @code{FIRST_PARM_OFFSET (fundecl)},
2675 which is correct for most machines; in general, the arguments are found
2676 immediately before the stack frame.  Note that this is not the case on
2677 some targets that save registers into the caller's frame, such as SPARC
2678 and rs6000, and so such targets need to define this macro.
2679
2680 You only need to define this macro if the default is incorrect, and you
2681 want to support call frame debugging information like that provided by
2682 DWARF 2.
2683
2684 @findex SMALL_STACK
2685 @item SMALL_STACK
2686 Define this macro if the stack size for the target is very small.  This
2687 has the effect of disabling gcc's built-in @samp{alloca}, though
2688 @samp{__builtin_alloca} is not affected.
2689 @end table
2690
2691 @node Exception Handling
2692 @subsection Exception Handling Support
2693 @cindex exception handling
2694
2695 @table @code
2696 @findex EH_RETURN_DATA_REGNO
2697 @item EH_RETURN_DATA_REGNO (@var{N})
2698 A C expression whose value is the @var{N}th register number used for
2699 data by exception handlers, or @code{INVALID_REGNUM} if fewer than
2700 @var{N} registers are usable.
2701
2702 The exception handling library routines communicate with the exception
2703 handlers via a set of agreed upon registers.  Ideally these registers
2704 should be call-clobbered; it is possible to use call-saved registers,
2705 but may negatively impact code size.  The target must support at least
2706 2 data registers, but should define 4 if there are enough free registers.
2707
2708 You must define this macro if you want to support call frame exception
2709 handling like that provided by DWARF 2.
2710
2711 @findex EH_RETURN_STACKADJ_RTX
2712 @item EH_RETURN_STACKADJ_RTX
2713 A C expression whose value is RTL representing a location in which
2714 to store a stack adjustment to be applied before function return.
2715 This is used to unwind the stack to an exception handler's call frame.
2716 It will be assigned zero on code paths that return normally.
2717
2718 Typically this is a call-clobbered hard register that is otherwise
2719 untouched by the epilogue, but could also be a stack slot.
2720
2721 You must define this macro if you want to support call frame exception
2722 handling like that provided by DWARF 2.
2723
2724 @findex EH_RETURN_HANDLER_RTX
2725 @item EH_RETURN_HANDLER_RTX
2726 A C expression whose value is RTL representing a location in which
2727 to store the address of an exception handler to which we should
2728 return.  It will not be assigned on code paths that return normally.
2729
2730 Typically this is the location in the call frame at which the normal
2731 return address is stored.  For targets that return by popping an
2732 address off the stack, this might be a memory address just below
2733 the @emph{target} call frame rather than inside the current call
2734 frame.  @code{EH_RETURN_STACKADJ_RTX} will have already been assigned,
2735 so it may be used to calculate the location of the target call frame.
2736
2737 Some targets have more complex requirements than storing to an
2738 address calculable during initial code generation.  In that case
2739 the @code{eh_return} instruction pattern should be used instead.
2740
2741 If you want to support call frame exception handling, you must
2742 define either this macro or the @code{eh_return} instruction pattern.
2743
2744 @findex ASM_PREFERRED_EH_DATA_FORMAT
2745 @item ASM_PREFERRED_EH_DATA_FORMAT(@var{code}, @var{global})
2746 This macro chooses the encoding of pointers embedded in the exception
2747 handling sections.  If at all possible, this should be defined such
2748 that the exception handling section will not require dynamic relocations,
2749 and so may be read-only.
2750
2751 @var{code} is 0 for data, 1 for code labels, 2 for function pointers.
2752 @var{global} is true if the symbol may be affected by dynamic relocations.
2753 The macro should return a combination of the @code{DW_EH_PE_*} defines
2754 as found in @file{dwarf2.h}.
2755
2756 If this macro is not defined, pointers will not be encoded but
2757 represented directly.
2758
2759 @findex ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX
2760 @item ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX(@var{file}, @var{encoding}, @var{size}, @var{addr}, @var{done})
2761 This macro allows the target to emit whatever special magic is required
2762 to represent the encoding chosen by @code{ASM_PREFERRED_EH_DATA_FORMAT}.
2763 Generic code takes care of pc-relative and indirect encodings; this must
2764 be defined if the target uses text-relative or data-relative encodings.
2765
2766 This is a C statement that branches to @var{done} if the format was
2767 handled.  @var{encoding} is the format chosen, @var{size} is the number
2768 of bytes that the format occupies, @var{addr} is the @code{SYMBOL_REF}
2769 to be emitted.
2770
2771 @findex MD_FALLBACK_FRAME_STATE_FOR
2772 @item MD_FALLBACK_FRAME_STATE_FOR(@var{context}, @var{fs}, @var{success})
2773 This macro allows the target to add cpu and operating system specific
2774 code to the call-frame unwinder for use when there is no unwind data
2775 available.  The most common reason to implement this macro is to unwind
2776 through signal frames.
2777
2778 This macro is called from @code{uw_frame_state_for} in @file{unwind-dw2.c}
2779 and @file{unwind-ia64.c}.  @var{context} is an @code{_Unwind_Context};
2780 @var{fs} is an @code{_Unwind_FrameState}.  Examine @code{context->ra}
2781 for the address of the code being executed and @code{context->cfa} for
2782 the stack pointer value.  If the frame can be decoded, the register save
2783 addresses should be updated in @var{fs} and the macro should branch to
2784 @var{success}.  If the frame cannot be decoded, the macro should do 
2785 nothing.
2786 @end table
2787
2788 @node Stack Checking
2789 @subsection Specifying How Stack Checking is Done
2790
2791 GCC will check that stack references are within the boundaries of
2792 the stack, if the @option{-fstack-check} is specified, in one of three ways:
2793
2794 @enumerate
2795 @item
2796 If the value of the @code{STACK_CHECK_BUILTIN} macro is nonzero, GCC
2797 will assume that you have arranged for stack checking to be done at
2798 appropriate places in the configuration files, e.g., in
2799 @code{TARGET_ASM_FUNCTION_PROLOGUE}.  GCC will do not other special
2800 processing.
2801
2802 @item
2803 If @code{STACK_CHECK_BUILTIN} is zero and you defined a named pattern
2804 called @code{check_stack} in your @file{md} file, GCC will call that
2805 pattern with one argument which is the address to compare the stack
2806 value against.  You must arrange for this pattern to report an error if
2807 the stack pointer is out of range.
2808
2809 @item
2810 If neither of the above are true, GCC will generate code to periodically
2811 ``probe'' the stack pointer using the values of the macros defined below.
2812 @end enumerate
2813
2814 Normally, you will use the default values of these macros, so GCC
2815 will use the third approach.
2816
2817 @table @code
2818 @findex STACK_CHECK_BUILTIN
2819 @item STACK_CHECK_BUILTIN
2820 A nonzero value if stack checking is done by the configuration files in a
2821 machine-dependent manner.  You should define this macro if stack checking
2822 is require by the ABI of your machine or if you would like to have to stack
2823 checking in some more efficient way than GCC's portable approach.
2824 The default value of this macro is zero.
2825
2826 @findex STACK_CHECK_PROBE_INTERVAL
2827 @item STACK_CHECK_PROBE_INTERVAL
2828 An integer representing the interval at which GCC must generate stack
2829 probe instructions.  You will normally define this macro to be no larger
2830 than the size of the ``guard pages'' at the end of a stack area.  The
2831 default value of 4096 is suitable for most systems.
2832
2833 @findex STACK_CHECK_PROBE_LOAD
2834 @item STACK_CHECK_PROBE_LOAD
2835 A integer which is nonzero if GCC should perform the stack probe
2836 as a load instruction and zero if GCC should use a store instruction.
2837 The default is zero, which is the most efficient choice on most systems.
2838
2839 @findex STACK_CHECK_PROTECT
2840 @item STACK_CHECK_PROTECT
2841 The number of bytes of stack needed to recover from a stack overflow,
2842 for languages where such a recovery is supported.  The default value of
2843 75 words should be adequate for most machines.
2844
2845 @findex STACK_CHECK_MAX_FRAME_SIZE
2846 @item STACK_CHECK_MAX_FRAME_SIZE
2847 The maximum size of a stack frame, in bytes.  GCC will generate probe
2848 instructions in non-leaf functions to ensure at least this many bytes of
2849 stack are available.  If a stack frame is larger than this size, stack
2850 checking will not be reliable and GCC will issue a warning.  The
2851 default is chosen so that GCC only generates one instruction on most
2852 systems.  You should normally not change the default value of this macro.
2853
2854 @findex STACK_CHECK_FIXED_FRAME_SIZE
2855 @item STACK_CHECK_FIXED_FRAME_SIZE
2856 GCC uses this value to generate the above warning message.  It
2857 represents the amount of fixed frame used by a function, not including
2858 space for any callee-saved registers, temporaries and user variables.
2859 You need only specify an upper bound for this amount and will normally
2860 use the default of four words.
2861
2862 @findex STACK_CHECK_MAX_VAR_SIZE
2863 @item STACK_CHECK_MAX_VAR_SIZE
2864 The maximum size, in bytes, of an object that GCC will place in the
2865 fixed area of the stack frame when the user specifies
2866 @option{-fstack-check}.
2867 GCC computed the default from the values of the above macros and you will
2868 normally not need to override that default.
2869 @end table
2870
2871 @need 2000
2872 @node Frame Registers
2873 @subsection Registers That Address the Stack Frame
2874
2875 @c prevent bad page break with this line
2876 This discusses registers that address the stack frame.
2877
2878 @table @code
2879 @findex STACK_POINTER_REGNUM
2880 @item STACK_POINTER_REGNUM
2881 The register number of the stack pointer register, which must also be a
2882 fixed register according to @code{FIXED_REGISTERS}.  On most machines,
2883 the hardware determines which register this is.
2884
2885 @findex FRAME_POINTER_REGNUM
2886 @item FRAME_POINTER_REGNUM
2887 The register number of the frame pointer register, which is used to
2888 access automatic variables in the stack frame.  On some machines, the
2889 hardware determines which register this is.  On other machines, you can
2890 choose any register you wish for this purpose.
2891
2892 @findex HARD_FRAME_POINTER_REGNUM
2893 @item HARD_FRAME_POINTER_REGNUM
2894 On some machines the offset between the frame pointer and starting
2895 offset of the automatic variables is not known until after register
2896 allocation has been done (for example, because the saved registers are
2897 between these two locations).  On those machines, define
2898 @code{FRAME_POINTER_REGNUM} the number of a special, fixed register to
2899 be used internally until the offset is known, and define
2900 @code{HARD_FRAME_POINTER_REGNUM} to be the actual hard register number
2901 used for the frame pointer.
2902
2903 You should define this macro only in the very rare circumstances when it
2904 is not possible to calculate the offset between the frame pointer and
2905 the automatic variables until after register allocation has been
2906 completed.  When this macro is defined, you must also indicate in your
2907 definition of @code{ELIMINABLE_REGS} how to eliminate
2908 @code{FRAME_POINTER_REGNUM} into either @code{HARD_FRAME_POINTER_REGNUM}
2909 or @code{STACK_POINTER_REGNUM}.
2910
2911 Do not define this macro if it would be the same as
2912 @code{FRAME_POINTER_REGNUM}.
2913
2914 @findex ARG_POINTER_REGNUM
2915 @item ARG_POINTER_REGNUM
2916 The register number of the arg pointer register, which is used to access
2917 the function's argument list.  On some machines, this is the same as the
2918 frame pointer register.  On some machines, the hardware determines which
2919 register this is.  On other machines, you can choose any register you
2920 wish for this purpose.  If this is not the same register as the frame
2921 pointer register, then you must mark it as a fixed register according to
2922 @code{FIXED_REGISTERS}, or arrange to be able to eliminate it
2923 (@pxref{Elimination}).
2924
2925 @findex RETURN_ADDRESS_POINTER_REGNUM
2926 @item RETURN_ADDRESS_POINTER_REGNUM
2927 The register number of the return address pointer register, which is used to
2928 access the current function's return address from the stack.  On some
2929 machines, the return address is not at a fixed offset from the frame
2930 pointer or stack pointer or argument pointer.  This register can be defined
2931 to point to the return address on the stack, and then be converted by
2932 @code{ELIMINABLE_REGS} into either the frame pointer or stack pointer.
2933
2934 Do not define this macro unless there is no other way to get the return
2935 address from the stack.
2936
2937 @findex STATIC_CHAIN_REGNUM
2938 @findex STATIC_CHAIN_INCOMING_REGNUM
2939 @item STATIC_CHAIN_REGNUM
2940 @itemx STATIC_CHAIN_INCOMING_REGNUM
2941 Register numbers used for passing a function's static chain pointer.  If
2942 register windows are used, the register number as seen by the called
2943 function is @code{STATIC_CHAIN_INCOMING_REGNUM}, while the register
2944 number as seen by the calling function is @code{STATIC_CHAIN_REGNUM}.  If
2945 these registers are the same, @code{STATIC_CHAIN_INCOMING_REGNUM} need
2946 not be defined.
2947
2948 The static chain register need not be a fixed register.
2949
2950 If the static chain is passed in memory, these macros should not be
2951 defined; instead, the next two macros should be defined.
2952
2953 @findex STATIC_CHAIN
2954 @findex STATIC_CHAIN_INCOMING
2955 @item STATIC_CHAIN
2956 @itemx STATIC_CHAIN_INCOMING
2957 If the static chain is passed in memory, these macros provide rtx giving
2958 @code{mem} expressions that denote where they are stored.
2959 @code{STATIC_CHAIN} and @code{STATIC_CHAIN_INCOMING} give the locations
2960 as seen by the calling and called functions, respectively.  Often the former
2961 will be at an offset from the stack pointer and the latter at an offset from
2962 the frame pointer.
2963
2964 @findex stack_pointer_rtx
2965 @findex frame_pointer_rtx
2966 @findex arg_pointer_rtx
2967 The variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and
2968 @code{arg_pointer_rtx} will have been initialized prior to the use of these
2969 macros and should be used to refer to those items.
2970
2971 If the static chain is passed in a register, the two previous macros should
2972 be defined instead.
2973 @end table
2974
2975 @node Elimination
2976 @subsection Eliminating Frame Pointer and Arg Pointer
2977
2978 @c prevent bad page break with this line
2979 This is about eliminating the frame pointer and arg pointer.
2980
2981 @table @code
2982 @findex FRAME_POINTER_REQUIRED
2983 @item FRAME_POINTER_REQUIRED
2984 A C expression which is nonzero if a function must have and use a frame
2985 pointer.  This expression is evaluated  in the reload pass.  If its value is
2986 nonzero the function will have a frame pointer.
2987
2988 The expression can in principle examine the current function and decide
2989 according to the facts, but on most machines the constant 0 or the
2990 constant 1 suffices.  Use 0 when the machine allows code to be generated
2991 with no frame pointer, and doing so saves some time or space.  Use 1
2992 when there is no possible advantage to avoiding a frame pointer.
2993
2994 In certain cases, the compiler does not know how to produce valid code
2995 without a frame pointer.  The compiler recognizes those cases and
2996 automatically gives the function a frame pointer regardless of what
2997 @code{FRAME_POINTER_REQUIRED} says.  You don't need to worry about
2998 them.
2999
3000 In a function that does not require a frame pointer, the frame pointer
3001 register can be allocated for ordinary usage, unless you mark it as a
3002 fixed register.  See @code{FIXED_REGISTERS} for more information.
3003
3004 @findex INITIAL_FRAME_POINTER_OFFSET
3005 @findex get_frame_size
3006 @item INITIAL_FRAME_POINTER_OFFSET (@var{depth-var})
3007 A C statement to store in the variable @var{depth-var} the difference
3008 between the frame pointer and the stack pointer values immediately after
3009 the function prologue.  The value would be computed from information
3010 such as the result of @code{get_frame_size ()} and the tables of
3011 registers @code{regs_ever_live} and @code{call_used_regs}.
3012
3013 If @code{ELIMINABLE_REGS} is defined, this macro will be not be used and
3014 need not be defined.  Otherwise, it must be defined even if
3015 @code{FRAME_POINTER_REQUIRED} is defined to always be true; in that
3016 case, you may set @var{depth-var} to anything.
3017
3018 @findex ELIMINABLE_REGS
3019 @item ELIMINABLE_REGS
3020 If defined, this macro specifies a table of register pairs used to
3021 eliminate unneeded registers that point into the stack frame.  If it is not
3022 defined, the only elimination attempted by the compiler is to replace
3023 references to the frame pointer with references to the stack pointer.
3024
3025 The definition of this macro is a list of structure initializations, each
3026 of which specifies an original and replacement register.
3027
3028 On some machines, the position of the argument pointer is not known until
3029 the compilation is completed.  In such a case, a separate hard register
3030 must be used for the argument pointer.  This register can be eliminated by
3031 replacing it with either the frame pointer or the argument pointer,
3032 depending on whether or not the frame pointer has been eliminated.
3033
3034 In this case, you might specify:
3035 @example
3036 #define ELIMINABLE_REGS  \
3037 @{@{ARG_POINTER_REGNUM, STACK_POINTER_REGNUM@}, \
3038  @{ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM@}, \
3039  @{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM@}@}
3040 @end example
3041
3042 Note that the elimination of the argument pointer with the stack pointer is
3043 specified first since that is the preferred elimination.
3044
3045 @findex CAN_ELIMINATE
3046 @item CAN_ELIMINATE (@var{from-reg}, @var{to-reg})
3047 A C expression that returns non-zero if the compiler is allowed to try
3048 to replace register number @var{from-reg} with register number
3049 @var{to-reg}.  This macro need only be defined if @code{ELIMINABLE_REGS}
3050 is defined, and will usually be the constant 1, since most of the cases
3051 preventing register elimination are things that the compiler already
3052 knows about.
3053
3054 @findex INITIAL_ELIMINATION_OFFSET
3055 @item INITIAL_ELIMINATION_OFFSET (@var{from-reg}, @var{to-reg}, @var{offset-var})
3056 This macro is similar to @code{INITIAL_FRAME_POINTER_OFFSET}.  It
3057 specifies the initial difference between the specified pair of
3058 registers.  This macro must be defined if @code{ELIMINABLE_REGS} is
3059 defined.
3060
3061 @findex LONGJMP_RESTORE_FROM_STACK
3062 @item LONGJMP_RESTORE_FROM_STACK
3063 Define this macro if the @code{longjmp} function restores registers from
3064 the stack frames, rather than from those saved specifically by
3065 @code{setjmp}.  Certain quantities must not be kept in registers across
3066 a call to @code{setjmp} on such machines.
3067 @end table
3068
3069 @node Stack Arguments
3070 @subsection Passing Function Arguments on the Stack
3071 @cindex arguments on stack
3072 @cindex stack arguments
3073
3074 The macros in this section control how arguments are passed
3075 on the stack.  See the following section for other macros that
3076 control passing certain arguments in registers.
3077
3078 @table @code
3079 @findex PROMOTE_PROTOTYPES
3080 @item PROMOTE_PROTOTYPES
3081 A C expression whose value is nonzero if an argument declared in
3082 a prototype as an integral type smaller than @code{int} should
3083 actually be passed as an @code{int}.  In addition to avoiding
3084 errors in certain cases of mismatch, it also makes for better
3085 code on certain machines.  If the macro is not defined in target
3086 header files, it defaults to 0.
3087
3088 @findex PUSH_ARGS
3089 @item PUSH_ARGS
3090 A C expression.  If nonzero, push insns will be used to pass
3091 outgoing arguments.
3092 If the target machine does not have a push instruction, set it to zero.
3093 That directs GCC to use an alternate strategy: to
3094 allocate the entire argument block and then store the arguments into
3095 it.  When @code{PUSH_ARGS} is nonzero, @code{PUSH_ROUNDING} must be defined too.
3096 On some machines, the definition
3097
3098 @findex PUSH_ROUNDING
3099 @item PUSH_ROUNDING (@var{npushed})
3100 A C expression that is the number of bytes actually pushed onto the
3101 stack when an instruction attempts to push @var{npushed} bytes.
3102
3103 On some machines, the definition
3104
3105 @example
3106 #define PUSH_ROUNDING(BYTES) (BYTES)
3107 @end example
3108
3109 @noindent
3110 will suffice.  But on other machines, instructions that appear
3111 to push one byte actually push two bytes in an attempt to maintain
3112 alignment.  Then the definition should be
3113
3114 @example
3115 #define PUSH_ROUNDING(BYTES) (((BYTES) + 1) & ~1)
3116 @end example
3117
3118 @findex ACCUMULATE_OUTGOING_ARGS
3119 @findex current_function_outgoing_args_size
3120 @item ACCUMULATE_OUTGOING_ARGS
3121 A C expression.  If nonzero, the maximum amount of space required for outgoing arguments
3122 will be computed and placed into the variable
3123 @code{current_function_outgoing_args_size}.  No space will be pushed
3124 onto the stack for each call; instead, the function prologue should
3125 increase the stack frame size by this amount.
3126
3127 Setting both @code{PUSH_ARGS} and @code{ACCUMULATE_OUTGOING_ARGS}
3128 is not proper.
3129
3130 @findex REG_PARM_STACK_SPACE
3131 @item REG_PARM_STACK_SPACE (@var{fndecl})
3132 Define this macro if functions should assume that stack space has been
3133 allocated for arguments even when their values are passed in
3134 registers.
3135
3136 The value of this macro is the size, in bytes, of the area reserved for
3137 arguments passed in registers for the function represented by @var{fndecl},
3138 which can be zero if GCC is calling a library function.
3139
3140 This space can be allocated by the caller, or be a part of the
3141 machine-dependent stack frame: @code{OUTGOING_REG_PARM_STACK_SPACE} says
3142 which.
3143 @c above is overfull.  not sure what to do.  --mew 5feb93  did
3144 @c something, not sure if it looks good.  --mew 10feb93
3145
3146 @findex MAYBE_REG_PARM_STACK_SPACE
3147 @findex FINAL_REG_PARM_STACK_SPACE
3148 @item MAYBE_REG_PARM_STACK_SPACE
3149 @itemx FINAL_REG_PARM_STACK_SPACE (@var{const_size}, @var{var_size})
3150 Define these macros in addition to the one above if functions might
3151 allocate stack space for arguments even when their values are passed
3152 in registers.  These should be used when the stack space allocated
3153 for arguments in registers is not a simple constant independent of the
3154 function declaration.
3155
3156 The value of the first macro is the size, in bytes, of the area that
3157 we should initially assume would be reserved for arguments passed in registers.
3158
3159 The value of the second macro is the actual size, in bytes, of the area
3160 that will be reserved for arguments passed in registers.  This takes two
3161 arguments: an integer representing the number of bytes of fixed sized
3162 arguments on the stack, and a tree representing the number of bytes of
3163 variable sized arguments on the stack.
3164
3165 When these macros are defined, @code{REG_PARM_STACK_SPACE} will only be
3166 called for libcall functions, the current function, or for a function
3167 being called when it is known that such stack space must be allocated.
3168 In each case this value can be easily computed.
3169
3170 When deciding whether a called function needs such stack space, and how
3171 much space to reserve, GCC uses these two macros instead of
3172 @code{REG_PARM_STACK_SPACE}.
3173
3174 @findex OUTGOING_REG_PARM_STACK_SPACE
3175 @item OUTGOING_REG_PARM_STACK_SPACE
3176 Define this if it is the responsibility of the caller to allocate the area
3177 reserved for arguments passed in registers.
3178
3179 If @code{ACCUMULATE_OUTGOING_ARGS} is defined, this macro controls
3180 whether the space for these arguments counts in the value of
3181 @code{current_function_outgoing_args_size}.
3182
3183 @findex STACK_PARMS_IN_REG_PARM_AREA
3184 @item STACK_PARMS_IN_REG_PARM_AREA
3185 Define this macro if @code{REG_PARM_STACK_SPACE} is defined, but the
3186 stack parameters don't skip the area specified by it.
3187 @c i changed this, makes more sens and it should have taken care of the
3188 @c overfull.. not as specific, tho.  --mew 5feb93
3189
3190 Normally, when a parameter is not passed in registers, it is placed on the
3191 stack beyond the @code{REG_PARM_STACK_SPACE} area.  Defining this macro
3192 suppresses this behavior and causes the parameter to be passed on the
3193 stack in its natural location.
3194
3195 @findex RETURN_POPS_ARGS
3196 @item RETURN_POPS_ARGS (@var{fundecl}, @var{funtype}, @var{stack-size})
3197 A C expression that should indicate the number of bytes of its own
3198 arguments that a function pops on returning, or 0 if the
3199 function pops no arguments and the caller must therefore pop them all
3200 after the function returns.
3201
3202 @var{fundecl} is a C variable whose value is a tree node that describes
3203 the function in question.  Normally it is a node of type
3204 @code{FUNCTION_DECL} that describes the declaration of the function.
3205 From this you can obtain the @code{DECL_MACHINE_ATTRIBUTES} of the function.
3206
3207 @var{funtype} is a C variable whose value is a tree node that
3208 describes the function in question.  Normally it is a node of type
3209 @code{FUNCTION_TYPE} that describes the data type of the function.
3210 From this it is possible to obtain the data types of the value and
3211 arguments (if known).
3212
3213 When a call to a library function is being considered, @var{fundecl}
3214 will contain an identifier node for the library function.  Thus, if
3215 you need to distinguish among various library functions, you can do so
3216 by their names.  Note that ``library function'' in this context means
3217 a function used to perform arithmetic, whose name is known specially
3218 in the compiler and was not mentioned in the C code being compiled.
3219
3220 @var{stack-size} is the number of bytes of arguments passed on the
3221 stack.  If a variable number of bytes is passed, it is zero, and
3222 argument popping will always be the responsibility of the calling function.
3223
3224 On the Vax, all functions always pop their arguments, so the definition
3225 of this macro is @var{stack-size}.  On the 68000, using the standard
3226 calling convention, no functions pop their arguments, so the value of
3227 the macro is always 0 in this case.  But an alternative calling
3228 convention is available in which functions that take a fixed number of
3229 arguments pop them but other functions (such as @code{printf}) pop
3230 nothing (the caller pops all).  When this convention is in use,
3231 @var{funtype} is examined to determine whether a function takes a fixed
3232 number of arguments.
3233 @end table
3234
3235 @node Register Arguments
3236 @subsection Passing Arguments in Registers
3237 @cindex arguments in registers
3238 @cindex registers arguments
3239
3240 This section describes the macros which let you control how various
3241 types of arguments are passed in registers or how they are arranged in
3242 the stack.
3243
3244 @table @code
3245 @findex FUNCTION_ARG
3246 @item FUNCTION_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
3247 A C expression that controls whether a function argument is passed
3248 in a register, and which register.
3249
3250 The arguments are @var{cum}, which summarizes all the previous
3251 arguments; @var{mode}, the machine mode of the argument; @var{type},
3252 the data type of the argument as a tree node or 0 if that is not known
3253 (which happens for C support library functions); and @var{named},
3254 which is 1 for an ordinary argument and 0 for nameless arguments that
3255 correspond to @samp{@dots{}} in the called function's prototype.
3256 @var{type} can be an incomplete type if a syntax error has previously
3257 occurred.
3258
3259 The value of the expression is usually either a @code{reg} RTX for the
3260 hard register in which to pass the argument, or zero to pass the
3261 argument on the stack.
3262
3263 For machines like the Vax and 68000, where normally all arguments are
3264 pushed, zero suffices as a definition.
3265
3266 The value of the expression can also be a @code{parallel} RTX@.  This is
3267 used when an argument is passed in multiple locations.  The mode of the
3268 of the @code{parallel} should be the mode of the entire argument.  The
3269 @code{parallel} holds any number of @code{expr_list} pairs; each one
3270 describes where part of the argument is passed.  In each
3271 @code{expr_list} the first operand must be a @code{reg} RTX for the hard
3272 register in which to pass this part of the argument, and the mode of the
3273 register RTX indicates how large this part of the argument is.  The
3274 second operand of the @code{expr_list} is a @code{const_int} which gives
3275 the offset in bytes into the entire argument of where this part starts.
3276 As a special exception the first @code{expr_list} in the @code{parallel}
3277 RTX may have a first operand of zero.  This indicates that the entire
3278 argument is also stored on the stack.
3279
3280 The last time this macro is called, it is called with @code{MODE ==
3281 VOIDmode}, and its result is passed to the @code{call} or @code{call_value}
3282 pattern as operands 2 and 3 respectively.
3283
3284 @cindex @file{stdarg.h} and register arguments
3285 The usual way to make the ISO library @file{stdarg.h} work on a machine
3286 where some arguments are usually passed in registers, is to cause
3287 nameless arguments to be passed on the stack instead.  This is done
3288 by making @code{FUNCTION_ARG} return 0 whenever @var{named} is 0.
3289
3290 @cindex @code{MUST_PASS_IN_STACK}, and @code{FUNCTION_ARG}
3291 @cindex @code{REG_PARM_STACK_SPACE}, and @code{FUNCTION_ARG}
3292 You may use the macro @code{MUST_PASS_IN_STACK (@var{mode}, @var{type})}
3293 in the definition of this macro to determine if this argument is of a
3294 type that must be passed in the stack.  If @code{REG_PARM_STACK_SPACE}
3295 is not defined and @code{FUNCTION_ARG} returns non-zero for such an
3296 argument, the compiler will abort.  If @code{REG_PARM_STACK_SPACE} is
3297 defined, the argument will be computed in the stack and then loaded into
3298 a register.
3299
3300 @findex MUST_PASS_IN_STACK
3301 @item MUST_PASS_IN_STACK (@var{mode}, @var{type})
3302 Define as a C expression that evaluates to nonzero if we do not know how
3303 to pass TYPE solely in registers.  The file @file{expr.h} defines a
3304 definition that is usually appropriate, refer to @file{expr.h} for additional
3305 documentation.
3306
3307 @findex FUNCTION_INCOMING_ARG
3308 @item FUNCTION_INCOMING_ARG (@var{cum}, @var{mode}, @var{type}, @var{named})
3309 Define this macro if the target machine has ``register windows'', so
3310 that the register in which a function sees an arguments is not
3311 necessarily the same as the one in which the caller passed the
3312 argument.
3313
3314 For such machines, @code{FUNCTION_ARG} computes the register in which
3315 the caller passes the value, and @code{FUNCTION_INCOMING_ARG} should
3316 be defined in a similar fashion to tell the function being called
3317 where the arguments will arrive.
3318
3319 If @code{FUNCTION_INCOMING_ARG} is not defined, @code{FUNCTION_ARG}
3320 serves both purposes.
3321
3322 @findex FUNCTION_ARG_PARTIAL_NREGS
3323 @item FUNCTION_ARG_PARTIAL_NREGS (@var{cum}, @var{mode}, @var{type}, @var{named})
3324 A C expression for the number of words, at the beginning of an
3325 argument, that must be put in registers.  The value must be zero for
3326 arguments that are passed entirely in registers or that are entirely
3327 pushed on the stack.
3328
3329 On some machines, certain arguments must be passed partially in
3330 registers and partially in memory.  On these machines, typically the
3331 first @var{n} words of arguments are passed in registers, and the rest
3332 on the stack.  If a multi-word argument (a @code{double} or a
3333 structure) crosses that boundary, its first few words must be passed
3334 in registers and the rest must be pushed.  This macro tells the
3335 compiler when this occurs, and how many of the words should go in
3336 registers.
3337
3338 @code{FUNCTION_ARG} for these arguments should return the first
3339 register to be used by the caller for this argument; likewise
3340 @code{FUNCTION_INCOMING_ARG}, for the called function.
3341
3342 @findex FUNCTION_ARG_PASS_BY_REFERENCE
3343 @item FUNCTION_ARG_PASS_BY_REFERENCE (@var{cum}, @var{mode}, @var{type}, @var{named})
3344 A C expression that indicates when an argument must be passed by reference.
3345 If nonzero for an argument, a copy of that argument is made in memory and a
3346 pointer to the argument is passed instead of the argument itself.
3347 The pointer is passed in whatever way is appropriate for passing a pointer
3348 to that type.
3349
3350 On machines where @code{REG_PARM_STACK_SPACE} is not defined, a suitable
3351 definition of this macro might be
3352 @smallexample
3353 #define FUNCTION_ARG_PASS_BY_REFERENCE\
3354 (CUM, MODE, TYPE, NAMED)  \
3355   MUST_PASS_IN_STACK (MODE, TYPE)
3356 @end smallexample
3357 @c this is *still* too long.  --mew 5feb93
3358
3359 @findex FUNCTION_ARG_CALLEE_COPIES
3360 @item FUNCTION_ARG_CALLEE_COPIES (@var{cum}, @var{mode}, @var{type}, @var{named})
3361 If defined, a C expression that indicates when it is the called function's
3362 responsibility to make a copy of arguments passed by invisible reference.
3363 Normally, the caller makes a copy and passes the address of the copy to the
3364 routine being called.  When @code{FUNCTION_ARG_CALLEE_COPIES} is defined and is
3365 nonzero, the caller does not make a copy.  Instead, it passes a pointer to the
3366 ``live'' value.  The called function must not modify this value.  If it can be
3367 determined that the value won't be modified, it need not make a copy;
3368 otherwise a copy must be made.
3369
3370 @findex CUMULATIVE_ARGS
3371 @item CUMULATIVE_ARGS
3372 A C type for declaring a variable that is used as the first argument of
3373 @code{FUNCTION_ARG} and other related values.  For some target machines,
3374 the type @code{int} suffices and can hold the number of bytes of
3375 argument so far.
3376
3377 There is no need to record in @code{CUMULATIVE_ARGS} anything about the
3378 arguments that have been passed on the stack.  The compiler has other
3379 variables to keep track of that.  For target machines on which all
3380 arguments are passed on the stack, there is no need to store anything in
3381 @code{CUMULATIVE_ARGS}; however, the data structure must exist and
3382 should not be empty, so use @code{int}.
3383
3384 @findex INIT_CUMULATIVE_ARGS
3385 @item INIT_CUMULATIVE_ARGS (@var{cum}, @var{fntype}, @var{libname}, @var{indirect})
3386 A C statement (sans semicolon) for initializing the variable @var{cum}
3387 for the state at the beginning of the argument list.  The variable has
3388 type @code{CUMULATIVE_ARGS}.  The value of @var{fntype} is the tree node
3389 for the data type of the function which will receive the args, or 0
3390 if the args are to a compiler support library function.  The value of
3391 @var{indirect} is nonzero when processing an indirect call, for example
3392 a call through a function pointer.  The value of @var{indirect} is zero
3393 for a call to an explicitly named function, a library function call, or when
3394 @code{INIT_CUMULATIVE_ARGS} is used to find arguments for the function
3395 being compiled.
3396
3397 When processing a call to a compiler support library function,
3398 @var{libname} identifies which one.  It is a @code{symbol_ref} rtx which
3399 contains the name of the function, as a string.  @var{libname} is 0 when
3400 an ordinary C function call is being processed.  Thus, each time this
3401 macro is called, either @var{libname} or @var{fntype} is nonzero, but
3402 never both of them at once.
3403
3404 @findex INIT_CUMULATIVE_LIBCALL_ARGS
3405 @item INIT_CUMULATIVE_LIBCALL_ARGS (@var{cum}, @var{mode}, @var{libname})
3406 Like @code{INIT_CUMULATIVE_ARGS} but only used for outgoing libcalls,
3407 it gets a @code{MODE} argument instead of @var{fntype}, that would be
3408 @code{NULL}.  @var{indirect} would always be zero, too.  If this macro
3409 is not defined, @code{INIT_CUMULATIVE_ARGS (cum, NULL_RTX, libname,
3410 0)} is used instead.
3411
3412 @findex INIT_CUMULATIVE_INCOMING_ARGS
3413 @item INIT_CUMULATIVE_INCOMING_ARGS (@var{cum}, @var{fntype}, @var{libname})
3414 Like @code{INIT_CUMULATIVE_ARGS} but overrides it for the purposes of
3415 finding the arguments for the function being compiled.  If this macro is
3416 undefined, @code{INIT_CUMULATIVE_ARGS} is used instead.
3417
3418 The value passed for @var{libname} is always 0, since library routines
3419 with special calling conventions are never compiled with GCC@.  The
3420 argument @var{libname} exists for symmetry with
3421 @code{INIT_CUMULATIVE_ARGS}.
3422 @c could use "this macro" in place of @code{INIT_CUMULATIVE_ARGS}, maybe.
3423 @c --mew 5feb93   i switched the order of the sentences.  --mew 10feb93
3424
3425 @findex FUNCTION_ARG_ADVANCE
3426 @item FUNCTION_ARG_ADVANCE (@var{cum}, @var{mode}, @var{type}, @var{named})
3427 A C statement (sans semicolon) to update the summarizer variable
3428 @var{cum} to advance past an argument in the argument list.  The
3429 values @var{mode}, @var{type} and @var{named} describe that argument.
3430 Once this is done, the variable @var{cum} is suitable for analyzing
3431 the @emph{following} argument with @code{FUNCTION_ARG}, etc.
3432
3433 This macro need not do anything if the argument in question was passed
3434 on the stack.  The compiler knows how to track the amount of stack space
3435 used for arguments without any special help.
3436
3437 @findex FUNCTION_ARG_PADDING
3438 @item FUNCTION_ARG_PADDING (@var{mode}, @var{type})
3439 If defined, a C expression which determines whether, and in which direction,
3440 to pad out an argument with extra space.  The value should be of type
3441 @code{enum direction}: either @code{upward} to pad above the argument,
3442 @code{downward} to pad below, or @code{none} to inhibit padding.
3443
3444 The @emph{amount} of padding is always just enough to reach the next
3445 multiple of @code{FUNCTION_ARG_BOUNDARY}; this macro does not control
3446 it.
3447
3448 This macro has a default definition which is right for most systems.
3449 For little-endian machines, the default is to pad upward.  For
3450 big-endian machines, the default is to pad downward for an argument of
3451 constant size shorter than an @code{int}, and upward otherwise.
3452
3453 @findex PAD_VARARGS_DOWN
3454 @item PAD_VARARGS_DOWN
3455 If defined, a C expression which determines whether the default
3456 implementation of va_arg will attempt to pad down before reading the
3457 next argument, if that argument is smaller than its aligned space as
3458 controlled by @code{PARM_BOUNDARY}.  If this macro is not defined, all such
3459 arguments are padded down if @code{BYTES_BIG_ENDIAN} is true.
3460
3461 @findex FUNCTION_ARG_BOUNDARY
3462 @item FUNCTION_ARG_BOUNDARY (@var{mode}, @var{type})
3463 If defined, a C expression that gives the alignment boundary, in bits,
3464 of an argument with the specified mode and type.  If it is not defined,
3465 @code{PARM_BOUNDARY} is used for all arguments.
3466
3467 @findex FUNCTION_ARG_REGNO_P
3468 @item FUNCTION_ARG_REGNO_P (@var{regno})
3469 A C expression that is nonzero if @var{regno} is the number of a hard
3470 register in which function arguments are sometimes passed.  This does
3471 @emph{not} include implicit arguments such as the static chain and
3472 the structure-value address.  On many machines, no registers can be
3473 used for this purpose since all function arguments are pushed on the
3474 stack.
3475
3476 @findex LOAD_ARGS_REVERSED
3477 @item LOAD_ARGS_REVERSED
3478 If defined, the order in which arguments are loaded into their
3479 respective argument registers is reversed so that the last
3480 argument is loaded first.  This macro only affects arguments
3481 passed in registers.
3482
3483 @end table
3484
3485 @node Scalar Return
3486 @subsection How Scalar Function Values Are Returned
3487 @cindex return values in registers
3488 @cindex values, returned by functions
3489 @cindex scalars, returned as values
3490
3491 This section discusses the macros that control returning scalars as
3492 values---values that can fit in registers.
3493
3494 @table @code
3495 @findex TRADITIONAL_RETURN_FLOAT
3496 @item TRADITIONAL_RETURN_FLOAT
3497 Define this macro if @option{-traditional} should not cause functions
3498 declared to return @code{float} to convert the value to @code{double}.
3499
3500 @findex FUNCTION_VALUE
3501 @item FUNCTION_VALUE (@var{valtype}, @var{func})
3502 A C expression to create an RTX representing the place where a
3503 function returns a value of data type @var{valtype}.  @var{valtype} is
3504 a tree node representing a data type.  Write @code{TYPE_MODE
3505 (@var{valtype})} to get the machine mode used to represent that type.
3506 On many machines, only the mode is relevant.  (Actually, on most
3507 machines, scalar values are returned in the same place regardless of
3508 mode).
3509
3510 The value of the expression is usually a @code{reg} RTX for the hard
3511 register where the return value is stored.  The value can also be a
3512 @code{parallel} RTX, if the return value is in multiple places.  See
3513 @code{FUNCTION_ARG} for an explanation of the @code{parallel} form.
3514
3515 If @code{PROMOTE_FUNCTION_RETURN} is defined, you must apply the same
3516 promotion rules specified in @code{PROMOTE_MODE} if @var{valtype} is a
3517 scalar type.
3518
3519 If the precise function being called is known, @var{func} is a tree
3520 node (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
3521 pointer.  This makes it possible to use a different value-returning
3522 convention for specific functions when all their calls are
3523 known.
3524
3525 @code{FUNCTION_VALUE} is not used for return vales with aggregate data
3526 types, because these are returned in another way.  See
3527 @code{STRUCT_VALUE_REGNUM} and related macros, below.
3528
3529 @findex FUNCTION_OUTGOING_VALUE
3530 @item FUNCTION_OUTGOING_VALUE (@var{valtype}, @var{func})
3531 Define this macro if the target machine has ``register windows''
3532 so that the register in which a function returns its value is not
3533 the same as the one in which the caller sees the value.
3534
3535 For such machines, @code{FUNCTION_VALUE} computes the register in which
3536 the caller will see the value.  @code{FUNCTION_OUTGOING_VALUE} should be
3537 defined in a similar fashion to tell the function where to put the
3538 value.
3539
3540 If @code{FUNCTION_OUTGOING_VALUE} is not defined,
3541 @code{FUNCTION_VALUE} serves both purposes.
3542
3543 @code{FUNCTION_OUTGOING_VALUE} is not used for return vales with
3544 aggregate data types, because these are returned in another way.  See
3545 @code{STRUCT_VALUE_REGNUM} and related macros, below.
3546
3547 @findex LIBCALL_VALUE
3548 @item LIBCALL_VALUE (@var{mode})
3549 A C expression to create an RTX representing the place where a library
3550 function returns a value of mode @var{mode}.  If the precise function
3551 being called is known, @var{func} is a tree node
3552 (@code{FUNCTION_DECL}) for it; otherwise, @var{func} is a null
3553 pointer.  This makes it possible to use a different value-returning
3554 convention for specific functions when all their calls are
3555 known.
3556
3557 Note that ``library function'' in this context means a compiler
3558 support routine, used to perform arithmetic, whose name is known
3559 specially by the compiler and was not mentioned in the C code being
3560 compiled.
3561
3562 The definition of @code{LIBRARY_VALUE} need not be concerned aggregate
3563 data types, because none of the library functions returns such types.
3564
3565 @findex FUNCTION_VALUE_REGNO_P
3566 @item FUNCTION_VALUE_REGNO_P (@var{regno})
3567 A C expression that is nonzero if @var{regno} is the number of a hard
3568 register in which the values of called function may come back.
3569
3570 A register whose use for returning values is limited to serving as the
3571 second of a pair (for a value of type @code{double}, say) need not be
3572 recognized by this macro.  So for most machines, this definition
3573 suffices:
3574
3575 @example
3576 #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0)
3577 @end example
3578
3579 If the machine has register windows, so that the caller and the called
3580 function use different registers for the return value, this macro
3581 should recognize only the caller's register numbers.
3582
3583 @findex APPLY_RESULT_SIZE
3584 @item APPLY_RESULT_SIZE
3585 Define this macro if @samp{untyped_call} and @samp{untyped_return}
3586 need more space than is implied by @code{FUNCTION_VALUE_REGNO_P} for
3587 saving and restoring an arbitrary return value.
3588 @end table
3589
3590 @node Aggregate Return
3591 @subsection How Large Values Are Returned
3592 @cindex aggregates as return values
3593 @cindex large return values
3594 @cindex returning aggregate values
3595 @cindex structure value address
3596
3597 When a function value's mode is @code{BLKmode} (and in some other
3598 cases), the value is not returned according to @code{FUNCTION_VALUE}
3599 (@pxref{Scalar Return}).  Instead, the caller passes the address of a
3600 block of memory in which the value should be stored.  This address
3601 is called the @dfn{structure value address}.
3602
3603 This section describes how to control returning structure values in
3604 memory.
3605
3606 @table @code
3607 @findex RETURN_IN_MEMORY
3608 @item RETURN_IN_MEMORY (@var{type})
3609 A C expression which can inhibit the returning of certain function
3610 values in registers, based on the type of value.  A nonzero value says
3611 to return the function value in memory, just as large structures are
3612 always returned.  Here @var{type} will be a C expression of type
3613 @code{tree}, representing the data type of the value.
3614
3615 Note that values of mode @code{BLKmode} must be explicitly handled
3616 by this macro.  Also, the option @option{-fpcc-struct-return}
3617 takes effect regardless of this macro.  On most systems, it is
3618 possible to leave the macro undefined; this causes a default
3619 definition to be used, whose value is the constant 1 for @code{BLKmode}
3620 values, and 0 otherwise.
3621
3622 Do not use this macro to indicate that structures and unions should always
3623 be returned in memory.  You should instead use @code{DEFAULT_PCC_STRUCT_RETURN}
3624 to indicate this.
3625
3626 @findex DEFAULT_PCC_STRUCT_RETURN
3627 @item DEFAULT_PCC_STRUCT_RETURN
3628 Define this macro to be 1 if all structure and union return values must be
3629 in memory.  Since this results in slower code, this should be defined
3630 only if needed for compatibility with other compilers or with an ABI@.
3631 If you define this macro to be 0, then the conventions used for structure
3632 and union return values are decided by the @code{RETURN_IN_MEMORY} macro.
3633
3634 If not defined, this defaults to the value 1.
3635
3636 @findex STRUCT_VALUE_REGNUM
3637 @item STRUCT_VALUE_REGNUM
3638 If the structure value address is passed in a register, then
3639 @code{STRUCT_VALUE_REGNUM} should be the number of that register.
3640
3641 @findex STRUCT_VALUE
3642 @item STRUCT_VALUE
3643 If the structure value address is not passed in a register, define
3644 @code{STRUCT_VALUE} as an expression returning an RTX for the place
3645 where the address is passed.  If it returns 0, the address is passed as
3646 an ``invisible'' first argument.
3647
3648 @findex STRUCT_VALUE_INCOMING_REGNUM
3649 @item STRUCT_VALUE_INCOMING_REGNUM
3650 On some architectures the place where the structure value address
3651 is found by the called function is not the same place that the
3652 caller put it.  This can be due to register windows, or it could
3653 be because the function prologue moves it to a different place.
3654
3655 If the incoming location of the structure value address is in a
3656 register, define this macro as the register number.
3657
3658 @findex STRUCT_VALUE_INCOMING
3659 @item STRUCT_VALUE_INCOMING
3660 If the incoming location is not a register, then you should define
3661 @code{STRUCT_VALUE_INCOMING} as an expression for an RTX for where the
3662 called function should find the value.  If it should find the value on
3663 the stack, define this to create a @code{mem} which refers to the frame
3664 pointer.  A definition of 0 means that the address is passed as an
3665 ``invisible'' first argument.
3666
3667 @findex PCC_STATIC_STRUCT_RETURN
3668 @item PCC_STATIC_STRUCT_RETURN
3669 Define this macro if the usual system convention on the target machine
3670 for returning structures and unions is for the called function to return
3671 the address of a static variable containing the value.
3672
3673 Do not define this if the usual system convention is for the caller to
3674 pass an address to the subroutine.
3675
3676 This macro has effect in @option{-fpcc-struct-return} mode, but it does
3677 nothing when you use @option{-freg-struct-return} mode.
3678 @end table
3679
3680 @node Caller Saves
3681 @subsection Caller-Saves Register Allocation
3682
3683 If you enable it, GCC can save registers around function calls.  This
3684 makes it possible to use call-clobbered registers to hold variables that
3685 must live across calls.
3686
3687 @table @code
3688 @findex DEFAULT_CALLER_SAVES
3689 @item DEFAULT_CALLER_SAVES
3690 Define this macro if function calls on the target machine do not preserve
3691 any registers; in other words, if @code{CALL_USED_REGISTERS} has 1
3692 for all registers.  When defined, this macro enables @option{-fcaller-saves}
3693 by default for all optimization levels.  It has no effect for optimization
3694 levels 2 and higher, where @option{-fcaller-saves} is the default.
3695
3696 @findex CALLER_SAVE_PROFITABLE
3697 @item CALLER_SAVE_PROFITABLE (@var{refs}, @var{calls})
3698 A C expression to determine whether it is worthwhile to consider placing
3699 a pseudo-register in a call-clobbered hard register and saving and
3700 restoring it around each function call.  The expression should be 1 when
3701 this is worth doing, and 0 otherwise.
3702
3703 If you don't define this macro, a default is used which is good on most
3704 machines: @code{4 * @var{calls} < @var{refs}}.
3705
3706 @findex HARD_REGNO_CALLER_SAVE_MODE
3707 @item HARD_REGNO_CALLER_SAVE_MODE (@var{regno}, @var{nregs})
3708 A C expression specifying which mode is required for saving @var{nregs}
3709 of a pseudo-register in call-clobbered hard register @var{regno}.  If
3710 @var{regno} is unsuitable for caller save, @code{VOIDmode} should be
3711 returned.  For most machines this macro need not be defined since GCC
3712 will select the smallest suitable mode.
3713 @end table
3714
3715 @node Function Entry
3716 @subsection Function Entry and Exit
3717 @cindex function entry and exit
3718 @cindex prologue
3719 @cindex epilogue
3720
3721 This section describes the macros that output function entry
3722 (@dfn{prologue}) and exit (@dfn{epilogue}) code.
3723
3724 @deftypefn {Target Hook} void TARGET_ASM_FUNCTION_PROLOGUE (FILE *@var{file}, HOST_WIDE_INT @var{size})
3725 If defined, a function that outputs the assembler code for entry to a
3726 function.  The prologue is responsible for setting up the stack frame,
3727 initializing the frame pointer register, saving registers that must be
3728 saved, and allocating @var{size} additional bytes of storage for the
3729 local variables.  @var{size} is an integer.  @var{file} is a stdio
3730 stream to which the assembler code should be output.
3731
3732 The label for the beginning of the function need not be output by this
3733 macro.  That has already been done when the macro is run.
3734
3735 @findex regs_ever_live
3736 To determine which registers to save, the macro can refer to the array
3737 @code{regs_ever_live}: element @var{r} is nonzero if hard register
3738 @var{r} is used anywhere within the function.  This implies the function
3739 prologue should save register @var{r}, provided it is not one of the
3740 call-used registers.  (@code{TARGET_ASM_FUNCTION_EPILOGUE} must likewise use
3741 @code{regs_ever_live}.)
3742
3743 On machines that have ``register windows'', the function entry code does
3744 not save on the stack the registers that are in the windows, even if
3745 they are supposed to be preserved by function calls; instead it takes
3746 appropriate steps to ``push'' the register stack, if any non-call-used
3747 registers are used in the function.
3748
3749 @findex frame_pointer_needed
3750 On machines where functions may or may not have frame-pointers, the
3751 function entry code must vary accordingly; it must set up the frame
3752 pointer if one is wanted, and not otherwise.  To determine whether a
3753 frame pointer is in wanted, the macro can refer to the variable
3754 @code{frame_pointer_needed}.  The variable's value will be 1 at run
3755 time in a function that needs a frame pointer.  @xref{Elimination}.
3756
3757 The function entry code is responsible for allocating any stack space
3758 required for the function.  This stack space consists of the regions
3759 listed below.  In most cases, these regions are allocated in the
3760 order listed, with the last listed region closest to the top of the
3761 stack (the lowest address if @code{STACK_GROWS_DOWNWARD} is defined, and
3762 the highest address if it is not defined).  You can use a different order
3763 for a machine if doing so is more convenient or required for
3764 compatibility reasons.  Except in cases where required by standard
3765 or by a debugger, there is no reason why the stack layout used by GCC
3766 need agree with that used by other compilers for a machine.
3767 @end deftypefn
3768
3769 @deftypefn {Target Hook} void TARGET_ASM_FUNCTION_END_PROLOGUE (FILE *@var{file})
3770 If defined, a function that outputs assembler code at the end of a
3771 prologue.  This should be used when the function prologue is being
3772 emitted as RTL, and you have some extra assembler that needs to be
3773 emitted.  @xref{prologue instruction pattern}.
3774 @end deftypefn
3775
3776 @deftypefn {Target Hook} void TARGET_ASM_FUNCTION_BEGIN_EPILOGUE (FILE *@var{file})
3777 If defined, a function that outputs assembler code at the start of an
3778 epilogue.  This should be used when the function epilogue is being
3779 emitted as RTL, and you have some extra assembler that needs to be
3780 emitted.  @xref{epilogue instruction pattern}.
3781 @end deftypefn
3782
3783 @deftypefn {Target Hook} void TARGET_ASM_FUNCTION_EPILOGUE (FILE *@var{file}, HOST_WIDE_INT @var{size})
3784 If defined, a function that outputs the assembler code for exit from a
3785 function.  The epilogue is responsible for restoring the saved
3786 registers and stack pointer to their values when the function was
3787 called, and returning control to the caller.  This macro takes the
3788 same arguments as the macro @code{TARGET_ASM_FUNCTION_PROLOGUE}, and the
3789 registers to restore are determined from @code{regs_ever_live} and
3790 @code{CALL_USED_REGISTERS} in the same way.
3791
3792 On some machines, there is a single instruction that does all the work
3793 of returning from the function.  On these machines, give that
3794 instruction the name @samp{return} and do not define the macro
3795 @code{TARGET_ASM_FUNCTION_EPILOGUE} at all.
3796
3797 Do not define a pattern named @samp{return} if you want the
3798 @code{TARGET_ASM_FUNCTION_EPILOGUE} to be used.  If you want the target
3799 switches to control whether return instructions or epilogues are used,
3800 define a @samp{return} pattern with a validity condition that tests the
3801 target switches appropriately.  If the @samp{return} pattern's validity
3802 condition is false, epilogues will be used.
3803
3804 On machines where functions may or may not have frame-pointers, the
3805 function exit code must vary accordingly.  Sometimes the code for these
3806 two cases is completely different.  To determine whether a frame pointer
3807 is wanted, the macro can refer to the variable
3808 @code{frame_pointer_needed}.  The variable's value will be 1 when compiling
3809 a function that needs a frame pointer.
3810
3811 Normally, @code{TARGET_ASM_FUNCTION_PROLOGUE} and
3812 @code{TARGET_ASM_FUNCTION_EPILOGUE} must treat leaf functions specially.
3813 The C variable @code{current_function_is_leaf} is nonzero for such a
3814 function.  @xref{Leaf Functions}.
3815
3816 On some machines, some functions pop their arguments on exit while
3817 others leave that for the caller to do.  For example, the 68020 when
3818 given @option{-mrtd} pops arguments in functions that take a fixed
3819 number of arguments.
3820
3821 @findex current_function_pops_args
3822 Your definition of the macro @code{RETURN_POPS_ARGS} decides which
3823 functions pop their own arguments.  @code{TARGET_ASM_FUNCTION_EPILOGUE}
3824 needs to know what was decided.  The variable that is called
3825 @code{current_function_pops_args} is the number of bytes of its
3826 arguments that a function should pop.  @xref{Scalar Return}.
3827 @c what is the "its arguments" in the above sentence referring to, pray
3828 @c tell?  --mew 5feb93
3829 @end deftypefn
3830
3831 @table @code
3832
3833 @itemize @bullet
3834 @item
3835 @findex current_function_pretend_args_size
3836 A region of @code{current_function_pretend_args_size} bytes of
3837 uninitialized space just underneath the first argument arriving on the
3838 stack.  (This may not be at the very start of the allocated stack region
3839 if the calling sequence has pushed anything else since pushing the stack
3840 arguments.  But usually, on such machines, nothing else has been pushed
3841 yet, because the function prologue itself does all the pushing.)  This
3842 region is used on machines where an argument may be passed partly in
3843 registers and partly in memory, and, in some cases to support the
3844 features in @code{<varargs.h>} and @code{<stdarg.h>}.
3845
3846 @item
3847 An area of memory used to save certain registers used by the function.
3848 The size of this area, which may also include space for such things as
3849 the return address and pointers to previous stack frames, is
3850 machine-specific and usually depends on which registers have been used
3851 in the function.  Machines with register windows often do not require
3852 a save area.
3853
3854 @item
3855 A region of at least @var{size} bytes, possibly rounded up to an allocation
3856 boundary, to contain the local variables of the function.  On some machines,
3857 this region and the save area may occur in the opposite order, with the
3858 save area closer to the top of the stack.
3859
3860 @item
3861 @cindex @code{ACCUMULATE_OUTGOING_ARGS} and stack frames
3862 Optionally, when @code{ACCUMULATE_OUTGOING_ARGS} is defined, a region of
3863 @code{current_function_outgoing_args_size} bytes to be used for outgoing
3864 argument lists of the function.  @xref{Stack Arguments}.
3865 @end itemize
3866
3867 Normally, it is necessary for the macros
3868 @code{TARGET_ASM_FUNCTION_PROLOGUE} and
3869 @code{TARGET_ASM_FUNCTION_EPILOGUE} to treat leaf functions specially.
3870 The C variable @code{current_function_is_leaf} is nonzero for such a
3871 function.
3872
3873 @findex EXIT_IGNORE_STACK
3874 @item EXIT_IGNORE_STACK
3875 Define this macro as a C expression that is nonzero if the return
3876 instruction or the function epilogue ignores the value of the stack
3877 pointer; in other words, if it is safe to delete an instruction to
3878 adjust the stack pointer before a return from the function.
3879
3880 Note that this macro's value is relevant only for functions for which
3881 frame pointers are maintained.  It is never safe to delete a final
3882 stack adjustment in a function that has no frame pointer, and the
3883 compiler knows this regardless of @code{EXIT_IGNORE_STACK}.
3884
3885 @findex EPILOGUE_USES
3886 @item EPILOGUE_USES (@var{regno})
3887 Define this macro as a C expression that is nonzero for registers that are
3888 used by the epilogue or the @samp{return} pattern.  The stack and frame
3889 pointer registers are already be assumed to be used as needed.
3890
3891 @findex DELAY_SLOTS_FOR_EPILOGUE
3892 @item DELAY_SLOTS_FOR_EPILOGUE
3893 Define this macro if the function epilogue contains delay slots to which
3894 instructions from the rest of the function can be ``moved''.  The
3895 definition should be a C expression whose value is an integer
3896 representing the number of delay slots there.
3897
3898 @findex ELIGIBLE_FOR_EPILOGUE_DELAY
3899 @item ELIGIBLE_FOR_EPILOGUE_DELAY (@var{insn}, @var{n})
3900 A C expression that returns 1 if @var{insn} can be placed in delay
3901 slot number @var{n} of the epilogue.
3902
3903 The argument @var{n} is an integer which identifies the delay slot now
3904 being considered (since different slots may have different rules of
3905 eligibility).  It is never negative and is always less than the number
3906 of epilogue delay slots (what @code{DELAY_SLOTS_FOR_EPILOGUE} returns).
3907 If you reject a particular insn for a given delay slot, in principle, it
3908 may be reconsidered for a subsequent delay slot.  Also, other insns may
3909 (at least in principle) be considered for the so far unfilled delay
3910 slot.
3911
3912 @findex current_function_epilogue_delay_list
3913 @findex final_scan_insn
3914 The insns accepted to fill the epilogue delay slots are put in an RTL
3915 list made with @code{insn_list} objects, stored in the variable
3916 @code{current_function_epilogue_delay_list}.  The insn for the first
3917 delay slot comes first in the list.  Your definition of the macro
3918 @code{TARGET_ASM_FUNCTION_EPILOGUE} should fill the delay slots by
3919 outputting the insns in this list, usually by calling
3920 @code{final_scan_insn}.
3921
3922 You need not define this macro if you did not define
3923 @code{DELAY_SLOTS_FOR_EPILOGUE}.
3924
3925 @findex ASM_OUTPUT_MI_THUNK
3926 @item ASM_OUTPUT_MI_THUNK (@var{file}, @var{thunk_fndecl}, @var{delta}, @var{function})
3927 A C compound statement that outputs the assembler code for a thunk
3928 function, used to implement C++ virtual function calls with multiple
3929 inheritance.  The thunk acts as a wrapper around a virtual function,
3930 adjusting the implicit object parameter before handing control off to
3931 the real function.
3932
3933 First, emit code to add the integer @var{delta} to the location that
3934 contains the incoming first argument.  Assume that this argument
3935 contains a pointer, and is the one used to pass the @code{this} pointer
3936 in C++.  This is the incoming argument @emph{before} the function prologue,
3937 e.g.@: @samp{%o0} on a sparc.  The addition must preserve the values of
3938 all other incoming arguments.
3939
3940 After the addition, emit code to jump to @var{function}, which is a
3941 @code{FUNCTION_DECL}.  This is a direct pure jump, not a call, and does
3942 not touch the return address.  Hence returning from @var{FUNCTION} will
3943 return to whoever called the current @samp{thunk}.
3944
3945 The effect must be as if @var{function} had been called directly with
3946 the adjusted first argument.  This macro is responsible for emitting all
3947 of the code for a thunk function; @code{TARGET_ASM_FUNCTION_PROLOGUE}
3948 and @code{TARGET_ASM_FUNCTION_EPILOGUE} are not invoked.
3949
3950 The @var{thunk_fndecl} is redundant.  (@var{delta} and @var{function}
3951 have already been extracted from it.)  It might possibly be useful on
3952 some targets, but probably not.
3953
3954 If you do not define this macro, the target-independent code in the C++
3955 front end will generate a less efficient heavyweight thunk that calls
3956 @var{function} instead of jumping to it.  The generic approach does
3957 not support varargs.
3958 @end table
3959
3960 @node Profiling
3961 @subsection Generating Code for Profiling
3962 @cindex profiling, code generation
3963
3964 These macros will help you generate code for profiling.
3965
3966 @table @code
3967 @findex FUNCTION_PROFILER
3968 @item FUNCTION_PROFILER (@var{file}, @var{labelno})
3969 A C statement or compound statement to output to @var{file} some
3970 assembler code to call the profiling subroutine @code{mcount}.
3971
3972 @findex mcount
3973 The details of how @code{mcount} expects to be called are determined by
3974 your operating system environment, not by GCC@.  To figure them out,
3975 compile a small program for profiling using the system's installed C
3976 compiler and look at the assembler code that results.
3977
3978 Older implementations of @code{mcount} expect the address of a counter
3979 variable to be loaded into some register.  The name of this variable is
3980 @samp{LP} followed by the number @var{labelno}, so you would generate
3981 the name using @samp{LP%d} in a @code{fprintf}.
3982
3983 @findex PROFILE_HOOK
3984 @item PROFILE_HOOK
3985 A C statement or compound statement to output to @var{file} some assembly
3986 code to call the profiling subroutine @code{mcount} even the target does
3987 not support profiling.
3988
3989 @findex NO_PROFILE_COUNTERS
3990 @item NO_PROFILE_COUNTERS
3991 Define this macro if the @code{mcount} subroutine on your system does
3992 not need a counter variable allocated for each function.  This is true
3993 for almost all modern implementations.  If you define this macro, you
3994 must not use the @var{labelno} argument to @code{FUNCTION_PROFILER}.
3995
3996 @findex PROFILE_BEFORE_PROLOGUE
3997 @item PROFILE_BEFORE_PROLOGUE
3998 Define this macro if the code for function profiling should come before
3999 the function prologue.  Normally, the profiling code comes after.
4000
4001 @findex FUNCTION_BLOCK_PROFILER
4002 @vindex profile_block_flag
4003 @item FUNCTION_BLOCK_PROFILER (@var{file}, @var{labelno})
4004 A C statement or compound statement to output to @var{file} some
4005 assembler code to initialize basic-block profiling for the current
4006 object module.  The global compile flag @code{profile_block_flag}
4007 distinguishes two profile modes.
4008
4009 @table @code
4010 @findex __bb_init_func
4011 @item profile_block_flag != 2
4012 Output code to call the subroutine @code{__bb_init_func} once per
4013 object module, passing it as its sole argument the address of a block
4014 allocated in the object module.
4015
4016 The name of the block is a local symbol made with this statement:
4017
4018 @smallexample
4019 ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 0);
4020 @end smallexample
4021
4022 Of course, since you are writing the definition of
4023 @code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you
4024 can take a short cut in the definition of this macro and use the name
4025 that you know will result.
4026
4027 The first word of this block is a flag which will be nonzero if the
4028 object module has already been initialized.  So test this word first,
4029 and do not call @code{__bb_init_func} if the flag is
4030 nonzero.  @var{labelno} contains a unique number which may be used to
4031 generate a label as a branch destination when @code{__bb_init_func}
4032 will not be called.
4033
4034 Described in assembler language, the code to be output looks like:
4035
4036 @example
4037   cmp (LPBX0),0
4038   bne local_label
4039   parameter1 <- LPBX0
4040   call __bb_init_func
4041 local_label:
4042 @end example
4043
4044 @findex __bb_init_trace_func
4045 @item profile_block_flag == 2
4046 Output code to call the subroutine @code{__bb_init_trace_func}
4047 and pass two parameters to it.  The first parameter is the same as
4048 for @code{__bb_init_func}.  The second parameter is the number of the
4049 first basic block of the function as given by @var{labelno}.  Note
4050 that @code{__bb_init_trace_func} has to be called, even if the object
4051 module has been initialized already.
4052
4053 Described in assembler language, the code to be output looks like:
4054 @example
4055 parameter1 <- LPBX0
4056 parameter2 <- @var{labelno}
4057 call __bb_init_trace_func
4058 @end example
4059 @end table
4060
4061 @findex BLOCK_PROFILER
4062 @vindex profile_block_flag
4063 @item BLOCK_PROFILER (@var{file}, @var{blockno})
4064 A C statement or compound statement to output to @var{file} some
4065 assembler code to increment the count associated with the basic
4066 block number @var{blockno}.  The global compile flag
4067 @code{profile_block_flag} distinguishes two profile modes.
4068
4069 @table @code
4070 @item profile_block_flag != 2
4071 Output code to increment the counter directly.  Basic blocks are
4072 numbered separately from zero within each compilation.  The count
4073 associated with block number @var{blockno} is at index
4074 @var{blockno} in a vector of words; the name of this array is a local
4075 symbol made with this statement:
4076
4077 @smallexample
4078 ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 2);
4079 @end smallexample
4080
4081 @c This paragraph is the same as one a few paragraphs up.
4082 @c That is not an error.
4083 Of course, since you are writing the definition of
4084 @code{ASM_GENERATE_INTERNAL_LABEL} as well as that of this macro, you
4085 can take a short cut in the definition of this macro and use the name
4086 that you know will result.
4087
4088 Described in assembler language, the code to be output looks like:
4089
4090 @smallexample
4091 inc (LPBX2+4*@var{blockno})
4092 @end smallexample
4093
4094 @vindex __bb
4095 @findex __bb_trace_func
4096 @item profile_block_flag == 2
4097 Output code to initialize the global structure @code{__bb} and
4098 call the function @code{__bb_trace_func}, which will increment the
4099 counter.
4100
4101 @code{__bb} consists of two words.  In the first word, the current
4102 basic block number, as given by @var{blockno}, has to be stored.  In
4103 the second word, the address of a block allocated in the object
4104 module has to be stored.  The address is given by the label created
4105 with this statement:
4106
4107 @smallexample
4108 ASM_GENERATE_INTERNAL_LABEL (@var{buffer}, "LPBX", 0);
4109 @end smallexample
4110
4111 Described in assembler language, the code to be output looks like:
4112 @example
4113 move @var{blockno} -> (__bb)
4114 move LPBX0 -> (__bb+4)
4115 call __bb_trace_func
4116 @end example
4117 @end table
4118
4119 @findex FUNCTION_BLOCK_PROFILER_EXIT
4120 @findex __bb_trace_ret
4121 @vindex profile_block_flag
4122 @item FUNCTION_BLOCK_PROFILER_EXIT (@var{file})
4123 A C statement or compound statement to output to @var{file} assembler
4124 code to call function @code{__bb_trace_ret}.  The assembler code should
4125 only be output if the global compile flag @code{profile_block_flag} ==
4126 2.  This macro has to be used at every place where code for returning
4127 from a function is generated (e.g.@:
4128 @code{TARGET_ASM_FUNCTION_EPILOGUE}).  Although you have to write the
4129 definition of @code{TARGET_ASM_FUNCTION_EPILOGUE} as well, you have to
4130 define this macro to tell the compiler, that the proper call to
4131 @code{__bb_trace_ret} is produced.
4132
4133 @findex MACHINE_STATE_SAVE
4134 @findex __bb_init_trace_func
4135 @findex __bb_trace_func
4136 @findex __bb_trace_ret
4137 @item MACHINE_STATE_SAVE (@var{id})
4138 A C statement or compound statement to save all registers, which may
4139 be clobbered by a function call, including condition codes.  The
4140 @code{asm} statement will be mostly likely needed to handle this
4141 task.  Local labels in the assembler code can be concatenated with the
4142 string @var{id}, to obtain a unique label name.
4143
4144 Registers or condition codes clobbered by
4145 @code{TARGET_ASM_FUNCTION_PROLOGUE} or
4146 @code{TARGET_ASM_FUNCTION_EPILOGUE} must be saved in the macros
4147 @code{FUNCTION_BLOCK_PROFILER}, @code{FUNCTION_BLOCK_PROFILER_EXIT} and
4148 @code{BLOCK_PROFILER} prior calling @code{__bb_init_trace_func},
4149 @code{__bb_trace_ret} and @code{__bb_trace_func} respectively.
4150
4151 @findex MACHINE_STATE_RESTORE
4152 @findex __bb_init_trace_func
4153 @findex __bb_trace_func
4154 @findex __bb_trace_ret
4155 @item MACHINE_STATE_RESTORE (@var{id})
4156 A C statement or compound statement to restore all registers, including
4157 condition codes, saved by @code{MACHINE_STATE_SAVE}.
4158
4159 Registers or condition codes clobbered by
4160 @code{TARGET_ASM_FUNCTION_PROLOGUE} or
4161 @code{TARGET_ASM_FUNCTION_EPILOGUE} must be restored in the macros
4162 @code{FUNCTION_BLOCK_PROFILER}, @code{FUNCTION_BLOCK_PROFILER_EXIT} and
4163 @code{BLOCK_PROFILER} after calling @code{__bb_init_trace_func},
4164 @code{__bb_trace_ret} and @code{__bb_trace_func} respectively.
4165
4166 @findex BLOCK_PROFILER_CODE
4167 @item BLOCK_PROFILER_CODE
4168 A C function or functions which are needed in the library to
4169 support block profiling.
4170
4171 @findex TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
4172 @item TARGET_ALLOWS_PROFILING_WITHOUT_FRAME_POINTER
4173 On some targets, it is impossible to use profiling when the frame
4174 pointer has been omitted.  For example, on x86 GNU/Linux systems,
4175 the @code{mcount} routine provided by the GNU C Library finds the
4176 address of the routine that called the routine that called @code{mcount}
4177 by looking in the immediate caller's stack frame.  If the immediate
4178 caller has no frame pointer, this lookup will fail.
4179
4180 By default, GCC assumes that the target does allow profiling when the
4181 frame pointer is omitted.  This macro should be defined to a C
4182 expression that evaluates to @code{false} if the target does not allow
4183 profiling when the frame pointer is omitted.
4184
4185 @end table
4186
4187 @node Inlining
4188 @subsection Permitting inlining of functions with attributes
4189 @cindex inlining
4190
4191 By default if a function has a target specific attribute attached to it,
4192 it will not be inlined.  This behaviour can be overridden if the target
4193 defines the @samp{FUNCTION_ATTRIBUTE_INLINABLE_P} macro.  This macro
4194 takes one argument, a @samp{DECL} describing the function.  It should
4195 return non-zero if the function can be inlined, otherwise it should
4196 return 0.
4197
4198 @node Tail Calling
4199 @subsection Permitting tail calls to functions
4200 @cindex tail calls
4201 @cindex sibling calls
4202
4203 @table @code
4204 @findex FUNCTION_OK_FOR_SIBCALL
4205 @item FUNCTION_OK_FOR_SIBCALL (@var{decl})
4206 A C expression that evaluates to true if it is ok to perform a sibling
4207 call to @var{decl}.
4208
4209 It is not uncommon for limitations of calling conventions to prevent
4210 tail calls to functions outside the current unit of translation, or
4211 during PIC compilation.  Use this macro to enforce these restrictions,
4212 as the @code{sibcall} md pattern can not fail, or fall over to a
4213 ``normal'' call.
4214 @end table
4215
4216 @node Varargs
4217 @section Implementing the Varargs Macros
4218 @cindex varargs implementation
4219
4220 GCC comes with an implementation of @code{<varargs.h>} and
4221 @code{<stdarg.h>} that work without change on machines that pass arguments
4222 on the stack.  Other machines require their own implementations of
4223 varargs, and the two machine independent header files must have
4224 conditionals to include it.
4225
4226 ISO @code{<stdarg.h>} differs from traditional @code{<varargs.h>} mainly in
4227 the calling convention for @code{va_start}.  The traditional
4228 implementation takes just one argument, which is the variable in which
4229 to store the argument pointer.  The ISO implementation of
4230 @code{va_start} takes an additional second argument.  The user is
4231 supposed to write the last named argument of the function here.
4232
4233 However, @code{va_start} should not use this argument.  The way to find
4234 the end of the named arguments is with the built-in functions described
4235 below.
4236
4237 @table @code
4238 @findex __builtin_saveregs
4239 @item __builtin_saveregs ()
4240 Use this built-in function to save the argument registers in memory so
4241 that the varargs mechanism can access them.  Both ISO and traditional
4242 versions of @code{va_start} must use @code{__builtin_saveregs}, unless
4243 you use @code{SETUP_INCOMING_VARARGS} (see below) instead.
4244
4245 On some machines, @code{__builtin_saveregs} is open-coded under the
4246 control of the macro @code{EXPAND_BUILTIN_SAVEREGS}.  On other machines,
4247 it calls a routine written in assembler language, found in
4248 @file{libgcc2.c}.
4249
4250 Code generated for the call to @code{__builtin_saveregs} appears at the
4251 beginning of the function, as opposed to where the call to
4252 @code{__builtin_saveregs} is written, regardless of what the code is.
4253 This is because the registers must be saved before the function starts
4254 to use them for its own purposes.
4255 @c i rewrote the first sentence above to fix an overfull hbox. --mew
4256 @c 10feb93
4257
4258 @findex __builtin_args_info
4259 @item __builtin_args_info (@var{category})
4260 Use this built-in function to find the first anonymous arguments in
4261 registers.
4262
4263 In general, a machine may have several categories of registers used for
4264 arguments, each for a particular category of data types.  (For example,
4265 on some machines, floating-point registers are used for floating-point
4266 arguments while other arguments are passed in the general registers.)
4267 To make non-varargs functions use the proper calling convention, you
4268 have defined the @code{CUMULATIVE_ARGS} data type to record how many
4269 registers in each category have been used so far
4270
4271 @code{__builtin_args_info} accesses the same data structure of type
4272 @code{CUMULATIVE_ARGS} after the ordinary argument layout is finished
4273 with it, with @var{category} specifying which word to access.  Thus, the
4274 value indicates the first unused register in a given category.
4275
4276 Normally, you would use @code{__builtin_args_info} in the implementation
4277 of @code{va_start}, accessing each category just once and storing the
4278 value in the @code{va_list} object.  This is because @code{va_list} will
4279 have to update the values, and there is no way to alter the
4280 values accessed by @code{__builtin_args_info}.
4281
4282 @findex __builtin_next_arg
4283 @item __builtin_next_arg (@var{lastarg})
4284 This is the equivalent of @code{__builtin_args_info}, for stack
4285 arguments.  It returns the address of the first anonymous stack
4286 argument, as type @code{void *}.  If @code{ARGS_GROW_DOWNWARD}, it
4287 returns the address of the location above the first anonymous stack
4288 argument.  Use it in @code{va_start} to initialize the pointer for
4289 fetching arguments from the stack.  Also use it in @code{va_start} to
4290 verify that the second parameter @var{lastarg} is the last named argument
4291 of the current function.
4292
4293 @findex __builtin_classify_type
4294 @item __builtin_classify_type (@var{object})
4295 Since each machine has its own conventions for which data types are
4296 passed in which kind of register, your implementation of @code{va_arg}
4297 has to embody these conventions.  The easiest way to categorize the
4298 specified data type is to use @code{__builtin_classify_type} together
4299 with @code{sizeof} and @code{__alignof__}.
4300
4301 @code{__builtin_classify_type} ignores the value of @var{object},
4302 considering only its data type.  It returns an integer describing what
4303 kind of type that is---integer, floating, pointer, structure, and so on.
4304
4305 The file @file{typeclass.h} defines an enumeration that you can use to
4306 interpret the values of @code{__builtin_classify_type}.
4307 @end table
4308
4309 These machine description macros help implement varargs:
4310
4311 @table @code
4312 @findex EXPAND_BUILTIN_SAVEREGS
4313 @item EXPAND_BUILTIN_SAVEREGS ()
4314 If defined, is a C expression that produces the machine-specific code
4315 for a call to @code{__builtin_saveregs}.  This code will be moved to the
4316 very beginning of the function, before any parameter access are made.
4317 The return value of this function should be an RTX that contains the
4318 value to use as the return of @code{__builtin_saveregs}.
4319
4320 @findex SETUP_INCOMING_VARARGS
4321 @item SETUP_INCOMING_VARARGS (@var{args_so_far}, @var{mode}, @var{type}, @var{pretend_args_size}, @var{second_time})
4322 This macro offers an alternative to using @code{__builtin_saveregs} and
4323 defining the macro @code{EXPAND_BUILTIN_SAVEREGS}.  Use it to store the
4324 anonymous register arguments into the stack so that all the arguments
4325 appear to have been passed consecutively on the stack.  Once this is
4326 done, you can use the standard implementation of varargs that works for
4327 machines that pass all their arguments on the stack.
4328
4329 The argument @var{args_so_far} is the @code{CUMULATIVE_ARGS} data
4330 structure, containing the values that are obtained after processing the
4331 named arguments.  The arguments @var{mode} and @var{type} describe the
4332 last named argument---its machine mode and its data type as a tree node.
4333
4334 The macro implementation should do two things: first, push onto the
4335 stack all the argument registers @emph{not} used for the named
4336 arguments, and second, store the size of the data thus pushed into the
4337 @code{int}-valued variable whose name is supplied as the argument
4338 @var{pretend_args_size}.  The value that you store here will serve as
4339 additional offset for setting up the stack frame.
4340
4341 Because you must generate code to push the anonymous arguments at
4342 compile time without knowing their data types,
4343 @code{SETUP_INCOMING_VARARGS} is only useful on machines that have just
4344 a single category of argument register and use it uniformly for all data
4345 types.
4346
4347 If the argument @var{second_time} is nonzero, it means that the
4348 arguments of the function are being analyzed for the second time.  This
4349 happens for an inline function, which is not actually compiled until the
4350 end of the source file.  The macro @code{SETUP_INCOMING_VARARGS} should
4351 not generate any instructions in this case.
4352
4353 @findex STRICT_ARGUMENT_NAMING
4354 @item STRICT_ARGUMENT_NAMING
4355 Define this macro to be a nonzero value if the location where a function
4356 argument is passed depends on whether or not it is a named argument.
4357
4358 This macro controls how the @var{named} argument to @code{FUNCTION_ARG}
4359 is set for varargs and stdarg functions.  If this macro returns a
4360 nonzero value, the @var{named} argument is always true for named
4361 arguments, and false for unnamed arguments.  If it returns a value of
4362 zero, but @code{SETUP_INCOMING_VARARGS} is defined, then all arguments
4363 are treated as named.  Otherwise, all named arguments except the last
4364 are treated as named.
4365
4366 You need not define this macro if it always returns zero.
4367
4368 @findex PRETEND_OUTGOING_VARARGS_NAMED
4369 @item PRETEND_OUTGOING_VARARGS_NAMED
4370 If you need to conditionally change ABIs so that one works with
4371 @code{SETUP_INCOMING_VARARGS}, but the other works like neither
4372 @code{SETUP_INCOMING_VARARGS} nor @code{STRICT_ARGUMENT_NAMING} was
4373 defined, then define this macro to return nonzero if
4374 @code{SETUP_INCOMING_VARARGS} is used, zero otherwise.
4375 Otherwise, you should not define this macro.
4376 @end table
4377
4378 @node Trampolines
4379 @section Trampolines for Nested Functions
4380 @cindex trampolines for nested functions
4381 @cindex nested functions, trampolines for
4382
4383 A @dfn{trampoline} is a small piece of code that is created at run time
4384 when the address of a nested function is taken.  It normally resides on
4385 the stack, in the stack frame of the containing function.  These macros
4386 tell GCC how to generate code to allocate and initialize a
4387 trampoline.
4388
4389 The instructions in the trampoline must do two things: load a constant
4390 address into the static chain register, and jump to the real address of
4391 the nested function.  On CISC machines such as the m68k, this requires
4392 two instructions, a move immediate and a jump.  Then the two addresses
4393 exist in the trampoline as word-long immediate operands.  On RISC
4394 machines, it is often necessary to load each address into a register in
4395 two parts.  Then pieces of each address form separate immediate
4396 operands.
4397
4398 The code generated to initialize the trampoline must store the variable
4399 parts---the static chain value and the function address---into the
4400 immediate operands of the instructions.  On a CISC machine, this is
4401 simply a matter of copying each address to a memory reference at the
4402 proper offset from the start of the trampoline.  On a RISC machine, it
4403 may be necessary to take out pieces of the address and store them
4404 separately.
4405
4406 @table @code
4407 @findex TRAMPOLINE_TEMPLATE
4408 @item TRAMPOLINE_TEMPLATE (@var{file})
4409 A C statement to output, on the stream @var{file}, assembler code for a
4410 block of data that contains the constant parts of a trampoline.  This
4411 code should not include a label---the label is taken care of
4412 automatically.
4413
4414 If you do not define this macro, it means no template is needed
4415 for the target.  Do not define this macro on systems where the block move
4416 code to copy the trampoline into place would be larger than the code
4417 to generate it on the spot.
4418
4419 @findex TRAMPOLINE_SECTION
4420 @item TRAMPOLINE_SECTION
4421 The name of a subroutine to switch to the section in which the
4422 trampoline template is to be placed (@pxref{Sections}).  The default is
4423 a value of @samp{readonly_data_section}, which places the trampoline in
4424 the section containing read-only data.
4425
4426 @findex TRAMPOLINE_SIZE
4427 @item TRAMPOLINE_SIZE
4428 A C expression for the size in bytes of the trampoline, as an integer.
4429
4430 @findex TRAMPOLINE_ALIGNMENT
4431 @item TRAMPOLINE_ALIGNMENT
4432 Alignment required for trampolines, in bits.
4433
4434 If you don't define this macro, the value of @code{BIGGEST_ALIGNMENT}
4435 is used for aligning trampolines.
4436
4437 @findex INITIALIZE_TRAMPOLINE
4438 @item INITIALIZE_TRAMPOLINE (@var{addr}, @var{fnaddr}, @var{static_chain})
4439 A C statement to initialize the variable parts of a trampoline.
4440 @var{addr} is an RTX for the address of the trampoline; @var{fnaddr} is
4441 an RTX for the address of the nested function; @var{static_chain} is an
4442 RTX for the static chain value that should be passed to the function
4443 when it is called.
4444
4445 @findex TRAMPOLINE_ADJUST_ADDRESS
4446 @item TRAMPOLINE_ADJUST_ADDRESS (@var{addr})
4447 A C statement that should perform any machine-specific adjustment in
4448 the address of the trampoline.  Its argument contains the address that
4449 was passed to @code{INITIALIZE_TRAMPOLINE}.  In case the address to be
4450 used for a function call should be different from the address in which
4451 the template was stored, the different address should be assigned to
4452 @var{addr}.  If this macro is not defined, @var{addr} will be used for
4453 function calls.
4454
4455 @findex ALLOCATE_TRAMPOLINE
4456 @item ALLOCATE_TRAMPOLINE (@var{fp})
4457 A C expression to allocate run-time space for a trampoline.  The
4458 expression value should be an RTX representing a memory reference to the
4459 space for the trampoline.
4460
4461 @cindex @code{TARGET_ASM_FUNCTION_EPILOGUE} and trampolines
4462 @cindex @code{TARGET_ASM_FUNCTION_PROLOGUE} and trampolines
4463 If this macro is not defined, by default the trampoline is allocated as
4464 a stack slot.  This default is right for most machines.  The exceptions
4465 are machines where it is impossible to execute instructions in the stack
4466 area.  On such machines, you may have to implement a separate stack,
4467 using this macro in conjunction with @code{TARGET_ASM_FUNCTION_PROLOGUE}
4468 and @code{TARGET_ASM_FUNCTION_EPILOGUE}.
4469
4470 @var{fp} points to a data structure, a @code{struct function}, which
4471 describes the compilation status of the immediate containing function of
4472 the function which the trampoline is for.  Normally (when
4473 @code{ALLOCATE_TRAMPOLINE} is not defined), the stack slot for the
4474 trampoline is in the stack frame of this containing function.  Other
4475 allocation strategies probably must do something analogous with this
4476 information.
4477 @end table
4478
4479 Implementing trampolines is difficult on many machines because they have
4480 separate instruction and data caches.  Writing into a stack location
4481 fails to clear the memory in the instruction cache, so when the program
4482 jumps to that location, it executes the old contents.
4483
4484 Here are two possible solutions.  One is to clear the relevant parts of
4485 the instruction cache whenever a trampoline is set up.  The other is to
4486 make all trampolines identical, by having them jump to a standard
4487 subroutine.  The former technique makes trampoline execution faster; the
4488 latter makes initialization faster.
4489
4490 To clear the instruction cache when a trampoline is initialized, define
4491 the following macros which describe the shape of the cache.
4492
4493 @table @code
4494 @findex INSN_CACHE_SIZE
4495 @item INSN_CACHE_SIZE
4496 The total size in bytes of the cache.
4497
4498 @findex INSN_CACHE_LINE_WIDTH
4499 @item INSN_CACHE_LINE_WIDTH
4500 The length in bytes of each cache line.  The cache is divided into cache
4501 lines which are disjoint slots, each holding a contiguous chunk of data
4502 fetched from memory.  Each time data is brought into the cache, an
4503 entire line is read at once.  The data loaded into a cache line is
4504 always aligned on a boundary equal to the line size.
4505
4506 @findex INSN_CACHE_DEPTH
4507 @item INSN_CACHE_DEPTH
4508 The number of alternative cache lines that can hold any particular memory
4509 location.
4510 @end table
4511
4512 Alternatively, if the machine has system calls or instructions to clear
4513 the instruction cache directly, you can define the following macro.
4514
4515 @table @code
4516 @findex CLEAR_INSN_CACHE
4517 @item CLEAR_INSN_CACHE (@var{beg}, @var{end})
4518 If defined, expands to a C expression clearing the @emph{instruction
4519 cache} in the specified interval.  If it is not defined, and the macro
4520 @code{INSN_CACHE_SIZE} is defined, some generic code is generated to clear the
4521 cache.  The definition of this macro would typically be a series of
4522 @code{asm} statements.  Both @var{beg} and @var{end} are both pointer
4523 expressions.
4524 @end table
4525
4526 To use a standard subroutine, define the following macro.  In addition,
4527 you must make sure that the instructions in a trampoline fill an entire
4528 cache line with identical instructions, or else ensure that the
4529 beginning of the trampoline code is always aligned at the same point in
4530 its cache line.  Look in @file{m68k.h} as a guide.
4531
4532 @table @code
4533 @findex TRANSFER_FROM_TRAMPOLINE
4534 @item TRANSFER_FROM_TRAMPOLINE
4535 Define this macro if trampolines need a special subroutine to do their
4536 work.  The macro should expand to a series of @code{asm} statements
4537 which will be compiled with GCC@.  They go in a library function named
4538 @code{__transfer_from_trampoline}.
4539
4540 If you need to avoid executing the ordinary prologue code of a compiled
4541 C function when you jump to the subroutine, you can do so by placing a
4542 special label of your own in the assembler code.  Use one @code{asm}
4543 statement to generate an assembler label, and another to make the label
4544 global.  Then trampolines can use that label to jump directly to your
4545 special assembler code.
4546 @end table
4547
4548 @node Library Calls
4549 @section Implicit Calls to Library Routines
4550 @cindex library subroutine names
4551 @cindex @file{libgcc.a}
4552
4553 @c prevent bad page break with this line
4554 Here is an explanation of implicit calls to library routines.
4555
4556 @table @code
4557 @findex MULSI3_LIBCALL
4558 @item MULSI3_LIBCALL
4559 A C string constant giving the name of the function to call for
4560 multiplication of one signed full-word by another.  If you do not
4561 define this macro, the default name is used, which is @code{__mulsi3},
4562 a function defined in @file{libgcc.a}.
4563
4564 @findex DIVSI3_LIBCALL
4565 @item DIVSI3_LIBCALL
4566 A C string constant giving the name of the function to call for
4567 division of one signed full-word by another.  If you do not define
4568 this macro, the default name is used, which is @code{__divsi3}, a
4569 function defined in @file{libgcc.a}.
4570
4571 @findex UDIVSI3_LIBCALL
4572 @item UDIVSI3_LIBCALL
4573 A C string constant giving the name of the function to call for
4574 division of one unsigned full-word by another.  If you do not define
4575 this macro, the default name is used, which is @code{__udivsi3}, a
4576 function defined in @file{libgcc.a}.
4577
4578 @findex MODSI3_LIBCALL
4579 @item MODSI3_LIBCALL
4580 A C string constant giving the name of the function to call for the
4581 remainder in division of one signed full-word by another.  If you do
4582 not define this macro, the default name is used, which is
4583 @code{__modsi3}, a function defined in @file{libgcc.a}.
4584
4585 @findex UMODSI3_LIBCALL
4586 @item UMODSI3_LIBCALL
4587 A C string constant giving the name of the function to call for the
4588 remainder in division of one unsigned full-word by another.  If you do
4589 not define this macro, the default name is used, which is
4590 @code{__umodsi3}, a function defined in @file{libgcc.a}.
4591
4592 @findex MULDI3_LIBCALL
4593 @item MULDI3_LIBCALL
4594 A C string constant giving the name of the function to call for
4595 multiplication of one signed double-word by another.  If you do not
4596 define this macro, the default name is used, which is @code{__muldi3},
4597 a function defined in @file{libgcc.a}.
4598
4599 @findex DIVDI3_LIBCALL
4600 @item DIVDI3_LIBCALL
4601 A C string constant giving the name of the function to call for
4602 division of one signed double-word by another.  If you do not define
4603 this macro, the default name is used, which is @code{__divdi3}, a
4604 function defined in @file{libgcc.a}.
4605
4606 @findex UDIVDI3_LIBCALL
4607 @item UDIVDI3_LIBCALL
4608 A C string constant giving the name of the function to call for
4609 division of one unsigned full-word by another.  If you do not define
4610 this macro, the default name is used, which is @code{__udivdi3}, a
4611 function defined in @file{libgcc.a}.
4612
4613 @findex MODDI3_LIBCALL
4614 @item MODDI3_LIBCALL
4615 A C string constant giving the name of the function to call for the
4616 remainder in division of one signed double-word by another.  If you do
4617 not define this macro, the default name is used, which is
4618 @code{__moddi3}, a function defined in @file{libgcc.a}.
4619
4620 @findex UMODDI3_LIBCALL
4621 @item UMODDI3_LIBCALL
4622 A C string constant giving the name of the function to call for the
4623 remainder in division of one unsigned full-word by another.  If you do
4624 not define this macro, the default name is used, which is
4625 @code{__umoddi3}, a function defined in @file{libgcc.a}.
4626
4627 @findex INIT_TARGET_OPTABS
4628 @item INIT_TARGET_OPTABS
4629 Define this macro as a C statement that declares additional library
4630 routines renames existing ones.  @code{init_optabs} calls this macro after
4631 initializing all the normal library routines.
4632
4633 @findex FLOAT_LIB_COMPARE_RETURNS_BOOL (@var{mode}, @var{comparison})
4634 @item FLOAT_LIB_COMPARE_RETURNS_BOOL
4635 Define this macro as a C statement that returns nonzero if a call to
4636 the floating point comparison library function will return a boolean
4637 value that indicates the result of the comparison.  It should return
4638 zero if one of gcc's own libgcc functions is called.
4639
4640 Most ports don't need to define this macro.
4641
4642 @findex TARGET_EDOM
4643 @cindex @code{EDOM}, implicit usage
4644 @item TARGET_EDOM
4645 The value of @code{EDOM} on the target machine, as a C integer constant
4646 expression.  If you don't define this macro, GCC does not attempt to
4647 deposit the value of @code{EDOM} into @code{errno} directly.  Look in
4648 @file{/usr/include/errno.h} to find the value of @code{EDOM} on your
4649 system.
4650
4651 If you do not define @code{TARGET_EDOM}, then compiled code reports
4652 domain errors by calling the library function and letting it report the
4653 error.  If mathematical functions on your system use @code{matherr} when
4654 there is an error, then you should leave @code{TARGET_EDOM} undefined so
4655 that @code{matherr} is used normally.
4656
4657 @findex GEN_ERRNO_RTX
4658 @cindex @code{errno}, implicit usage
4659 @item GEN_ERRNO_RTX
4660 Define this macro as a C expression to create an rtl expression that
4661 refers to the global ``variable'' @code{errno}.  (On certain systems,
4662 @code{errno} may not actually be a variable.)  If you don't define this
4663 macro, a reasonable default is used.
4664
4665 @findex TARGET_MEM_FUNCTIONS
4666 @cindex @code{bcopy}, implicit usage
4667 @cindex @code{memcpy}, implicit usage
4668 @cindex @code{memmove}, implicit usage
4669 @cindex @code{bzero}, implicit usage
4670 @cindex @code{memset}, implicit usage
4671 @item TARGET_MEM_FUNCTIONS
4672 Define this macro if GCC should generate calls to the ISO C
4673 (and System V) library functions @code{memcpy}, @code{memmove} and
4674 @code{memset} rather than the BSD functions @code{bcopy} and @code{bzero}.
4675
4676 @findex LIBGCC_NEEDS_DOUBLE
4677 @item LIBGCC_NEEDS_DOUBLE
4678 Define this macro if @code{float} arguments cannot be passed to library
4679 routines (so they must be converted to @code{double}).  This macro
4680 affects both how library calls are generated and how the library
4681 routines in @file{libgcc.a} accept their arguments.  It is useful on
4682 machines where floating and fixed point arguments are passed
4683 differently, such as the i860.
4684
4685 @findex NEXT_OBJC_RUNTIME
4686 @item NEXT_OBJC_RUNTIME
4687 Define this macro to generate code for Objective-C message sending using
4688 the calling convention of the NeXT system.  This calling convention
4689 involves passing the object, the selector and the method arguments all
4690 at once to the method-lookup library function.
4691
4692 The default calling convention passes just the object and the selector
4693 to the lookup function, which returns a pointer to the method.
4694 @end table
4695
4696 @node Addressing Modes
4697 @section Addressing Modes
4698 @cindex addressing modes
4699
4700 @c prevent bad page break with this line
4701 This is about addressing modes.
4702
4703 @table @code
4704 @findex HAVE_PRE_INCREMENT
4705 @findex HAVE_PRE_DECREMENT
4706 @findex HAVE_POST_INCREMENT
4707 @findex HAVE_POST_DECREMENT
4708 @item HAVE_PRE_INCREMENT
4709 @itemx HAVE_PRE_DECREMENT
4710 @itemx HAVE_POST_INCREMENT
4711 @itemx HAVE_POST_DECREMENT
4712 A C expression that is non-zero if the machine supports pre-increment,
4713 pre-decrement, post-increment, or post-decrement addressing respectively.
4714
4715 @findex HAVE_POST_MODIFY_DISP
4716 @findex HAVE_PRE_MODIFY_DISP
4717 @item HAVE_PRE_MODIFY_DISP
4718 @itemx HAVE_POST_MODIFY_DISP
4719 A C expression that is non-zero if the machine supports pre- or
4720 post-address side-effect generation involving constants other than
4721 the size of the memory operand.
4722
4723 @findex HAVE_POST_MODIFY_REG
4724 @findex HAVE_PRE_MODIFY_REG
4725 @item HAVE_PRE_MODIFY_REG
4726 @itemx HAVE_POST_MODIFY_REG
4727 A C expression that is non-zero if the machine supports pre- or
4728 post-address side-effect generation involving a register displacement.
4729
4730 @findex CONSTANT_ADDRESS_P
4731 @item CONSTANT_ADDRESS_P (@var{x})
4732 A C expression that is 1 if the RTX @var{x} is a constant which
4733 is a valid address.  On most machines, this can be defined as
4734 @code{CONSTANT_P (@var{x})}, but a few machines are more restrictive
4735 in which constant addresses are supported.
4736
4737 @findex CONSTANT_P
4738 @code{CONSTANT_P} accepts integer-values expressions whose values are
4739 not explicitly known, such as @code{symbol_ref}, @code{label_ref}, and
4740 @code{high} expressions and @code{const} arithmetic expressions, in
4741 addition to @code{const_int} and @code{const_double} expressions.
4742
4743 @findex MAX_REGS_PER_ADDRESS
4744 @item MAX_REGS_PER_ADDRESS
4745 A number, the maximum number of registers that can appear in a valid
4746 memory address.  Note that it is up to you to specify a value equal to
4747 the maximum number that @code{GO_IF_LEGITIMATE_ADDRESS} would ever
4748 accept.
4749
4750 @findex GO_IF_LEGITIMATE_ADDRESS
4751 @item GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label})
4752 A C compound statement with a conditional @code{goto @var{label};}
4753 executed if @var{x} (an RTX) is a legitimate memory address on the
4754 target machine for a memory operand of mode @var{mode}.
4755
4756 It usually pays to define several simpler macros to serve as
4757 subroutines for this one.  Otherwise it may be too complicated to
4758 understand.
4759
4760 This macro must exist in two variants: a strict variant and a
4761 non-strict one.  The strict variant is used in the reload pass.  It
4762 must be defined so that any pseudo-register that has not been
4763 allocated a hard register is considered a memory reference.  In
4764 contexts where some kind of register is required, a pseudo-register
4765 with no hard register must be rejected.
4766
4767 The non-strict variant is used in other passes.  It must be defined to
4768 accept all pseudo-registers in every context where some kind of
4769 register is required.
4770
4771 @findex REG_OK_STRICT
4772 Compiler source files that want to use the strict variant of this
4773 macro define the macro @code{REG_OK_STRICT}.  You should use an
4774 @code{#ifdef REG_OK_STRICT} conditional to define the strict variant
4775 in that case and the non-strict variant otherwise.
4776
4777 Subroutines to check for acceptable registers for various purposes (one
4778 for base registers, one for index registers, and so on) are typically
4779 among the subroutines used to define @code{GO_IF_LEGITIMATE_ADDRESS}.
4780 Then only these subroutine macros need have two variants; the higher
4781 levels of macros may be the same whether strict or not.
4782
4783 Normally, constant addresses which are the sum of a @code{symbol_ref}
4784 and an integer are stored inside a @code{const} RTX to mark them as
4785 constant.  Therefore, there is no need to recognize such sums
4786 specifically as legitimate addresses.  Normally you would simply
4787 recognize any @code{const} as legitimate.
4788
4789 Usually @code{PRINT_OPERAND_ADDRESS} is not prepared to handle constant
4790 sums that are not marked with  @code{const}.  It assumes that a naked
4791 @code{plus} indicates indexing.  If so, then you @emph{must} reject such
4792 naked constant sums as illegitimate addresses, so that none of them will
4793 be given to @code{PRINT_OPERAND_ADDRESS}.
4794
4795 @cindex @code{ENCODE_SECTION_INFO} and address validation
4796 On some machines, whether a symbolic address is legitimate depends on
4797 the section that the address refers to.  On these machines, define the
4798 macro @code{ENCODE_SECTION_INFO} to store the information into the
4799 @code{symbol_ref}, and then check for it here.  When you see a
4800 @code{const}, you will have to look inside it to find the
4801 @code{symbol_ref} in order to determine the section.  @xref{Assembler
4802 Format}.
4803
4804 @findex saveable_obstack
4805 The best way to modify the name string is by adding text to the
4806 beginning, with suitable punctuation to prevent any ambiguity.  Allocate
4807 the new name in @code{saveable_obstack}.  You will have to modify
4808 @code{ASM_OUTPUT_LABELREF} to remove and decode the added text and
4809 output the name accordingly, and define @code{STRIP_NAME_ENCODING} to
4810 access the original name string.
4811
4812 You can check the information stored here into the @code{symbol_ref} in
4813 the definitions of the macros @code{GO_IF_LEGITIMATE_ADDRESS} and
4814 @code{PRINT_OPERAND_ADDRESS}.
4815
4816 @findex REG_OK_FOR_BASE_P
4817 @item REG_OK_FOR_BASE_P (@var{x})
4818 A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
4819 RTX) is valid for use as a base register.  For hard registers, it
4820 should always accept those which the hardware permits and reject the
4821 others.  Whether the macro accepts or rejects pseudo registers must be
4822 controlled by @code{REG_OK_STRICT} as described above.  This usually
4823 requires two variant definitions, of which @code{REG_OK_STRICT}
4824 controls the one actually used.
4825
4826 @findex REG_MODE_OK_FOR_BASE_P
4827 @item REG_MODE_OK_FOR_BASE_P (@var{x}, @var{mode})
4828 A C expression that is just like @code{REG_OK_FOR_BASE_P}, except that
4829 that expression may examine the mode of the memory reference in
4830 @var{mode}.  You should define this macro if the mode of the memory
4831 reference affects whether a register may be used as a base register.  If
4832 you define this macro, the compiler will use it instead of
4833 @code{REG_OK_FOR_BASE_P}.
4834
4835 @findex REG_OK_FOR_INDEX_P
4836 @item REG_OK_FOR_INDEX_P (@var{x})
4837 A C expression that is nonzero if @var{x} (assumed to be a @code{reg}
4838 RTX) is valid for use as an index register.
4839
4840 The difference between an index register and a base register is that
4841 the index register may be scaled.  If an address involves the sum of
4842 two registers, neither one of them scaled, then either one may be
4843 labeled the ``base'' and the other the ``index''; but whichever
4844 labeling is used must fit the machine's constraints of which registers
4845 may serve in each capacity.  The compiler will try both labelings,
4846 looking for one that is valid, and will reload one or both registers
4847 only if neither labeling works.
4848
4849 @findex FIND_BASE_TERM
4850 @item FIND_BASE_TERM (@var{x})
4851 A C expression to determine the base term of address @var{x}.
4852 This macro is used in only one place: `find_base_term' in alias.c.
4853
4854 It is always safe for this macro to not be defined.  It exists so
4855 that alias analysis can understand machine-dependent addresses.
4856
4857 The typical use of this macro is to handle addresses containing
4858 a label_ref or symbol_ref within an UNSPEC@.
4859
4860 @findex LEGITIMIZE_ADDRESS
4861 @item LEGITIMIZE_ADDRESS (@var{x}, @var{oldx}, @var{mode}, @var{win})
4862 A C compound statement that attempts to replace @var{x} with a valid
4863 memory address for an operand of mode @var{mode}.  @var{win} will be a
4864 C statement label elsewhere in the code; the macro definition may use
4865
4866 @example
4867 GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{win});
4868 @end example
4869
4870 @noindent
4871 to avoid further processing if the address has become legitimate.
4872
4873 @findex break_out_memory_refs
4874 @var{x} will always be the result of a call to @code{break_out_memory_refs},
4875 and @var{oldx} will be the operand that was given to that function to produce
4876 @var{x}.
4877
4878 The code generated by this macro should not alter the substructure of
4879 @var{x}.  If it transforms @var{x} into a more legitimate form, it
4880 should assign @var{x} (which will always be a C variable) a new value.
4881
4882 It is not necessary for this macro to come up with a legitimate
4883 address.  The compiler has standard ways of doing so in all cases.  In
4884 fact, it is safe for this macro to do nothing.  But often a
4885 machine-dependent strategy can generate better code.
4886
4887 @findex LEGITIMIZE_RELOAD_ADDRESS
4888 @item LEGITIMIZE_RELOAD_ADDRESS (@var{x}, @var{mode}, @var{opnum}, @var{type}, @var{ind_levels}, @var{win})
4889 A C compound statement that attempts to replace @var{x}, which is an address
4890 that needs reloading, with a valid memory address for an operand of mode
4891 @var{mode}.  @var{win} will be a C statement label elsewhere in the code.
4892 It is not necessary to define this macro, but it might be useful for
4893 performance reasons.
4894
4895 For example, on the i386, it is sometimes possible to use a single
4896 reload register instead of two by reloading a sum of two pseudo
4897 registers into a register.  On the other hand, for number of RISC
4898 processors offsets are limited so that often an intermediate address
4899 needs to be generated in order to address a stack slot.  By defining
4900 @code{LEGITIMIZE_RELOAD_ADDRESS} appropriately, the intermediate addresses
4901 generated for adjacent some stack slots can be made identical, and thus
4902 be shared.
4903
4904 @emph{Note}: This macro should be used with caution.  It is necessary
4905 to know something of how reload works in order to effectively use this,
4906 and it is quite easy to produce macros that build in too much knowledge
4907 of reload internals.
4908
4909 @emph{Note}: This macro must be able to reload an address created by a
4910 previous invocation of this macro.  If it fails to handle such addresses
4911 then the compiler may generate incorrect code or abort.
4912
4913 @findex push_reload
4914 The macro definition should use @code{push_reload} to indicate parts that
4915 need reloading; @var{opnum}, @var{type} and @var{ind_levels} are usually
4916 suitable to be passed unaltered to @code{push_reload}.
4917
4918 The code generated by this macro must not alter the substructure of
4919 @var{x}.  If it transforms @var{x} into a more legitimate form, it
4920 should assign @var{x} (which will always be a C variable) a new value.
4921 This also applies to parts that you change indirectly by calling
4922 @code{push_reload}.
4923
4924 @findex strict_memory_address_p
4925 The macro definition may use @code{strict_memory_address_p} to test if
4926 the address has become legitimate.
4927
4928 @findex copy_rtx
4929 If you want to change only a part of @var{x}, one standard way of doing
4930 this is to use @code{copy_rtx}.  Note, however, that is unshares only a
4931 single level of rtl.  Thus, if the part to be changed is not at the
4932 top level, you'll need to replace first the top level.
4933 It is not necessary for this macro to come up with a legitimate
4934 address;  but often a machine-dependent strategy can generate better code.
4935
4936 @findex GO_IF_MODE_DEPENDENT_ADDRESS
4937 @item GO_IF_MODE_DEPENDENT_ADDRESS (@var{addr}, @var{label})
4938 A C statement or compound statement with a conditional @code{goto
4939 @var{label};} executed if memory address @var{x} (an RTX) can have
4940 different meanings depending on the machine mode of the memory
4941 reference it is used for or if the address is valid for some modes
4942 but not others.
4943
4944 Autoincrement and autodecrement addresses typically have mode-dependent
4945 effects because the amount of the increment or decrement is the size
4946 of the operand being addressed.  Some machines have other mode-dependent
4947 addresses.  Many RISC machines have no mode-dependent addresses.
4948
4949 You may assume that @var{addr} is a valid address for the machine.
4950
4951 @findex LEGITIMATE_CONSTANT_P
4952 @item LEGITIMATE_CONSTANT_P (@var{x})
4953 A C expression that is nonzero if @var{x} is a legitimate constant for
4954 an immediate operand on the target machine.  You can assume that
4955 @var{x} satisfies @code{CONSTANT_P}, so you need not check this.  In fact,
4956 @samp{1} is a suitable definition for this macro on machines where
4957 anything @code{CONSTANT_P} is valid.
4958 @end table
4959
4960 @node Condition Code
4961 @section Condition Code Status
4962 @cindex condition code status
4963
4964 @c prevent bad page break with this line
4965 This describes the condition code status.
4966
4967 @findex cc_status
4968 The file @file{conditions.h} defines a variable @code{cc_status} to
4969 describe how the condition code was computed (in case the interpretation of
4970 the condition code depends on the instruction that it was set by).  This
4971 variable contains the RTL expressions on which the condition code is
4972 currently based, and several standard flags.
4973
4974 Sometimes additional machine-specific flags must be defined in the machine
4975 description header file.  It can also add additional machine-specific
4976 information by defining @code{CC_STATUS_MDEP}.
4977
4978 @table @code
4979 @findex CC_STATUS_MDEP
4980 @item CC_STATUS_MDEP
4981 C code for a data type which is used for declaring the @code{mdep}
4982 component of @code{cc_status}.  It defaults to @code{int}.
4983
4984 This macro is not used on machines that do not use @code{cc0}.
4985
4986 @findex CC_STATUS_MDEP_INIT
4987 @item CC_STATUS_MDEP_INIT
4988 A C expression to initialize the @code{mdep} field to ``empty''.
4989 The default definition does nothing, since most machines don't use
4990 the field anyway.  If you want to use the field, you should probably
4991 define this macro to initialize it.
4992
4993 This macro is not used on machines that do not use @code{cc0}.
4994
4995 @findex NOTICE_UPDATE_CC
4996 @item NOTICE_UPDATE_CC (@var{exp}, @var{insn})
4997 A C compound statement to set the components of @code{cc_status}
4998 appropriately for an insn @var{insn} whose body is @var{exp}.  It is
4999 this macro's responsibility to recognize insns that set the condition
5000 code as a byproduct of other activity as well as those that explicitly
5001 set @code{(cc0)}.
5002
5003 This macro is not used on machines that do not use @code{cc0}.
5004
5005 If there are insns that do not set the condition code but do alter
5006 other machine registers, this macro must check to see whether they
5007 invalidate the expressions that the condition code is recorded as
5008 reflecting.  For example, on the 68000, insns that store in address
5009 registers do not set the condition code, which means that usually
5010 @code{NOTICE_UPDATE_CC} can leave @code{cc_status} unaltered for such
5011 insns.  But suppose that the previous insn set the condition code
5012 based on location @samp{a4@@(102)} and the current insn stores a new
5013 value in @samp{a4}.  Although the condition code is not changed by
5014 this, it will no longer be true that it reflects the contents of
5015 @samp{a4@@(102)}.  Therefore, @code{NOTICE_UPDATE_CC} must alter
5016 @code{cc_status} in this case to say that nothing is known about the
5017 condition code value.
5018
5019 The definition of @code{NOTICE_UPDATE_CC} must be prepared to deal
5020 with the results of peephole optimization: insns whose patterns are
5021 @code{parallel} RTXs containing various @code{reg}, @code{mem} or
5022 constants which are just the operands.  The RTL structure of these
5023 insns is not sufficient to indicate what the insns actually do.  What
5024 @code{NOTICE_UPDATE_CC} should do when it sees one is just to run
5025 @code{CC_STATUS_INIT}.
5026
5027 A possible definition of @code{NOTICE_UPDATE_CC} is to call a function
5028 that looks at an attribute (@pxref{Insn Attributes}) named, for example,
5029 @samp{cc}.  This avoids having detailed information about patterns in
5030 two places, the @file{md} file and in @code{NOTICE_UPDATE_CC}.
5031
5032 @findex EXTRA_CC_MODES
5033 @item EXTRA_CC_MODES
5034 A list of additional modes for condition code values in registers
5035 (@pxref{Jump Patterns}).  This macro should expand to a sequence of
5036 calls of the macro @code{CC} separated by white space.  @code{CC} takes
5037 two arguments.  The first is the enumeration name of the mode, which
5038 should begin with @samp{CC} and end with @samp{mode}.  The second is a C
5039 string giving the printable name of the mode; it should be the same as
5040 the first argument, but with the trailing @samp{mode} removed.
5041
5042 You should only define this macro if additional modes are required.
5043
5044 A sample definition of @code{EXTRA_CC_MODES} is:
5045 @smallexample
5046 #define EXTRA_CC_MODES            \
5047     CC(CC_NOOVmode, "CC_NOOV")    \
5048     CC(CCFPmode, "CCFP")          \
5049     CC(CCFPEmode, "CCFPE")
5050 @end smallexample
5051
5052 @findex SELECT_CC_MODE
5053 @item SELECT_CC_MODE (@var{op}, @var{x}, @var{y})
5054 Returns a mode from class @code{MODE_CC} to be used when comparison
5055 operation code @var{op} is applied to rtx @var{x} and @var{y}.  For
5056 example, on the Sparc, @code{SELECT_CC_MODE} is defined as (see
5057 @pxref{Jump Patterns} for a description of the reason for this
5058 definition)
5059
5060 @smallexample
5061 #define SELECT_CC_MODE(OP,X,Y) \
5062   (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT          \
5063    ? ((OP == EQ || OP == NE) ? CCFPmode : CCFPEmode)    \
5064    : ((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS    \
5065        || GET_CODE (X) == NEG) \
5066       ? CC_NOOVmode : CCmode))
5067 @end smallexample
5068
5069 You need not define this macro if @code{EXTRA_CC_MODES} is not defined.
5070
5071 @findex CANONICALIZE_COMPARISON
5072 @item CANONICALIZE_COMPARISON (@var{code}, @var{op0}, @var{op1})
5073 On some machines not all possible comparisons are defined, but you can
5074 convert an invalid comparison into a valid one.  For example, the Alpha
5075 does not have a @code{GT} comparison, but you can use an @code{LT}
5076 comparison instead and swap the order of the operands.
5077
5078 On such machines, define this macro to be a C statement to do any
5079 required conversions.  @var{code} is the initial comparison code
5080 and @var{op0} and @var{op1} are the left and right operands of the
5081 comparison, respectively.  You should modify @var{code}, @var{op0}, and
5082 @var{op1} as required.
5083
5084 GCC will not assume that the comparison resulting from this macro is
5085 valid but will see if the resulting insn matches a pattern in the
5086 @file{md} file.
5087
5088 You need not define this macro if it would never change the comparison
5089 code or operands.
5090
5091 @findex REVERSIBLE_CC_MODE
5092 @item REVERSIBLE_CC_MODE (@var{mode})
5093 A C expression whose value is one if it is always safe to reverse a
5094 comparison whose mode is @var{mode}.  If @code{SELECT_CC_MODE}
5095 can ever return @var{mode} for a floating-point inequality comparison,
5096 then @code{REVERSIBLE_CC_MODE (@var{mode})} must be zero.
5097
5098 You need not define this macro if it would always returns zero or if the
5099 floating-point format is anything other than @code{IEEE_FLOAT_FORMAT}.
5100 For example, here is the definition used on the Sparc, where floating-point
5101 inequality comparisons are always given @code{CCFPEmode}:
5102
5103 @smallexample
5104 #define REVERSIBLE_CC_MODE(MODE)  ((MODE) != CCFPEmode)
5105 @end smallexample
5106
5107 @findex REVERSE_CONDITION (@var{code}, @var{mode})
5108 A C expression whose value is reversed condition code of the @var{code} for
5109 comparison done in CC_MODE @var{mode}.  The macro is used only in case
5110 @code{REVERSIBLE_CC_MODE (@var{mode})} is nonzero.  Define this macro in case
5111 machine has some non-standard way how to reverse certain conditionals.  For
5112 instance in case all floating point conditions are non-trapping, compiler may
5113 freely convert unordered compares to ordered one.  Then definition may look
5114 like:
5115
5116 @smallexample
5117 #define REVERSE_CONDITION(CODE, MODE) \
5118    ((MODE) != CCFPmode ? reverse_condition (CODE) \
5119     : reverse_condition_maybe_unordered (CODE))
5120 @end smallexample
5121
5122 @findex REVERSE_CONDEXEC_PREDICATES_P
5123 @item REVERSE_CONDEXEC_PREDICATES_P (@var{code1}, @var{code2})
5124 A C expression that returns true if the conditional execution predicate
5125 @var{code1} is the inverse of @var{code2} and vice versa.  Define this to
5126 return 0 if the target has conditional execution predicates that cannot be
5127 reversed safely.  If no expansion is specified, this macro is defined as
5128 follows:
5129
5130 @smallexample
5131 #define REVERSE_CONDEXEC_PREDICATES_P (x, y) \
5132    ((x) == reverse_condition (y))
5133 @end smallexample
5134
5135 @end table
5136
5137 @node Costs
5138 @section Describing Relative Costs of Operations
5139 @cindex costs of instructions
5140 @cindex relative costs
5141 @cindex speed of instructions
5142
5143 These macros let you describe the relative speed of various operations
5144 on the target machine.
5145
5146 @table @code
5147 @findex CONST_COSTS
5148 @item CONST_COSTS (@var{x}, @var{code}, @var{outer_code})
5149 A part of a C @code{switch} statement that describes the relative costs
5150 of constant RTL expressions.  It must contain @code{case} labels for
5151 expression codes @code{const_int}, @code{const}, @code{symbol_ref},
5152 @code{label_ref} and @code{const_double}.  Each case must ultimately
5153 reach a @code{return} statement to return the relative cost of the use
5154 of that kind of constant value in an expression.  The cost may depend on
5155 the precise value of the constant, which is available for examination in
5156 @var{x}, and the rtx code of the expression in which it is contained,
5157 found in @var{outer_code}.
5158
5159 @var{code} is the expression code---redundant, since it can be
5160 obtained with @code{GET_CODE (@var{x})}.
5161
5162 @findex RTX_COSTS
5163 @findex COSTS_N_INSNS
5164 @item RTX_COSTS (@var{x}, @var{code}, @var{outer_code})
5165 Like @code{CONST_COSTS} but applies to nonconstant RTL expressions.
5166 This can be used, for example, to indicate how costly a multiply
5167 instruction is.  In writing this macro, you can use the construct
5168 @code{COSTS_N_INSNS (@var{n})} to specify a cost equal to @var{n} fast
5169 instructions.  @var{outer_code} is the code of the expression in which
5170 @var{x} is contained.
5171
5172 This macro is optional; do not define it if the default cost assumptions
5173 are adequate for the target machine.
5174
5175 @findex DEFAULT_RTX_COSTS
5176 @item DEFAULT_RTX_COSTS (@var{x}, @var{code}, @var{outer_code})
5177 This macro, if defined, is called for any case not handled by the
5178 @code{RTX_COSTS} or @code{CONST_COSTS} macros.  This eliminates the need
5179 to put case labels into the macro, but the code, or any functions it
5180 calls, must assume that the RTL in @var{x} could be of any type that has
5181 not already been handled.  The arguments are the same as for
5182 @code{RTX_COSTS}, and the macro should execute a return statement giving
5183 the cost of any RTL expressions that it can handle.  The default cost
5184 calculation is used for any RTL for which this macro does not return a
5185 value.
5186
5187 This macro is optional; do not define it if the default cost assumptions
5188 are adequate for the target machine.
5189
5190 @findex ADDRESS_COST
5191 @item ADDRESS_COST (@var{address})
5192 An expression giving the cost of an addressing mode that contains
5193 @var{address}.  If not defined, the cost is computed from
5194 the @var{address} expression and the @code{CONST_COSTS} values.
5195
5196 For most CISC machines, the default cost is a good approximation of the
5197 true cost of the addressing mode.  However, on RISC machines, all
5198 instructions normally have the same length and execution time.  Hence
5199 all addresses will have equal costs.
5200
5201 In cases where more than one form of an address is known, the form with
5202 the lowest cost will be used.  If multiple forms have the same, lowest,
5203 cost, the one that is the most complex will be used.
5204
5205 For example, suppose an address that is equal to the sum of a register
5206 and a constant is used twice in the same basic block.  When this macro
5207 is not defined, the address will be computed in a register and memory
5208 references will be indirect through that register.  On machines where
5209 the cost of the addressing mode containing the sum is no higher than
5210 that of a simple indirect reference, this will produce an additional
5211 instruction and possibly require an additional register.  Proper
5212 specification of this macro eliminates this overhead for such machines.
5213
5214 Similar use of this macro is made in strength reduction of loops.
5215
5216 @var{address} need not be valid as an address.  In such a case, the cost
5217 is not relevant and can be any value; invalid addresses need not be
5218 assigned a different cost.
5219
5220 On machines where an address involving more than one register is as
5221 cheap as an address computation involving only one register, defining
5222 @code{ADDRESS_COST} to reflect this can cause two registers to be live
5223 over a region of code where only one would have been if
5224 @code{ADDRESS_COST} were not defined in that manner.  This effect should
5225 be considered in the definition of this macro.  Equivalent costs should
5226 probably only be given to addresses with different numbers of registers
5227 on machines with lots of registers.
5228
5229 This macro will normally either not be defined or be defined as a
5230 constant.
5231
5232 @findex REGISTER_MOVE_COST
5233 @item REGISTER_MOVE_COST (@var{mode}, @var{from}, @var{to})
5234 A C expression for the cost of moving data of mode @var{mode} from a
5235 register in class @var{from} to one in class @var{to}.  The classes are
5236 expressed using the enumeration values such as @code{GENERAL_REGS}.  A
5237 value of 2 is the default; other values are interpreted relative to
5238 that.
5239
5240 It is not required that the cost always equal 2 when @var{from} is the
5241 same as @var{to}; on some machines it is expensive to move between
5242 registers if they are not general registers.
5243
5244 If reload sees an insn consisting of a single @code{set} between two
5245 hard registers, and if @code{REGISTER_MOVE_COST} applied to their
5246 classes returns a value of 2, reload does not check to ensure that the
5247 constraints of the insn are met.  Setting a cost of other than 2 will
5248 allow reload to verify that the constraints are met.  You should do this
5249 if the @samp{mov@var{m}} pattern's constraints do not allow such copying.
5250
5251 @findex MEMORY_MOVE_COST
5252 @item MEMORY_MOVE_COST (@var{mode}, @var{class}, @var{in})
5253 A C expression for the cost of moving data of mode @var{mode} between a
5254 register of class @var{class} and memory; @var{in} is zero if the value
5255 is to be written to memory, non-zero if it is to be read in.  This cost
5256 is relative to those in @code{REGISTER_MOVE_COST}.  If moving between
5257 registers and memory is more expensive than between two registers, you
5258 should define this macro to express the relative cost.
5259
5260 If you do not define this macro, GCC uses a default cost of 4 plus
5261 the cost of copying via a secondary reload register, if one is
5262 needed.  If your machine requires a secondary reload register to copy
5263 between memory and a register of @var{class} but the reload mechanism is
5264 more complex than copying via an intermediate, define this macro to
5265 reflect the actual cost of the move.
5266
5267 GCC defines the function @code{memory_move_secondary_cost} if
5268 secondary reloads are needed.  It computes the costs due to copying via
5269 a secondary register.  If your machine copies from memory using a
5270 secondary register in the conventional way but the default base value of
5271 4 is not correct for your machine, define this macro to add some other
5272 value to the result of that function.  The arguments to that function
5273 are the same as to this macro.
5274
5275 @findex BRANCH_COST
5276 @item BRANCH_COST
5277 A C expression for the cost of a branch instruction.  A value of 1 is
5278 the default; other values are interpreted relative to that.
5279 @end table
5280
5281 Here are additional macros which do not specify precise relative costs,
5282 but only that certain actions are more expensive than GCC would
5283 ordinarily expect.
5284
5285 @table @code
5286 @findex SLOW_BYTE_ACCESS
5287 @item SLOW_BYTE_ACCESS
5288 Define this macro as a C expression which is nonzero if accessing less
5289 than a word of memory (i.e.@: a @code{char} or a @code{short}) is no
5290 faster than accessing a word of memory, i.e., if such access
5291 require more than one instruction or if there is no difference in cost
5292 between byte and (aligned) word loads.
5293
5294 When this macro is not defined, the compiler will access a field by
5295 finding the smallest containing object; when it is defined, a fullword
5296 load will be used if alignment permits.  Unless bytes accesses are
5297 faster than word accesses, using word accesses is preferable since it
5298 may eliminate subsequent memory access if subsequent accesses occur to
5299 other fields in the same word of the structure, but to different bytes.
5300
5301 @findex SLOW_ZERO_EXTEND
5302 @item SLOW_ZERO_EXTEND
5303 Define this macro if zero-extension (of a @code{char} or @code{short}
5304 to an @code{int}) can be done faster if the destination is a register
5305 that is known to be zero.
5306
5307 If you define this macro, you must have instruction patterns that
5308 recognize RTL structures like this:
5309
5310 @smallexample
5311 (set (strict_low_part (subreg:QI (reg:SI @dots{}) 0)) @dots{})
5312 @end smallexample
5313
5314 @noindent
5315 and likewise for @code{HImode}.
5316
5317 @findex SLOW_UNALIGNED_ACCESS
5318 @item SLOW_UNALIGNED_ACCESS (@var{mode}, @var{alignment})
5319 Define this macro to be the value 1 if memory accesses described by the
5320 @var{mode} and @var{alignment} parameters have a cost many times greater
5321 than aligned accesses, for example if they are emulated in a trap
5322 handler.
5323
5324 When this macro is non-zero, the compiler will act as if
5325 @code{STRICT_ALIGNMENT} were non-zero when generating code for block
5326 moves.  This can cause significantly more instructions to be produced.
5327 Therefore, do not set this macro non-zero if unaligned accesses only add a
5328 cycle or two to the time for a memory access.
5329
5330 If the value of this macro is always zero, it need not be defined.  If
5331 this macro is defined, it should produce a non-zero value when
5332 @code{STRICT_ALIGNMENT} is non-zero.
5333
5334 @findex DONT_REDUCE_ADDR
5335 @item DONT_REDUCE_ADDR
5336 Define this macro to inhibit strength reduction of memory addresses.
5337 (On some machines, such strength reduction seems to do harm rather
5338 than good.)
5339
5340 @findex MOVE_RATIO
5341 @item MOVE_RATIO
5342 The threshold of number of scalar memory-to-memory move insns, @emph{below}
5343 which a sequence of insns should be generated instead of a
5344 string move insn or a library call.  Increasing the value will always
5345 make code faster, but eventually incurs high cost in increased code size.
5346
5347 Note that on machines where the corresponding move insn is a
5348 @code{define_expand} that emits a sequence of insns, this macro counts
5349 the number of such sequences.
5350
5351 If you don't define this, a reasonable default is used.
5352
5353 @findex MOVE_BY_PIECES_P
5354 @item MOVE_BY_PIECES_P (@var{size}, @var{alignment})
5355 A C expression used to determine whether @code{move_by_pieces} will be used to
5356 copy a chunk of memory, or whether some other block move mechanism
5357 will be used.  Defaults to 1 if @code{move_by_pieces_ninsns} returns less
5358 than @code{MOVE_RATIO}.
5359
5360 @findex MOVE_MAX_PIECES
5361 @item MOVE_MAX_PIECES
5362 A C expression used by @code{move_by_pieces} to determine the largest unit
5363 a load or store used to copy memory is.  Defaults to @code{MOVE_MAX}.
5364
5365 @findex USE_LOAD_POST_INCREMENT
5366 @item USE_LOAD_POST_INCREMENT (@var{mode})
5367 A C expression used to determine whether a load postincrement is a good
5368 thing to use for a given mode.  Defaults to the value of
5369 @code{HAVE_POST_INCREMENT}.
5370
5371 @findex USE_LOAD_POST_DECREMENT
5372 @item USE_LOAD_POST_DECREMENT (@var{mode})
5373 A C expression used to determine whether a load postdecrement is a good
5374 thing to use for a given mode.  Defaults to the value of
5375 @code{HAVE_POST_DECREMENT}.
5376
5377 @findex USE_LOAD_PRE_INCREMENT
5378 @item USE_LOAD_PRE_INCREMENT (@var{mode})
5379 A C expression used to determine whether a load preincrement is a good
5380 thing to use for a given mode.  Defaults to the value of
5381 @code{HAVE_PRE_INCREMENT}.
5382
5383 @findex USE_LOAD_PRE_DECREMENT
5384 @item USE_LOAD_PRE_DECREMENT (@var{mode})
5385 A C expression used to determine whether a load predecrement is a good
5386 thing to use for a given mode.  Defaults to the value of
5387 @code{HAVE_PRE_DECREMENT}.
5388
5389 @findex USE_STORE_POST_INCREMENT
5390 @item USE_STORE_POST_INCREMENT (@var{mode})
5391 A C expression used to determine whether a store postincrement is a good
5392 thing to use for a given mode.  Defaults to the value of
5393 @code{HAVE_POST_INCREMENT}.
5394
5395 @findex USE_STORE_POST_DECREMENT
5396 @item USE_STORE_POST_DECREMENT (@var{mode})
5397 A C expression used to determine whether a store postdecrement is a good
5398 thing to use for a given mode.  Defaults to the value of
5399 @code{HAVE_POST_DECREMENT}.
5400
5401 @findex USE_STORE_PRE_INCREMENT
5402 @item USE_STORE_PRE_INCREMENT (@var{mode})
5403 This macro is used to determine whether a store preincrement is a good
5404 thing to use for a given mode.  Defaults to the value of
5405 @code{HAVE_PRE_INCREMENT}.
5406
5407 @findex USE_STORE_PRE_DECREMENT
5408 @item USE_STORE_PRE_DECREMENT (@var{mode})
5409 This macro is used to determine whether a store predecrement is a good
5410 thing to use for a given mode.  Defaults to the value of
5411 @code{HAVE_PRE_DECREMENT}.
5412
5413 @findex NO_FUNCTION_CSE
5414 @item NO_FUNCTION_CSE
5415 Define this macro if it is as good or better to call a constant
5416 function address than to call an address kept in a register.
5417
5418 @findex NO_RECURSIVE_FUNCTION_CSE
5419 @item NO_RECURSIVE_FUNCTION_CSE
5420 Define this macro if it is as good or better for a function to call
5421 itself with an explicit address than to call an address kept in a
5422 register.
5423
5424 @findex ADJUST_COST
5425 @item ADJUST_COST (@var{insn}, @var{link}, @var{dep_insn}, @var{cost})
5426 A C statement (sans semicolon) to update the integer variable @var{cost}
5427 based on the relationship between @var{insn} that is dependent on
5428 @var{dep_insn} through the dependence @var{link}.  The default is to
5429 make no adjustment to @var{cost}.  This can be used for example to
5430 specify to the scheduler that an output- or anti-dependence does not
5431 incur the same cost as a data-dependence.
5432
5433 @findex ADJUST_PRIORITY
5434 @item ADJUST_PRIORITY (@var{insn})
5435 A C statement (sans semicolon) to update the integer scheduling
5436 priority @code{INSN_PRIORITY(@var{insn})}.  Reduce the priority
5437 to execute the @var{insn} earlier, increase the priority to execute
5438 @var{insn} later.    Do not define this macro if you do not need to
5439 adjust the scheduling priorities of insns.
5440 @end table
5441
5442 @node Sections
5443 @section Dividing the Output into Sections (Texts, Data, @dots{})
5444 @c the above section title is WAY too long.  maybe cut the part between
5445 @c the (...)?  --mew 10feb93
5446
5447 An object file is divided into sections containing different types of
5448 data.  In the most common case, there are three sections: the @dfn{text
5449 section}, which holds instructions and read-only data; the @dfn{data
5450 section}, which holds initialized writable data; and the @dfn{bss
5451 section}, which holds uninitialized data.  Some systems have other kinds
5452 of sections.
5453
5454 The compiler must tell the assembler when to switch sections.  These
5455 macros control what commands to output to tell the assembler this.  You
5456 can also define additional sections.
5457
5458 @table @code
5459 @findex TEXT_SECTION_ASM_OP
5460 @item TEXT_SECTION_ASM_OP
5461 A C expression whose value is a string, including spacing, containing the
5462 assembler operation that should precede instructions and read-only data.
5463 Normally @code{"\t.text"} is right.
5464
5465 @findex DATA_SECTION_ASM_OP
5466 @item DATA_SECTION_ASM_OP
5467 A C expression whose value is a string, including spacing, containing the
5468 assembler operation to identify the following data as writable initialized
5469 data.  Normally @code{"\t.data"} is right.
5470
5471 @findex SHARED_SECTION_ASM_OP
5472 @item SHARED_SECTION_ASM_OP
5473 If defined, a C expression whose value is a string, including spacing,
5474 containing the assembler operation to identify the following data as
5475 shared data.  If not defined, @code{DATA_SECTION_ASM_OP} will be used.
5476
5477 @findex BSS_SECTION_ASM_OP
5478 @item BSS_SECTION_ASM_OP
5479 If defined, a C expression whose value is a string, including spacing,
5480 containing the assembler operation to identify the following data as
5481 uninitialized global data.  If not defined, and neither
5482 @code{ASM_OUTPUT_BSS} nor @code{ASM_OUTPUT_ALIGNED_BSS} are defined,
5483 uninitialized global data will be output in the data section if
5484 @option{-fno-common} is passed, otherwise @code{ASM_OUTPUT_COMMON} will be
5485 used.
5486
5487 @findex SHARED_BSS_SECTION_ASM_OP
5488 @item SHARED_BSS_SECTION_ASM_OP
5489 If defined, a C expression whose value is a string, including spacing,
5490 containing the assembler operation to identify the following data as
5491 uninitialized global shared data.  If not defined, and
5492 @code{BSS_SECTION_ASM_OP} is, the latter will be used.
5493
5494 @findex INIT_SECTION_ASM_OP
5495 @item INIT_SECTION_ASM_OP
5496 If defined, a C expression whose value is a string, including spacing,
5497 containing the assembler operation to identify the following data as
5498 initialization code.  If not defined, GCC will assume such a section does
5499 not exist.
5500
5501 @findex FINI_SECTION_ASM_OP
5502 @item FINI_SECTION_ASM_OP
5503 If defined, a C expression whose value is a string, including spacing,
5504 containing the assembler operation to identify the following data as
5505 finalization code.  If not defined, GCC will assume such a section does
5506 not exist.
5507
5508 @findex CRT_CALL_STATIC_FUNCTION
5509 @item CRT_CALL_STATIC_FUNCTION
5510 If defined, a C statement that calls the function named as the sole
5511 argument of this macro.  This is used in @file{crtstuff.c} if
5512 @code{INIT_SECTION_ASM_OP} or @code{FINI_SECTION_ASM_OP} to calls to
5513 initialization and finalization functions from the init and fini
5514 sections.  By default, this macro is a simple function call.  Some
5515 ports need hand-crafted assembly code to avoid dependencies on
5516 registers initialized in the function prologue or to ensure that
5517 constant pools don't end up too far way in the text section.
5518
5519 @findex EXTRA_SECTIONS
5520 @findex in_text
5521 @findex in_data
5522 @item EXTRA_SECTIONS
5523 A list of names for sections other than the standard two, which are
5524 @code{in_text} and @code{in_data}.  You need not define this macro
5525 on a system with no other sections (that GCC needs to use).
5526
5527 @findex EXTRA_SECTION_FUNCTIONS
5528 @findex text_section
5529 @findex data_section
5530 @item EXTRA_SECTION_FUNCTIONS
5531 One or more functions to be defined in @file{varasm.c}.  These
5532 functions should do jobs analogous to those of @code{text_section} and
5533 @code{data_section}, for your additional sections.  Do not define this
5534 macro if you do not define @code{EXTRA_SECTIONS}.
5535
5536 @findex READONLY_DATA_SECTION
5537 @item READONLY_DATA_SECTION
5538 On most machines, read-only variables, constants, and jump tables are
5539 placed in the text section.  If this is not the case on your machine,
5540 this macro should be defined to be the name of a function (either
5541 @code{data_section} or a function defined in @code{EXTRA_SECTIONS}) that
5542 switches to the section to be used for read-only items.
5543
5544 If these items should be placed in the text section, this macro should
5545 not be defined.
5546
5547 @findex SELECT_SECTION
5548 @item SELECT_SECTION (@var{exp}, @var{reloc})
5549 A C statement or statements to switch to the appropriate section for
5550 output of @var{exp}.  You can assume that @var{exp} is either a
5551 @code{VAR_DECL} node or a constant of some sort.  @var{reloc}
5552 indicates whether the initial value of @var{exp} requires link-time
5553 relocations.  Select the section by calling @code{text_section} or one
5554 of the alternatives for other sections.
5555
5556 Do not define this macro if you put all read-only variables and
5557 constants in the read-only data section (usually the text section).
5558
5559 @findex SELECT_RTX_SECTION
5560 @item SELECT_RTX_SECTION (@var{mode}, @var{rtx})
5561 A C statement or statements to switch to the appropriate section for
5562 output of @var{rtx} in mode @var{mode}.  You can assume that @var{rtx}
5563 is some kind of constant in RTL@.  The argument @var{mode} is redundant
5564 except in the case of a @code{const_int} rtx.  Select the section by
5565 calling @code{text_section} or one of the alternatives for other
5566 sections.
5567
5568 Do not define this macro if you put all constants in the read-only
5569 data section.
5570
5571 @findex JUMP_TABLES_IN_TEXT_SECTION
5572 @item JUMP_TABLES_IN_TEXT_SECTION
5573 Define this macro to be an expression with a non-zero value if jump
5574 tables (for @code{tablejump} insns) should be output in the text
5575 section, along with the assembler instructions.  Otherwise, the
5576 readonly data section is used.
5577
5578 This macro is irrelevant if there is no separate readonly data section.
5579
5580 @findex ENCODE_SECTION_INFO
5581 @item ENCODE_SECTION_INFO (@var{decl})
5582 Define this macro if references to a symbol must be treated differently
5583 depending on something about the variable or function named by the
5584 symbol (such as what section it is in).
5585
5586 The macro definition, if any, is executed immediately after the rtl for
5587 @var{decl} has been created and stored in @code{DECL_RTL (@var{decl})}.
5588 The value of the rtl will be a @code{mem} whose address is a
5589 @code{symbol_ref}.
5590
5591 @cindex @code{SYMBOL_REF_FLAG}, in @code{ENCODE_SECTION_INFO}
5592 The usual thing for this macro to do is to record a flag in the
5593 @code{symbol_ref} (such as @code{SYMBOL_REF_FLAG}) or to store a
5594 modified name string in the @code{symbol_ref} (if one bit is not enough
5595 information).
5596
5597 @findex STRIP_NAME_ENCODING
5598 @item STRIP_NAME_ENCODING (@var{var}, @var{sym_name})
5599 Decode @var{sym_name} and store the real name part in @var{var}, sans
5600 the characters that encode section info.  Define this macro if
5601 @code{ENCODE_SECTION_INFO} alters the symbol's name string.
5602
5603 @findex UNIQUE_SECTION_P
5604 @item UNIQUE_SECTION_P (@var{decl})
5605 A C expression which evaluates to true if @var{decl} should be placed
5606 into a unique section for some target-specific reason.  If you do not
5607 define this macro, the default is @samp{0}.  Note that the flag
5608 @option{-ffunction-sections} will also cause functions to be placed into
5609 unique sections.
5610
5611 @findex UNIQUE_SECTION
5612 @item UNIQUE_SECTION (@var{decl}, @var{reloc})
5613 A C statement to build up a unique section name, expressed as a
5614 @code{STRING_CST} node, and assign it to @samp{DECL_SECTION_NAME (@var{decl})}.
5615 @var{reloc} indicates whether the initial value of @var{exp} requires
5616 link-time relocations.  If you do not define this macro, GCC will use
5617 the symbol name prefixed by @samp{.} as the section name.  Note - this
5618 macro can now be called for uninitialised data items as well as
5619 initialised data and functions.
5620 @end table
5621
5622 @node PIC
5623 @section Position Independent Code
5624 @cindex position independent code
5625 @cindex PIC
5626
5627 This section describes macros that help implement generation of position
5628 independent code.  Simply defining these macros is not enough to
5629 generate valid PIC; you must also add support to the macros
5630 @code{GO_IF_LEGITIMATE_ADDRESS} and @code{PRINT_OPERAND_ADDRESS}, as
5631 well as @code{LEGITIMIZE_ADDRESS}.  You must modify the definition of
5632 @samp{movsi} to do something appropriate when the source operand
5633 contains a symbolic address.  You may also need to alter the handling of
5634 switch statements so that they use relative addresses.
5635 @c i rearranged the order of the macros above to try to force one of
5636 @c them to the next line, to eliminate an overfull hbox. --mew 10feb93
5637
5638 @table @code
5639 @findex PIC_OFFSET_TABLE_REGNUM
5640 @item PIC_OFFSET_TABLE_REGNUM
5641 The register number of the register used to address a table of static
5642 data addresses in memory.  In some cases this register is defined by a
5643 processor's ``application binary interface'' (ABI)@.  When this macro
5644 is defined, RTL is generated for this register once, as with the stack
5645 pointer and frame pointer registers.  If this macro is not defined, it
5646 is up to the machine-dependent files to allocate such a register (if
5647 necessary).
5648
5649 @findex PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
5650 @item PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
5651 Define this macro if the register defined by
5652 @code{PIC_OFFSET_TABLE_REGNUM} is clobbered by calls.  Do not define
5653 this macro if @code{PIC_OFFSET_TABLE_REGNUM} is not defined.
5654
5655 @findex FINALIZE_PIC
5656 @item FINALIZE_PIC
5657 By generating position-independent code, when two different programs (A
5658 and B) share a common library (libC.a), the text of the library can be
5659 shared whether or not the library is linked at the same address for both
5660 programs.  In some of these environments, position-independent code
5661 requires not only the use of different addressing modes, but also
5662 special code to enable the use of these addressing modes.
5663
5664 The @code{FINALIZE_PIC} macro serves as a hook to emit these special
5665 codes once the function is being compiled into assembly code, but not
5666 before.  (It is not done before, because in the case of compiling an
5667 inline function, it would lead to multiple PIC prologues being
5668 included in functions which used inline functions and were compiled to
5669 assembly language.)
5670
5671 @findex LEGITIMATE_PIC_OPERAND_P
5672 @item LEGITIMATE_PIC_OPERAND_P (@var{x})
5673 A C expression that is nonzero if @var{x} is a legitimate immediate
5674 operand on the target machine when generating position independent code.
5675 You can assume that @var{x} satisfies @code{CONSTANT_P}, so you need not
5676 check this.  You can also assume @var{flag_pic} is true, so you need not
5677 check it either.  You need not define this macro if all constants
5678 (including @code{SYMBOL_REF}) can be immediate operands when generating
5679 position independent code.
5680 @end table
5681
5682 @node Assembler Format
5683 @section Defining the Output Assembler Language
5684
5685 This section describes macros whose principal purpose is to describe how
5686 to write instructions in assembler language---rather than what the
5687 instructions do.
5688
5689 @menu
5690 * File Framework::       Structural information for the assembler file.
5691 * Data Output::          Output of constants (numbers, strings, addresses).
5692 * Uninitialized Data::   Output of uninitialized variables.
5693 * Label Output::         Output and generation of labels.
5694 * Initialization::       General principles of initialization
5695                            and termination routines.
5696 * Macros for Initialization::
5697                          Specific macros that control the handling of
5698                            initialization and termination routines.
5699 * Instruction Output::   Output of actual instructions.
5700 * Dispatch Tables::      Output of jump tables.
5701 * Exception Region Output:: Output of exception region code.
5702 * Alignment Output::     Pseudo ops for alignment and skipping data.
5703 @end menu
5704
5705 @node File Framework
5706 @subsection The Overall Framework of an Assembler File
5707 @cindex assembler format
5708 @cindex output of assembler code
5709
5710 @c prevent bad page break with this line
5711 This describes the overall framework of an assembler file.
5712
5713 @table @code
5714 @findex ASM_FILE_START
5715 @item ASM_FILE_START (@var{stream})
5716 A C expression which outputs to the stdio stream @var{stream}
5717 some appropriate text to go at the start of an assembler file.
5718
5719 Normally this macro is defined to output a line containing
5720 @samp{#NO_APP}, which is a comment that has no effect on most
5721 assemblers but tells the GNU assembler that it can save time by not
5722 checking for certain assembler constructs.
5723
5724 On systems that use SDB, it is necessary to output certain commands;
5725 see @file{attasm.h}.
5726
5727 @findex ASM_FILE_END
5728 @item ASM_FILE_END (@var{stream})
5729 A C expression which outputs to the stdio stream @var{stream}
5730 some appropriate text to go at the end of an assembler file.
5731
5732 If this macro is not defined, the default is to output nothing
5733 special at the end of the file.  Most systems don't require any
5734 definition.
5735
5736 On systems that use SDB, it is necessary to output certain commands;
5737 see @file{attasm.h}.
5738
5739 @findex ASM_COMMENT_START
5740 @item ASM_COMMENT_START
5741 A C string constant describing how to begin a comment in the target
5742 assembler language.  The compiler assumes that the comment will end at
5743 the end of the line.
5744
5745 @findex ASM_APP_ON
5746 @item ASM_APP_ON
5747 A C string constant for text to be output before each @code{asm}
5748 statement or group of consecutive ones.  Normally this is
5749 @code{"#APP"}, which is a comment that has no effect on most
5750 assemblers but tells the GNU assembler that it must check the lines
5751 that follow for all valid assembler constructs.
5752
5753 @findex ASM_APP_OFF
5754 @item ASM_APP_OFF
5755 A C string constant for text to be output after each @code{asm}
5756 statement or group of consecutive ones.  Normally this is
5757 @code{"#NO_APP"}, which tells the GNU assembler to resume making the
5758 time-saving assumptions that are valid for ordinary compiler output.
5759
5760 @findex ASM_OUTPUT_SOURCE_FILENAME
5761 @item ASM_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name})
5762 A C statement to output COFF information or DWARF debugging information
5763 which indicates that filename @var{name} is the current source file to
5764 the stdio stream @var{stream}.
5765
5766 This macro need not be defined if the standard form of output
5767 for the file format in use is appropriate.
5768
5769 @findex OUTPUT_QUOTED_STRING
5770 @item OUTPUT_QUOTED_STRING (@var{stream}, @var{string})
5771 A C statement to output the string @var{string} to the stdio stream
5772 @var{stream}.  If you do not call the function @code{output_quoted_string}
5773 in your config files, GCC will only call it to output filenames to
5774 the assembler source.  So you can use it to canonicalize the format
5775 of the filename using this macro.
5776
5777 @findex ASM_OUTPUT_SOURCE_LINE
5778 @item ASM_OUTPUT_SOURCE_LINE (@var{stream}, @var{line})
5779 A C statement to output DBX or SDB debugging information before code
5780 for line number @var{line} of the current source file to the
5781 stdio stream @var{stream}.
5782
5783 This macro need not be defined if the standard form of debugging
5784 information for the debugger in use is appropriate.
5785
5786 @findex ASM_OUTPUT_IDENT
5787 @item ASM_OUTPUT_IDENT (@var{stream}, @var{string})
5788 A C statement to output something to the assembler file to handle a
5789 @samp{#ident} directive containing the text @var{string}.  If this
5790 macro is not defined, nothing is output for a @samp{#ident} directive.
5791
5792 @findex ASM_OUTPUT_SECTION_NAME
5793 @item ASM_OUTPUT_SECTION_NAME (@var{stream}, @var{decl}, @var{name}, @var{reloc})
5794 A C statement to output something to the assembler file to switch to section
5795 @var{name} for object @var{decl} which is either a @code{FUNCTION_DECL}, a
5796 @code{VAR_DECL} or @code{NULL_TREE}.  @var{reloc}
5797 indicates whether the initial value of @var{exp} requires link-time
5798 relocations.  The string given by @var{name} will always be the
5799 canonical version stored in the global stringpool.
5800
5801 Some target formats do not support arbitrary sections.  Do not define
5802 this macro in such cases.
5803
5804 At present this macro is only used to support section attributes.
5805 When this macro is undefined, section attributes are disabled.
5806
5807 @findex OBJC_PROLOGUE
5808 @item OBJC_PROLOGUE
5809 A C statement to output any assembler statements which are required to
5810 precede any Objective-C object definitions or message sending.  The
5811 statement is executed only when compiling an Objective-C program.
5812 @end table
5813
5814 @need 2000
5815 @node Data Output
5816 @subsection Output of Data
5817
5818 @c prevent bad page break with this line
5819 This describes data output.
5820
5821 @table @code
5822 @findex ASM_OUTPUT_LONG_DOUBLE
5823 @findex ASM_OUTPUT_DOUBLE
5824 @findex ASM_OUTPUT_FLOAT
5825 @item ASM_OUTPUT_LONG_DOUBLE (@var{stream}, @var{value})
5826 @itemx ASM_OUTPUT_DOUBLE (@var{stream}, @var{value})
5827 @itemx ASM_OUTPUT_FLOAT (@var{stream}, @var{value})
5828 @itemx ASM_OUTPUT_THREE_QUARTER_FLOAT (@var{stream}, @var{value})
5829 @itemx ASM_OUTPUT_SHORT_FLOAT (@var{stream}, @var{value})
5830 @itemx ASM_OUTPUT_BYTE_FLOAT (@var{stream}, @var{value})
5831 A C statement to output to the stdio stream @var{stream} an assembler
5832 instruction to assemble a floating-point constant of @code{TFmode},
5833 @code{DFmode}, @code{SFmode}, @code{TQFmode}, @code{HFmode}, or
5834 @code{QFmode}, respectively, whose value is @var{value}.  @var{value}
5835 will be a C expression of type @code{REAL_VALUE_TYPE}.  Macros such as
5836 @code{REAL_VALUE_TO_TARGET_DOUBLE} are useful for writing these
5837 definitions.
5838
5839 @findex ASM_OUTPUT_QUADRUPLE_INT
5840 @findex ASM_OUTPUT_DOUBLE_INT
5841 @findex ASM_OUTPUT_INT
5842 @findex ASM_OUTPUT_SHORT
5843 @findex ASM_OUTPUT_CHAR
5844 @findex output_addr_const
5845 @item ASM_OUTPUT_QUADRUPLE_INT (@var{stream}, @var{exp})
5846 @itemx ASM_OUTPUT_DOUBLE_INT (@var{stream}, @var{exp})
5847 @itemx ASM_OUTPUT_INT (@var{stream}, @var{exp})
5848 @itemx ASM_OUTPUT_SHORT (@var{stream}, @var{exp})
5849 @itemx ASM_OUTPUT_CHAR (@var{stream}, @var{exp})
5850 A C statement to output to the stdio stream @var{stream} an assembler
5851 instruction to assemble an integer of 16, 8, 4, 2 or 1 bytes,
5852 respectively, whose value is @var{value}.  The argument @var{exp} will
5853 be an RTL expression which represents a constant value.  Use
5854 @samp{output_addr_const (@var{stream}, @var{exp})} to output this value
5855 as an assembler expression.
5856
5857 For sizes larger than @code{UNITS_PER_WORD}, if the action of a macro
5858 would be identical to repeatedly calling the macro corresponding to
5859 a size of @code{UNITS_PER_WORD}, once for each word, you need not define
5860 the macro.
5861
5862 @findex OUTPUT_ADDR_CONST_EXTRA
5863 @item OUTPUT_ADDR_CONST_EXTRA (@var{stream}, @var{x}, @var{fail})
5864 A C statement to recognize @var{rtx} patterns that
5865 @code{output_addr_const} can't deal with, and output assembly code to
5866 @var{stream} corresponding to the pattern @var{x}.  This may be used to
5867 allow machine-dependent @code{UNSPEC}s to appear within constants.
5868
5869 If @code{OUTPUT_ADDR_CONST_EXTRA} fails to recognize a pattern, it must
5870 @code{goto fail}, so that a standard error message is printed.  If it
5871 prints an error message itself, by calling, for example,
5872 @code{output_operand_lossage}, it may just complete normally.
5873
5874 @findex ASM_OUTPUT_BYTE
5875 @item ASM_OUTPUT_BYTE (@var{stream}, @var{value})
5876 A C statement to output to the stdio stream @var{stream} an assembler
5877 instruction to assemble a single byte containing the number @var{value}.
5878
5879 @findex ASM_BYTE_OP
5880 @item ASM_BYTE_OP
5881 A C string constant, including spacing, giving the pseudo-op to use for a
5882 sequence of single-byte constants.  If this macro is not defined, the
5883 default is @code{"\t.byte\t"}.
5884
5885 @findex UNALIGNED_SHORT_ASM_OP
5886 @findex UNALIGNED_INT_ASM_OP
5887 @findex UNALIGNED_DOUBLE_INT_ASM_OP
5888 @item UNALIGNED_SHORT_ASM_OP
5889 @itemx UNALIGNED_INT_ASM_OP
5890 @itemx UNALIGNED_DOUBLE_INT_ASM_OP
5891 A C string constant, including spacing, giving the pseudo-op to use
5892 to assemble 16-, 32-, and 64-bit integers respectively @emph{without}
5893 adding implicit padding or alignment.  These macros are required if
5894 DWARF 2 frame unwind is used.  On ELF systems, these will default
5895 to @code{.2byte}, @code{.4byte}, and @code{.8byte}.
5896
5897 @findex ASM_OUTPUT_ASCII
5898 @item ASM_OUTPUT_ASCII (@var{stream}, @var{ptr}, @var{len})
5899 A C statement to output to the stdio stream @var{stream} an assembler
5900 instruction to assemble a string constant containing the @var{len}
5901 bytes at @var{ptr}.  @var{ptr} will be a C expression of type
5902 @code{char *} and @var{len} a C expression of type @code{int}.
5903
5904 If the assembler has a @code{.ascii} pseudo-op as found in the
5905 Berkeley Unix assembler, do not define the macro
5906 @code{ASM_OUTPUT_ASCII}.
5907
5908 @findex CONSTANT_POOL_BEFORE_FUNCTION
5909 @item CONSTANT_POOL_BEFORE_FUNCTION
5910 You may define this macro as a C expression.  You should define the
5911 expression to have a non-zero value if GCC should output the constant
5912 pool for a function before the code for the function, or a zero value if
5913 GCC should output the constant pool after the function.  If you do
5914 not define this macro, the usual case, GCC will output the constant
5915 pool before the function.
5916
5917 @findex ASM_OUTPUT_POOL_PROLOGUE
5918 @item ASM_OUTPUT_POOL_PROLOGUE (@var{file}, @var{funname}, @var{fundecl}, @var{size})
5919 A C statement to output assembler commands to define the start of the
5920 constant pool for a function.  @var{funname} is a string giving
5921 the name of the function.  Should the return type of the function
5922 be required, it can be obtained via @var{fundecl}.  @var{size}
5923 is the size, in bytes, of the constant pool that will be written
5924 immediately after this call.
5925
5926 If no constant-pool prefix is required, the usual case, this macro need
5927 not be defined.
5928
5929 @findex ASM_OUTPUT_SPECIAL_POOL_ENTRY
5930 @item ASM_OUTPUT_SPECIAL_POOL_ENTRY (@var{file}, @var{x}, @var{mode}, @var{align}, @var{labelno}, @var{jumpto})
5931 A C statement (with or without semicolon) to output a constant in the
5932 constant pool, if it needs special treatment.  (This macro need not do
5933 anything for RTL expressions that can be output normally.)
5934
5935 The argument @var{file} is the standard I/O stream to output the
5936 assembler code on.  @var{x} is the RTL expression for the constant to
5937 output, and @var{mode} is the machine mode (in case @var{x} is a
5938 @samp{const_int}).  @var{align} is the required alignment for the value
5939 @var{x}; you should output an assembler directive to force this much
5940 alignment.
5941
5942 The argument @var{labelno} is a number to use in an internal label for
5943 the address of this pool entry.  The definition of this macro is
5944 responsible for outputting the label definition at the proper place.
5945 Here is how to do this:
5946
5947 @example
5948 ASM_OUTPUT_INTERNAL_LABEL (@var{file}, "LC", @var{labelno});
5949 @end example
5950
5951 When you output a pool entry specially, you should end with a
5952 @code{goto} to the label @var{jumpto}.  This will prevent the same pool
5953 entry from being output a second time in the usual manner.
5954
5955 You need not define this macro if it would do nothing.
5956
5957 @findex CONSTANT_AFTER_FUNCTION_P
5958 @item CONSTANT_AFTER_FUNCTION_P (@var{exp})
5959 Define this macro as a C expression which is nonzero if the constant
5960 @var{exp}, of type @code{tree}, should be output after the code for a
5961 function.  The compiler will normally output all constants before the
5962 function; you need not define this macro if this is OK@.
5963
5964 @findex ASM_OUTPUT_POOL_EPILOGUE
5965 @item ASM_OUTPUT_POOL_EPILOGUE (@var{file} @var{funname} @var{fundecl} @var{size})
5966 A C statement to output assembler commands to at the end of the constant
5967 pool for a function.  @var{funname} is a string giving the name of the
5968 function.  Should the return type of the function be required, you can
5969 obtain it via @var{fundecl}.  @var{size} is the size, in bytes, of the
5970 constant pool that GCC wrote immediately before this call.
5971
5972 If no constant-pool epilogue is required, the usual case, you need not
5973 define this macro.
5974
5975 @findex IS_ASM_LOGICAL_LINE_SEPARATOR
5976 @item IS_ASM_LOGICAL_LINE_SEPARATOR (@var{C})
5977 Define this macro as a C expression which is nonzero if @var{C} is
5978 used as a logical line separator by the assembler.
5979
5980 If you do not define this macro, the default is that only
5981 the character @samp{;} is treated as a logical line separator.
5982 @end table
5983
5984 @deftypevr {Target Hook} {const char *} TARGET_ASM_OPEN_PAREN
5985 @end deftypevr
5986 @deftypevr {Target Hook} {const char *} TARGET_ASM_CLOSE_PAREN
5987 These target hooks are C string constants, describing the syntax in the
5988 assembler for grouping arithmetic expressions.  If not overridden, they
5989 default to normal parentheses, which is correct for most assemblers.
5990 @end deftypevr
5991
5992   These macros are provided by @file{real.h} for writing the definitions
5993 of @code{ASM_OUTPUT_DOUBLE} and the like:
5994
5995 @table @code
5996 @item REAL_VALUE_TO_TARGET_SINGLE (@var{x}, @var{l})
5997 @itemx REAL_VALUE_TO_TARGET_DOUBLE (@var{x}, @var{l})
5998 @itemx REAL_VALUE_TO_TARGET_LONG_DOUBLE (@var{x}, @var{l})
5999 @findex REAL_VALUE_TO_TARGET_SINGLE
6000 @findex REAL_VALUE_TO_TARGET_DOUBLE
6001 @findex REAL_VALUE_TO_TARGET_LONG_DOUBLE
6002 These translate @var{x}, of type @code{REAL_VALUE_TYPE}, to the target's
6003 floating point representation, and store its bit pattern in the array of
6004 @code{long int} whose address is @var{l}.  The number of elements in the
6005 output array is determined by the size of the desired target floating
6006 point data type: 32 bits of it go in each @code{long int} array
6007 element.  Each array element holds 32 bits of the result, even if
6008 @code{long int} is wider than 32 bits on the host machine.
6009
6010 The array element values are designed so that you can print them out
6011 using @code{fprintf} in the order they should appear in the target
6012 machine's memory.
6013
6014 @item REAL_VALUE_TO_DECIMAL (@var{x}, @var{format}, @var{string})
6015 @findex REAL_VALUE_TO_DECIMAL
6016 This macro converts @var{x}, of type @code{REAL_VALUE_TYPE}, to a
6017 decimal number and stores it as a string into @var{string}.
6018 You must pass, as @var{string}, the address of a long enough block
6019 of space to hold the result.
6020
6021 The argument @var{format} is a @code{printf}-specification that serves
6022 as a suggestion for how to format the output string.
6023 @end table
6024
6025 @node Uninitialized Data
6026 @subsection Output of Uninitialized Variables
6027
6028 Each of the macros in this section is used to do the whole job of
6029 outputting a single uninitialized variable.
6030
6031 @table @code
6032 @findex ASM_OUTPUT_COMMON
6033 @item ASM_OUTPUT_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
6034 A C statement (sans semicolon) to output to the stdio stream
6035 @var{stream} the assembler definition of a common-label named
6036 @var{name} whose size is @var{size} bytes.  The variable @var{rounded}
6037 is the size rounded up to whatever alignment the caller wants.
6038
6039 Use the expression @code{assemble_name (@var{stream}, @var{name})} to
6040 output the name itself; before and after that, output the additional
6041 assembler syntax for defining the name, and a newline.
6042
6043 This macro controls how the assembler definitions of uninitialized
6044 common global variables are output.
6045
6046 @findex ASM_OUTPUT_ALIGNED_COMMON
6047 @item ASM_OUTPUT_ALIGNED_COMMON (@var{stream}, @var{name}, @var{size}, @var{alignment})
6048 Like @code{ASM_OUTPUT_COMMON} except takes the required alignment as a
6049 separate, explicit argument.  If you define this macro, it is used in
6050 place of @code{ASM_OUTPUT_COMMON}, and gives you more flexibility in
6051 handling the required alignment of the variable.  The alignment is specified
6052 as the number of bits.
6053
6054 @findex ASM_OUTPUT_ALIGNED_DECL_COMMON
6055 @item ASM_OUTPUT_ALIGNED_DECL_COMMON (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
6056 Like @code{ASM_OUTPUT_ALIGNED_COMMON} except that @var{decl} of the
6057 variable to be output, if there is one, or @code{NULL_TREE} if there
6058 is no corresponding variable.  If you define this macro, GCC will use it
6059 in place of both @code{ASM_OUTPUT_COMMON} and
6060 @code{ASM_OUTPUT_ALIGNED_COMMON}.  Define this macro when you need to see
6061 the variable's decl in order to chose what to output.
6062
6063 @findex ASM_OUTPUT_SHARED_COMMON
6064 @item ASM_OUTPUT_SHARED_COMMON (@var{stream}, @var{name}, @var{size}, @var{rounded})
6065 If defined, it is similar to @code{ASM_OUTPUT_COMMON}, except that it
6066 is used when @var{name} is shared.  If not defined, @code{ASM_OUTPUT_COMMON}
6067 will be used.
6068
6069 @findex ASM_OUTPUT_BSS
6070 @item ASM_OUTPUT_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{rounded})
6071 A C statement (sans semicolon) to output to the stdio stream
6072 @var{stream} the assembler definition of uninitialized global @var{decl} named
6073 @var{name} whose size is @var{size} bytes.  The variable @var{rounded}
6074 is the size rounded up to whatever alignment the caller wants.
6075
6076 Try to use function @code{asm_output_bss} defined in @file{varasm.c} when
6077 defining this macro.  If unable, use the expression
6078 @code{assemble_name (@var{stream}, @var{name})} to output the name itself;
6079 before and after that, output the additional assembler syntax for defining
6080 the name, and a newline.
6081
6082 This macro controls how the assembler definitions of uninitialized global
6083 variables are output.  This macro exists to properly support languages like
6084 C++ which do not have @code{common} data.  However, this macro currently
6085 is not defined for all targets.  If this macro and
6086 @code{ASM_OUTPUT_ALIGNED_BSS} are not defined then @code{ASM_OUTPUT_COMMON}
6087 or @code{ASM_OUTPUT_ALIGNED_COMMON} or
6088 @code{ASM_OUTPUT_ALIGNED_DECL_COMMON} is used.
6089
6090 @findex ASM_OUTPUT_ALIGNED_BSS
6091 @item ASM_OUTPUT_ALIGNED_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
6092 Like @code{ASM_OUTPUT_BSS} except takes the required alignment as a
6093 separate, explicit argument.  If you define this macro, it is used in
6094 place of @code{ASM_OUTPUT_BSS}, and gives you more flexibility in
6095 handling the required alignment of the variable.  The alignment is specified
6096 as the number of bits.
6097
6098 Try to use function @code{asm_output_aligned_bss} defined in file
6099 @file{varasm.c} when defining this macro.
6100
6101 @findex ASM_OUTPUT_SHARED_BSS
6102 @item ASM_OUTPUT_SHARED_BSS (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{rounded})
6103 If defined, it is similar to @code{ASM_OUTPUT_BSS}, except that it
6104 is used when @var{name} is shared.  If not defined, @code{ASM_OUTPUT_BSS}
6105 will be used.
6106
6107 @findex ASM_OUTPUT_LOCAL
6108 @item ASM_OUTPUT_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
6109 A C statement (sans semicolon) to output to the stdio stream
6110 @var{stream} the assembler definition of a local-common-label named
6111 @var{name} whose size is @var{size} bytes.  The variable @var{rounded}
6112 is the size rounded up to whatever alignment the caller wants.
6113
6114 Use the expression @code{assemble_name (@var{stream}, @var{name})} to
6115 output the name itself; before and after that, output the additional
6116 assembler syntax for defining the name, and a newline.
6117
6118 This macro controls how the assembler definitions of uninitialized
6119 static variables are output.
6120
6121 @findex ASM_OUTPUT_ALIGNED_LOCAL
6122 @item ASM_OUTPUT_ALIGNED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{alignment})
6123 Like @code{ASM_OUTPUT_LOCAL} except takes the required alignment as a
6124 separate, explicit argument.  If you define this macro, it is used in
6125 place of @code{ASM_OUTPUT_LOCAL}, and gives you more flexibility in
6126 handling the required alignment of the variable.  The alignment is specified
6127 as the number of bits.
6128
6129 @findex ASM_OUTPUT_ALIGNED_DECL_LOCAL
6130 @item ASM_OUTPUT_ALIGNED_DECL_LOCAL (@var{stream}, @var{decl}, @var{name}, @var{size}, @var{alignment})
6131 Like @code{ASM_OUTPUT_ALIGNED_DECL} except that @var{decl} of the
6132 variable to be output, if there is one, or @code{NULL_TREE} if there
6133 is no corresponding variable.  If you define this macro, GCC will use it
6134 in place of both @code{ASM_OUTPUT_DECL} and
6135 @code{ASM_OUTPUT_ALIGNED_DECL}.  Define this macro when you need to see
6136 the variable's decl in order to chose what to output.
6137
6138 @findex ASM_OUTPUT_SHARED_LOCAL
6139 @item ASM_OUTPUT_SHARED_LOCAL (@var{stream}, @var{name}, @var{size}, @var{rounded})
6140 If defined, it is similar to @code{ASM_OUTPUT_LOCAL}, except that it
6141 is used when @var{name} is shared.  If not defined, @code{ASM_OUTPUT_LOCAL}
6142 will be used.
6143 @end table
6144
6145 @node Label Output
6146 @subsection Output and Generation of Labels
6147
6148 @c prevent bad page break with this line
6149 This is about outputting labels.
6150
6151 @table @code
6152 @findex ASM_OUTPUT_LABEL
6153 @findex assemble_name
6154 @item ASM_OUTPUT_LABEL (@var{stream}, @var{name})
6155 A C statement (sans semicolon) to output to the stdio stream
6156 @var{stream} the assembler definition of a label named @var{name}.
6157 Use the expression @code{assemble_name (@var{stream}, @var{name})} to
6158 output the name itself; before and after that, output the additional
6159 assembler syntax for defining the name, and a newline.
6160
6161 @findex ASM_DECLARE_FUNCTION_NAME
6162 @item ASM_DECLARE_FUNCTION_NAME (@var{stream}, @var{name}, @var{decl})
6163 A C statement (sans semicolon) to output to the stdio stream
6164 @var{stream} any text necessary for declaring the name @var{name} of a
6165 function which is being defined.  This macro is responsible for
6166 outputting the label definition (perhaps using
6167 @code{ASM_OUTPUT_LABEL}).  The argument @var{decl} is the
6168 @code{FUNCTION_DECL} tree node representing the function.
6169
6170 If this macro is not defined, then the function name is defined in the
6171 usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
6172
6173 @findex ASM_DECLARE_FUNCTION_SIZE
6174 @item ASM_DECLARE_FUNCTION_SIZE (@var{stream}, @var{name}, @var{decl})
6175 A C statement (sans semicolon) to output to the stdio stream
6176 @var{stream} any text necessary for declaring the size of a function
6177 which is being defined.  The argument @var{name} is the name of the
6178 function.  The argument @var{decl} is the @code{FUNCTION_DECL} tree node
6179 representing the function.
6180
6181 If this macro is not defined, then the function size is not defined.
6182
6183 @findex ASM_DECLARE_OBJECT_NAME
6184 @item ASM_DECLARE_OBJECT_NAME (@var{stream}, @var{name}, @var{decl})
6185 A C statement (sans semicolon) to output to the stdio stream
6186 @var{stream} any text necessary for declaring the name @var{name} of an
6187 initialized variable which is being defined.  This macro must output the
6188 label definition (perhaps using @code{ASM_OUTPUT_LABEL}).  The argument
6189 @var{decl} is the @code{VAR_DECL} tree node representing the variable.
6190
6191 If this macro is not defined, then the variable name is defined in the
6192 usual manner as a label (by means of @code{ASM_OUTPUT_LABEL}).
6193
6194 @findex ASM_DECLARE_REGISTER_GLOBAL
6195 @item ASM_DECLARE_REGISTER_GLOBAL (@var{stream}, @var{decl}, @var{regno}, @var{name})
6196 A C statement (sans semicolon) to output to the stdio stream
6197 @var{stream} any text necessary for claiming a register @var{regno}
6198 for a global variable @var{decl} with name @var{name}.
6199
6200 If you don't define this macro, that is equivalent to defining it to do
6201 nothing.
6202
6203 @findex  ASM_FINISH_DECLARE_OBJECT
6204 @item ASM_FINISH_DECLARE_OBJECT (@var{stream}, @var{decl}, @var{toplevel}, @var{atend})
6205 A C statement (sans semicolon) to finish up declaring a variable name
6206 once the compiler has processed its initializer fully and thus has had a
6207 chance to determine the size of an array when controlled by an
6208 initializer.  This is used on systems where it's necessary to declare
6209 something about the size of the object.
6210
6211 If you don't define this macro, that is equivalent to defining it to do
6212 nothing.
6213
6214 @findex ASM_GLOBALIZE_LABEL
6215 @item ASM_GLOBALIZE_LABEL (@var{stream}, @var{name})
6216 A C statement (sans semicolon) to output to the stdio stream
6217 @var{stream} some commands that will make the label @var{name} global;
6218 that is, available for reference from other files.  Use the expression
6219 @code{assemble_name (@var{stream}, @var{name})} to output the name
6220 itself; before and after that, output the additional assembler syntax
6221 for making that name global, and a newline.
6222
6223 @findex ASM_WEAKEN_LABEL
6224 @item ASM_WEAKEN_LABEL
6225 A C statement (sans semicolon) to output to the stdio stream
6226 @var{stream} some commands that will make the label @var{name} weak;
6227 that is, available for reference from other files but only used if
6228 no other definition is available.  Use the expression
6229 @code{assemble_name (@var{stream}, @var{name})} to output the name
6230 itself; before and after that, output the additional assembler syntax
6231 for making that name weak, and a newline.
6232
6233 If you don't define this macro, GCC will not support weak
6234 symbols and you should not define the @code{SUPPORTS_WEAK} macro.
6235
6236 @findex SUPPORTS_WEAK
6237 @item SUPPORTS_WEAK
6238 A C expression which evaluates to true if the target supports weak symbols.
6239
6240 If you don't define this macro, @file{defaults.h} provides a default
6241 definition.  If @code{ASM_WEAKEN_LABEL} is defined, the default
6242 definition is @samp{1}; otherwise, it is @samp{0}.  Define this macro if
6243 you want to control weak symbol support with a compiler flag such as
6244 @option{-melf}.
6245
6246 @findex MAKE_DECL_ONE_ONLY (@var{decl})
6247 @item MAKE_DECL_ONE_ONLY
6248 A C statement (sans semicolon) to mark @var{decl} to be emitted as a
6249 public symbol such that extra copies in multiple translation units will
6250 be discarded by the linker.  Define this macro if your object file
6251 format provides support for this concept, such as the @samp{COMDAT}
6252 section flags in the Microsoft Windows PE/COFF format, and this support
6253 requires changes to @var{decl}, such as putting it in a separate section.
6254
6255 @findex SUPPORTS_ONE_ONLY
6256 @item SUPPORTS_ONE_ONLY
6257 A C expression which evaluates to true if the target supports one-only
6258 semantics.
6259
6260 If you don't define this macro, @file{varasm.c} provides a default
6261 definition.  If @code{MAKE_DECL_ONE_ONLY} is defined, the default
6262 definition is @samp{1}; otherwise, it is @samp{0}.  Define this macro if
6263 you want to control one-only symbol support with a compiler flag, or if
6264 setting the @code{DECL_ONE_ONLY} flag is enough to mark a declaration to
6265 be emitted as one-only.
6266
6267 @findex ASM_OUTPUT_EXTERNAL
6268 @item ASM_OUTPUT_EXTERNAL (@var{stream}, @var{decl}, @var{name})
6269 A C statement (sans semicolon) to output to the stdio stream
6270 @var{stream} any text necessary for declaring the name of an external
6271 symbol named @var{name} which is referenced in this compilation but
6272 not defined.  The value of @var{decl} is the tree node for the
6273 declaration.
6274
6275 This macro need not be defined if it does not need to output anything.
6276 The GNU assembler and most Unix assemblers don't require anything.
6277
6278 @findex ASM_OUTPUT_EXTERNAL_LIBCALL
6279 @item ASM_OUTPUT_EXTERNAL_LIBCALL (@var{stream}, @var{symref})
6280 A C statement (sans semicolon) to output on @var{stream} an assembler
6281 pseudo-op to declare a library function name external.  The name of the
6282 library function is given by @var{symref}, which has type @code{rtx} and
6283 is a @code{symbol_ref}.
6284
6285 This macro need not be defined if it does not need to output anything.
6286 The GNU assembler and most Unix assemblers don't require anything.
6287
6288 @findex ASM_OUTPUT_LABELREF
6289 @item ASM_OUTPUT_LABELREF (@var{stream}, @var{name})
6290 A C statement (sans semicolon) to output to the stdio stream
6291 @var{stream} a reference in assembler syntax to a label named
6292 @var{name}.  This should add @samp{_} to the front of the name, if that
6293 is customary on your operating system, as it is in most Berkeley Unix
6294 systems.  This macro is used in @code{assemble_name}.
6295
6296 @ignore @c Seems not to exist anymore.
6297 @findex ASM_OUTPUT_LABELREF_AS_INT
6298 @item ASM_OUTPUT_LABELREF_AS_INT (@var{file}, @var{label})
6299 Define this macro for systems that use the program @code{collect2}.
6300 The definition should be a C statement to output a word containing
6301 a reference to the label @var{label}.
6302 @end ignore
6303
6304 @findex ASM_OUTPUT_SYMBOL_REF
6305 @item ASM_OUTPUT_SYMBOL_REF (@var{stream}, @var{sym})
6306 A C statement (sans semicolon) to output a reference to
6307 @code{SYMBOL_REF} @var{sym}.  If not defined, @code{assemble_output}
6308 will be used to output the name of the symbol.  This macro may be used
6309 to modify the way a symbol is referenced depending on information
6310 encoded by @code{ENCODE_SECTION_INFO}.
6311
6312 @findex ASM_OUTPUT_INTERNAL_LABEL
6313 @item ASM_OUTPUT_INTERNAL_LABEL (@var{stream}, @var{prefix}, @var{num})
6314 A C statement to output to the stdio stream @var{stream} a label whose
6315 name is made from the string @var{prefix} and the number @var{num}.
6316
6317 It is absolutely essential that these labels be distinct from the labels
6318 used for user-level functions and variables.  Otherwise, certain programs
6319 will have name conflicts with internal labels.
6320
6321 It is desirable to exclude internal labels from the symbol table of the
6322 object file.  Most assemblers have a naming convention for labels that
6323 should be excluded; on many systems, the letter @samp{L} at the
6324 beginning of a label has this effect.  You should find out what
6325 convention your system uses, and follow it.
6326
6327 The usual definition of this macro is as follows:
6328
6329 @example
6330 fprintf (@var{stream}, "L%s%d:\n", @var{prefix}, @var{num})
6331 @end example
6332
6333 @findex ASM_OUTPUT_DEBUG_LABEL
6334 @item ASM_OUTPUT_DEBUG_LABEL (@var{stream}, @var{prefix}, @var{num})
6335 A C statement to output to the stdio stream @var{stream} a debug info
6336 label whose name is made from the string @var{prefix} and the number
6337 @var{num}.  This is useful for VLIW targets, where debug info labels
6338 may need to be treated differently than branch target labels.  On some
6339 systems, branch target labels must be at the beginning of instruction
6340 bundles, but debug info labels can occur in the middle of instruction
6341 bundles.
6342
6343 If this macro is not defined, then @code{ASM_OUTPUT_INTERNAL_LABEL} will be
6344 used.
6345
6346 @findex ASM_OUTPUT_ALTERNATE_LABEL_NAME
6347 @item ASM_OUTPUT_ALTERNATE_LABEL_NAME (@var{stream}, @var{string})
6348 A C statement to output to the stdio stream @var{stream} the string
6349 @var{string}.
6350
6351 The default definition of this macro is as follows:
6352
6353 @example
6354 fprintf (@var{stream}, "%s:\n", LABEL_ALTERNATE_NAME (INSN))
6355 @end example
6356
6357 @findex ASM_GENERATE_INTERNAL_LABEL
6358 @item ASM_GENERATE_INTERNAL_LABEL (@var{string}, @var{prefix}, @var{num})
6359 A C statement to store into the string @var{string} a label whose name
6360 is made from the string @var{prefix} and the number @var{num}.
6361
6362 This string, when output subsequently by @code{assemble_name}, should
6363 produce the output that @code{ASM_OUTPUT_INTERNAL_LABEL} would produce
6364 with the same @var{prefix} and @var{num}.
6365
6366 If the string begins with @samp{*}, then @code{assemble_name} will
6367 output the rest of the string unchanged.  It is often convenient for
6368 @code{ASM_GENERATE_INTERNAL_LABEL} to use @samp{*} in this way.  If the
6369 string doesn't start with @samp{*}, then @code{ASM_OUTPUT_LABELREF} gets
6370 to output the string, and may change it.  (Of course,
6371 @code{ASM_OUTPUT_LABELREF} is also part of your machine description, so
6372 you should know what it does on your machine.)
6373
6374 @findex ASM_FORMAT_PRIVATE_NAME
6375 @item ASM_FORMAT_PRIVATE_NAME (@var{outvar}, @var{name}, @var{number})
6376 A C expression to assign to @var{outvar} (which is a variable of type
6377 @code{char *}) a newly allocated string made from the string
6378 @var{name} and the number @var{number}, with some suitable punctuation
6379 added.  Use @code{alloca} to get space for the string.
6380
6381 The string will be used as an argument to @code{ASM_OUTPUT_LABELREF} to
6382 produce an assembler label for an internal static variable whose name is
6383 @var{name}.  Therefore, the string must be such as to result in valid
6384 assembler code.  The argument @var{number} is different each time this
6385 macro is executed; it prevents conflicts between similarly-named
6386 internal static variables in different scopes.
6387
6388 Ideally this string should not be a valid C identifier, to prevent any
6389 conflict with the user's own symbols.  Most assemblers allow periods
6390 or percent signs in assembler symbols; putting at least one of these
6391 between the name and the number will suffice.
6392
6393 @findex ASM_OUTPUT_DEF
6394 @item ASM_OUTPUT_DEF (@var{stream}, @var{name}, @var{value})
6395 A C statement to output to the stdio stream @var{stream} assembler code
6396 which defines (equates) the symbol @var{name} to have the value @var{value}.
6397
6398 @findex SET_ASM_OP
6399 If @code{SET_ASM_OP} is defined, a default definition is provided which is
6400 correct for most systems.
6401
6402 @findex ASM_OUTPUT_DEF_FROM_DECLS
6403 @item ASM_OUTPUT_DEF_FROM_DECLS (@var{stream}, @var{decl_of_name}, @var{decl_of_value})
6404 A C statement to output to the stdio stream @var{stream} assembler code
6405 which defines (equates) the symbol whose tree node is @var{decl_of_name}
6406 to have the value of the tree node @var{decl_of_value}.  This macro will
6407 be used in preference to @samp{ASM_OUTPUT_DEF} if it is defined and if
6408 the tree nodes are available.
6409
6410 @findex ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL
6411 @item ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL (@var{stream}, @var{symbol}, @var{high}, @var{low})
6412 A C statement to output to the stdio stream @var{stream} assembler code
6413 which defines (equates) the symbol @var{symbol} to have a value equal to
6414 the difference of the two symbols @var{high} and @var{low},
6415 i.e.@: @var{high} minus @var{low}.  GCC guarantees that the symbols @var{high}
6416 and @var{low} are already known by the assembler so that the difference
6417 resolves into a constant.
6418
6419 @findex SET_ASM_OP
6420 If @code{SET_ASM_OP} is defined, a default definition is provided which is
6421 correct for most systems.
6422
6423 @findex ASM_OUTPUT_WEAK_ALIAS
6424 @item ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value})
6425 A C statement to output to the stdio stream @var{stream} assembler code
6426 which defines (equates) the weak symbol @var{name} to have the value
6427 @var{value}.
6428
6429 Define this macro if the target only supports weak aliases; define
6430 @code{ASM_OUTPUT_DEF} instead if possible.
6431
6432 @findex OBJC_GEN_METHOD_LABEL
6433 @item OBJC_GEN_METHOD_LABEL (@var{buf}, @var{is_inst}, @var{class_name}, @var{cat_name}, @var{sel_name})
6434 Define this macro to override the default assembler names used for
6435 Objective-C methods.
6436
6437 The default name is a unique method number followed by the name of the
6438 class (e.g.@: @samp{_1_Foo}).  For methods in categories, the name of
6439 the category is also included in the assembler name (e.g.@:
6440 @samp{_1_Foo_Bar}).
6441
6442 These names are safe on most systems, but make debugging difficult since
6443 the method's selector is not present in the name.  Therefore, particular
6444 systems define other ways of computing names.
6445
6446 @var{buf} is an expression of type @code{char *} which gives you a
6447 buffer in which to store the name; its length is as long as
6448 @var{class_name}, @var{cat_name} and @var{sel_name} put together, plus
6449 50 characters extra.
6450
6451 The argument @var{is_inst} specifies whether the method is an instance
6452 method or a class method; @var{class_name} is the name of the class;
6453 @var{cat_name} is the name of the category (or NULL if the method is not
6454 in a category); and @var{sel_name} is the name of the selector.
6455
6456 On systems where the assembler can handle quoted names, you can use this
6457 macro to provide more human-readable names.
6458
6459 @findex ASM_DECLARE_CLASS_REFERENCE
6460 @item ASM_DECLARE_CLASS_REFERENCE (@var{stream}, @var{name})
6461 A C statement (sans semicolon) to output to the stdio stream
6462 @var{stream} commands to declare that the label @var{name} is an
6463 Objective-C class reference.  This is only needed for targets whose
6464 linkers have special support for NeXT-style runtimes.
6465
6466 @findex ASM_DECLARE_UNRESOLVED_REFERENCE
6467 @item ASM_DECLARE_UNRESOLVED_REFERENCE (@var{stream}, @var{name})
6468 A C statement (sans semicolon) to output to the stdio stream
6469 @var{stream} commands to declare that the label @var{name} is an
6470 unresolved Objective-C class reference.  This is only needed for targets
6471 whose linkers have special support for NeXT-style runtimes.
6472 @end table
6473
6474 @node Initialization
6475 @subsection How Initialization Functions Are Handled
6476 @cindex initialization routines
6477 @cindex termination routines
6478 @cindex constructors, output of
6479 @cindex destructors, output of
6480
6481 The compiled code for certain languages includes @dfn{constructors}
6482 (also called @dfn{initialization routines})---functions to initialize
6483 data in the program when the program is started.  These functions need
6484 to be called before the program is ``started''---that is to say, before
6485 @code{main} is called.
6486
6487 Compiling some languages generates @dfn{destructors} (also called
6488 @dfn{termination routines}) that should be called when the program
6489 terminates.
6490
6491 To make the initialization and termination functions work, the compiler
6492 must output something in the assembler code to cause those functions to
6493 be called at the appropriate time.  When you port the compiler to a new
6494 system, you need to specify how to do this.
6495
6496 There are two major ways that GCC currently supports the execution of
6497 initialization and termination functions.  Each way has two variants.
6498 Much of the structure is common to all four variations.
6499
6500 @findex __CTOR_LIST__
6501 @findex __DTOR_LIST__
6502 The linker must build two lists of these functions---a list of
6503 initialization functions, called @code{__CTOR_LIST__}, and a list of
6504 termination functions, called @code{__DTOR_LIST__}.
6505
6506 Each list always begins with an ignored function pointer (which may hold
6507 0, @minus{}1, or a count of the function pointers after it, depending on
6508 the environment).  This is followed by a series of zero or more function
6509 pointers to constructors (or destructors), followed by a function
6510 pointer containing zero.
6511
6512 Depending on the operating system and its executable file format, either
6513 @file{crtstuff.c} or @file{libgcc2.c} traverses these lists at startup
6514 time and exit time.  Constructors are called in reverse order of the
6515 list; destructors in forward order.
6516
6517 The best way to handle static constructors works only for object file
6518 formats which provide arbitrarily-named sections.  A section is set
6519 aside for a list of constructors, and another for a list of destructors.
6520 Traditionally these are called @samp{.ctors} and @samp{.dtors}.  Each
6521 object file that defines an initialization function also puts a word in
6522 the constructor section to point to that function.  The linker
6523 accumulates all these words into one contiguous @samp{.ctors} section.
6524 Termination functions are handled similarly.
6525
6526 To use this method, you need appropriate definitions of the macros
6527 @code{ASM_OUTPUT_CONSTRUCTOR} and @code{ASM_OUTPUT_DESTRUCTOR}.  Usually
6528 you can get them by including @file{svr4.h}.
6529
6530 When arbitrary sections are available, there are two variants, depending
6531 upon how the code in @file{crtstuff.c} is called.  On systems that
6532 support an @dfn{init} section which is executed at program startup,
6533 parts of @file{crtstuff.c} are compiled into that section.  The
6534 program is linked by the @code{gcc} driver like this:
6535
6536 @example
6537 ld -o @var{output_file} crtbegin.o @dots{} crtend.o -lgcc
6538 @end example
6539
6540 The head of a function (@code{__do_global_ctors}) appears in the init
6541 section of @file{crtbegin.o}; the remainder of the function appears in
6542 the init section of @file{crtend.o}.  The linker will pull these two
6543 parts of the section together, making a whole function.  If any of the
6544 user's object files linked into the middle of it contribute code, then that
6545 code will be executed as part of the body of @code{__do_global_ctors}.
6546
6547 To use this variant, you must define the @code{INIT_SECTION_ASM_OP}
6548 macro properly.
6549
6550 If no init section is available, do not define
6551 @code{INIT_SECTION_ASM_OP}.  Then @code{__do_global_ctors} is built into
6552 the text section like all other functions, and resides in
6553 @file{libgcc.a}.  When GCC compiles any function called @code{main}, it
6554 inserts a procedure call to @code{__main} as the first executable code
6555 after the function prologue.  The @code{__main} function, also defined
6556 in @file{libgcc2.c}, simply calls @file{__do_global_ctors}.
6557
6558 In file formats that don't support arbitrary sections, there are again
6559 two variants.  In the simplest variant, the GNU linker (GNU @code{ld})
6560 and an `a.out' format must be used.  In this case,
6561 @code{ASM_OUTPUT_CONSTRUCTOR} is defined to produce a @code{.stabs}
6562 entry of type @samp{N_SETT}, referencing the name @code{__CTOR_LIST__},
6563 and with the address of the void function containing the initialization
6564 code as its value.  The GNU linker recognizes this as a request to add
6565 the value to a ``set''; the values are accumulated, and are eventually
6566 placed in the executable as a vector in the format described above, with
6567 a leading (ignored) count and a trailing zero element.
6568 @code{ASM_OUTPUT_DESTRUCTOR} is handled similarly.  Since no init
6569 section is available, the absence of @code{INIT_SECTION_ASM_OP} causes
6570 the compilation of @code{main} to call @code{__main} as above, starting
6571 the initialization process.
6572
6573 The last variant uses neither arbitrary sections nor the GNU linker.
6574 This is preferable when you want to do dynamic linking and when using
6575 file formats which the GNU linker does not support, such as `ECOFF'@.  In
6576 this case, @code{ASM_OUTPUT_CONSTRUCTOR} does not produce an
6577 @code{N_SETT} symbol; initialization and termination functions are
6578 recognized simply by their names.  This requires an extra program in the
6579 linkage step, called @code{collect2}.  This program pretends to be the
6580 linker, for use with GCC; it does its job by running the ordinary
6581 linker, but also arranges to include the vectors of initialization and
6582 termination functions.  These functions are called via @code{__main} as
6583 described above.
6584
6585 Choosing among these configuration options has been simplified by a set
6586 of operating-system-dependent files in the @file{config} subdirectory.
6587 These files define all of the relevant parameters.  Usually it is
6588 sufficient to include one into your specific machine-dependent
6589 configuration file.  These files are:
6590
6591 @table @file
6592 @item aoutos.h
6593 For operating systems using the `a.out' format.
6594
6595 @item next.h
6596 For operating systems using the `MachO' format.
6597
6598 @item svr3.h
6599 For System V Release 3 and similar systems using `COFF' format.
6600
6601 @item svr4.h
6602 For System V Release 4 and similar systems using `ELF' format.
6603
6604 @item vms.h
6605 For the VMS operating system.
6606 @end table
6607
6608 @ifinfo
6609 The following section describes the specific macros that control and
6610 customize the handling of initialization and termination functions.
6611 @end ifinfo
6612
6613 @node Macros for Initialization
6614 @subsection Macros Controlling Initialization Routines
6615
6616 Here are the macros that control how the compiler handles initialization
6617 and termination functions:
6618
6619 @table @code
6620 @findex INIT_SECTION_ASM_OP
6621 @item INIT_SECTION_ASM_OP
6622 If defined, a C string constant, including spacing, for the assembler
6623 operation to identify the following data as initialization code.  If not
6624 defined, GCC will assume such a section does not exist.  When you are
6625 using special sections for initialization and termination functions, this
6626 macro also controls how @file{crtstuff.c} and @file{libgcc2.c} arrange to
6627 run the initialization functions.
6628
6629 @item HAS_INIT_SECTION
6630 @findex HAS_INIT_SECTION
6631 If defined, @code{main} will not call @code{__main} as described above.
6632 This macro should be defined for systems that control the contents of the
6633 init section on a symbol-by-symbol basis, such as OSF/1, and should not
6634 be defined explicitly for systems that support
6635 @code{INIT_SECTION_ASM_OP}.
6636
6637 @item LD_INIT_SWITCH
6638 @findex LD_INIT_SWITCH
6639 If defined, a C string constant for a switch that tells the linker that
6640 the following symbol is an initialization routine.
6641
6642 @item LD_FINI_SWITCH
6643 @findex LD_FINI_SWITCH
6644 If defined, a C string constant for a switch that tells the linker that
6645 the following symbol is a finalization routine.
6646
6647 @item INVOKE__main
6648 @findex INVOKE__main
6649 If defined, @code{main} will call @code{__main} despite the presence of
6650 @code{INIT_SECTION_ASM_OP}.  This macro should be defined for systems
6651 where the init section is not actually run automatically, but is still
6652 useful for collecting the lists of constructors and destructors.
6653
6654 @item SUPPORTS_INIT_PRIORITY
6655 @findex SUPPORTS_INIT_PRIORITY
6656 If nonzero, the C++ @code{init_priority} attribute is supported and the
6657 compiler should emit instructions to control the order of initialization
6658 of objects.  If zero, the compiler will issue an error message upon
6659 encountering an @code{init_priority} attribute.
6660
6661 @item ASM_OUTPUT_CONSTRUCTOR (@var{stream}, @var{name})
6662 @findex ASM_OUTPUT_CONSTRUCTOR
6663 Define this macro as a C statement to output on the stream @var{stream}
6664 the assembler code to arrange to call the function named @var{name} at
6665 initialization time.
6666
6667 Assume that @var{name} is the name of a C function generated
6668 automatically by the compiler.  This function takes no arguments.  Use
6669 the function @code{assemble_name} to output the name @var{name}; this
6670 performs any system-specific syntactic transformations such as adding an
6671 underscore.
6672
6673 If you don't define this macro, nothing special is output to arrange to
6674 call the function.  This is correct when the function will be called in
6675 some other manner---for example, by means of the @code{collect2} program,
6676 which looks through the symbol table to find these functions by their
6677 names.
6678
6679 @item ASM_OUTPUT_DESTRUCTOR (@var{stream}, @var{name})
6680 @findex ASM_OUTPUT_DESTRUCTOR
6681 This is like @code{ASM_OUTPUT_CONSTRUCTOR} but used for termination
6682 functions rather than initialization functions.
6683
6684 When @code{ASM_OUTPUT_CONSTRUCTOR} and @code{ASM_OUTPUT_DESTRUCTOR} are
6685 defined, the initialization routine generated for the generated object
6686 file will have static linkage.
6687 @end table
6688
6689 If your system uses @code{collect2} as the means of processing
6690 constructors, then that program normally uses @code{nm} to scan an
6691 object file for constructor functions to be called.  On such systems you
6692 must not define @code{ASM_OUTPUT_CONSTRUCTOR} and @code{ASM_OUTPUT_DESTRUCTOR}
6693 as the object file's initialization routine must have global scope.
6694
6695 On certain kinds of systems, you can define these macros to make
6696 @code{collect2} work faster (and, in some cases, make it work at all):
6697
6698 @table @code
6699 @findex OBJECT_FORMAT_COFF
6700 @item OBJECT_FORMAT_COFF
6701 Define this macro if the system uses COFF (Common Object File Format)
6702 object files, so that @code{collect2} can assume this format and scan
6703 object files directly for dynamic constructor/destructor functions.
6704
6705 @findex OBJECT_FORMAT_ROSE
6706 @item OBJECT_FORMAT_ROSE
6707 Define this macro if the system uses ROSE format object files, so that
6708 @code{collect2} can assume this format and scan object files directly
6709 for dynamic constructor/destructor functions.
6710
6711 These macros are effective only in a native compiler; @code{collect2} as
6712 part of a cross compiler always uses @code{nm} for the target machine.
6713
6714 @findex REAL_NM_FILE_NAME
6715 @item REAL_NM_FILE_NAME
6716 Define this macro as a C string constant containing the file name to use
6717 to execute @code{nm}.  The default is to search the path normally for
6718 @code{nm}.
6719
6720 If your system supports shared libraries and has a program to list the
6721 dynamic dependencies of a given library or executable, you can define
6722 these macros to enable support for running initialization and
6723 termination functions in shared libraries:
6724
6725 @findex LDD_SUFFIX
6726 @item LDD_SUFFIX
6727 Define this macro to a C string constant containing the name of the
6728 program which lists dynamic dependencies, like @code{"ldd"} under SunOS 4.
6729
6730 @findex PARSE_LDD_OUTPUT
6731 @item PARSE_LDD_OUTPUT (@var{ptr})
6732 Define this macro to be C code that extracts filenames from the output
6733 of the program denoted by @code{LDD_SUFFIX}.  @var{ptr} is a variable
6734 of type @code{char *} that points to the beginning of a line of output
6735 from @code{LDD_SUFFIX}.  If the line lists a dynamic dependency, the
6736 code must advance @var{ptr} to the beginning of the filename on that
6737 line.  Otherwise, it must set @var{ptr} to @code{NULL}.
6738
6739 @end table
6740
6741 @node Instruction Output
6742 @subsection Output of Assembler Instructions
6743
6744 @c prevent bad page break with this line
6745 This describes assembler instruction output.
6746
6747 @table @code
6748 @findex REGISTER_NAMES
6749 @item REGISTER_NAMES
6750 A C initializer containing the assembler's names for the machine
6751 registers, each one as a C string constant.  This is what translates
6752 register numbers in the compiler into assembler language.
6753
6754 @findex ADDITIONAL_REGISTER_NAMES
6755 @item ADDITIONAL_REGISTER_NAMES
6756 If defined, a C initializer for an array of structures containing a name
6757 and a register number.  This macro defines additional names for hard
6758 registers, thus allowing the @code{asm} option in declarations to refer
6759 to registers using alternate names.
6760
6761 @findex ASM_OUTPUT_OPCODE
6762 @item ASM_OUTPUT_OPCODE (@var{stream}, @var{ptr})
6763 Define this macro if you are using an unusual assembler that
6764 requires different names for the machine instructions.
6765
6766 The definition is a C statement or statements which output an
6767 assembler instruction opcode to the stdio stream @var{stream}.  The
6768 macro-operand @var{ptr} is a variable of type @code{char *} which
6769 points to the opcode name in its ``internal'' form---the form that is
6770 written in the machine description.  The definition should output the
6771 opcode name to @var{stream}, performing any translation you desire, and
6772 increment the variable @var{ptr} to point at the end of the opcode
6773 so that it will not be output twice.
6774
6775 In fact, your macro definition may process less than the entire opcode
6776 name, or more than the opcode name; but if you want to process text
6777 that includes @samp{%}-sequences to substitute operands, you must take
6778 care of the substitution yourself.  Just be sure to increment
6779 @var{ptr} over whatever text should not be output normally.
6780
6781 @findex recog_operand
6782 If you need to look at the operand values, they can be found as the
6783 elements of @code{recog_operand}.
6784
6785 If the macro definition does nothing, the instruction is output
6786 in the usual way.
6787
6788 @findex FINAL_PRESCAN_INSN
6789 @item FINAL_PRESCAN_INSN (@var{insn}, @var{opvec}, @var{noperands})
6790 If defined, a C statement to be executed just prior to the output of
6791 assembler code for @var{insn}, to modify the extracted operands so
6792 they will be output differently.
6793
6794 Here the argument @var{opvec} is the vector containing the operands
6795 extracted from @var{insn}, and @var{noperands} is the number of
6796 elements of the vector which contain meaningful data for this insn.
6797 The contents of this vector are what will be used to convert the insn
6798 template into assembler code, so you can change the assembler output
6799 by changing the contents of the vector.
6800
6801 This macro is useful when various assembler syntaxes share a single
6802 file of instruction patterns; by defining this macro differently, you
6803 can cause a large class of instructions to be output differently (such
6804 as with rearranged operands).  Naturally, variations in assembler
6805 syntax affecting individual insn patterns ought to be handled by
6806 writing conditional output routines in those patterns.
6807
6808 If this macro is not defined, it is equivalent to a null statement.
6809
6810 @findex FINAL_PRESCAN_LABEL
6811 @item FINAL_PRESCAN_LABEL
6812 If defined, @code{FINAL_PRESCAN_INSN} will be called on each
6813 @code{CODE_LABEL}.  In that case, @var{opvec} will be a null pointer and
6814 @var{noperands} will be zero.
6815
6816 @findex PRINT_OPERAND
6817 @item PRINT_OPERAND (@var{stream}, @var{x}, @var{code})
6818 A C compound statement to output to stdio stream @var{stream} the
6819 assembler syntax for an instruction operand @var{x}.  @var{x} is an
6820 RTL expression.
6821
6822 @var{code} is a value that can be used to specify one of several ways
6823 of printing the operand.  It is used when identical operands must be
6824 printed differently depending on the context.  @var{code} comes from
6825 the @samp{%} specification that was used to request printing of the
6826 operand.  If the specification was just @samp{%@var{digit}} then
6827 @var{code} is 0; if the specification was @samp{%@var{ltr}
6828 @var{digit}} then @var{code} is the ASCII code for @var{ltr}.
6829
6830 @findex reg_names
6831 If @var{x} is a register, this macro should print the register's name.
6832 The names can be found in an array @code{reg_names} whose type is
6833 @code{char *[]}.  @code{reg_names} is initialized from
6834 @code{REGISTER_NAMES}.
6835
6836 When the machine description has a specification @samp{%@var{punct}}
6837 (a @samp{%} followed by a punctuation character), this macro is called
6838 with a null pointer for @var{x} and the punctuation character for
6839 @var{code}.
6840
6841 @findex PRINT_OPERAND_PUNCT_VALID_P
6842 @item PRINT_OPERAND_PUNCT_VALID_P (@var{code})
6843 A C expression which evaluates to true if @var{code} is a valid
6844 punctuation character for use in the @code{PRINT_OPERAND} macro.  If
6845 @code{PRINT_OPERAND_PUNCT_VALID_P} is not defined, it means that no
6846 punctuation characters (except for the standard one, @samp{%}) are used
6847 in this way.
6848
6849 @findex PRINT_OPERAND_ADDRESS
6850 @item PRINT_OPERAND_ADDRESS (@var{stream}, @var{x})
6851 A C compound statement to output to stdio stream @var{stream} the
6852 assembler syntax for an instruction operand that is a memory reference
6853 whose address is @var{x}.  @var{x} is an RTL expression.
6854
6855 @cindex @code{ENCODE_SECTION_INFO} usage
6856 On some machines, the syntax for a symbolic address depends on the
6857 section that the address refers to.  On these machines, define the macro
6858 @code{ENCODE_SECTION_INFO} to store the information into the
6859 @code{symbol_ref}, and then check for it here.  @xref{Assembler Format}.
6860
6861 @findex DBR_OUTPUT_SEQEND
6862 @findex dbr_sequence_length
6863 @item DBR_OUTPUT_SEQEND(@var{file})
6864 A C statement, to be executed after all slot-filler instructions have
6865 been output.  If necessary, call @code{dbr_sequence_length} to
6866 determine the number of slots filled in a sequence (zero if not
6867 currently outputting a sequence), to decide how many no-ops to output,
6868 or whatever.
6869
6870 Don't define this macro if it has nothing to do, but it is helpful in
6871 reading assembly output if the extent of the delay sequence is made
6872 explicit (e.g.@: with white space).
6873
6874 @findex final_sequence
6875 Note that output routines for instructions with delay slots must be
6876 prepared to deal with not being output as part of a sequence
6877 (i.e.@: when the scheduling pass is not run, or when no slot fillers could be
6878 found.)  The variable @code{final_sequence} is null when not
6879 processing a sequence, otherwise it contains the @code{sequence} rtx
6880 being output.
6881
6882 @findex REGISTER_PREFIX
6883 @findex LOCAL_LABEL_PREFIX
6884 @findex USER_LABEL_PREFIX
6885 @findex IMMEDIATE_PREFIX
6886 @findex asm_fprintf
6887 @item REGISTER_PREFIX
6888 @itemx LOCAL_LABEL_PREFIX
6889 @itemx USER_LABEL_PREFIX
6890 @itemx IMMEDIATE_PREFIX
6891 If defined, C string expressions to be used for the @samp{%R}, @samp{%L},
6892 @samp{%U}, and @samp{%I} options of @code{asm_fprintf} (see
6893 @file{final.c}).  These are useful when a single @file{md} file must
6894 support multiple assembler formats.  In that case, the various @file{tm.h}
6895 files can define these macros differently.
6896
6897 @item ASM_FPRINTF_EXTENSIONS(@var{file}, @var{argptr}, @var{format})
6898 @findex ASM_FPRINTF_EXTENSIONS
6899 If defined this macro should expand to a series of @code{case}
6900 statements which will be parsed inside the @code{switch} statement of
6901 the @code{asm_fprintf} function.  This allows targets to define extra
6902 printf formats which may useful when generating their assembler
6903 statements.  Note that upper case letters are reserved for future
6904 generic extensions to asm_fprintf, and so are not available to target
6905 specific code.  The output file is given by the parameter @var{file}.
6906 The varargs input pointer is @var{argptr} and the rest of the format
6907 string, starting the character after the one that is being switched
6908 upon, is pointed to by @var{format}.
6909
6910 @findex ASSEMBLER_DIALECT
6911 @item ASSEMBLER_DIALECT
6912 If your target supports multiple dialects of assembler language (such as
6913 different opcodes), define this macro as a C expression that gives the
6914 numeric index of the assembler language dialect to use, with zero as the
6915 first variant.
6916
6917 If this macro is defined, you may use constructs of the form
6918 @samp{@{option0|option1|option2@dots{}@}} in the output
6919 templates of patterns (@pxref{Output Template}) or in the first argument
6920 of @code{asm_fprintf}.  This construct outputs @samp{option0},
6921 @samp{option1} or @samp{option2}, etc., if the value of
6922 @code{ASSEMBLER_DIALECT} is zero, one or two, etc.  Any special
6923 characters within these strings retain their usual meaning.
6924
6925 If you do not define this macro, the characters @samp{@{}, @samp{|} and
6926 @samp{@}} do not have any special meaning when used in templates or
6927 operands to @code{asm_fprintf}.
6928
6929 Define the macros @code{REGISTER_PREFIX}, @code{LOCAL_LABEL_PREFIX},
6930 @code{USER_LABEL_PREFIX} and @code{IMMEDIATE_PREFIX} if you can express
6931 the variations in assembler language syntax with that mechanism.  Define
6932 @code{ASSEMBLER_DIALECT} and use the @samp{@{option0|option1@}} syntax
6933 if the syntax variant are larger and involve such things as different
6934 opcodes or operand order.
6935
6936 @findex ASM_OUTPUT_REG_PUSH
6937 @item ASM_OUTPUT_REG_PUSH (@var{stream}, @var{regno})
6938 A C expression to output to @var{stream} some assembler code
6939 which will push hard register number @var{regno} onto the stack.
6940 The code need not be optimal, since this macro is used only when
6941 profiling.
6942
6943 @findex ASM_OUTPUT_REG_POP
6944 @item ASM_OUTPUT_REG_POP (@var{stream}, @var{regno})
6945 A C expression to output to @var{stream} some assembler code
6946 which will pop hard register number @var{regno} off of the stack.
6947 The code need not be optimal, since this macro is used only when
6948 profiling.
6949 @end table
6950
6951 @node Dispatch Tables
6952 @subsection Output of Dispatch Tables
6953
6954 @c prevent bad page break with this line
6955 This concerns dispatch tables.
6956
6957 @table @code
6958 @cindex dispatch table
6959 @findex ASM_OUTPUT_ADDR_DIFF_ELT
6960 @item ASM_OUTPUT_ADDR_DIFF_ELT (@var{stream}, @var{body}, @var{value}, @var{rel})
6961 A C statement to output to the stdio stream @var{stream} an assembler
6962 pseudo-instruction to generate a difference between two labels.
6963 @var{value} and @var{rel} are the numbers of two internal labels.  The
6964 definitions of these labels are output using
6965 @code{ASM_OUTPUT_INTERNAL_LABEL}, and they must be printed in the same
6966 way here.  For example,
6967
6968 @example
6969 fprintf (@var{stream}, "\t.word L%d-L%d\n",
6970          @var{value}, @var{rel})
6971 @end example
6972
6973 You must provide this macro on machines where the addresses in a
6974 dispatch table are relative to the table's own address.  If defined, GCC
6975 will also use this macro on all machines when producing PIC@.
6976 @var{body} is the body of the @code{ADDR_DIFF_VEC}; it is provided so that the
6977 mode and flags can be read.
6978
6979 @findex ASM_OUTPUT_ADDR_VEC_ELT
6980 @item ASM_OUTPUT_ADDR_VEC_ELT (@var{stream}, @var{value})
6981 This macro should be provided on machines where the addresses
6982 in a dispatch table are absolute.
6983
6984 The definition should be a C statement to output to the stdio stream
6985 @var{stream} an assembler pseudo-instruction to generate a reference to
6986 a label.  @var{value} is the number of an internal label whose
6987 definition is output using @code{ASM_OUTPUT_INTERNAL_LABEL}.
6988 For example,
6989
6990 @example
6991 fprintf (@var{stream}, "\t.word L%d\n", @var{value})
6992 @end example
6993
6994 @findex ASM_OUTPUT_CASE_LABEL
6995 @item ASM_OUTPUT_CASE_LABEL (@var{stream}, @var{prefix}, @var{num}, @var{table})
6996 Define this if the label before a jump-table needs to be output
6997 specially.  The first three arguments are the same as for
6998 @code{ASM_OUTPUT_INTERNAL_LABEL}; the fourth argument is the
6999 jump-table which follows (a @code{jump_insn} containing an
7000 @code{addr_vec} or @code{addr_diff_vec}).
7001
7002 This feature is used on system V to output a @code{swbeg} statement
7003 for the table.
7004
7005 If this macro is not defined, these labels are output with
7006 @code{ASM_OUTPUT_INTERNAL_LABEL}.
7007
7008 @findex ASM_OUTPUT_CASE_END
7009 @item ASM_OUTPUT_CASE_END (@var{stream}, @var{num}, @var{table})
7010 Define this if something special must be output at the end of a
7011 jump-table.  The definition should be a C statement to be executed
7012 after the assembler code for the table is written.  It should write
7013 the appropriate code to stdio stream @var{stream}.  The argument
7014 @var{table} is the jump-table insn, and @var{num} is the label-number
7015 of the preceding label.
7016
7017 If this macro is not defined, nothing special is output at the end of
7018 the jump-table.
7019 @end table
7020
7021 @node Exception Region Output
7022 @subsection Assembler Commands for Exception Regions
7023
7024 @c prevent bad page break with this line
7025
7026 This describes commands marking the start and the end of an exception
7027 region.
7028
7029 @table @code
7030 @findex ASM_OUTPUT_EH_REGION_BEG
7031 @item ASM_OUTPUT_EH_REGION_BEG ()
7032 A C expression to output text to mark the start of an exception region.
7033
7034 This macro need not be defined on most platforms.
7035
7036 @findex ASM_OUTPUT_EH_REGION_END
7037 @item ASM_OUTPUT_EH_REGION_END ()
7038 A C expression to output text to mark the end of an exception region.
7039
7040 This macro need not be defined on most platforms.
7041
7042 @findex EXCEPTION_SECTION
7043 @item EXCEPTION_SECTION ()
7044 A C expression to switch to the section in which the main
7045 exception table is to be placed (@pxref{Sections}).  The default is a
7046 section named @code{.gcc_except_table} on machines that support named
7047 sections via @code{ASM_OUTPUT_SECTION_NAME}, otherwise if @option{-fpic}
7048 or @option{-fPIC} is in effect, the @code{data_section}, otherwise the
7049 @code{readonly_data_section}.
7050
7051 @findex EH_FRAME_SECTION_ASM_OP
7052 @item EH_FRAME_SECTION_ASM_OP
7053 If defined, a C string constant, including spacing, for the assembler
7054 operation to switch to the section for exception handling frame unwind
7055 information.  If not defined, GCC will provide a default definition if the
7056 target supports named sections.  @file{crtstuff.c} uses this macro to
7057 switch to the appropriate section.
7058
7059 You should define this symbol if your target supports DWARF 2 frame
7060 unwind information and the default definition does not work.
7061
7062 @findex OMIT_EH_TABLE
7063 @item OMIT_EH_TABLE ()
7064 A C expression that is nonzero if the normal exception table output
7065 should be omitted.
7066
7067 This macro need not be defined on most platforms.
7068
7069 @findex EH_TABLE_LOOKUP
7070 @item EH_TABLE_LOOKUP ()
7071 Alternate runtime support for looking up an exception at runtime and
7072 finding the associated handler, if the default method won't work.
7073
7074 This macro need not be defined on most platforms.
7075
7076 @findex DOESNT_NEED_UNWINDER
7077 @item DOESNT_NEED_UNWINDER
7078 A C expression that decides whether or not the current function needs to
7079 have a function unwinder generated for it.  See the file @file{except.c}
7080 for details on when to define this, and how.
7081
7082 @findex MASK_RETURN_ADDR
7083 @item MASK_RETURN_ADDR
7084 An rtx used to mask the return address found via @code{RETURN_ADDR_RTX}, so
7085 that it does not contain any extraneous set bits in it.
7086
7087 @findex DWARF2_UNWIND_INFO
7088 @item DWARF2_UNWIND_INFO
7089 Define this macro to 0 if your target supports DWARF 2 frame unwind
7090 information, but it does not yet work with exception handling.
7091 Otherwise, if your target supports this information (if it defines
7092 @samp{INCOMING_RETURN_ADDR_RTX} and either @samp{UNALIGNED_INT_ASM_OP}
7093 or @samp{OBJECT_FORMAT_ELF}), GCC will provide a default definition of
7094 1.
7095
7096 If this macro is defined to 1, the DWARF 2 unwinder will be the default
7097 exception handling mechanism; otherwise, @code{setjmp}/@code{longjmp} will be used by
7098 default.
7099
7100 If this macro is defined to anything, the DWARF 2 unwinder will be used
7101 instead of inline unwinders and @code{__unwind_function} in the non-@code{setjmp} case.
7102
7103 @findex DWARF_CIE_DATA_ALIGNMENT
7104 @item DWARF_CIE_DATA_ALIGNMENT
7105 This macro need only be defined if the target might save registers in the
7106 function prologue at an offset to the stack pointer that is not aligned to
7107 @code{UNITS_PER_WORD}.  The definition should be the negative minimum
7108 alignment if @code{STACK_GROWS_DOWNWARD} is defined, and the positive
7109 minimum alignment otherwise.  @xref{SDB and DWARF}.  Only applicable if
7110 the target supports DWARF 2 frame unwind information.
7111
7112 @end table
7113
7114 @node Alignment Output
7115 @subsection Assembler Commands for Alignment
7116
7117 @c prevent bad page break with this line
7118 This describes commands for alignment.
7119
7120 @table @code
7121 @findex LABEL_ALIGN_AFTER_BARRIER
7122 @item LABEL_ALIGN_AFTER_BARRIER (@var{label})
7123 The alignment (log base 2) to put in front of @var{label}, which follows
7124 a @code{BARRIER}.
7125
7126 This macro need not be defined if you don't want any special alignment
7127 to be done at such a time.  Most machine descriptions do not currently
7128 define the macro.
7129
7130 Unless it's necessary to inspect the @var{label} parameter, it is better
7131 to set the variable @var{align_jumps} in the target's
7132 @code{OVERRIDE_OPTIONS}.  Otherwise, you should try to honour the user's
7133 selection in @var{align_jumps} in a @code{LABEL_ALIGN_AFTER_BARRIER}
7134 implementation.
7135
7136 @findex LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
7137 @item LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP
7138 The maximum number of bytes to skip when applying
7139 @code{LABEL_ALIGN_AFTER_BARRIER}.  This works only if
7140 @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
7141
7142 @findex LOOP_ALIGN
7143 @item LOOP_ALIGN (@var{label})
7144 The alignment (log base 2) to put in front of @var{label}, which follows
7145 a @code{NOTE_INSN_LOOP_BEG} note.
7146
7147 This macro need not be defined if you don't want any special alignment
7148 to be done at such a time.  Most machine descriptions do not currently
7149 define the macro.
7150
7151 Unless it's necessary to inspect the @var{label} parameter, it is better
7152 to set the variable @code{align_loops} in the target's
7153 @code{OVERRIDE_OPTIONS}.  Otherwise, you should try to honour the user's
7154 selection in @code{align_loops} in a @code{LOOP_ALIGN} implementation.
7155
7156 @findex LOOP_ALIGN_MAX_SKIP
7157 @item LOOP_ALIGN_MAX_SKIP
7158 The maximum number of bytes to skip when applying @code{LOOP_ALIGN}.
7159 This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
7160
7161 @findex LABEL_ALIGN
7162 @item LABEL_ALIGN (@var{label})
7163 The alignment (log base 2) to put in front of @var{label}.
7164 If @code{LABEL_ALIGN_AFTER_BARRIER} / @code{LOOP_ALIGN} specify a different alignment,
7165 the maximum of the specified values is used.
7166
7167 Unless it's necessary to inspect the @var{label} parameter, it is better
7168 to set the variable @code{align_labels} in the target's
7169 @code{OVERRIDE_OPTIONS}.  Otherwise, you should try to honour the user's
7170 selection in @code{align_labels} in a @code{LABEL_ALIGN} implementation.
7171
7172 @findex LABEL_ALIGN_MAX_SKIP
7173 @item LABEL_ALIGN_MAX_SKIP
7174 The maximum number of bytes to skip when applying @code{LABEL_ALIGN}.
7175 This works only if @code{ASM_OUTPUT_MAX_SKIP_ALIGN} is defined.
7176
7177 @findex ASM_OUTPUT_SKIP
7178 @item ASM_OUTPUT_SKIP (@var{stream}, @var{nbytes})
7179 A C statement to output to the stdio stream @var{stream} an assembler
7180 instruction to advance the location counter by @var{nbytes} bytes.
7181 Those bytes should be zero when loaded.  @var{nbytes} will be a C
7182 expression of type @code{int}.
7183
7184 @findex ASM_NO_SKIP_IN_TEXT
7185 @item ASM_NO_SKIP_IN_TEXT
7186 Define this macro if @code{ASM_OUTPUT_SKIP} should not be used in the
7187 text section because it fails to put zeros in the bytes that are skipped.
7188 This is true on many Unix systems, where the pseudo--op to skip bytes
7189 produces no-op instructions rather than zeros when used in the text
7190 section.
7191
7192 @findex ASM_OUTPUT_ALIGN
7193 @item ASM_OUTPUT_ALIGN (@var{stream}, @var{power})
7194 A C statement to output to the stdio stream @var{stream} an assembler
7195 command to advance the location counter to a multiple of 2 to the
7196 @var{power} bytes.  @var{power} will be a C expression of type @code{int}.
7197
7198 @findex ASM_OUTPUT_MAX_SKIP_ALIGN
7199 @item ASM_OUTPUT_MAX_SKIP_ALIGN (@var{stream}, @var{power}, @var{max_skip})
7200 A C statement to output to the stdio stream @var{stream} an assembler
7201 command to advance the location counter to a multiple of 2 to the
7202 @var{power} bytes, but only if @var{max_skip} or fewer bytes are needed to
7203 satisfy the alignment request.  @var{power} and @var{max_skip} will be
7204 a C expression of type @code{int}.
7205 @end table
7206
7207 @need 3000
7208 @node Debugging Info
7209 @section Controlling Debugging Information Format
7210
7211 @c prevent bad page break with this line
7212 This describes how to specify debugging information.
7213
7214 @menu
7215 * All Debuggers::      Macros that affect all debugging formats uniformly.
7216 * DBX Options::        Macros enabling specific options in DBX format.
7217 * DBX Hooks::          Hook macros for varying DBX format.
7218 * File Names and DBX:: Macros controlling output of file names in DBX format.
7219 * SDB and DWARF::      Macros for SDB (COFF) and DWARF formats.
7220 @end menu
7221
7222 @node All Debuggers
7223 @subsection Macros Affecting All Debugging Formats
7224
7225 @c prevent bad page break with this line
7226 These macros affect all debugging formats.
7227
7228 @table @code
7229 @findex DBX_REGISTER_NUMBER
7230 @item DBX_REGISTER_NUMBER (@var{regno})
7231 A C expression that returns the DBX register number for the compiler
7232 register number @var{regno}.  In simple cases, the value of this
7233 expression may be @var{regno} itself.  But sometimes there are some
7234 registers that the compiler knows about and DBX does not, or vice
7235 versa.  In such cases, some register may need to have one number in
7236 the compiler and another for DBX@.
7237
7238 If two registers have consecutive numbers inside GCC, and they can be
7239 used as a pair to hold a multiword value, then they @emph{must} have
7240 consecutive numbers after renumbering with @code{DBX_REGISTER_NUMBER}.
7241 Otherwise, debuggers will be unable to access such a pair, because they
7242 expect register pairs to be consecutive in their own numbering scheme.
7243
7244 If you find yourself defining @code{DBX_REGISTER_NUMBER} in way that
7245 does not preserve register pairs, then what you must do instead is
7246 redefine the actual register numbering scheme.
7247
7248 @findex DEBUGGER_AUTO_OFFSET
7249 @item DEBUGGER_AUTO_OFFSET (@var{x})
7250 A C expression that returns the integer offset value for an automatic
7251 variable having address @var{x} (an RTL expression).  The default
7252 computation assumes that @var{x} is based on the frame-pointer and
7253 gives the offset from the frame-pointer.  This is required for targets
7254 that produce debugging output for DBX or COFF-style debugging output
7255 for SDB and allow the frame-pointer to be eliminated when the
7256 @option{-g} options is used.
7257
7258 @findex DEBUGGER_ARG_OFFSET
7259 @item DEBUGGER_ARG_OFFSET (@var{offset}, @var{x})
7260 A C expression that returns the integer offset value for an argument
7261 having address @var{x} (an RTL expression).  The nominal offset is
7262 @var{offset}.
7263
7264 @findex PREFERRED_DEBUGGING_TYPE
7265 @item PREFERRED_DEBUGGING_TYPE
7266 A C expression that returns the type of debugging output GCC should
7267 produce when the user specifies just @option{-g}.  Define
7268 this if you have arranged for GCC to support more than one format of
7269 debugging output.  Currently, the allowable values are @code{DBX_DEBUG},
7270 @code{SDB_DEBUG}, @code{DWARF_DEBUG}, @code{DWARF2_DEBUG}, and
7271 @code{XCOFF_DEBUG}.
7272
7273 When the user specifies @option{-ggdb}, GCC normally also uses the
7274 value of this macro to select the debugging output format, but with two
7275 exceptions.  If @code{DWARF2_DEBUGGING_INFO} is defined and
7276 @code{LINKER_DOES_NOT_WORK_WITH_DWARF2} is not defined, GCC uses the
7277 value @code{DWARF2_DEBUG}.  Otherwise, if @code{DBX_DEBUGGING_INFO} is
7278 defined, GCC uses @code{DBX_DEBUG}.
7279
7280 The value of this macro only affects the default debugging output; the
7281 user can always get a specific type of output by using @option{-gstabs},
7282 @option{-gcoff}, @option{-gdwarf-1}, @option{-gdwarf-2}, or @option{-gxcoff}.
7283 @end table
7284
7285 @node DBX Options
7286 @subsection Specific Options for DBX Output
7287
7288 @c prevent bad page break with this line
7289 These are specific options for DBX output.
7290
7291 @table @code
7292 @findex DBX_DEBUGGING_INFO
7293 @item DBX_DEBUGGING_INFO
7294 Define this macro if GCC should produce debugging output for DBX
7295 in response to the @option{-g} option.
7296
7297 @findex XCOFF_DEBUGGING_INFO
7298 @item XCOFF_DEBUGGING_INFO
7299 Define this macro if GCC should produce XCOFF format debugging output
7300 in response to the @option{-g} option.  This is a variant of DBX format.
7301
7302 @findex DEFAULT_GDB_EXTENSIONS
7303 @item DEFAULT_GDB_EXTENSIONS
7304 Define this macro to control whether GCC should by default generate
7305 GDB's extended version of DBX debugging information (assuming DBX-format
7306 debugging information is enabled at all).  If you don't define the
7307 macro, the default is 1: always generate the extended information
7308 if there is any occasion to.
7309
7310 @findex DEBUG_SYMS_TEXT
7311 @item DEBUG_SYMS_TEXT
7312 Define this macro if all @code{.stabs} commands should be output while
7313 in the text section.
7314
7315 @findex ASM_STABS_OP
7316 @item ASM_STABS_OP
7317 A C string constant, including spacing, naming the assembler pseudo op to
7318 use instead of @code{"\t.stabs\t"} to define an ordinary debugging symbol.
7319 If you don't define this macro, @code{"\t.stabs\t"} is used.  This macro
7320 applies only to DBX debugging information format.
7321
7322 @findex ASM_STABD_OP
7323 @item ASM_STABD_OP
7324 A C string constant, including spacing, naming the assembler pseudo op to
7325 use instead of @code{"\t.stabd\t"} to define a debugging symbol whose
7326 value is the current location.  If you don't define this macro,
7327 @code{"\t.stabd\t"} is used.  This macro applies only to DBX debugging
7328 information format.
7329
7330 @findex ASM_STABN_OP
7331 @item ASM_STABN_OP
7332 A C string constant, including spacing, naming the assembler pseudo op to
7333 use instead of @code{"\t.stabn\t"} to define a debugging symbol with no
7334 name.  If you don't define this macro, @code{"\t.stabn\t"} is used.  This
7335 macro applies only to DBX debugging information format.
7336
7337 @findex DBX_NO_XREFS
7338 @item DBX_NO_XREFS
7339 Define this macro if DBX on your system does not support the construct
7340 @samp{xs@var{tagname}}.  On some systems, this construct is used to
7341 describe a forward reference to a structure named @var{tagname}.
7342 On other systems, this construct is not supported at all.
7343
7344 @findex DBX_CONTIN_LENGTH
7345 @item DBX_CONTIN_LENGTH
7346 A symbol name in DBX-format debugging information is normally
7347 continued (split into two separate @code{.stabs} directives) when it
7348 exceeds a certain length (by default, 80 characters).  On some
7349 operating systems, DBX requires this splitting; on others, splitting
7350 must not be done.  You can inhibit splitting by defining this macro
7351 with the value zero.  You can override the default splitting-length by
7352 defining this macro as an expression for the length you desire.
7353
7354 @findex DBX_CONTIN_CHAR
7355 @item DBX_CONTIN_CHAR
7356 Normally continuation is indicated by adding a @samp{\} character to
7357 the end of a @code{.stabs} string when a continuation follows.  To use
7358 a different character instead, define this macro as a character
7359 constant for the character you want to use.  Do not define this macro
7360 if backslash is correct for your system.
7361
7362 @findex DBX_STATIC_STAB_DATA_SECTION
7363 @item DBX_STATIC_STAB_DATA_SECTION
7364 Define this macro if it is necessary to go to the data section before
7365 outputting the @samp{.stabs} pseudo-op for a non-global static
7366 variable.
7367
7368 @findex DBX_TYPE_DECL_STABS_CODE
7369 @item DBX_TYPE_DECL_STABS_CODE
7370 The value to use in the ``code'' field of the @code{.stabs} directive
7371 for a typedef.  The default is @code{N_LSYM}.
7372
7373 @findex DBX_STATIC_CONST_VAR_CODE
7374 @item DBX_STATIC_CONST_VAR_CODE
7375 The value to use in the ``code'' field of the @code{.stabs} directive
7376 for a static variable located in the text section.  DBX format does not
7377 provide any ``right'' way to do this.  The default is @code{N_FUN}.
7378
7379 @findex DBX_REGPARM_STABS_CODE
7380 @item DBX_REGPARM_STABS_CODE
7381 The value to use in the ``code'' field of the @code{.stabs} directive
7382 for a parameter passed in registers.  DBX format does not provide any
7383 ``right'' way to do this.  The default is @code{N_RSYM}.
7384
7385 @findex DBX_REGPARM_STABS_LETTER
7386 @item DBX_REGPARM_STABS_LETTER
7387 The letter to use in DBX symbol data to identify a symbol as a parameter
7388 passed in registers.  DBX format does not customarily provide any way to
7389 do this.  The default is @code{'P'}.
7390
7391 @findex DBX_MEMPARM_STABS_LETTER
7392 @item DBX_MEMPARM_STABS_LETTER
7393 The letter to use in DBX symbol data to identify a symbol as a stack
7394 parameter.  The default is @code{'p'}.
7395
7396 @findex DBX_FUNCTION_FIRST
7397 @item DBX_FUNCTION_FIRST
7398 Define this macro if the DBX information for a function and its
7399 arguments should precede the assembler code for the function.  Normally,
7400 in DBX format, the debugging information entirely follows the assembler
7401 code.
7402
7403 @findex DBX_LBRAC_FIRST
7404 @item DBX_LBRAC_FIRST
7405 Define this macro if the @code{N_LBRAC} symbol for a block should
7406 precede the debugging information for variables and functions defined in
7407 that block.  Normally, in DBX format, the @code{N_LBRAC} symbol comes
7408 first.
7409
7410 @findex DBX_BLOCKS_FUNCTION_RELATIVE
7411 @item DBX_BLOCKS_FUNCTION_RELATIVE
7412 Define this macro if the value of a symbol describing the scope of a
7413 block (@code{N_LBRAC} or @code{N_RBRAC}) should be relative to the start
7414 of the enclosing function.  Normally, GCC uses an absolute address.
7415
7416 @findex DBX_USE_BINCL
7417 @item DBX_USE_BINCL
7418 Define this macro if GCC should generate @code{N_BINCL} and
7419 @code{N_EINCL} stabs for included header files, as on Sun systems.  This
7420 macro also directs GCC to output a type number as a pair of a file
7421 number and a type number within the file.  Normally, GCC does not
7422 generate @code{N_BINCL} or @code{N_EINCL} stabs, and it outputs a single
7423 number for a type number.
7424 @end table
7425
7426 @node DBX Hooks
7427 @subsection Open-Ended Hooks for DBX Format
7428
7429 @c prevent bad page break with this line
7430 These are hooks for DBX format.
7431
7432 @table @code
7433 @findex DBX_OUTPUT_LBRAC
7434 @item DBX_OUTPUT_LBRAC (@var{stream}, @var{name})
7435 Define this macro to say how to output to @var{stream} the debugging
7436 information for the start of a scope level for variable names.  The
7437 argument @var{name} is the name of an assembler symbol (for use with
7438 @code{assemble_name}) whose value is the address where the scope begins.
7439
7440 @findex DBX_OUTPUT_RBRAC
7441 @item DBX_OUTPUT_RBRAC (@var{stream}, @var{name})
7442 Like @code{DBX_OUTPUT_LBRAC}, but for the end of a scope level.
7443
7444 @findex DBX_OUTPUT_ENUM
7445 @item DBX_OUTPUT_ENUM (@var{stream}, @var{type})
7446 Define this macro if the target machine requires special handling to
7447 output an enumeration type.  The definition should be a C statement
7448 (sans semicolon) to output the appropriate information to @var{stream}
7449 for the type @var{type}.
7450
7451 @findex DBX_OUTPUT_FUNCTION_END
7452 @item DBX_OUTPUT_FUNCTION_END (@var{stream}, @var{function})
7453 Define this macro if the target machine requires special output at the
7454 end of the debugging information for a function.  The definition should
7455 be a C statement (sans semicolon) to output the appropriate information
7456 to @var{stream}.  @var{function} is the @code{FUNCTION_DECL} node for
7457 the function.
7458
7459 @findex DBX_OUTPUT_STANDARD_TYPES
7460 @item DBX_OUTPUT_STANDARD_TYPES (@var{syms})
7461 Define this macro if you need to control the order of output of the
7462 standard data types at the beginning of compilation.  The argument
7463 @var{syms} is a @code{tree} which is a chain of all the predefined
7464 global symbols, including names of data types.
7465
7466 Normally, DBX output starts with definitions of the types for integers
7467 and characters, followed by all the other predefined types of the
7468 particular language in no particular order.
7469
7470 On some machines, it is necessary to output different particular types
7471 first.  To do this, define @code{DBX_OUTPUT_STANDARD_TYPES} to output
7472 those symbols in the necessary order.  Any predefined types that you
7473 don't explicitly output will be output afterward in no particular order.
7474
7475 Be careful not to define this macro so that it works only for C@.  There
7476 are no global variables to access most of the built-in types, because
7477 another language may have another set of types.  The way to output a
7478 particular type is to look through @var{syms} to see if you can find it.
7479 Here is an example:
7480
7481 @smallexample
7482 @{
7483   tree decl;
7484   for (decl = syms; decl; decl = TREE_CHAIN (decl))
7485     if (!strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
7486                  "long int"))
7487       dbxout_symbol (decl);
7488   @dots{}
7489 @}
7490 @end smallexample
7491
7492 @noindent
7493 This does nothing if the expected type does not exist.
7494
7495 See the function @code{init_decl_processing} in @file{c-decl.c} to find
7496 the names to use for all the built-in C types.
7497
7498 Here is another way of finding a particular type:
7499
7500 @c this is still overfull.  --mew 10feb93
7501 @smallexample
7502 @{
7503   tree decl;
7504   for (decl = syms; decl; decl = TREE_CHAIN (decl))
7505     if (TREE_CODE (decl) == TYPE_DECL
7506         && (TREE_CODE (TREE_TYPE (decl))
7507             == INTEGER_CST)
7508         && TYPE_PRECISION (TREE_TYPE (decl)) == 16
7509         && TYPE_UNSIGNED (TREE_TYPE (decl)))
7510 @group
7511       /* @r{This must be @code{unsigned short}.}  */
7512       dbxout_symbol (decl);
7513   @dots{}
7514 @}
7515 @end group
7516 @end smallexample
7517
7518 @findex NO_DBX_FUNCTION_END
7519 @item NO_DBX_FUNCTION_END
7520 Some stabs encapsulation formats (in particular ECOFF), cannot handle the
7521 @code{.stabs "",N_FUN,,0,0,Lscope-function-1} gdb dbx extension construct.
7522 On those machines, define this macro to turn this feature off without
7523 disturbing the rest of the gdb extensions.
7524
7525 @end table
7526
7527 @node File Names and DBX
7528 @subsection File Names in DBX Format
7529
7530 @c prevent bad page break with this line
7531 This describes file names in DBX format.
7532
7533 @table @code
7534 @findex DBX_WORKING_DIRECTORY
7535 @item DBX_WORKING_DIRECTORY
7536 Define this if DBX wants to have the current directory recorded in each
7537 object file.
7538
7539 Note that the working directory is always recorded if GDB extensions are
7540 enabled.
7541
7542 @findex DBX_OUTPUT_MAIN_SOURCE_FILENAME
7543 @item DBX_OUTPUT_MAIN_SOURCE_FILENAME (@var{stream}, @var{name})
7544 A C statement to output DBX debugging information to the stdio stream
7545 @var{stream} which indicates that file @var{name} is the main source
7546 file---the file specified as the input file for compilation.
7547 This macro is called only once, at the beginning of compilation.
7548
7549 This macro need not be defined if the standard form of output
7550 for DBX debugging information is appropriate.
7551
7552 @findex DBX_OUTPUT_MAIN_SOURCE_DIRECTORY
7553 @item DBX_OUTPUT_MAIN_SOURCE_DIRECTORY (@var{stream}, @var{name})
7554 A C statement to output DBX debugging information to the stdio stream
7555 @var{stream} which indicates that the current directory during
7556 compilation is named @var{name}.
7557
7558 This macro need not be defined if the standard form of output
7559 for DBX debugging information is appropriate.
7560
7561 @findex DBX_OUTPUT_MAIN_SOURCE_FILE_END
7562 @item DBX_OUTPUT_MAIN_SOURCE_FILE_END (@var{stream}, @var{name})
7563 A C statement to output DBX debugging information at the end of
7564 compilation of the main source file @var{name}.
7565
7566 If you don't define this macro, nothing special is output at the end
7567 of compilation, which is correct for most machines.
7568
7569 @findex DBX_OUTPUT_SOURCE_FILENAME
7570 @item DBX_OUTPUT_SOURCE_FILENAME (@var{stream}, @var{name})
7571 A C statement to output DBX debugging information to the stdio stream
7572 @var{stream} which indicates that file @var{name} is the current source
7573 file.  This output is generated each time input shifts to a different
7574 source file as a result of @samp{#include}, the end of an included file,
7575 or a @samp{#line} command.
7576
7577 This macro need not be defined if the standard form of output
7578 for DBX debugging information is appropriate.
7579 @end table
7580
7581 @need 2000
7582 @node SDB and DWARF
7583 @subsection Macros for SDB and DWARF Output
7584
7585 @c prevent bad page break with this line
7586 Here are macros for SDB and DWARF output.
7587
7588 @table @code
7589 @findex SDB_DEBUGGING_INFO
7590 @item SDB_DEBUGGING_INFO
7591 Define this macro if GCC should produce COFF-style debugging output
7592 for SDB in response to the @option{-g} option.
7593
7594 @findex DWARF_DEBUGGING_INFO
7595 @item DWARF_DEBUGGING_INFO
7596 Define this macro if GCC should produce dwarf format debugging output
7597 in response to the @option{-g} option.
7598
7599 @findex DWARF2_DEBUGGING_INFO
7600 @item DWARF2_DEBUGGING_INFO
7601 Define this macro if GCC should produce dwarf version 2 format
7602 debugging output in response to the @option{-g} option.
7603
7604 To support optional call frame debugging information, you must also
7605 define @code{INCOMING_RETURN_ADDR_RTX} and either set
7606 @code{RTX_FRAME_RELATED_P} on the prologue insns if you use RTL for the
7607 prologue, or call @code{dwarf2out_def_cfa} and @code{dwarf2out_reg_save}
7608 as appropriate from @code{TARGET_ASM_FUNCTION_PROLOGUE} if you don't.
7609
7610 @findex DWARF2_FRAME_INFO
7611 @item DWARF2_FRAME_INFO
7612 Define this macro to a nonzero value if GCC should always output
7613 Dwarf 2 frame information.  If @code{DWARF2_UNWIND_INFO}
7614 (@pxref{Exception Region Output} is nonzero, GCC will output this
7615 information not matter how you define @code{DWARF2_FRAME_INFO}.
7616
7617 @findex LINKER_DOES_NOT_WORK_WITH_DWARF2
7618 @item LINKER_DOES_NOT_WORK_WITH_DWARF2
7619 Define this macro if the linker does not work with Dwarf version 2.
7620 Normally, if the user specifies only @option{-ggdb} GCC will use Dwarf
7621 version 2 if available; this macro disables this.  See the description
7622 of the @code{PREFERRED_DEBUGGING_TYPE} macro for more details.
7623
7624 @findex DWARF2_GENERATE_TEXT_SECTION_LABEL
7625 @item DWARF2_GENERATE_TEXT_SECTION_LABEL
7626 By default, the Dwarf 2 debugging information generator will generate a
7627 label to mark the beginning of the text section.  If it is better simply
7628 to use the name of the text section itself, rather than an explicit label,
7629 to indicate the beginning of the text section, define this macro to zero.
7630
7631 @findex DWARF2_ASM_LINE_DEBUG_INFO
7632 @item DWARF2_ASM_LINE_DEBUG_INFO
7633 Define this macro to be a nonzero value if the assembler can generate Dwarf 2
7634 line debug info sections.  This will result in much more compact line number
7635 tables, and hence is desirable if it works.
7636
7637 @findex PUT_SDB_@dots{}
7638 @item PUT_SDB_@dots{}
7639 Define these macros to override the assembler syntax for the special
7640 SDB assembler directives.  See @file{sdbout.c} for a list of these
7641 macros and their arguments.  If the standard syntax is used, you need
7642 not define them yourself.
7643
7644 @findex SDB_DELIM
7645 @item SDB_DELIM
7646 Some assemblers do not support a semicolon as a delimiter, even between
7647 SDB assembler directives.  In that case, define this macro to be the
7648 delimiter to use (usually @samp{\n}).  It is not necessary to define
7649 a new set of @code{PUT_SDB_@var{op}} macros if this is the only change
7650 required.
7651
7652 @findex SDB_GENERATE_FAKE
7653 @item SDB_GENERATE_FAKE
7654 Define this macro to override the usual method of constructing a dummy
7655 name for anonymous structure and union types.  See @file{sdbout.c} for
7656 more information.
7657
7658 @findex SDB_ALLOW_UNKNOWN_REFERENCES
7659 @item SDB_ALLOW_UNKNOWN_REFERENCES
7660 Define this macro to allow references to unknown structure,
7661 union, or enumeration tags to be emitted.  Standard COFF does not
7662 allow handling of unknown references, MIPS ECOFF has support for
7663 it.
7664
7665 @findex SDB_ALLOW_FORWARD_REFERENCES
7666 @item SDB_ALLOW_FORWARD_REFERENCES
7667 Define this macro to allow references to structure, union, or
7668 enumeration tags that have not yet been seen to be handled.  Some
7669 assemblers choke if forward tags are used, while some require it.
7670 @end table
7671
7672 @node Cross-compilation
7673 @section Cross Compilation and Floating Point
7674 @cindex cross compilation and floating point
7675 @cindex floating point and cross compilation
7676
7677 While all modern machines use 2's complement representation for integers,
7678 there are a variety of representations for floating point numbers.  This
7679 means that in a cross-compiler the representation of floating point numbers
7680 in the compiled program may be different from that used in the machine
7681 doing the compilation.
7682
7683 @findex atof
7684 Because different representation systems may offer different amounts of
7685 range and precision, the cross compiler cannot safely use the host
7686 machine's floating point arithmetic.  Therefore, floating point constants
7687 must be represented in the target machine's format.  This means that the
7688 cross compiler cannot use @code{atof} to parse a floating point constant;
7689 it must have its own special routine to use instead.  Also, constant
7690 folding must emulate the target machine's arithmetic (or must not be done
7691 at all).
7692
7693 The macros in the following table should be defined only if you are cross
7694 compiling between different floating point formats.
7695
7696 Otherwise, don't define them.  Then default definitions will be set up which
7697 use @code{double} as the data type, @code{==} to test for equality, etc.
7698
7699 You don't need to worry about how many times you use an operand of any
7700 of these macros.  The compiler never uses operands which have side effects.
7701
7702 @table @code
7703 @findex REAL_VALUE_TYPE
7704 @item REAL_VALUE_TYPE
7705 A macro for the C data type to be used to hold a floating point value
7706 in the target machine's format.  Typically this would be a
7707 @code{struct} containing an array of @code{int}.
7708
7709 @findex REAL_VALUES_EQUAL
7710 @item REAL_VALUES_EQUAL (@var{x}, @var{y})
7711 A macro for a C expression which compares for equality the two values,
7712 @var{x} and @var{y}, both of type @code{REAL_VALUE_TYPE}.
7713
7714 @findex REAL_VALUES_LESS
7715 @item REAL_VALUES_LESS (@var{x}, @var{y})
7716 A macro for a C expression which tests whether @var{x} is less than
7717 @var{y}, both values being of type @code{REAL_VALUE_TYPE} and
7718 interpreted as floating point numbers in the target machine's
7719 representation.
7720
7721 @findex REAL_VALUE_LDEXP
7722 @findex ldexp
7723 @item REAL_VALUE_LDEXP (@var{x}, @var{scale})
7724 A macro for a C expression which performs the standard library
7725 function @code{ldexp}, but using the target machine's floating point
7726 representation.  Both @var{x} and the value of the expression have
7727 type @code{REAL_VALUE_TYPE}.  The second argument, @var{scale}, is an
7728 integer.
7729
7730 @findex REAL_VALUE_FIX
7731 @item REAL_VALUE_FIX (@var{x})
7732 A macro whose definition is a C expression to convert the target-machine
7733 floating point value @var{x} to a signed integer.  @var{x} has type
7734 @code{REAL_VALUE_TYPE}.
7735
7736 @findex REAL_VALUE_UNSIGNED_FIX
7737 @item REAL_VALUE_UNSIGNED_FIX (@var{x})
7738 A macro whose definition is a C expression to convert the target-machine
7739 floating point value @var{x} to an unsigned integer.  @var{x} has type
7740 @code{REAL_VALUE_TYPE}.
7741
7742 @findex REAL_VALUE_RNDZINT
7743 @item REAL_VALUE_RNDZINT (@var{x})
7744 A macro whose definition is a C expression to round the target-machine
7745 floating point value @var{x} towards zero to an integer value (but still
7746 as a floating point number).  @var{x} has type @code{REAL_VALUE_TYPE},
7747 and so does the value.
7748
7749 @findex REAL_VALUE_UNSIGNED_RNDZINT
7750 @item REAL_VALUE_UNSIGNED_RNDZINT (@var{x})
7751 A macro whose definition is a C expression to round the target-machine
7752 floating point value @var{x} towards zero to an unsigned integer value
7753 (but still represented as a floating point number).  @var{x} has type
7754 @code{REAL_VALUE_TYPE}, and so does the value.
7755
7756 @findex REAL_VALUE_ATOF
7757 @item REAL_VALUE_ATOF (@var{string}, @var{mode})
7758 A macro for a C expression which converts @var{string}, an expression of
7759 type @code{char *}, into a floating point number in the target machine's
7760 representation for mode @var{mode}.  The value has type
7761 @code{REAL_VALUE_TYPE}.
7762
7763 @findex REAL_INFINITY
7764 @item REAL_INFINITY
7765 Define this macro if infinity is a possible floating point value, and
7766 therefore division by 0 is legitimate.
7767
7768 @findex REAL_VALUE_ISINF
7769 @findex isinf
7770 @item REAL_VALUE_ISINF (@var{x})
7771 A macro for a C expression which determines whether @var{x}, a floating
7772 point value, is infinity.  The value has type @code{int}.
7773 By default, this is defined to call @code{isinf}.
7774
7775 @findex REAL_VALUE_ISNAN
7776 @findex isnan
7777 @item REAL_VALUE_ISNAN (@var{x})
7778 A macro for a C expression which determines whether @var{x}, a floating
7779 point value, is a ``nan'' (not-a-number).  The value has type
7780 @code{int}.  By default, this is defined to call @code{isnan}.
7781 @end table
7782
7783 @cindex constant folding and floating point
7784 Define the following additional macros if you want to make floating
7785 point constant folding work while cross compiling.  If you don't
7786 define them, cross compilation is still possible, but constant folding
7787 will not happen for floating point values.
7788
7789 @table @code
7790 @findex REAL_ARITHMETIC
7791 @item REAL_ARITHMETIC (@var{output}, @var{code}, @var{x}, @var{y})
7792 A macro for a C statement which calculates an arithmetic operation of
7793 the two floating point values @var{x} and @var{y}, both of type
7794 @code{REAL_VALUE_TYPE} in the target machine's representation, to
7795 produce a result of the same type and representation which is stored
7796 in @var{output} (which will be a variable).
7797
7798 The operation to be performed is specified by @var{code}, a tree code
7799 which will always be one of the following: @code{PLUS_EXPR},
7800 @code{MINUS_EXPR}, @code{MULT_EXPR}, @code{RDIV_EXPR},
7801 @code{MAX_EXPR}, @code{MIN_EXPR}.
7802
7803 @cindex overflow while constant folding
7804 The expansion of this macro is responsible for checking for overflow.
7805 If overflow happens, the macro expansion should execute the statement
7806 @code{return 0;}, which indicates the inability to perform the
7807 arithmetic operation requested.
7808
7809 @findex REAL_VALUE_NEGATE
7810 @item REAL_VALUE_NEGATE (@var{x})
7811 A macro for a C expression which returns the negative of the floating
7812 point value @var{x}.  Both @var{x} and the value of the expression
7813 have type @code{REAL_VALUE_TYPE} and are in the target machine's
7814 floating point representation.
7815
7816 There is no way for this macro to report overflow, since overflow
7817 can't happen in the negation operation.
7818
7819 @findex REAL_VALUE_TRUNCATE
7820 @item REAL_VALUE_TRUNCATE (@var{mode}, @var{x})
7821 A macro for a C expression which converts the floating point value
7822 @var{x} to mode @var{mode}.
7823
7824 Both @var{x} and the value of the expression are in the target machine's
7825 floating point representation and have type @code{REAL_VALUE_TYPE}.
7826 However, the value should have an appropriate bit pattern to be output
7827 properly as a floating constant whose precision accords with mode
7828 @var{mode}.
7829
7830 There is no way for this macro to report overflow.
7831
7832 @findex REAL_VALUE_TO_INT
7833 @item REAL_VALUE_TO_INT (@var{low}, @var{high}, @var{x})
7834 A macro for a C expression which converts a floating point value
7835 @var{x} into a double-precision integer which is then stored into
7836 @var{low} and @var{high}, two variables of type @var{int}.
7837
7838 @item REAL_VALUE_FROM_INT (@var{x}, @var{low}, @var{high}, @var{mode})
7839 @findex REAL_VALUE_FROM_INT
7840 A macro for a C expression which converts a double-precision integer
7841 found in @var{low} and @var{high}, two variables of type @var{int},
7842 into a floating point value which is then stored into @var{x}.
7843 The value is in the target machine's representation for mode @var{mode}
7844 and has the type @code{REAL_VALUE_TYPE}.
7845 @end table
7846
7847 @node Mode Switching
7848 @section Mode Switching Instructions
7849 @cindex mode switching
7850 The following macros control mode switching optimizations:
7851
7852 @table @code
7853 @findex OPTIMIZE_MODE_SWITCHING
7854 @item OPTIMIZE_MODE_SWITCHING (@var{entity})
7855 Define this macro if the port needs extra instructions inserted for mode
7856 switching in an optimizing compilation.
7857
7858 For an example, the SH4 can perform both single and double precision
7859 floating point operations, but to perform a single precision operation,
7860 the FPSCR PR bit has to be cleared, while for a double precision
7861 operation, this bit has to be set.  Changing the PR bit requires a general
7862 purpose register as a scratch register, hence these FPSCR sets have to
7863 be inserted before reload, i.e.@: you can't put this into instruction emitting
7864 or @code{MACHINE_DEPENDENT_REORG}.
7865
7866 You can have multiple entities that are mode-switched, and select at run time
7867 which entities actually need it.  @code{OPTIMIZE_MODE_SWITCHING} should
7868 return non-zero for any @var{entity} that that needs mode-switching.
7869 If you define this macro, you also have to define
7870 @code{NUM_MODES_FOR_MODE_SWITCHING}, @code{MODE_NEEDED},
7871 @code{MODE_PRIORITY_TO_MODE} and @code{EMIT_MODE_SET}.
7872 @code{NORMAL_MODE} is optional.
7873
7874 @findex NUM_MODES_FOR_MODE_SWITCHING
7875 @item NUM_MODES_FOR_MODE_SWITCHING
7876 If you define @code{OPTIMIZE_MODE_SWITCHING}, you have to define this as
7877 initializer for an array of integers.  Each initializer element
7878 N refers to an entity that needs mode switching, and specifies the number
7879 of different modes that might need to be set for this entity.
7880 The position of the initializer in the initializer - starting counting at
7881 zero - determines the integer that is used to refer to the mode-switched
7882 entity in question.
7883 In macros that take mode arguments / yield a mode result, modes are
7884 represented as numbers 0 @dots{} N @minus{} 1.  N is used to specify that no mode
7885 switch is needed / supplied.
7886
7887 @findex MODE_NEEDED
7888 @item MODE_NEEDED (@var{entity}, @var{insn})
7889 @var{entity} is an integer specifying a mode-switched entity.  If
7890 @code{OPTIMIZE_MODE_SWITCHING} is defined, you must define this macro to
7891 return an integer value not larger than the corresponding element in
7892 @code{NUM_MODES_FOR_MODE_SWITCHING}, to denote the mode that @var{entity} must
7893 be switched into prior to the execution of @var{insn}.
7894
7895 @findex NORMAL_MODE
7896 @item NORMAL_MODE (@var{entity})
7897 If this macro is defined, it is evaluated for every @var{entity} that needs
7898 mode switching.  It should evaluate to an integer, which is a mode that
7899 @var{entity} is assumed to be switched to at function entry and exit.
7900
7901 @findex MODE_PRIORITY_TO_MODE
7902 @item MODE_PRIORITY_TO_MODE (@var{entity}, @var{n})
7903 This macro specifies the order in which modes for @var{entity} are processed.
7904 0 is the highest priority, @code{NUM_MODES_FOR_MODE_SWITCHING[@var{entity}] - 1} the
7905 lowest.  The value of the macro should be an integer designating a mode
7906 for @var{entity}.  For any fixed @var{entity}, @code{mode_priority_to_mode}
7907 (@var{entity}, @var{n}) shall be a bijection in 0 @dots{}
7908 @code{num_modes_for_mode_switching[@var{entity}] - 1}.
7909
7910 @findex EMIT_MODE_SET
7911 @item EMIT_MODE_SET (@var{entity}, @var{mode}, @var{hard_regs_live})
7912 Generate one or more insns to set @var{entity} to @var{mode}.
7913 @var{hard_reg_live} is the set of hard registers live at the point where
7914 the insn(s) are to be inserted.
7915 @end table
7916
7917 @node Misc
7918 @section Miscellaneous Parameters
7919 @cindex parameters, miscellaneous
7920
7921 @c prevent bad page break with this line
7922 Here are several miscellaneous parameters.
7923
7924 @table @code
7925 @item PREDICATE_CODES
7926 @findex PREDICATE_CODES
7927 Define this if you have defined special-purpose predicates in the file
7928 @file{@var{machine}.c}.  This macro is called within an initializer of an
7929 array of structures.  The first field in the structure is the name of a
7930 predicate and the second field is an array of rtl codes.  For each
7931 predicate, list all rtl codes that can be in expressions matched by the
7932 predicate.  The list should have a trailing comma.  Here is an example
7933 of two entries in the list for a typical RISC machine:
7934
7935 @smallexample
7936 #define PREDICATE_CODES \
7937   @{"gen_reg_rtx_operand", @{SUBREG, REG@}@},  \
7938   @{"reg_or_short_cint_operand", @{SUBREG, REG, CONST_INT@}@},
7939 @end smallexample
7940
7941 Defining this macro does not affect the generated code (however,
7942 incorrect definitions that omit an rtl code that may be matched by the
7943 predicate can cause the compiler to malfunction).  Instead, it allows
7944 the table built by @file{genrecog} to be more compact and efficient,
7945 thus speeding up the compiler.  The most important predicates to include
7946 in the list specified by this macro are those used in the most insn
7947 patterns.
7948
7949 For each predicate function named in @code{PREDICATE_CODES}, a
7950 declaration will be generated in @file{insn-codes.h}.
7951
7952 @item SPECIAL_MODE_PREDICATES
7953 @findex SPECIAL_MODE_PREDICATES
7954 Define this if you have special predicates that know special things
7955 about modes.  Genrecog will warn about certain forms of
7956 @code{match_operand} without a mode; if the operand predicate is
7957 listed in @code{SPECIAL_MODE_PREDICATES}, the warning will be
7958 suppressed.
7959
7960 Here is an example from the IA-32 port (@code{ext_register_operand}
7961 specially checks for @code{HImode} or @code{SImode} in preparation
7962 for a byte extraction from @code{%ah} etc.).
7963
7964 @smallexample
7965 #define SPECIAL_MODE_PREDICATES \
7966   "ext_register_operand",
7967 @end smallexample
7968
7969 @findex CASE_VECTOR_MODE
7970 @item CASE_VECTOR_MODE
7971 An alias for a machine mode name.  This is the machine mode that
7972 elements of a jump-table should have.
7973
7974 @findex CASE_VECTOR_SHORTEN_MODE
7975 @item CASE_VECTOR_SHORTEN_MODE (@var{min_offset}, @var{max_offset}, @var{body})
7976 Optional: return the preferred mode for an @code{addr_diff_vec}
7977 when the minimum and maximum offset are known.  If you define this,
7978 it enables extra code in branch shortening to deal with @code{addr_diff_vec}.
7979 To make this work, you also have to define INSN_ALIGN and
7980 make the alignment for @code{addr_diff_vec} explicit.
7981 The @var{body} argument is provided so that the offset_unsigned and scale
7982 flags can be updated.
7983
7984 @findex CASE_VECTOR_PC_RELATIVE
7985 @item CASE_VECTOR_PC_RELATIVE
7986 Define this macro to be a C expression to indicate when jump-tables
7987 should contain relative addresses.  If jump-tables never contain
7988 relative addresses, then you need not define this macro.
7989
7990 @findex CASE_DROPS_THROUGH
7991 @item CASE_DROPS_THROUGH
7992 Define this if control falls through a @code{case} insn when the index
7993 value is out of range.  This means the specified default-label is
7994 actually ignored by the @code{case} insn proper.
7995
7996 @findex CASE_VALUES_THRESHOLD
7997 @item CASE_VALUES_THRESHOLD
7998 Define this to be the smallest number of different values for which it
7999 is best to use a jump-table instead of a tree of conditional branches.
8000 The default is four for machines with a @code{casesi} instruction and
8001 five otherwise.  This is best for most machines.
8002
8003 @findex WORD_REGISTER_OPERATIONS
8004 @item WORD_REGISTER_OPERATIONS
8005 Define this macro if operations between registers with integral mode
8006 smaller than a word are always performed on the entire register.
8007 Most RISC machines have this property and most CISC machines do not.
8008
8009 @findex LOAD_EXTEND_OP
8010 @item LOAD_EXTEND_OP (@var{mode})
8011 Define this macro to be a C expression indicating when insns that read
8012 memory in @var{mode}, an integral mode narrower than a word, set the
8013 bits outside of @var{mode} to be either the sign-extension or the
8014 zero-extension of the data read.  Return @code{SIGN_EXTEND} for values
8015 of @var{mode} for which the
8016 insn sign-extends, @code{ZERO_EXTEND} for which it zero-extends, and
8017 @code{NIL} for other modes.
8018
8019 This macro is not called with @var{mode} non-integral or with a width
8020 greater than or equal to @code{BITS_PER_WORD}, so you may return any
8021 value in this case.  Do not define this macro if it would always return
8022 @code{NIL}.  On machines where this macro is defined, you will normally
8023 define it as the constant @code{SIGN_EXTEND} or @code{ZERO_EXTEND}.
8024
8025 @findex SHORT_IMMEDIATES_SIGN_EXTEND
8026 @item SHORT_IMMEDIATES_SIGN_EXTEND
8027 Define this macro if loading short immediate values into registers sign
8028 extends.
8029
8030 @findex IMPLICIT_FIX_EXPR
8031 @item IMPLICIT_FIX_EXPR
8032 An alias for a tree code that should be used by default for conversion
8033 of floating point values to fixed point.  Normally,
8034 @code{FIX_ROUND_EXPR} is used.
8035
8036 @findex FIXUNS_TRUNC_LIKE_FIX_TRUNC
8037 @item FIXUNS_TRUNC_LIKE_FIX_TRUNC
8038 Define this macro if the same instructions that convert a floating
8039 point number to a signed fixed point number also convert validly to an
8040 unsigned one.
8041
8042 @findex EASY_DIV_EXPR
8043 @item EASY_DIV_EXPR
8044 An alias for a tree code that is the easiest kind of division to
8045 compile code for in the general case.  It may be
8046 @code{TRUNC_DIV_EXPR}, @code{FLOOR_DIV_EXPR}, @code{CEIL_DIV_EXPR} or
8047 @code{ROUND_DIV_EXPR}.  These four division operators differ in how
8048 they round the result to an integer.  @code{EASY_DIV_EXPR} is used
8049 when it is permissible to use any of those kinds of division and the
8050 choice should be made on the basis of efficiency.
8051
8052 @findex MOVE_MAX
8053 @item MOVE_MAX
8054 The maximum number of bytes that a single instruction can move quickly
8055 between memory and registers or between two memory locations.
8056
8057 @findex MAX_MOVE_MAX
8058 @item MAX_MOVE_MAX
8059 The maximum number of bytes that a single instruction can move quickly
8060 between memory and registers or between two memory locations.  If this
8061 is undefined, the default is @code{MOVE_MAX}.  Otherwise, it is the
8062 constant value that is the largest value that @code{MOVE_MAX} can have
8063 at run-time.
8064
8065 @findex SHIFT_COUNT_TRUNCATED
8066 @item SHIFT_COUNT_TRUNCATED
8067 A C expression that is nonzero if on this machine the number of bits
8068 actually used for the count of a shift operation is equal to the number
8069 of bits needed to represent the size of the object being shifted.  When
8070 this macro is non-zero, the compiler will assume that it is safe to omit
8071 a sign-extend, zero-extend, and certain bitwise `and' instructions that
8072 truncates the count of a shift operation.  On machines that have
8073 instructions that act on bit-fields at variable positions, which may
8074 include `bit test' instructions, a nonzero @code{SHIFT_COUNT_TRUNCATED}
8075 also enables deletion of truncations of the values that serve as
8076 arguments to bit-field instructions.
8077
8078 If both types of instructions truncate the count (for shifts) and
8079 position (for bit-field operations), or if no variable-position bit-field
8080 instructions exist, you should define this macro.
8081
8082 However, on some machines, such as the 80386 and the 680x0, truncation
8083 only applies to shift operations and not the (real or pretended)
8084 bit-field operations.  Define @code{SHIFT_COUNT_TRUNCATED} to be zero on
8085 such machines.  Instead, add patterns to the @file{md} file that include
8086 the implied truncation of the shift instructions.
8087
8088 You need not define this macro if it would always have the value of zero.
8089
8090 @findex TRULY_NOOP_TRUNCATION
8091 @item TRULY_NOOP_TRUNCATION (@var{outprec}, @var{inprec})
8092 A C expression which is nonzero if on this machine it is safe to
8093 ``convert'' an integer of @var{inprec} bits to one of @var{outprec}
8094 bits (where @var{outprec} is smaller than @var{inprec}) by merely
8095 operating on it as if it had only @var{outprec} bits.
8096
8097 On many machines, this expression can be 1.
8098
8099 @c rearranged this, removed the phrase "it is reported that".  this was
8100 @c to fix an overfull hbox.  --mew 10feb93
8101 When @code{TRULY_NOOP_TRUNCATION} returns 1 for a pair of sizes for
8102 modes for which @code{MODES_TIEABLE_P} is 0, suboptimal code can result.
8103 If this is the case, making @code{TRULY_NOOP_TRUNCATION} return 0 in
8104 such cases may improve things.
8105
8106 @findex STORE_FLAG_VALUE
8107 @item STORE_FLAG_VALUE
8108 A C expression describing the value returned by a comparison operator
8109 with an integral mode and stored by a store-flag instruction
8110 (@samp{s@var{cond}}) when the condition is true.  This description must
8111 apply to @emph{all} the @samp{s@var{cond}} patterns and all the
8112 comparison operators whose results have a @code{MODE_INT} mode.
8113
8114 A value of 1 or @minus{}1 means that the instruction implementing the
8115 comparison operator returns exactly 1 or @minus{}1 when the comparison is true
8116 and 0 when the comparison is false.  Otherwise, the value indicates
8117 which bits of the result are guaranteed to be 1 when the comparison is
8118 true.  This value is interpreted in the mode of the comparison
8119 operation, which is given by the mode of the first operand in the
8120 @samp{s@var{cond}} pattern.  Either the low bit or the sign bit of
8121 @code{STORE_FLAG_VALUE} be on.  Presently, only those bits are used by
8122 the compiler.
8123
8124 If @code{STORE_FLAG_VALUE} is neither 1 or @minus{}1, the compiler will
8125 generate code that depends only on the specified bits.  It can also
8126 replace comparison operators with equivalent operations if they cause
8127 the required bits to be set, even if the remaining bits are undefined.
8128 For example, on a machine whose comparison operators return an
8129 @code{SImode} value and where @code{STORE_FLAG_VALUE} is defined as
8130 @samp{0x80000000}, saying that just the sign bit is relevant, the
8131 expression
8132
8133 @smallexample
8134 (ne:SI (and:SI @var{x} (const_int @var{power-of-2})) (const_int 0))
8135 @end smallexample
8136
8137 @noindent
8138 can be converted to
8139
8140 @smallexample
8141 (ashift:SI @var{x} (const_int @var{n}))
8142 @end smallexample
8143
8144 @noindent
8145 where @var{n} is the appropriate shift count to move the bit being
8146 tested into the sign bit.
8147
8148 There is no way to describe a machine that always sets the low-order bit
8149 for a true value, but does not guarantee the value of any other bits,
8150 but we do not know of any machine that has such an instruction.  If you
8151 are trying to port GCC to such a machine, include an instruction to
8152 perform a logical-and of the result with 1 in the pattern for the
8153 comparison operators and let us know
8154 @ifset USING
8155 (@pxref{Bug Reporting,,How to Report Bugs}).
8156 @end ifset
8157 @ifclear USING
8158 (@pxref{Bug Reporting,,How to Report Bugs,gcc.info,Using GCC}).
8159 @end ifclear
8160
8161 Often, a machine will have multiple instructions that obtain a value
8162 from a comparison (or the condition codes).  Here are rules to guide the
8163 choice of value for @code{STORE_FLAG_VALUE}, and hence the instructions
8164 to be used:
8165
8166 @itemize @bullet
8167 @item
8168 Use the shortest sequence that yields a valid definition for
8169 @code{STORE_FLAG_VALUE}.  It is more efficient for the compiler to
8170 ``normalize'' the value (convert it to, e.g., 1 or 0) than for the
8171 comparison operators to do so because there may be opportunities to
8172 combine the normalization with other operations.
8173
8174 @item
8175 For equal-length sequences, use a value of 1 or @minus{}1, with @minus{}1 being
8176 slightly preferred on machines with expensive jumps and 1 preferred on
8177 other machines.
8178
8179 @item
8180 As a second choice, choose a value of @samp{0x80000001} if instructions
8181 exist that set both the sign and low-order bits but do not define the
8182 others.
8183
8184 @item
8185 Otherwise, use a value of @samp{0x80000000}.
8186 @end itemize
8187
8188 Many machines can produce both the value chosen for
8189 @code{STORE_FLAG_VALUE} and its negation in the same number of
8190 instructions.  On those machines, you should also define a pattern for
8191 those cases, e.g., one matching
8192
8193 @smallexample
8194 (set @var{A} (neg:@var{m} (ne:@var{m} @var{B} @var{C})))
8195 @end smallexample
8196
8197 Some machines can also perform @code{and} or @code{plus} operations on
8198 condition code values with less instructions than the corresponding
8199 @samp{s@var{cond}} insn followed by @code{and} or @code{plus}.  On those
8200 machines, define the appropriate patterns.  Use the names @code{incscc}
8201 and @code{decscc}, respectively, for the patterns which perform
8202 @code{plus} or @code{minus} operations on condition code values.  See
8203 @file{rs6000.md} for some examples.  The GNU Superoptizer can be used to
8204 find such instruction sequences on other machines.
8205
8206 You need not define @code{STORE_FLAG_VALUE} if the machine has no store-flag
8207 instructions.
8208
8209 @findex FLOAT_STORE_FLAG_VALUE
8210 @item FLOAT_STORE_FLAG_VALUE (@var{mode})
8211 A C expression that gives a non-zero @code{REAL_VALUE_TYPE} value that is
8212 returned when comparison operators with floating-point results are true.
8213 Define this macro on machine that have comparison operations that return
8214 floating-point values.  If there are no such operations, do not define
8215 this macro.
8216
8217 @findex Pmode
8218 @item Pmode
8219 An alias for the machine mode for pointers.  On most machines, define
8220 this to be the integer mode corresponding to the width of a hardware
8221 pointer; @code{SImode} on 32-bit machine or @code{DImode} on 64-bit machines.
8222 On some machines you must define this to be one of the partial integer
8223 modes, such as @code{PSImode}.
8224
8225 The width of @code{Pmode} must be at least as large as the value of
8226 @code{POINTER_SIZE}.  If it is not equal, you must define the macro
8227 @code{POINTERS_EXTEND_UNSIGNED} to specify how pointers are extended
8228 to @code{Pmode}.
8229
8230 @findex FUNCTION_MODE
8231 @item FUNCTION_MODE
8232 An alias for the machine mode used for memory references to functions
8233 being called, in @code{call} RTL expressions.  On most machines this
8234 should be @code{QImode}.
8235
8236 @findex INTEGRATE_THRESHOLD
8237 @item INTEGRATE_THRESHOLD (@var{decl})
8238 A C expression for the maximum number of instructions above which the
8239 function @var{decl} should not be inlined.  @var{decl} is a
8240 @code{FUNCTION_DECL} node.
8241
8242 The default definition of this macro is 64 plus 8 times the number of
8243 arguments that the function accepts.  Some people think a larger
8244 threshold should be used on RISC machines.
8245
8246 @findex STDC_0_IN_SYSTEM_HEADERS
8247 @item STDC_0_IN_SYSTEM_HEADERS
8248 In normal operation, the preprocessor expands @code{__STDC__} to the
8249 constant 1, to signify that GCC conforms to ISO Standard C@.  On some
8250 hosts, like Solaris, the system compiler uses a different convention,
8251 where @code{__STDC__} is normally 0, but is 1 if the user specifies
8252 strict conformance to the C Standard.
8253
8254 Defining @code{STDC_0_IN_SYSTEM_HEADERS} makes GNU CPP follows the host
8255 convention when processing system header files, but when processing user
8256 files @code{__STDC__} will always expand to 1.
8257
8258 @findex SCCS_DIRECTIVE
8259 @item SCCS_DIRECTIVE
8260 Define this if the preprocessor should ignore @code{#sccs} directives
8261 and print no error message.
8262
8263 @findex NO_IMPLICIT_EXTERN_C
8264 @item NO_IMPLICIT_EXTERN_C
8265 Define this macro if the system header files support C++ as well as C@.
8266 This macro inhibits the usual method of using system header files in
8267 C++, which is to pretend that the file's contents are enclosed in
8268 @samp{extern "C" @{@dots{}@}}.
8269
8270 @findex HANDLE_PRAGMA
8271 @item HANDLE_PRAGMA (@var{getc}, @var{ungetc}, @var{name})
8272 This macro is no longer supported.  You must use
8273 @code{REGISTER_TARGET_PRAGMAS} instead.
8274
8275 @findex REGISTER_TARGET_PRAGMAS
8276 @findex #pragma
8277 @findex pragma
8278 @item REGISTER_TARGET_PRAGMAS (@var{pfile})
8279 Define this macro if you want to implement any target-specific pragmas.
8280 If defined, it is a C expression which makes a series of calls to the
8281 @code{cpp_register_pragma} and/or @code{cpp_register_pragma_space}
8282 functions.  The @var{pfile} argument is the first argument to supply to
8283 these functions.  The macro may also do setup required for the pragmas.
8284
8285 The primary reason to define this macro is to provide compatibility with
8286 other compilers for the same target.  In general, we discourage
8287 definition of target-specific pragmas for GCC@.
8288
8289 If the pragma can be implemented by attributes then the macro
8290 @samp{INSERT_ATTRIBUTES} might be a useful one to define as well.
8291
8292 Preprocessor macros that appear on pragma lines are not expanded.  All
8293 @samp{#pragma} directives that do not match any registered pragma are
8294 silently ignored, unless the user specifies @option{-Wunknown-pragmas}.
8295
8296 @deftypefun void cpp_register_pragma (cpp_reader *@var{pfile}, const char *@var{space}, const char *@var{name}, void (*@var{callback}) (cpp_reader *))
8297
8298 Each call to @code{cpp_register_pragma} establishes one pragma.  The
8299 @var{callback} routine will be called when the preprocessor encounters a
8300 pragma of the form
8301
8302 @smallexample
8303 #pragma [@var{space}] @var{name} @dots{}
8304 @end smallexample
8305
8306 @var{space} must have been the subject of a previous call to
8307 @code{cpp_register_pragma_space}, or else be a null pointer.  The
8308 callback routine receives @var{pfile} as its first argument, but must
8309 not use it for anything (this may change in the future).  It may read
8310 any text after the @var{name} by making calls to @code{c_lex}.  Text
8311 which is not read by the callback will be silently ignored.
8312
8313 Note that both @var{space} and @var{name} are case sensitive.
8314
8315 For an example use of this routine, see @file{c4x.h} and the callback
8316 routines defined in @file{c4x.c}.
8317
8318 Note that the use of @code{c_lex} is specific to the C and C++
8319 compilers.  It will not work in the Java or Fortran compilers, or any
8320 other language compilers for that matter.  Thus if @code{c_lex} is going
8321 to be called from target-specific code, it must only be done so when
8322 building the C and C++ compilers.  This can be done by defining the
8323 variables @code{c_target_objs} and @code{cxx_target_objs} in the
8324 target entry in the @file{config.gcc} file.  These variables should name
8325 the target-specific, language-specific object file which contains the
8326 code that uses @code{c_lex}.  Note it will also be necessary to add a
8327 rule to the makefile fragment pointed to by @code{tmake_file} that shows
8328 how to build this object file.
8329 @end deftypefun
8330
8331 @deftypefun void cpp_register_pragma_space (cpp_reader *@var{pfile}, const char *@var{space})
8332 This routine establishes a namespace for pragmas, which will be
8333 registered by subsequent calls to @code{cpp_register_pragma}.  For
8334 example, pragmas defined by the C standard are in the @samp{STDC}
8335 namespace, and pragmas specific to GCC are in the @samp{GCC} namespace.
8336
8337 For an example use of this routine in a target header, see @file{v850.h}.
8338 @end deftypefun
8339
8340 @findex HANDLE_SYSV_PRAGMA
8341 @findex #pragma
8342 @findex pragma
8343 @item HANDLE_SYSV_PRAGMA
8344 Define this macro (to a value of 1) if you want the System V style
8345 pragmas @samp{#pragma pack(<n>)} and @samp{#pragma weak <name>
8346 [=<value>]} to be supported by gcc.
8347
8348 The pack pragma specifies the maximum alignment (in bytes) of fields
8349 within a structure, in much the same way as the @samp{__aligned__} and
8350 @samp{__packed__} @code{__attribute__}s do.  A pack value of zero resets
8351 the behaviour to the default.
8352
8353 The weak pragma only works if @code{SUPPORTS_WEAK} and
8354 @code{ASM_WEAKEN_LABEL} are defined.  If enabled it allows the creation
8355 of specifically named weak labels, optionally with a value.
8356
8357 @findex HANDLE_PRAGMA_PACK_PUSH_POP
8358 @findex #pragma
8359 @findex pragma
8360 @item HANDLE_PRAGMA_PACK_PUSH_POP
8361 Define this macro (to a value of 1) if you want to support the Win32
8362 style pragmas @samp{#pragma pack(push,@var{n})} and @samp{#pragma
8363 pack(pop)}.  The @samp{pack(push,@var{n})} pragma specifies the maximum alignment
8364 (in bytes) of fields within a structure, in much the same way as the
8365 @samp{__aligned__} and @samp{__packed__} @code{__attribute__}s do.  A
8366 pack value of zero resets the behaviour to the default.  Successive
8367 invocations of this pragma cause the previous values to be stacked, so
8368 that invocations of @samp{#pragma pack(pop)} will return to the previous
8369 value.
8370 @end table
8371
8372 @deftypefn {Target Hook} int TARGET_VALID_DECL_ATTRIBUTE (tree @var{decl}, tree @var{attributes}, tree @var{identifier}, tree @var{args})
8373 If defined, this target hook is a function which returns nonzero if @var{identifier} with
8374 arguments @var{args} is a valid machine specific attribute for @var{decl}.
8375 The attributes in @var{attributes} have previously been assigned to @var{decl}.
8376 @end deftypefn
8377
8378 @deftypefn {Target Hook} int TARGET_VALID_TYPE_ATTRIBUTE (tree @var{type}, tree @var{attributes}, tree @var{identifier}, tree @var{args})
8379 If defined, this target hook is a function which returns nonzero if @var{identifier} with
8380 arguments @var{args} is a valid machine specific attribute for @var{type}.
8381 The attributes in @var{attributes} have previously been assigned to @var{type}.
8382 @end deftypefn
8383
8384 @deftypefn {Target Hook} int TARGET_COMP_TYPE_ATTRIBUTES (tree @var{type1}, tree @var{type2})
8385 If defined, this target hook is a function which returns zero if the attributes on
8386 @var{type1} and @var{type2} are incompatible, one if they are compatible,
8387 and two if they are nearly compatible (which causes a warning to be
8388 generated).  If this is not defined, machine-specific attributes are
8389 supposed always to be compatible.
8390 @end deftypefn
8391
8392 @deftypefn {Target Hook} void TARGET_SET_DEFAULT_TYPE_ATTRIBUTES (tree @var{type})
8393 If defined, this target hook is a function which assigns default attributes to
8394 newly defined @var{type}.
8395 @end deftypefn
8396
8397 @deftypefn {Target Hook} tree TARGET_MERGE_TYPE_ATTRIBUTES (tree @var{type1}, tree @var{type2})
8398 Define this target hook if the merging of type attributes needs special
8399 handling.  If defined, the result is a list of the combined
8400 @code{TYPE_ATTRIBUTES} of @var{type1} and @var{type2}.  It is assumed
8401 that @code{comptypes} has already been called and returned 1.  This
8402 function may call @code{merge_attributes} to handle machine-independent
8403 merging.
8404 @end deftypefn
8405
8406 @deftypefn {Target Hook} tree TARGET_MERGE_DECL_ATTRIBUTES (tree @var{olddecl}, tree @var{newdecl})
8407 Define this target hook if the merging of decl attributes needs special
8408 handling.  If defined, the result is a list of the combined
8409 @code{DECL_MACHINE_ATTRIBUTES} of @var{olddecl} and @var{newdecl}.
8410 @var{newdecl} is a duplicate declaration of @var{olddecl}.  Examples of
8411 when this is needed are when one attribute overrides another, or when an
8412 attribute is nullified by a subsequent definition.  This function may
8413 call @code{merge_attributes} to handle machine-independent merging.
8414
8415 @findex TARGET_DLLIMPORT_DECL_ATTRIBUTES
8416 If the only target-specific handling you require is @samp{dllimport} for
8417 Windows targets, you should define the macro
8418 @code{TARGET_DLLIMPORT_DECL_ATTRIBUTES}.  This links in a function
8419 called @code{merge_dllimport_decl_attributes} which can then be defined
8420 as the expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}.  This is done
8421 in @file{i386/cygwin.h} and @file{i386/i386.c}, for example.
8422 @end deftypefn
8423
8424 @deftypefn {Target Hook} void TARGET_INSERT_ATTRIBUTES (tree @var{node}, tree *@var{attr_ptr})
8425 Define this target hook if you want to be able to add attributes to a decl
8426 when it is being created.  This is normally useful for back ends which
8427 wish to implement a pragma by using the attributes which correspond to
8428 the pragma's effect.  The @var{node} argument is the decl which is being
8429 created.  The @var{attr_ptr} argument is a pointer to the attribute list
8430 for this decl.  The list itself should not be modified, since it may be
8431 shared with other decls, but attributes may be chained on the head of
8432 the list and @code{*@var{attr_ptr}} modified to point to the new
8433 attributes, or a copy of the list may be made if further changes are
8434 needed.
8435 @end deftypefn
8436
8437 @table @code
8438 @findex DOLLARS_IN_IDENTIFIERS
8439 @item DOLLARS_IN_IDENTIFIERS
8440 Define this macro to control use of the character @samp{$} in identifier
8441 names.  0 means @samp{$} is not allowed by default; 1 means it is allowed.
8442 1 is the default; there is no need to define this macro in that case.
8443 This macro controls the compiler proper; it does not affect the preprocessor.
8444
8445 @findex NO_DOLLAR_IN_LABEL
8446 @item NO_DOLLAR_IN_LABEL
8447 Define this macro if the assembler does not accept the character
8448 @samp{$} in label names.  By default constructors and destructors in
8449 G++ have @samp{$} in the identifiers.  If this macro is defined,
8450 @samp{.} is used instead.
8451
8452 @findex NO_DOT_IN_LABEL
8453 @item NO_DOT_IN_LABEL
8454 Define this macro if the assembler does not accept the character
8455 @samp{.} in label names.  By default constructors and destructors in G++
8456 have names that use @samp{.}.  If this macro is defined, these names
8457 are rewritten to avoid @samp{.}.
8458
8459 @findex DEFAULT_MAIN_RETURN
8460 @item DEFAULT_MAIN_RETURN
8461 Define this macro if the target system expects every program's @code{main}
8462 function to return a standard ``success'' value by default (if no other
8463 value is explicitly returned).
8464
8465 The definition should be a C statement (sans semicolon) to generate the
8466 appropriate rtl instructions.  It is used only when compiling the end of
8467 @code{main}.
8468
8469 @item NEED_ATEXIT
8470 @findex NEED_ATEXIT
8471 Define this if the target system lacks the function @code{atexit}
8472 from the ISO C standard.  If this macro is defined, a default definition
8473 will be provided to support C++.  If @code{ON_EXIT} is not defined,
8474 a default @code{exit} function will also be provided.
8475
8476 @item ON_EXIT
8477 @findex ON_EXIT
8478 Define this macro if the target has another way to implement atexit
8479 functionality without replacing @code{exit}.  For instance, SunOS 4 has
8480 a similar @code{on_exit} library function.
8481
8482 The definition should be a functional macro which can be used just like
8483 the @code{atexit} function.
8484
8485 @item EXIT_BODY
8486 @findex EXIT_BODY
8487 Define this if your @code{exit} function needs to do something
8488 besides calling an external function @code{_cleanup} before
8489 terminating with @code{_exit}.  The @code{EXIT_BODY} macro is
8490 only needed if @code{NEED_ATEXIT} is defined and @code{ON_EXIT} is not
8491 defined.
8492
8493 @findex INSN_SETS_ARE_DELAYED
8494 @item INSN_SETS_ARE_DELAYED (@var{insn})
8495 Define this macro as a C expression that is nonzero if it is safe for the
8496 delay slot scheduler to place instructions in the delay slot of @var{insn},
8497 even if they appear to use a resource set or clobbered in @var{insn}.
8498 @var{insn} is always a @code{jump_insn} or an @code{insn}; GCC knows that
8499 every @code{call_insn} has this behavior.  On machines where some @code{insn}
8500 or @code{jump_insn} is really a function call and hence has this behavior,
8501 you should define this macro.
8502
8503 You need not define this macro if it would always return zero.
8504
8505 @findex INSN_REFERENCES_ARE_DELAYED
8506 @item INSN_REFERENCES_ARE_DELAYED (@var{insn})
8507 Define this macro as a C expression that is nonzero if it is safe for the
8508 delay slot scheduler to place instructions in the delay slot of @var{insn},
8509 even if they appear to set or clobber a resource referenced in @var{insn}.
8510 @var{insn} is always a @code{jump_insn} or an @code{insn}.  On machines where
8511 some @code{insn} or @code{jump_insn} is really a function call and its operands
8512 are registers whose use is actually in the subroutine it calls, you should
8513 define this macro.  Doing so allows the delay slot scheduler to move
8514 instructions which copy arguments into the argument registers into the delay
8515 slot of @var{insn}.
8516
8517 You need not define this macro if it would always return zero.
8518
8519 @findex MACHINE_DEPENDENT_REORG
8520 @item MACHINE_DEPENDENT_REORG (@var{insn})
8521 In rare cases, correct code generation requires extra machine
8522 dependent processing between the second jump optimization pass and
8523 delayed branch scheduling.  On those machines, define this macro as a C
8524 statement to act on the code starting at @var{insn}.
8525
8526 @findex MULTIPLE_SYMBOL_SPACES
8527 @item MULTIPLE_SYMBOL_SPACES
8528 Define this macro if in some cases global symbols from one translation
8529 unit may not be bound to undefined symbols in another translation unit
8530 without user intervention.  For instance, under Microsoft Windows
8531 symbols must be explicitly imported from shared libraries (DLLs).
8532
8533 @findex MD_ASM_CLOBBERS
8534 @item MD_ASM_CLOBBERS (@var{clobbers})
8535 A C statement that adds to @var{clobbers} @code{STRING_CST} trees for
8536 any hard regs the port wishes to automatically clobber for all asms.
8537
8538 @findex ISSUE_RATE
8539 @item ISSUE_RATE
8540 A C expression that returns how many instructions can be issued at the
8541 same time if the machine is a superscalar machine.
8542
8543 @findex MD_SCHED_INIT
8544 @item MD_SCHED_INIT (@var{file}, @var{verbose}, @var{max_ready})
8545 A C statement which is executed by the scheduler at the
8546 beginning of each block of instructions that are to be scheduled.
8547 @var{file} is either a null pointer, or a stdio stream to write any
8548 debug output to.  @var{verbose} is the verbose level provided by
8549 @option{-fsched-verbose-@var{n}}.  @var{max_ready} is the maximum number
8550 of insns in the current scheduling region that can be live at the same
8551 time.  This can be used to allocate scratch space if it is needed.
8552
8553 @findex MD_SCHED_FINISH
8554 @item MD_SCHED_FINISH (@var{file}, @var{verbose})
8555 A C statement which is executed by the scheduler at the end of each block
8556 of instructions that are to be scheduled.  It can be used to perform
8557 cleanup of any actions done by the other scheduling macros.
8558 @var{file} is either a null pointer, or a stdio stream to write any
8559 debug output to.  @var{verbose} is the verbose level provided by
8560 @option{-fsched-verbose-@var{n}}.
8561
8562 @findex MD_SCHED_REORDER
8563 @item MD_SCHED_REORDER (@var{file}, @var{verbose}, @var{ready}, @var{n_ready}, @var{clock}, @var{can_issue_more})
8564 A C statement which is executed by the scheduler after it
8565 has scheduled the ready list to allow the machine description to reorder
8566 it (for example to combine two small instructions together on
8567 @samp{VLIW} machines).  @var{file} is either a null pointer, or a stdio
8568 stream to write any debug output to.  @var{verbose} is the verbose level
8569 provided by @option{-fsched-verbose-@var{n}}.  @var{ready} is a pointer to
8570 the ready list of instructions that are ready to be scheduled.
8571 @var{n_ready} is the number of elements in the ready list.  The
8572 scheduler reads the ready list in reverse order, starting with
8573 @var{ready}[@var{n_ready}-1] and going to @var{ready}[0].  @var{clock}
8574 is the timer tick of the scheduler.  @var{can_issue_more} is an output
8575 parameter that is set to the number of insns that can issue this clock;
8576 normally this is just @code{issue_rate}.  See also @samp{MD_SCHED_REORDER2}.
8577
8578 @findex MD_SCHED_REORDER2
8579 @item MD_SCHED_REORDER2 (@var{file}, @var{verbose}, @var{ready}, @var{n_ready}, @var{clock}, @var{can_issue_more})
8580 Like @samp{MD_SCHED_REORDER}, but called at a different time.  While the
8581 @samp{MD_SCHED_REORDER} macro is called whenever the scheduler starts a
8582 new cycle, this macro is used immediately after @samp{MD_SCHED_VARIABLE_ISSUE}
8583 is called; it can reorder the ready list and set @var{can_issue_more} to
8584 determine whether there are more insns to be scheduled in the same cycle.
8585 Defining this macro can be useful if there are frequent situations where
8586 scheduling one insn causes other insns to become ready in the same cycle,
8587 these other insns can then be taken into account properly.
8588
8589 @findex MD_SCHED_VARIABLE_ISSUE
8590 @item MD_SCHED_VARIABLE_ISSUE (@var{file}, @var{verbose}, @var{insn}, @var{more})
8591 A C statement which is executed by the scheduler after it
8592 has scheduled an insn from the ready list.  @var{file} is either a null
8593 pointer, or a stdio stream to write any debug output to.  @var{verbose}
8594 is the verbose level provided by @option{-fsched-verbose-@var{n}}.
8595 @var{insn} is the instruction that was scheduled.  @var{more} is the
8596 number of instructions that can be issued in the current cycle.  The
8597 @samp{MD_SCHED_VARIABLE_ISSUE} macro is responsible for updating the
8598 value of @var{more} (typically by @samp{@var{more}--}).
8599
8600 @findex MAX_INTEGER_COMPUTATION_MODE
8601 @item MAX_INTEGER_COMPUTATION_MODE
8602 Define this to the largest integer machine mode which can be used for
8603 operations other than load, store and copy operations.
8604
8605 You need only define this macro if the target holds values larger than
8606 @code{word_mode} in general purpose registers.  Most targets should not define
8607 this macro.
8608
8609 @findex MATH_LIBRARY
8610 @item MATH_LIBRARY
8611 Define this macro as a C string constant for the linker argument to link
8612 in the system math library, or @samp{""} if the target does not have a
8613 separate math library.
8614
8615 You need only define this macro if the default of @samp{"-lm"} is wrong.
8616
8617 @findex LIBRARY_PATH_ENV
8618 @item LIBRARY_PATH_ENV
8619 Define this macro as a C string constant for the environment variable that
8620 specifies where the linker should look for libraries.
8621
8622 You need only define this macro if the default of @samp{"LIBRARY_PATH"}
8623 is wrong.
8624
8625 @findex TARGET_HAS_F_SETLKW
8626 @item TARGET_HAS_F_SETLKW
8627 Define this macro if the target supports file locking with fcntl / F_SETLKW@.
8628 Note that this functionality is part of POSIX@.
8629 Defining @code{TARGET_HAS_F_SETLKW} will enable the test coverage code
8630 to use file locking when exiting a program, which avoids race conditions
8631 if the program has forked.
8632
8633 @findex MAX_CONDITIONAL_EXECUTE
8634 @item MAX_CONDITIONAL_EXECUTE
8635
8636 A C expression for the maximum number of instructions to execute via
8637 conditional execution instructions instead of a branch.  A value of
8638 @code{BRANCH_COST}+1 is the default if the machine does not use cc0, and
8639 1 if it does use cc0.
8640
8641 @findex IFCVT_MODIFY_TESTS
8642 @item IFCVT_MODIFY_TESTS
8643 A C expression to modify the tests in @code{TRUE_EXPR}, and
8644 @code{FALSE_EXPR} for use in converting insns in @code{TEST_BB},
8645 @code{THEN_BB}, @code{ELSE_BB}, and @code{JOIN_BB} basic blocks to
8646 conditional execution.  Set either @code{TRUE_EXPR} or @code{FALSE_EXPR}
8647 to a null pointer if the tests cannot be converted.
8648
8649 @findex IFCVT_MODIFY_INSN
8650 @item IFCVT_MODIFY_INSN
8651 A C expression to modify the @code{PATTERN} of an @code{INSN} that is to
8652 be converted to conditional execution format.
8653
8654 @findex IFCVT_MODIFY_FINAL
8655 @item IFCVT_MODIFY_FINAL
8656 A C expression to perform any final machine dependent modifications in
8657 converting code to conditional execution in the basic blocks
8658 @code{TEST_BB}, @code{THEN_BB}, @code{ELSE_BB}, and @code{JOIN_BB}.
8659
8660 @findex IFCVT_MODIFY_CANCEL
8661 @item IFCVT_MODIFY_CANCEL
8662 A C expression to cancel any machine dependent modifications in
8663 converting code to conditional execution in the basic blocks
8664 @code{TEST_BB}, @code{THEN_BB}, @code{ELSE_BB}, and @code{JOIN_BB}.
8665
8666 @deftypefn {Target Hook} void TARGET_INIT_BUILTINS ()
8667 Define this hook if you have any machine-specific built-in functions
8668 that need to be defined.  It should be a function that performs the
8669 necessary setup.
8670
8671 Machine specific built-in functions can be useful to expand special machine
8672 instructions that would otherwise not normally be generated because
8673 they have no equivalent in the source language (for example, SIMD vector
8674 instructions or prefetch instructions).
8675
8676 To create a built-in function, call the function @code{builtin_function}
8677 which is defined by the language front end.  You can use any type nodes set
8678 up by @code{build_common_tree_nodes} and @code{build_common_tree_nodes_2};
8679 only language front ends that use these two functions will use
8680 @samp{TARGET_INIT_BUILTINS}.
8681 @end deftypefn
8682
8683 @deftypefn {Target Hook} rtx TARGET_EXPAND_BUILTIN (tree @var{exp}, rtx @var{target}, rtx @var{subtarget}, enum machine_mode @var{mode}, int @var{ignore})
8684
8685 Expand a call to a machine specific built-in function that was set up by
8686 @samp{TARGET_INIT_BUILTINS}.  @var{exp} is the expression for the
8687 function call; the result should go to @var{target} if that is
8688 convenient, and have mode @var{mode} if that is convenient.
8689 @var{subtarget} may be used as the target for computing one of
8690 @var{exp}'s operands.  @var{ignore} is nonzero if the value is to be
8691 ignored.  This function should return the result of the call to the
8692 built-in function.
8693 @end deftypefn
8694
8695 @end table