OSDN Git Service

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