OSDN Git Service

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