1 @c Copyright (C) 1988,1989,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,
2 @c 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3 @c Free Software Foundation, Inc.
4 @c This is part of the GCC manual.
5 @c For copying conditions, see the file gcc.texi.
8 @chapter Target Description Macros and Functions
9 @cindex machine description macros
10 @cindex target description macros
11 @cindex macros, target description
12 @cindex @file{tm.h} macros
14 In addition to the file @file{@var{machine}.md}, a machine description
15 includes a C header file conventionally given the name
16 @file{@var{machine}.h} and a C source file named @file{@var{machine}.c}.
17 The header file defines numerous macros that convey the information
18 about the target machine that does not fit into the scheme of the
19 @file{.md} file. The file @file{tm.h} should be a link to
20 @file{@var{machine}.h}. The header file @file{config.h} includes
21 @file{tm.h} and most compiler source files include @file{config.h}. The
22 source file defines a variable @code{targetm}, which is a structure
23 containing pointers to functions and data relating to the target
24 machine. @file{@var{machine}.c} should also contain their definitions,
25 if they are not defined elsewhere in GCC, and other functions called
26 through the macros defined in the @file{.h} file.
29 * Target Structure:: The @code{targetm} variable.
30 * Driver:: Controlling how the driver runs the compilation passes.
31 * Run-time Target:: Defining @samp{-m} options like @option{-m68000} and @option{-m68020}.
32 * Per-Function Data:: Defining data structures for per-function information.
33 * Storage Layout:: Defining sizes and alignments of data.
34 * Type Layout:: Defining sizes and properties of basic user data types.
35 * Registers:: Naming and describing the hardware registers.
36 * Register Classes:: Defining the classes of hardware registers.
37 * Old Constraints:: The old way to define machine-specific constraints.
38 * Stack and Calling:: Defining which way the stack grows and by how much.
39 * Varargs:: Defining the varargs macros.
40 * Trampolines:: Code set up at run time to enter a nested function.
41 * Library Calls:: Controlling how library routines are implicitly called.
42 * Addressing Modes:: Defining addressing modes valid for memory operands.
43 * Anchored Addresses:: Defining how @option{-fsection-anchors} should work.
44 * Condition Code:: Defining how insns update the condition code.
45 * Costs:: Defining relative costs of different operations.
46 * Scheduling:: Adjusting the behavior of the instruction scheduler.
47 * Sections:: Dividing storage into text, data, and other sections.
48 * PIC:: Macros for position independent code.
49 * Assembler Format:: Defining how to write insns and pseudo-ops to output.
50 * Debugging Info:: Defining the format of debugging output.
51 * Floating Point:: Handling floating point for cross-compilers.
52 * Mode Switching:: Insertion of mode-switching instructions.
53 * Target Attributes:: Defining target-specific uses of @code{__attribute__}.
54 * Emulated TLS:: Emulated TLS support.
55 * MIPS Coprocessors:: MIPS coprocessor support and how to customize it.
56 * PCH Target:: Validity checking for precompiled headers.
57 * C++ ABI:: Controlling C++ ABI changes.
58 * Named Address Spaces:: Adding support for named address spaces
59 * Misc:: Everything else.
62 @node Target Structure
63 @section The Global @code{targetm} Variable
65 @cindex target functions
67 @deftypevar {struct gcc_target} targetm
68 The target @file{.c} file must define the global @code{targetm} variable
69 which contains pointers to functions and data relating to the target
70 machine. The variable is declared in @file{target.h};
71 @file{target-def.h} defines the macro @code{TARGET_INITIALIZER} which is
72 used to initialize the variable, and macros for the default initializers
73 for elements of the structure. The @file{.c} file should override those
74 macros for which the default definition is inappropriate. For example:
77 #include "target-def.h"
79 /* @r{Initialize the GCC target structure.} */
81 #undef TARGET_COMP_TYPE_ATTRIBUTES
82 #define TARGET_COMP_TYPE_ATTRIBUTES @var{machine}_comp_type_attributes
84 struct gcc_target targetm = TARGET_INITIALIZER;
88 Where a macro should be defined in the @file{.c} file in this manner to
89 form part of the @code{targetm} structure, it is documented below as a
90 ``Target Hook'' with a prototype. Many macros will change in future
91 from being defined in the @file{.h} file to being part of the
92 @code{targetm} structure.
95 @section Controlling the Compilation Driver, @file{gcc}
97 @cindex controlling the compilation driver
99 @c prevent bad page break with this line
100 You can control the compilation driver.
102 @defmac SWITCH_TAKES_ARG (@var{char})
103 A C expression which determines whether the option @option{-@var{char}}
104 takes arguments. The value should be the number of arguments that
105 option takes--zero, for many options.
107 By default, this macro is defined as
108 @code{DEFAULT_SWITCH_TAKES_ARG}, which handles the standard options
109 properly. You need not define @code{SWITCH_TAKES_ARG} unless you
110 wish to add additional options which take arguments. Any redefinition
111 should call @code{DEFAULT_SWITCH_TAKES_ARG} and then check for
115 @defmac WORD_SWITCH_TAKES_ARG (@var{name})
116 A C expression which determines whether the option @option{-@var{name}}
117 takes arguments. The value should be the number of arguments that
118 option takes--zero, for many options. This macro rather than
119 @code{SWITCH_TAKES_ARG} is used for multi-character option names.
121 By default, this macro is defined as
122 @code{DEFAULT_WORD_SWITCH_TAKES_ARG}, which handles the standard options
123 properly. You need not define @code{WORD_SWITCH_TAKES_ARG} unless you
124 wish to add additional options which take arguments. Any redefinition
125 should call @code{DEFAULT_WORD_SWITCH_TAKES_ARG} and then check for
129 @defmac TARGET_OPTION_TRANSLATE_TABLE
130 If defined, a list of pairs of strings, the first of which is a
131 potential command line target to the @file{gcc} driver program, and the
132 second of which is a space-separated (tabs and other whitespace are not
133 supported) list of options with which to replace the first option. The
134 target defining this list is responsible for assuring that the results
135 are valid. Replacement options may not be the @code{--opt} style, they
136 must be the @code{-opt} style. It is the intention of this macro to
137 provide a mechanism for substitution that affects the multilibs chosen,
138 such as one option that enables many options, some of which select
139 multilibs. Example nonsensical definition, where @option{-malt-abi},
140 @option{-EB}, and @option{-mspoo} cause different multilibs to be chosen:
143 #define TARGET_OPTION_TRANSLATE_TABLE \
144 @{ "-fast", "-march=fast-foo -malt-abi -I/usr/fast-foo" @}, \
145 @{ "-compat", "-EB -malign=4 -mspoo" @}
149 @defmac DRIVER_SELF_SPECS
150 A list of specs for the driver itself. It should be a suitable
151 initializer for an array of strings, with no surrounding braces.
153 The driver applies these specs to its own command line between loading
154 default @file{specs} files (but not command-line specified ones) and
155 choosing the multilib directory or running any subcommands. It
156 applies them in the order given, so each spec can depend on the
157 options added by earlier ones. It is also possible to remove options
158 using @samp{%<@var{option}} in the usual way.
160 This macro can be useful when a port has several interdependent target
161 options. It provides a way of standardizing the command line so
162 that the other specs are easier to write.
164 Do not define this macro if it does not need to do anything.
167 @defmac OPTION_DEFAULT_SPECS
168 A list of specs used to support configure-time default options (i.e.@:
169 @option{--with} options) in the driver. It should be a suitable initializer
170 for an array of structures, each containing two strings, without the
171 outermost pair of surrounding braces.
173 The first item in the pair is the name of the default. This must match
174 the code in @file{config.gcc} for the target. The second item is a spec
175 to apply if a default with this name was specified. The string
176 @samp{%(VALUE)} in the spec will be replaced by the value of the default
177 everywhere it occurs.
179 The driver will apply these specs to its own command line between loading
180 default @file{specs} files and processing @code{DRIVER_SELF_SPECS}, using
181 the same mechanism as @code{DRIVER_SELF_SPECS}.
183 Do not define this macro if it does not need to do anything.
187 A C string constant that tells the GCC driver program options to
188 pass to CPP@. It can also specify how to translate options you
189 give to GCC into options for GCC to pass to the CPP@.
191 Do not define this macro if it does not need to do anything.
194 @defmac CPLUSPLUS_CPP_SPEC
195 This macro is just like @code{CPP_SPEC}, but is used for C++, rather
196 than C@. If you do not define this macro, then the value of
197 @code{CPP_SPEC} (if any) will be used instead.
201 A C string constant that tells the GCC driver program options to
202 pass to @code{cc1}, @code{cc1plus}, @code{f771}, and the other language
204 It can also specify how to translate options you give to GCC into options
205 for GCC to pass to front ends.
207 Do not define this macro if it does not need to do anything.
211 A C string constant that tells the GCC driver program options to
212 pass to @code{cc1plus}. It can also specify how to translate options you
213 give to GCC into options for GCC to pass to the @code{cc1plus}.
215 Do not define this macro if it does not need to do anything.
216 Note that everything defined in CC1_SPEC is already passed to
217 @code{cc1plus} so there is no need to duplicate the contents of
218 CC1_SPEC in CC1PLUS_SPEC@.
222 A C string constant that tells the GCC driver program options to
223 pass to the assembler. It can also specify how to translate options
224 you give to GCC into options for GCC to pass to the assembler.
225 See the file @file{sun3.h} for an example of this.
227 Do not define this macro if it does not need to do anything.
230 @defmac ASM_FINAL_SPEC
231 A C string constant that tells the GCC driver program how to
232 run any programs which cleanup after the normal assembler.
233 Normally, this is not needed. See the file @file{mips.h} for
236 Do not define this macro if it does not need to do anything.
239 @defmac AS_NEEDS_DASH_FOR_PIPED_INPUT
240 Define this macro, with no value, if the driver should give the assembler
241 an argument consisting of a single dash, @option{-}, to instruct it to
242 read from its standard input (which will be a pipe connected to the
243 output of the compiler proper). This argument is given after any
244 @option{-o} option specifying the name of the output file.
246 If you do not define this macro, the assembler is assumed to read its
247 standard input if given no non-option arguments. If your assembler
248 cannot read standard input at all, use a @samp{%@{pipe:%e@}} construct;
249 see @file{mips.h} for instance.
253 A C string constant that tells the GCC driver program options to
254 pass to the linker. It can also specify how to translate options you
255 give to GCC into options for GCC to pass to the linker.
257 Do not define this macro if it does not need to do anything.
261 Another C string constant used much like @code{LINK_SPEC}. The difference
262 between the two is that @code{LIB_SPEC} is used at the end of the
263 command given to the linker.
265 If this macro is not defined, a default is provided that
266 loads the standard C library from the usual place. See @file{gcc.c}.
270 Another C string constant that tells the GCC driver program
271 how and when to place a reference to @file{libgcc.a} into the
272 linker command line. This constant is placed both before and after
273 the value of @code{LIB_SPEC}.
275 If this macro is not defined, the GCC driver provides a default that
276 passes the string @option{-lgcc} to the linker.
279 @defmac REAL_LIBGCC_SPEC
280 By default, if @code{ENABLE_SHARED_LIBGCC} is defined, the
281 @code{LIBGCC_SPEC} is not directly used by the driver program but is
282 instead modified to refer to different versions of @file{libgcc.a}
283 depending on the values of the command line flags @option{-static},
284 @option{-shared}, @option{-static-libgcc}, and @option{-shared-libgcc}. On
285 targets where these modifications are inappropriate, define
286 @code{REAL_LIBGCC_SPEC} instead. @code{REAL_LIBGCC_SPEC} tells the
287 driver how to place a reference to @file{libgcc} on the link command
288 line, but, unlike @code{LIBGCC_SPEC}, it is used unmodified.
291 @defmac USE_LD_AS_NEEDED
292 A macro that controls the modifications to @code{LIBGCC_SPEC}
293 mentioned in @code{REAL_LIBGCC_SPEC}. If nonzero, a spec will be
294 generated that uses --as-needed and the shared libgcc in place of the
295 static exception handler library, when linking without any of
296 @code{-static}, @code{-static-libgcc}, or @code{-shared-libgcc}.
300 If defined, this C string constant is added to @code{LINK_SPEC}.
301 When @code{USE_LD_AS_NEEDED} is zero or undefined, it also affects
302 the modifications to @code{LIBGCC_SPEC} mentioned in
303 @code{REAL_LIBGCC_SPEC}.
306 @defmac STARTFILE_SPEC
307 Another C string constant used much like @code{LINK_SPEC}. The
308 difference between the two is that @code{STARTFILE_SPEC} is used at
309 the very beginning of the command given to the linker.
311 If this macro is not defined, a default is provided that loads the
312 standard C startup file from the usual place. See @file{gcc.c}.
316 Another C string constant used much like @code{LINK_SPEC}. The
317 difference between the two is that @code{ENDFILE_SPEC} is used at
318 the very end of the command given to the linker.
320 Do not define this macro if it does not need to do anything.
323 @defmac THREAD_MODEL_SPEC
324 GCC @code{-v} will print the thread model GCC was configured to use.
325 However, this doesn't work on platforms that are multilibbed on thread
326 models, such as AIX 4.3. On such platforms, define
327 @code{THREAD_MODEL_SPEC} such that it evaluates to a string without
328 blanks that names one of the recognized thread models. @code{%*}, the
329 default value of this macro, will expand to the value of
330 @code{thread_file} set in @file{config.gcc}.
333 @defmac SYSROOT_SUFFIX_SPEC
334 Define this macro to add a suffix to the target sysroot when GCC is
335 configured with a sysroot. This will cause GCC to search for usr/lib,
336 et al, within sysroot+suffix.
339 @defmac SYSROOT_HEADERS_SUFFIX_SPEC
340 Define this macro to add a headers_suffix to the target sysroot when
341 GCC is configured with a sysroot. This will cause GCC to pass the
342 updated sysroot+headers_suffix to CPP, causing it to search for
343 usr/include, et al, within sysroot+headers_suffix.
347 Define this macro to provide additional specifications to put in the
348 @file{specs} file that can be used in various specifications like
351 The definition should be an initializer for an array of structures,
352 containing a string constant, that defines the specification name, and a
353 string constant that provides the specification.
355 Do not define this macro if it does not need to do anything.
357 @code{EXTRA_SPECS} is useful when an architecture contains several
358 related targets, which have various @code{@dots{}_SPECS} which are similar
359 to each other, and the maintainer would like one central place to keep
362 For example, the PowerPC System V.4 targets use @code{EXTRA_SPECS} to
363 define either @code{_CALL_SYSV} when the System V calling sequence is
364 used or @code{_CALL_AIX} when the older AIX-based calling sequence is
367 The @file{config/rs6000/rs6000.h} target file defines:
370 #define EXTRA_SPECS \
371 @{ "cpp_sysv_default", CPP_SYSV_DEFAULT @},
373 #define CPP_SYS_DEFAULT ""
376 The @file{config/rs6000/sysv.h} target file defines:
380 "%@{posix: -D_POSIX_SOURCE @} \
381 %@{mcall-sysv: -D_CALL_SYSV @} \
382 %@{!mcall-sysv: %(cpp_sysv_default) @} \
383 %@{msoft-float: -D_SOFT_FLOAT@} %@{mcpu=403: -D_SOFT_FLOAT@}"
385 #undef CPP_SYSV_DEFAULT
386 #define CPP_SYSV_DEFAULT "-D_CALL_SYSV"
389 while the @file{config/rs6000/eabiaix.h} target file defines
390 @code{CPP_SYSV_DEFAULT} as:
393 #undef CPP_SYSV_DEFAULT
394 #define CPP_SYSV_DEFAULT "-D_CALL_AIX"
398 @defmac LINK_LIBGCC_SPECIAL_1
399 Define this macro if the driver program should find the library
400 @file{libgcc.a}. If you do not define this macro, the driver program will pass
401 the argument @option{-lgcc} to tell the linker to do the search.
404 @defmac LINK_GCC_C_SEQUENCE_SPEC
405 The sequence in which libgcc and libc are specified to the linker.
406 By default this is @code{%G %L %G}.
409 @defmac LINK_COMMAND_SPEC
410 A C string constant giving the complete command line need to execute the
411 linker. When you do this, you will need to update your port each time a
412 change is made to the link command line within @file{gcc.c}. Therefore,
413 define this macro only if you need to completely redefine the command
414 line for invoking the linker and there is no other way to accomplish
415 the effect you need. Overriding this macro may be avoidable by overriding
416 @code{LINK_GCC_C_SEQUENCE_SPEC} instead.
419 @defmac LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
420 A nonzero value causes @command{collect2} to remove duplicate @option{-L@var{directory}} search
421 directories from linking commands. Do not give it a nonzero value if
422 removing duplicate search directories changes the linker's semantics.
425 @defmac MULTILIB_DEFAULTS
426 Define this macro as a C expression for the initializer of an array of
427 string to tell the driver program which options are defaults for this
428 target and thus do not need to be handled specially when using
429 @code{MULTILIB_OPTIONS}.
431 Do not define this macro if @code{MULTILIB_OPTIONS} is not defined in
432 the target makefile fragment or if none of the options listed in
433 @code{MULTILIB_OPTIONS} are set by default.
434 @xref{Target Fragment}.
437 @defmac RELATIVE_PREFIX_NOT_LINKDIR
438 Define this macro to tell @command{gcc} that it should only translate
439 a @option{-B} prefix into a @option{-L} linker option if the prefix
440 indicates an absolute file name.
443 @defmac MD_EXEC_PREFIX
444 If defined, this macro is an additional prefix to try after
445 @code{STANDARD_EXEC_PREFIX}. @code{MD_EXEC_PREFIX} is not searched
446 when the compiler is built as a cross
447 compiler. If you define @code{MD_EXEC_PREFIX}, then be sure to add it
448 to the list of directories used to find the assembler in @file{configure.in}.
451 @defmac STANDARD_STARTFILE_PREFIX
452 Define this macro as a C string constant if you wish to override the
453 standard choice of @code{libdir} as the default prefix to
454 try when searching for startup files such as @file{crt0.o}.
455 @code{STANDARD_STARTFILE_PREFIX} is not searched when the compiler
456 is built as a cross compiler.
459 @defmac STANDARD_STARTFILE_PREFIX_1
460 Define this macro as a C string constant if you wish to override the
461 standard choice of @code{/lib} as a prefix to try after the default prefix
462 when searching for startup files such as @file{crt0.o}.
463 @code{STANDARD_STARTFILE_PREFIX_1} is not searched when the compiler
464 is built as a cross compiler.
467 @defmac STANDARD_STARTFILE_PREFIX_2
468 Define this macro as a C string constant if you wish to override the
469 standard choice of @code{/lib} as yet another prefix to try after the
470 default prefix when searching for startup files such as @file{crt0.o}.
471 @code{STANDARD_STARTFILE_PREFIX_2} is not searched when the compiler
472 is built as a cross compiler.
475 @defmac MD_STARTFILE_PREFIX
476 If defined, this macro supplies an additional prefix to try after the
477 standard prefixes. @code{MD_EXEC_PREFIX} is not searched when the
478 compiler is built as a cross compiler.
481 @defmac MD_STARTFILE_PREFIX_1
482 If defined, this macro supplies yet another prefix to try after the
483 standard prefixes. It is not searched when the compiler is built as a
487 @defmac INIT_ENVIRONMENT
488 Define this macro as a C string constant if you wish to set environment
489 variables for programs called by the driver, such as the assembler and
490 loader. The driver passes the value of this macro to @code{putenv} to
491 initialize the necessary environment variables.
494 @defmac LOCAL_INCLUDE_DIR
495 Define this macro as a C string constant if you wish to override the
496 standard choice of @file{/usr/local/include} as the default prefix to
497 try when searching for local header files. @code{LOCAL_INCLUDE_DIR}
498 comes before @code{SYSTEM_INCLUDE_DIR} in the search order.
500 Cross compilers do not search either @file{/usr/local/include} or its
504 @defmac SYSTEM_INCLUDE_DIR
505 Define this macro as a C string constant if you wish to specify a
506 system-specific directory to search for header files before the standard
507 directory. @code{SYSTEM_INCLUDE_DIR} comes before
508 @code{STANDARD_INCLUDE_DIR} in the search order.
510 Cross compilers do not use this macro and do not search the directory
514 @defmac STANDARD_INCLUDE_DIR
515 Define this macro as a C string constant if you wish to override the
516 standard choice of @file{/usr/include} as the default prefix to
517 try when searching for header files.
519 Cross compilers ignore this macro and do not search either
520 @file{/usr/include} or its replacement.
523 @defmac STANDARD_INCLUDE_COMPONENT
524 The ``component'' corresponding to @code{STANDARD_INCLUDE_DIR}.
525 See @code{INCLUDE_DEFAULTS}, below, for the description of components.
526 If you do not define this macro, no component is used.
529 @defmac INCLUDE_DEFAULTS
530 Define this macro if you wish to override the entire default search path
531 for include files. For a native compiler, the default search path
532 usually consists of @code{GCC_INCLUDE_DIR}, @code{LOCAL_INCLUDE_DIR},
533 @code{SYSTEM_INCLUDE_DIR}, @code{GPLUSPLUS_INCLUDE_DIR}, and
534 @code{STANDARD_INCLUDE_DIR}. In addition, @code{GPLUSPLUS_INCLUDE_DIR}
535 and @code{GCC_INCLUDE_DIR} are defined automatically by @file{Makefile},
536 and specify private search areas for GCC@. The directory
537 @code{GPLUSPLUS_INCLUDE_DIR} is used only for C++ programs.
539 The definition should be an initializer for an array of structures.
540 Each array element should have four elements: the directory name (a
541 string constant), the component name (also a string constant), a flag
542 for C++-only directories,
543 and a flag showing that the includes in the directory don't need to be
544 wrapped in @code{extern @samp{C}} when compiling C++. Mark the end of
545 the array with a null element.
547 The component name denotes what GNU package the include file is part of,
548 if any, in all uppercase letters. For example, it might be @samp{GCC}
549 or @samp{BINUTILS}. If the package is part of a vendor-supplied
550 operating system, code the component name as @samp{0}.
552 For example, here is the definition used for VAX/VMS:
555 #define INCLUDE_DEFAULTS \
557 @{ "GNU_GXX_INCLUDE:", "G++", 1, 1@}, \
558 @{ "GNU_CC_INCLUDE:", "GCC", 0, 0@}, \
559 @{ "SYS$SYSROOT:[SYSLIB.]", 0, 0, 0@}, \
566 Here is the order of prefixes tried for exec files:
570 Any prefixes specified by the user with @option{-B}.
573 The environment variable @code{GCC_EXEC_PREFIX} or, if @code{GCC_EXEC_PREFIX}
574 is not set and the compiler has not been installed in the configure-time
575 @var{prefix}, the location in which the compiler has actually been installed.
578 The directories specified by the environment variable @code{COMPILER_PATH}.
581 The macro @code{STANDARD_EXEC_PREFIX}, if the compiler has been installed
582 in the configured-time @var{prefix}.
585 The location @file{/usr/libexec/gcc/}, but only if this is a native compiler.
588 The location @file{/usr/lib/gcc/}, but only if this is a native compiler.
591 The macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a native
595 Here is the order of prefixes tried for startfiles:
599 Any prefixes specified by the user with @option{-B}.
602 The environment variable @code{GCC_EXEC_PREFIX} or its automatically determined
603 value based on the installed toolchain location.
606 The directories specified by the environment variable @code{LIBRARY_PATH}
607 (or port-specific name; native only, cross compilers do not use this).
610 The macro @code{STANDARD_EXEC_PREFIX}, but only if the toolchain is installed
611 in the configured @var{prefix} or this is a native compiler.
614 The location @file{/usr/lib/gcc/}, but only if this is a native compiler.
617 The macro @code{MD_EXEC_PREFIX}, if defined, but only if this is a native
621 The macro @code{MD_STARTFILE_PREFIX}, if defined, but only if this is a
622 native compiler, or we have a target system root.
625 The macro @code{MD_STARTFILE_PREFIX_1}, if defined, but only if this is a
626 native compiler, or we have a target system root.
629 The macro @code{STANDARD_STARTFILE_PREFIX}, with any sysroot modifications.
630 If this path is relative it will be prefixed by @code{GCC_EXEC_PREFIX} and
631 the machine suffix or @code{STANDARD_EXEC_PREFIX} and the machine suffix.
634 The macro @code{STANDARD_STARTFILE_PREFIX_1}, but only if this is a native
635 compiler, or we have a target system root. The default for this macro is
639 The macro @code{STANDARD_STARTFILE_PREFIX_2}, but only if this is a native
640 compiler, or we have a target system root. The default for this macro is
644 @node Run-time Target
645 @section Run-time Target Specification
646 @cindex run-time target specification
647 @cindex predefined macros
648 @cindex target specifications
650 @c prevent bad page break with this line
651 Here are run-time target specifications.
653 @defmac TARGET_CPU_CPP_BUILTINS ()
654 This function-like macro expands to a block of code that defines
655 built-in preprocessor macros and assertions for the target CPU, using
656 the functions @code{builtin_define}, @code{builtin_define_std} and
657 @code{builtin_assert}. When the front end
658 calls this macro it provides a trailing semicolon, and since it has
659 finished command line option processing your code can use those
662 @code{builtin_assert} takes a string in the form you pass to the
663 command-line option @option{-A}, such as @code{cpu=mips}, and creates
664 the assertion. @code{builtin_define} takes a string in the form
665 accepted by option @option{-D} and unconditionally defines the macro.
667 @code{builtin_define_std} takes a string representing the name of an
668 object-like macro. If it doesn't lie in the user's namespace,
669 @code{builtin_define_std} defines it unconditionally. Otherwise, it
670 defines a version with two leading underscores, and another version
671 with two leading and trailing underscores, and defines the original
672 only if an ISO standard was not requested on the command line. For
673 example, passing @code{unix} defines @code{__unix}, @code{__unix__}
674 and possibly @code{unix}; passing @code{_mips} defines @code{__mips},
675 @code{__mips__} and possibly @code{_mips}, and passing @code{_ABI64}
676 defines only @code{_ABI64}.
678 You can also test for the C dialect being compiled. The variable
679 @code{c_language} is set to one of @code{clk_c}, @code{clk_cplusplus}
680 or @code{clk_objective_c}. Note that if we are preprocessing
681 assembler, this variable will be @code{clk_c} but the function-like
682 macro @code{preprocessing_asm_p()} will return true, so you might want
683 to check for that first. If you need to check for strict ANSI, the
684 variable @code{flag_iso} can be used. The function-like macro
685 @code{preprocessing_trad_p()} can be used to check for traditional
689 @defmac TARGET_OS_CPP_BUILTINS ()
690 Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional
691 and is used for the target operating system instead.
694 @defmac TARGET_OBJFMT_CPP_BUILTINS ()
695 Similarly to @code{TARGET_CPU_CPP_BUILTINS} but this macro is optional
696 and is used for the target object format. @file{elfos.h} uses this
697 macro to define @code{__ELF__}, so you probably do not need to define
701 @deftypevar {extern int} target_flags
702 This variable is declared in @file{options.h}, which is included before
703 any target-specific headers.
706 @deftypevr {Target Hook} int TARGET_DEFAULT_TARGET_FLAGS
707 This variable specifies the initial value of @code{target_flags}.
708 Its default setting is 0.
711 @cindex optional hardware or system features
712 @cindex features, optional, in system conventions
714 @deftypefn {Target Hook} bool TARGET_HANDLE_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})
715 This hook is called whenever the user specifies one of the
716 target-specific options described by the @file{.opt} definition files
717 (@pxref{Options}). It has the opportunity to do some option-specific
718 processing and should return true if the option is valid. The default
719 definition does nothing but return true.
721 @var{code} specifies the @code{OPT_@var{name}} enumeration value
722 associated with the selected option; @var{name} is just a rendering of
723 the option name in which non-alphanumeric characters are replaced by
724 underscores. @var{arg} specifies the string argument and is null if
725 no argument was given. If the option is flagged as a @code{UInteger}
726 (@pxref{Option properties}), @var{value} is the numeric value of the
727 argument. Otherwise @var{value} is 1 if the positive form of the
728 option was used and 0 if the ``no-'' form was.
731 @deftypefn {Target Hook} bool TARGET_HANDLE_C_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})
732 This target hook is called whenever the user specifies one of the
733 target-specific C language family options described by the @file{.opt}
734 definition files(@pxref{Options}). It has the opportunity to do some
735 option-specific processing and should return true if the option is
736 valid. The arguments are like for @code{TARGET_HANDLE_OPTION}. The
737 default definition does nothing but return false.
739 In general, you should use @code{TARGET_HANDLE_OPTION} to handle
740 options. However, if processing an option requires routines that are
741 only available in the C (and related language) front ends, then you
742 should use @code{TARGET_HANDLE_C_OPTION} instead.
745 @deftypefn {Target Hook} tree TARGET_OBJC_CONSTRUCT_STRING (tree @var{string})
746 Construct a constant string representation for @var{string}
749 @defmac TARGET_VERSION
750 This macro is a C statement to print on @code{stderr} a string
751 describing the particular machine description choice. Every machine
752 description should define @code{TARGET_VERSION}. For example:
756 #define TARGET_VERSION \
757 fprintf (stderr, " (68k, Motorola syntax)");
759 #define TARGET_VERSION \
760 fprintf (stderr, " (68k, MIT syntax)");
765 @deftypefn {Target Hook} void TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE (void)
766 This target function is similar to the hook @code{TARGET_OPTION_OVERRIDE}
767 but is called when the optimize level is changed via an attribute or
768 pragma or when it is reset at the end of the code affected by the
769 attribute or pragma. It is not called at the beginning of compilation
770 when @code{TARGET_OPTION_OVERRIDE} is called so if you want to perform these
771 actions then, you should have @code{TARGET_OPTION_OVERRIDE} call
772 @code{TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE}.
775 @defmac C_COMMON_OVERRIDE_OPTIONS
776 This is similar to the @code{TARGET_OPTION_OVERRIDE} hook
777 but is only used in the C
778 language frontends (C, Objective-C, C++, Objective-C++) and so can be
779 used to alter option flag variables which only exist in those
783 @deftypevr {Target Hook} {const struct default_options *} TARGET_OPTION_OPTIMIZATION_TABLE
784 Some machines may desire to change what optimizations are performed for
785 various optimization levels. This variable, if defined, describes
786 options to enable at particular sets of optimization levels. These
787 options are processed once
788 just after the optimization level is determined and before the remainder
789 of the command options have been parsed, so may be overridden by other
790 options passed explicily.
792 This processing is run once at program startup and when the optimization
793 options are changed via @code{#pragma GCC optimize} or by using the
794 @code{optimize} attribute.
797 @deftypefn {Target Hook} void TARGET_OPTION_INIT_STRUCT (struct gcc_options *@var{opts})
798 Set target-dependent initial values of fields in @var{opts}.
801 @deftypefn {Target Hook} void TARGET_OPTION_DEFAULT_PARAMS (void)
802 Set target-dependent default values for @option{--param} settings, using calls to @code{set_default_param_value}.
805 @deftypefn {Target Hook} void TARGET_HELP (void)
806 This hook is called in response to the user invoking
807 @option{--target-help} on the command line. It gives the target a
808 chance to display extra information on the target specific command
809 line options found in its @file{.opt} file.
812 @defmac SWITCHABLE_TARGET
813 Some targets need to switch between substantially different subtargets
814 during compilation. For example, the MIPS target has one subtarget for
815 the traditional MIPS architecture and another for MIPS16. Source code
816 can switch between these two subarchitectures using the @code{mips16}
817 and @code{nomips16} attributes.
819 Such subtargets can differ in things like the set of available
820 registers, the set of available instructions, the costs of various
821 operations, and so on. GCC caches a lot of this type of information
822 in global variables, and recomputing them for each subtarget takes a
823 significant amount of time. The compiler therefore provides a facility
824 for maintaining several versions of the global variables and quickly
825 switching between them; see @file{target-globals.h} for details.
827 Define this macro to 1 if your target needs this facility. The default
831 @node Per-Function Data
832 @section Defining data structures for per-function information.
833 @cindex per-function data
834 @cindex data structures
836 If the target needs to store information on a per-function basis, GCC
837 provides a macro and a couple of variables to allow this. Note, just
838 using statics to store the information is a bad idea, since GCC supports
839 nested functions, so you can be halfway through encoding one function
840 when another one comes along.
842 GCC defines a data structure called @code{struct function} which
843 contains all of the data specific to an individual function. This
844 structure contains a field called @code{machine} whose type is
845 @code{struct machine_function *}, which can be used by targets to point
846 to their own specific data.
848 If a target needs per-function specific data it should define the type
849 @code{struct machine_function} and also the macro @code{INIT_EXPANDERS}.
850 This macro should be used to initialize the function pointer
851 @code{init_machine_status}. This pointer is explained below.
853 One typical use of per-function, target specific data is to create an
854 RTX to hold the register containing the function's return address. This
855 RTX can then be used to implement the @code{__builtin_return_address}
856 function, for level 0.
858 Note---earlier implementations of GCC used a single data area to hold
859 all of the per-function information. Thus when processing of a nested
860 function began the old per-function data had to be pushed onto a
861 stack, and when the processing was finished, it had to be popped off the
862 stack. GCC used to provide function pointers called
863 @code{save_machine_status} and @code{restore_machine_status} to handle
864 the saving and restoring of the target specific information. Since the
865 single data area approach is no longer used, these pointers are no
868 @defmac INIT_EXPANDERS
869 Macro called to initialize any target specific information. This macro
870 is called once per function, before generation of any RTL has begun.
871 The intention of this macro is to allow the initialization of the
872 function pointer @code{init_machine_status}.
875 @deftypevar {void (*)(struct function *)} init_machine_status
876 If this function pointer is non-@code{NULL} it will be called once per
877 function, before function compilation starts, in order to allow the
878 target to perform any target specific initialization of the
879 @code{struct function} structure. It is intended that this would be
880 used to initialize the @code{machine} of that structure.
882 @code{struct machine_function} structures are expected to be freed by GC@.
883 Generally, any memory that they reference must be allocated by using
884 GC allocation, including the structure itself.
888 @section Storage Layout
889 @cindex storage layout
891 Note that the definitions of the macros in this table which are sizes or
892 alignments measured in bits do not need to be constant. They can be C
893 expressions that refer to static variables, such as the @code{target_flags}.
894 @xref{Run-time Target}.
896 @defmac BITS_BIG_ENDIAN
897 Define this macro to have the value 1 if the most significant bit in a
898 byte has the lowest number; otherwise define it to have the value zero.
899 This means that bit-field instructions count from the most significant
900 bit. If the machine has no bit-field instructions, then this must still
901 be defined, but it doesn't matter which value it is defined to. This
902 macro need not be a constant.
904 This macro does not affect the way structure fields are packed into
905 bytes or words; that is controlled by @code{BYTES_BIG_ENDIAN}.
908 @defmac BYTES_BIG_ENDIAN
909 Define this macro to have the value 1 if the most significant byte in a
910 word has the lowest number. This macro need not be a constant.
913 @defmac WORDS_BIG_ENDIAN
914 Define this macro to have the value 1 if, in a multiword object, the
915 most significant word has the lowest number. This applies to both
916 memory locations and registers; GCC fundamentally assumes that the
917 order of words in memory is the same as the order in registers. This
918 macro need not be a constant.
921 @defmac FLOAT_WORDS_BIG_ENDIAN
922 Define this macro to have the value 1 if @code{DFmode}, @code{XFmode} or
923 @code{TFmode} floating point numbers are stored in memory with the word
924 containing the sign bit at the lowest address; otherwise define it to
925 have the value 0. This macro need not be a constant.
927 You need not define this macro if the ordering is the same as for
931 @defmac BITS_PER_UNIT
932 Define this macro to be the number of bits in an addressable storage
933 unit (byte). If you do not define this macro the default is 8.
936 @defmac BITS_PER_WORD
937 Number of bits in a word. If you do not define this macro, the default
938 is @code{BITS_PER_UNIT * UNITS_PER_WORD}.
941 @defmac MAX_BITS_PER_WORD
942 Maximum number of bits in a word. If this is undefined, the default is
943 @code{BITS_PER_WORD}. Otherwise, it is the constant value that is the
944 largest value that @code{BITS_PER_WORD} can have at run-time.
947 @defmac UNITS_PER_WORD
948 Number of storage units in a word; normally the size of a general-purpose
949 register, a power of two from 1 or 8.
952 @defmac MIN_UNITS_PER_WORD
953 Minimum number of units in a word. If this is undefined, the default is
954 @code{UNITS_PER_WORD}. Otherwise, it is the constant value that is the
955 smallest value that @code{UNITS_PER_WORD} can have at run-time.
959 Width of a pointer, in bits. You must specify a value no wider than the
960 width of @code{Pmode}. If it is not equal to the width of @code{Pmode},
961 you must define @code{POINTERS_EXTEND_UNSIGNED}. If you do not specify
962 a value the default is @code{BITS_PER_WORD}.
965 @defmac POINTERS_EXTEND_UNSIGNED
966 A C expression that determines how pointers should be extended from
967 @code{ptr_mode} to either @code{Pmode} or @code{word_mode}. It is
968 greater than zero if pointers should be zero-extended, zero if they
969 should be sign-extended, and negative if some other sort of conversion
970 is needed. In the last case, the extension is done by the target's
971 @code{ptr_extend} instruction.
973 You need not define this macro if the @code{ptr_mode}, @code{Pmode}
974 and @code{word_mode} are all the same width.
977 @defmac PROMOTE_MODE (@var{m}, @var{unsignedp}, @var{type})
978 A macro to update @var{m} and @var{unsignedp} when an object whose type
979 is @var{type} and which has the specified mode and signedness is to be
980 stored in a register. This macro is only called when @var{type} is a
983 On most RISC machines, which only have operations that operate on a full
984 register, define this macro to set @var{m} to @code{word_mode} if
985 @var{m} is an integer mode narrower than @code{BITS_PER_WORD}. In most
986 cases, only integer modes should be widened because wider-precision
987 floating-point operations are usually more expensive than their narrower
990 For most machines, the macro definition does not change @var{unsignedp}.
991 However, some machines, have instructions that preferentially handle
992 either signed or unsigned quantities of certain modes. For example, on
993 the DEC Alpha, 32-bit loads from memory and 32-bit add instructions
994 sign-extend the result to 64 bits. On such machines, set
995 @var{unsignedp} according to which kind of extension is more efficient.
997 Do not define this macro if it would never modify @var{m}.
1000 @deftypefn {Target Hook} {enum machine_mode} TARGET_PROMOTE_FUNCTION_MODE (const_tree @var{type}, enum machine_mode @var{mode}, int *@var{punsignedp}, const_tree @var{funtype}, int @var{for_return})
1001 Like @code{PROMOTE_MODE}, but it is applied to outgoing function arguments or
1002 function return values. The target hook should return the new mode
1003 and possibly change @code{*@var{punsignedp}} if the promotion should
1004 change signedness. This function is called only for scalar @emph{or
1007 @var{for_return} allows to distinguish the promotion of arguments and
1008 return values. If it is @code{1}, a return value is being promoted and
1009 @code{TARGET_FUNCTION_VALUE} must perform the same promotions done here.
1010 If it is @code{2}, the returned mode should be that of the register in
1011 which an incoming parameter is copied, or the outgoing result is computed;
1012 then the hook should return the same mode as @code{promote_mode}, though
1013 the signedness may be different.
1015 The default is to not promote arguments and return values. You can
1016 also define the hook to @code{default_promote_function_mode_always_promote}
1017 if you would like to apply the same rules given by @code{PROMOTE_MODE}.
1020 @defmac PARM_BOUNDARY
1021 Normal alignment required for function parameters on the stack, in
1022 bits. All stack parameters receive at least this much alignment
1023 regardless of data type. On most machines, this is the same as the
1027 @defmac STACK_BOUNDARY
1028 Define this macro to the minimum alignment enforced by hardware for the
1029 stack pointer on this machine. The definition is a C expression for the
1030 desired alignment (measured in bits). This value is used as a default
1031 if @code{PREFERRED_STACK_BOUNDARY} is not defined. On most machines,
1032 this should be the same as @code{PARM_BOUNDARY}.
1035 @defmac PREFERRED_STACK_BOUNDARY
1036 Define this macro if you wish to preserve a certain alignment for the
1037 stack pointer, greater than what the hardware enforces. The definition
1038 is a C expression for the desired alignment (measured in bits). This
1039 macro must evaluate to a value equal to or larger than
1040 @code{STACK_BOUNDARY}.
1043 @defmac INCOMING_STACK_BOUNDARY
1044 Define this macro if the incoming stack boundary may be different
1045 from @code{PREFERRED_STACK_BOUNDARY}. This macro must evaluate
1046 to a value equal to or larger than @code{STACK_BOUNDARY}.
1049 @defmac FUNCTION_BOUNDARY
1050 Alignment required for a function entry point, in bits.
1053 @defmac BIGGEST_ALIGNMENT
1054 Biggest alignment that any data type can require on this machine, in
1055 bits. Note that this is not the biggest alignment that is supported,
1056 just the biggest alignment that, when violated, may cause a fault.
1059 @defmac MALLOC_ABI_ALIGNMENT
1060 Alignment, in bits, a C conformant malloc implementation has to
1061 provide. If not defined, the default value is @code{BITS_PER_WORD}.
1064 @defmac ATTRIBUTE_ALIGNED_VALUE
1065 Alignment used by the @code{__attribute__ ((aligned))} construct. If
1066 not defined, the default value is @code{BIGGEST_ALIGNMENT}.
1069 @defmac MINIMUM_ATOMIC_ALIGNMENT
1070 If defined, the smallest alignment, in bits, that can be given to an
1071 object that can be referenced in one operation, without disturbing any
1072 nearby object. Normally, this is @code{BITS_PER_UNIT}, but may be larger
1073 on machines that don't have byte or half-word store operations.
1076 @defmac BIGGEST_FIELD_ALIGNMENT
1077 Biggest alignment that any structure or union field can require on this
1078 machine, in bits. If defined, this overrides @code{BIGGEST_ALIGNMENT} for
1079 structure and union fields only, unless the field alignment has been set
1080 by the @code{__attribute__ ((aligned (@var{n})))} construct.
1083 @defmac ADJUST_FIELD_ALIGN (@var{field}, @var{computed})
1084 An expression for the alignment of a structure field @var{field} if the
1085 alignment computed in the usual way (including applying of
1086 @code{BIGGEST_ALIGNMENT} and @code{BIGGEST_FIELD_ALIGNMENT} to the
1087 alignment) is @var{computed}. It overrides alignment only if the
1088 field alignment has not been set by the
1089 @code{__attribute__ ((aligned (@var{n})))} construct.
1092 @defmac MAX_STACK_ALIGNMENT
1093 Biggest stack alignment guaranteed by the backend. Use this macro
1094 to specify the maximum alignment of a variable on stack.
1096 If not defined, the default value is @code{STACK_BOUNDARY}.
1098 @c FIXME: The default should be @code{PREFERRED_STACK_BOUNDARY}.
1099 @c But the fix for PR 32893 indicates that we can only guarantee
1100 @c maximum stack alignment on stack up to @code{STACK_BOUNDARY}, not
1101 @c @code{PREFERRED_STACK_BOUNDARY}, if stack alignment isn't supported.
1104 @defmac MAX_OFILE_ALIGNMENT
1105 Biggest alignment supported by the object file format of this machine.
1106 Use this macro to limit the alignment which can be specified using the
1107 @code{__attribute__ ((aligned (@var{n})))} construct. If not defined,
1108 the default value is @code{BIGGEST_ALIGNMENT}.
1110 On systems that use ELF, the default (in @file{config/elfos.h}) is
1111 the largest supported 32-bit ELF section alignment representable on
1112 a 32-bit host e.g. @samp{(((unsigned HOST_WIDEST_INT) 1 << 28) * 8)}.
1113 On 32-bit ELF the largest supported section alignment in bits is
1114 @samp{(0x80000000 * 8)}, but this is not representable on 32-bit hosts.
1117 @defmac DATA_ALIGNMENT (@var{type}, @var{basic-align})
1118 If defined, a C expression to compute the alignment for a variable in
1119 the static store. @var{type} is the data type, and @var{basic-align} is
1120 the alignment that the object would ordinarily have. The value of this
1121 macro is used instead of that alignment to align the object.
1123 If this macro is not defined, then @var{basic-align} is used.
1126 One use of this macro is to increase alignment of medium-size data to
1127 make it all fit in fewer cache lines. Another is to cause character
1128 arrays to be word-aligned so that @code{strcpy} calls that copy
1129 constants to character arrays can be done inline.
1132 @defmac CONSTANT_ALIGNMENT (@var{constant}, @var{basic-align})
1133 If defined, a C expression to compute the alignment given to a constant
1134 that is being placed in memory. @var{constant} is the constant and
1135 @var{basic-align} is the alignment that the object would ordinarily
1136 have. The value of this macro is used instead of that alignment to
1139 If this macro is not defined, then @var{basic-align} is used.
1141 The typical use of this macro is to increase alignment for string
1142 constants to be word aligned so that @code{strcpy} calls that copy
1143 constants can be done inline.
1146 @defmac LOCAL_ALIGNMENT (@var{type}, @var{basic-align})
1147 If defined, a C expression to compute the alignment for a variable in
1148 the local store. @var{type} is the data type, and @var{basic-align} is
1149 the alignment that the object would ordinarily have. The value of this
1150 macro is used instead of that alignment to align the object.
1152 If this macro is not defined, then @var{basic-align} is used.
1154 One use of this macro is to increase alignment of medium-size data to
1155 make it all fit in fewer cache lines.
1158 @defmac STACK_SLOT_ALIGNMENT (@var{type}, @var{mode}, @var{basic-align})
1159 If defined, a C expression to compute the alignment for stack slot.
1160 @var{type} is the data type, @var{mode} is the widest mode available,
1161 and @var{basic-align} is the alignment that the slot would ordinarily
1162 have. The value of this macro is used instead of that alignment to
1165 If this macro is not defined, then @var{basic-align} is used when
1166 @var{type} is @code{NULL}. Otherwise, @code{LOCAL_ALIGNMENT} will
1169 This macro is to set alignment of stack slot to the maximum alignment
1170 of all possible modes which the slot may have.
1173 @defmac LOCAL_DECL_ALIGNMENT (@var{decl})
1174 If defined, a C expression to compute the alignment for a local
1175 variable @var{decl}.
1177 If this macro is not defined, then
1178 @code{LOCAL_ALIGNMENT (TREE_TYPE (@var{decl}), DECL_ALIGN (@var{decl}))}
1181 One use of this macro is to increase alignment of medium-size data to
1182 make it all fit in fewer cache lines.
1185 @defmac MINIMUM_ALIGNMENT (@var{exp}, @var{mode}, @var{align})
1186 If defined, a C expression to compute the minimum required alignment
1187 for dynamic stack realignment purposes for @var{exp} (a type or decl),
1188 @var{mode}, assuming normal alignment @var{align}.
1190 If this macro is not defined, then @var{align} will be used.
1193 @defmac EMPTY_FIELD_BOUNDARY
1194 Alignment in bits to be given to a structure bit-field that follows an
1195 empty field such as @code{int : 0;}.
1197 If @code{PCC_BITFIELD_TYPE_MATTERS} is true, it overrides this macro.
1200 @defmac STRUCTURE_SIZE_BOUNDARY
1201 Number of bits which any structure or union's size must be a multiple of.
1202 Each structure or union's size is rounded up to a multiple of this.
1204 If you do not define this macro, the default is the same as
1205 @code{BITS_PER_UNIT}.
1208 @defmac STRICT_ALIGNMENT
1209 Define this macro to be the value 1 if instructions will fail to work
1210 if given data not on the nominal alignment. If instructions will merely
1211 go slower in that case, define this macro as 0.
1214 @defmac PCC_BITFIELD_TYPE_MATTERS
1215 Define this if you wish to imitate the way many other C compilers handle
1216 alignment of bit-fields and the structures that contain them.
1218 The behavior is that the type written for a named bit-field (@code{int},
1219 @code{short}, or other integer type) imposes an alignment for the entire
1220 structure, as if the structure really did contain an ordinary field of
1221 that type. In addition, the bit-field is placed within the structure so
1222 that it would fit within such a field, not crossing a boundary for it.
1224 Thus, on most machines, a named bit-field whose type is written as
1225 @code{int} would not cross a four-byte boundary, and would force
1226 four-byte alignment for the whole structure. (The alignment used may
1227 not be four bytes; it is controlled by the other alignment parameters.)
1229 An unnamed bit-field will not affect the alignment of the containing
1232 If the macro is defined, its definition should be a C expression;
1233 a nonzero value for the expression enables this behavior.
1235 Note that if this macro is not defined, or its value is zero, some
1236 bit-fields may cross more than one alignment boundary. The compiler can
1237 support such references if there are @samp{insv}, @samp{extv}, and
1238 @samp{extzv} insns that can directly reference memory.
1240 The other known way of making bit-fields work is to define
1241 @code{STRUCTURE_SIZE_BOUNDARY} as large as @code{BIGGEST_ALIGNMENT}.
1242 Then every structure can be accessed with fullwords.
1244 Unless the machine has bit-field instructions or you define
1245 @code{STRUCTURE_SIZE_BOUNDARY} that way, you must define
1246 @code{PCC_BITFIELD_TYPE_MATTERS} to have a nonzero value.
1248 If your aim is to make GCC use the same conventions for laying out
1249 bit-fields as are used by another compiler, here is how to investigate
1250 what the other compiler does. Compile and run this program:
1269 printf ("Size of foo1 is %d\n",
1270 sizeof (struct foo1));
1271 printf ("Size of foo2 is %d\n",
1272 sizeof (struct foo2));
1277 If this prints 2 and 5, then the compiler's behavior is what you would
1278 get from @code{PCC_BITFIELD_TYPE_MATTERS}.
1281 @defmac BITFIELD_NBYTES_LIMITED
1282 Like @code{PCC_BITFIELD_TYPE_MATTERS} except that its effect is limited
1283 to aligning a bit-field within the structure.
1286 @deftypefn {Target Hook} bool TARGET_ALIGN_ANON_BITFIELD (void)
1287 When @code{PCC_BITFIELD_TYPE_MATTERS} is true this hook will determine
1288 whether unnamed bitfields affect the alignment of the containing
1289 structure. The hook should return true if the structure should inherit
1290 the alignment requirements of an unnamed bitfield's type.
1293 @deftypefn {Target Hook} bool TARGET_NARROW_VOLATILE_BITFIELD (void)
1294 This target hook should return @code{true} if accesses to volatile bitfields
1295 should use the narrowest mode possible. It should return @code{false} if
1296 these accesses should use the bitfield container type.
1298 The default is @code{!TARGET_STRICT_ALIGN}.
1301 @defmac MEMBER_TYPE_FORCES_BLK (@var{field}, @var{mode})
1302 Return 1 if a structure or array containing @var{field} should be accessed using
1305 If @var{field} is the only field in the structure, @var{mode} is its
1306 mode, otherwise @var{mode} is VOIDmode. @var{mode} is provided in the
1307 case where structures of one field would require the structure's mode to
1308 retain the field's mode.
1310 Normally, this is not needed.
1313 @defmac ROUND_TYPE_ALIGN (@var{type}, @var{computed}, @var{specified})
1314 Define this macro as an expression for the alignment of a type (given
1315 by @var{type} as a tree node) if the alignment computed in the usual
1316 way is @var{computed} and the alignment explicitly specified was
1319 The default is to use @var{specified} if it is larger; otherwise, use
1320 the smaller of @var{computed} and @code{BIGGEST_ALIGNMENT}
1323 @defmac MAX_FIXED_MODE_SIZE
1324 An integer expression for the size in bits of the largest integer
1325 machine mode that should actually be used. All integer machine modes of
1326 this size or smaller can be used for structures and unions with the
1327 appropriate sizes. If this macro is undefined, @code{GET_MODE_BITSIZE
1328 (DImode)} is assumed.
1331 @defmac STACK_SAVEAREA_MODE (@var{save_level})
1332 If defined, an expression of type @code{enum machine_mode} that
1333 specifies the mode of the save area operand of a
1334 @code{save_stack_@var{level}} named pattern (@pxref{Standard Names}).
1335 @var{save_level} is one of @code{SAVE_BLOCK}, @code{SAVE_FUNCTION}, or
1336 @code{SAVE_NONLOCAL} and selects which of the three named patterns is
1337 having its mode specified.
1339 You need not define this macro if it always returns @code{Pmode}. You
1340 would most commonly define this macro if the
1341 @code{save_stack_@var{level}} patterns need to support both a 32- and a
1345 @defmac STACK_SIZE_MODE
1346 If defined, an expression of type @code{enum machine_mode} that
1347 specifies the mode of the size increment operand of an
1348 @code{allocate_stack} named pattern (@pxref{Standard Names}).
1350 You need not define this macro if it always returns @code{word_mode}.
1351 You would most commonly define this macro if the @code{allocate_stack}
1352 pattern needs to support both a 32- and a 64-bit mode.
1355 @deftypefn {Target Hook} {enum machine_mode} TARGET_LIBGCC_CMP_RETURN_MODE (void)
1356 This target hook should return the mode to be used for the return value
1357 of compare instructions expanded to libgcc calls. If not defined
1358 @code{word_mode} is returned which is the right choice for a majority of
1362 @deftypefn {Target Hook} {enum machine_mode} TARGET_LIBGCC_SHIFT_COUNT_MODE (void)
1363 This target hook should return the mode to be used for the shift count operand
1364 of shift instructions expanded to libgcc calls. If not defined
1365 @code{word_mode} is returned which is the right choice for a majority of
1369 @deftypefn {Target Hook} {enum machine_mode} TARGET_UNWIND_WORD_MODE (void)
1370 Return machine mode to be used for @code{_Unwind_Word} type.
1371 The default is to use @code{word_mode}.
1374 @defmac ROUND_TOWARDS_ZERO
1375 If defined, this macro should be true if the prevailing rounding
1376 mode is towards zero.
1378 Defining this macro only affects the way @file{libgcc.a} emulates
1379 floating-point arithmetic.
1381 Not defining this macro is equivalent to returning zero.
1384 @defmac LARGEST_EXPONENT_IS_NORMAL (@var{size})
1385 This macro should return true if floats with @var{size}
1386 bits do not have a NaN or infinity representation, but use the largest
1387 exponent for normal numbers instead.
1389 Defining this macro only affects the way @file{libgcc.a} emulates
1390 floating-point arithmetic.
1392 The default definition of this macro returns false for all sizes.
1395 @deftypefn {Target Hook} bool TARGET_MS_BITFIELD_LAYOUT_P (const_tree @var{record_type})
1396 This target hook returns @code{true} if bit-fields in the given
1397 @var{record_type} are to be laid out following the rules of Microsoft
1398 Visual C/C++, namely: (i) a bit-field won't share the same storage
1399 unit with the previous bit-field if their underlying types have
1400 different sizes, and the bit-field will be aligned to the highest
1401 alignment of the underlying types of itself and of the previous
1402 bit-field; (ii) a zero-sized bit-field will affect the alignment of
1403 the whole enclosing structure, even if it is unnamed; except that
1404 (iii) a zero-sized bit-field will be disregarded unless it follows
1405 another bit-field of nonzero size. If this hook returns @code{true},
1406 other macros that control bit-field layout are ignored.
1408 When a bit-field is inserted into a packed record, the whole size
1409 of the underlying type is used by one or more same-size adjacent
1410 bit-fields (that is, if its long:3, 32 bits is used in the record,
1411 and any additional adjacent long bit-fields are packed into the same
1412 chunk of 32 bits. However, if the size changes, a new field of that
1413 size is allocated). In an unpacked record, this is the same as using
1414 alignment, but not equivalent when packing.
1416 If both MS bit-fields and @samp{__attribute__((packed))} are used,
1417 the latter will take precedence. If @samp{__attribute__((packed))} is
1418 used on a single field when MS bit-fields are in use, it will take
1419 precedence for that field, but the alignment of the rest of the structure
1420 may affect its placement.
1423 @deftypefn {Target Hook} bool TARGET_DECIMAL_FLOAT_SUPPORTED_P (void)
1424 Returns true if the target supports decimal floating point.
1427 @deftypefn {Target Hook} bool TARGET_FIXED_POINT_SUPPORTED_P (void)
1428 Returns true if the target supports fixed-point arithmetic.
1431 @deftypefn {Target Hook} void TARGET_EXPAND_TO_RTL_HOOK (void)
1432 This hook is called just before expansion into rtl, allowing the target
1433 to perform additional initializations or analysis before the expansion.
1434 For example, the rs6000 port uses it to allocate a scratch stack slot
1435 for use in copying SDmode values between memory and floating point
1436 registers whenever the function being expanded has any SDmode
1440 @deftypefn {Target Hook} void TARGET_INSTANTIATE_DECLS (void)
1441 This hook allows the backend to perform additional instantiations on rtl
1442 that are not actually in any insns yet, but will be later.
1445 @deftypefn {Target Hook} {const char *} TARGET_MANGLE_TYPE (const_tree @var{type})
1446 If your target defines any fundamental types, or any types your target
1447 uses should be mangled differently from the default, define this hook
1448 to return the appropriate encoding for these types as part of a C++
1449 mangled name. The @var{type} argument is the tree structure representing
1450 the type to be mangled. The hook may be applied to trees which are
1451 not target-specific fundamental types; it should return @code{NULL}
1452 for all such types, as well as arguments it does not recognize. If the
1453 return value is not @code{NULL}, it must point to a statically-allocated
1456 Target-specific fundamental types might be new fundamental types or
1457 qualified versions of ordinary fundamental types. Encode new
1458 fundamental types as @samp{@w{u @var{n} @var{name}}}, where @var{name}
1459 is the name used for the type in source code, and @var{n} is the
1460 length of @var{name} in decimal. Encode qualified versions of
1461 ordinary types as @samp{@w{U @var{n} @var{name} @var{code}}}, where
1462 @var{name} is the name used for the type qualifier in source code,
1463 @var{n} is the length of @var{name} as above, and @var{code} is the
1464 code used to represent the unqualified version of this type. (See
1465 @code{write_builtin_type} in @file{cp/mangle.c} for the list of
1466 codes.) In both cases the spaces are for clarity; do not include any
1467 spaces in your string.
1469 This hook is applied to types prior to typedef resolution. If the mangled
1470 name for a particular type depends only on that type's main variant, you
1471 can perform typedef resolution yourself using @code{TYPE_MAIN_VARIANT}
1474 The default version of this hook always returns @code{NULL}, which is
1475 appropriate for a target that does not define any new fundamental
1480 @section Layout of Source Language Data Types
1482 These macros define the sizes and other characteristics of the standard
1483 basic data types used in programs being compiled. Unlike the macros in
1484 the previous section, these apply to specific features of C and related
1485 languages, rather than to fundamental aspects of storage layout.
1487 @defmac INT_TYPE_SIZE
1488 A C expression for the size in bits of the type @code{int} on the
1489 target machine. If you don't define this, the default is one word.
1492 @defmac SHORT_TYPE_SIZE
1493 A C expression for the size in bits of the type @code{short} on the
1494 target machine. If you don't define this, the default is half a word.
1495 (If this would be less than one storage unit, it is rounded up to one
1499 @defmac LONG_TYPE_SIZE
1500 A C expression for the size in bits of the type @code{long} on the
1501 target machine. If you don't define this, the default is one word.
1504 @defmac ADA_LONG_TYPE_SIZE
1505 On some machines, the size used for the Ada equivalent of the type
1506 @code{long} by a native Ada compiler differs from that used by C@. In
1507 that situation, define this macro to be a C expression to be used for
1508 the size of that type. If you don't define this, the default is the
1509 value of @code{LONG_TYPE_SIZE}.
1512 @defmac LONG_LONG_TYPE_SIZE
1513 A C expression for the size in bits of the type @code{long long} on the
1514 target machine. If you don't define this, the default is two
1515 words. If you want to support GNU Ada on your machine, the value of this
1516 macro must be at least 64.
1519 @defmac CHAR_TYPE_SIZE
1520 A C expression for the size in bits of the type @code{char} on the
1521 target machine. If you don't define this, the default is
1522 @code{BITS_PER_UNIT}.
1525 @defmac BOOL_TYPE_SIZE
1526 A C expression for the size in bits of the C++ type @code{bool} and
1527 C99 type @code{_Bool} on the target machine. If you don't define
1528 this, and you probably shouldn't, the default is @code{CHAR_TYPE_SIZE}.
1531 @defmac FLOAT_TYPE_SIZE
1532 A C expression for the size in bits of the type @code{float} on the
1533 target machine. If you don't define this, the default is one word.
1536 @defmac DOUBLE_TYPE_SIZE
1537 A C expression for the size in bits of the type @code{double} on the
1538 target machine. If you don't define this, the default is two
1542 @defmac LONG_DOUBLE_TYPE_SIZE
1543 A C expression for the size in bits of the type @code{long double} on
1544 the target machine. If you don't define this, the default is two
1548 @defmac SHORT_FRACT_TYPE_SIZE
1549 A C expression for the size in bits of the type @code{short _Fract} on
1550 the target machine. If you don't define this, the default is
1551 @code{BITS_PER_UNIT}.
1554 @defmac FRACT_TYPE_SIZE
1555 A C expression for the size in bits of the type @code{_Fract} on
1556 the target machine. If you don't define this, the default is
1557 @code{BITS_PER_UNIT * 2}.
1560 @defmac LONG_FRACT_TYPE_SIZE
1561 A C expression for the size in bits of the type @code{long _Fract} on
1562 the target machine. If you don't define this, the default is
1563 @code{BITS_PER_UNIT * 4}.
1566 @defmac LONG_LONG_FRACT_TYPE_SIZE
1567 A C expression for the size in bits of the type @code{long long _Fract} on
1568 the target machine. If you don't define this, the default is
1569 @code{BITS_PER_UNIT * 8}.
1572 @defmac SHORT_ACCUM_TYPE_SIZE
1573 A C expression for the size in bits of the type @code{short _Accum} on
1574 the target machine. If you don't define this, the default is
1575 @code{BITS_PER_UNIT * 2}.
1578 @defmac ACCUM_TYPE_SIZE
1579 A C expression for the size in bits of the type @code{_Accum} on
1580 the target machine. If you don't define this, the default is
1581 @code{BITS_PER_UNIT * 4}.
1584 @defmac LONG_ACCUM_TYPE_SIZE
1585 A C expression for the size in bits of the type @code{long _Accum} on
1586 the target machine. If you don't define this, the default is
1587 @code{BITS_PER_UNIT * 8}.
1590 @defmac LONG_LONG_ACCUM_TYPE_SIZE
1591 A C expression for the size in bits of the type @code{long long _Accum} on
1592 the target machine. If you don't define this, the default is
1593 @code{BITS_PER_UNIT * 16}.
1596 @defmac LIBGCC2_LONG_DOUBLE_TYPE_SIZE
1597 Define this macro if @code{LONG_DOUBLE_TYPE_SIZE} is not constant or
1598 if you want routines in @file{libgcc2.a} for a size other than
1599 @code{LONG_DOUBLE_TYPE_SIZE}. If you don't define this, the
1600 default is @code{LONG_DOUBLE_TYPE_SIZE}.
1603 @defmac LIBGCC2_HAS_DF_MODE
1604 Define this macro if neither @code{DOUBLE_TYPE_SIZE} nor
1605 @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is
1606 @code{DFmode} but you want @code{DFmode} routines in @file{libgcc2.a}
1607 anyway. If you don't define this and either @code{DOUBLE_TYPE_SIZE}
1608 or @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64 then the default is 1,
1612 @defmac LIBGCC2_HAS_XF_MODE
1613 Define this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not
1614 @code{XFmode} but you want @code{XFmode} routines in @file{libgcc2.a}
1615 anyway. If you don't define this and @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE}
1616 is 80 then the default is 1, otherwise it is 0.
1619 @defmac LIBGCC2_HAS_TF_MODE
1620 Define this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not
1621 @code{TFmode} but you want @code{TFmode} routines in @file{libgcc2.a}
1622 anyway. If you don't define this and @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE}
1623 is 128 then the default is 1, otherwise it is 0.
1630 Define these macros to be the size in bits of the mantissa of
1631 @code{SFmode}, @code{DFmode}, @code{XFmode} and @code{TFmode} values,
1632 if the defaults in @file{libgcc2.h} are inappropriate. By default,
1633 @code{FLT_MANT_DIG} is used for @code{SF_SIZE}, @code{LDBL_MANT_DIG}
1634 for @code{XF_SIZE} and @code{TF_SIZE}, and @code{DBL_MANT_DIG} or
1635 @code{LDBL_MANT_DIG} for @code{DF_SIZE} according to whether
1636 @code{DOUBLE_TYPE_SIZE} or
1637 @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64.
1640 @defmac TARGET_FLT_EVAL_METHOD
1641 A C expression for the value for @code{FLT_EVAL_METHOD} in @file{float.h},
1642 assuming, if applicable, that the floating-point control word is in its
1643 default state. If you do not define this macro the value of
1644 @code{FLT_EVAL_METHOD} will be zero.
1647 @defmac WIDEST_HARDWARE_FP_SIZE
1648 A C expression for the size in bits of the widest floating-point format
1649 supported by the hardware. If you define this macro, you must specify a
1650 value less than or equal to the value of @code{LONG_DOUBLE_TYPE_SIZE}.
1651 If you do not define this macro, the value of @code{LONG_DOUBLE_TYPE_SIZE}
1655 @defmac DEFAULT_SIGNED_CHAR
1656 An expression whose value is 1 or 0, according to whether the type
1657 @code{char} should be signed or unsigned by default. The user can
1658 always override this default with the options @option{-fsigned-char}
1659 and @option{-funsigned-char}.
1662 @deftypefn {Target Hook} bool TARGET_DEFAULT_SHORT_ENUMS (void)
1663 This target hook should return true if the compiler should give an
1664 @code{enum} type only as many bytes as it takes to represent the range
1665 of possible values of that type. It should return false if all
1666 @code{enum} types should be allocated like @code{int}.
1668 The default is to return false.
1672 A C expression for a string describing the name of the data type to use
1673 for size values. The typedef name @code{size_t} is defined using the
1674 contents of the string.
1676 The string can contain more than one keyword. If so, separate them with
1677 spaces, and write first any length keyword, then @code{unsigned} if
1678 appropriate, and finally @code{int}. The string must exactly match one
1679 of the data type names defined in the function
1680 @code{init_decl_processing} in the file @file{c-decl.c}. You may not
1681 omit @code{int} or change the order---that would cause the compiler to
1684 If you don't define this macro, the default is @code{"long unsigned
1688 @defmac PTRDIFF_TYPE
1689 A C expression for a string describing the name of the data type to use
1690 for the result of subtracting two pointers. The typedef name
1691 @code{ptrdiff_t} is defined using the contents of the string. See
1692 @code{SIZE_TYPE} above for more information.
1694 If you don't define this macro, the default is @code{"long int"}.
1698 A C expression for a string describing the name of the data type to use
1699 for wide characters. The typedef name @code{wchar_t} is defined using
1700 the contents of the string. See @code{SIZE_TYPE} above for more
1703 If you don't define this macro, the default is @code{"int"}.
1706 @defmac WCHAR_TYPE_SIZE
1707 A C expression for the size in bits of the data type for wide
1708 characters. This is used in @code{cpp}, which cannot make use of
1713 A C expression for a string describing the name of the data type to
1714 use for wide characters passed to @code{printf} and returned from
1715 @code{getwc}. The typedef name @code{wint_t} is defined using the
1716 contents of the string. See @code{SIZE_TYPE} above for more
1719 If you don't define this macro, the default is @code{"unsigned int"}.
1723 A C expression for a string describing the name of the data type that
1724 can represent any value of any standard or extended signed integer type.
1725 The typedef name @code{intmax_t} is defined using the contents of the
1726 string. See @code{SIZE_TYPE} above for more information.
1728 If you don't define this macro, the default is the first of
1729 @code{"int"}, @code{"long int"}, or @code{"long long int"} that has as
1730 much precision as @code{long long int}.
1733 @defmac UINTMAX_TYPE
1734 A C expression for a string describing the name of the data type that
1735 can represent any value of any standard or extended unsigned integer
1736 type. The typedef name @code{uintmax_t} is defined using the contents
1737 of the string. See @code{SIZE_TYPE} above for more information.
1739 If you don't define this macro, the default is the first of
1740 @code{"unsigned int"}, @code{"long unsigned int"}, or @code{"long long
1741 unsigned int"} that has as much precision as @code{long long unsigned
1745 @defmac SIG_ATOMIC_TYPE
1751 @defmacx UINT16_TYPE
1752 @defmacx UINT32_TYPE
1753 @defmacx UINT64_TYPE
1754 @defmacx INT_LEAST8_TYPE
1755 @defmacx INT_LEAST16_TYPE
1756 @defmacx INT_LEAST32_TYPE
1757 @defmacx INT_LEAST64_TYPE
1758 @defmacx UINT_LEAST8_TYPE
1759 @defmacx UINT_LEAST16_TYPE
1760 @defmacx UINT_LEAST32_TYPE
1761 @defmacx UINT_LEAST64_TYPE
1762 @defmacx INT_FAST8_TYPE
1763 @defmacx INT_FAST16_TYPE
1764 @defmacx INT_FAST32_TYPE
1765 @defmacx INT_FAST64_TYPE
1766 @defmacx UINT_FAST8_TYPE
1767 @defmacx UINT_FAST16_TYPE
1768 @defmacx UINT_FAST32_TYPE
1769 @defmacx UINT_FAST64_TYPE
1770 @defmacx INTPTR_TYPE
1771 @defmacx UINTPTR_TYPE
1772 C expressions for the standard types @code{sig_atomic_t},
1773 @code{int8_t}, @code{int16_t}, @code{int32_t}, @code{int64_t},
1774 @code{uint8_t}, @code{uint16_t}, @code{uint32_t}, @code{uint64_t},
1775 @code{int_least8_t}, @code{int_least16_t}, @code{int_least32_t},
1776 @code{int_least64_t}, @code{uint_least8_t}, @code{uint_least16_t},
1777 @code{uint_least32_t}, @code{uint_least64_t}, @code{int_fast8_t},
1778 @code{int_fast16_t}, @code{int_fast32_t}, @code{int_fast64_t},
1779 @code{uint_fast8_t}, @code{uint_fast16_t}, @code{uint_fast32_t},
1780 @code{uint_fast64_t}, @code{intptr_t}, and @code{uintptr_t}. See
1781 @code{SIZE_TYPE} above for more information.
1783 If any of these macros evaluates to a null pointer, the corresponding
1784 type is not supported; if GCC is configured to provide
1785 @code{<stdint.h>} in such a case, the header provided may not conform
1786 to C99, depending on the type in question. The defaults for all of
1787 these macros are null pointers.
1790 @defmac TARGET_PTRMEMFUNC_VBIT_LOCATION
1791 The C++ compiler represents a pointer-to-member-function with a struct
1798 ptrdiff_t vtable_index;
1805 The C++ compiler must use one bit to indicate whether the function that
1806 will be called through a pointer-to-member-function is virtual.
1807 Normally, we assume that the low-order bit of a function pointer must
1808 always be zero. Then, by ensuring that the vtable_index is odd, we can
1809 distinguish which variant of the union is in use. But, on some
1810 platforms function pointers can be odd, and so this doesn't work. In
1811 that case, we use the low-order bit of the @code{delta} field, and shift
1812 the remainder of the @code{delta} field to the left.
1814 GCC will automatically make the right selection about where to store
1815 this bit using the @code{FUNCTION_BOUNDARY} setting for your platform.
1816 However, some platforms such as ARM/Thumb have @code{FUNCTION_BOUNDARY}
1817 set such that functions always start at even addresses, but the lowest
1818 bit of pointers to functions indicate whether the function at that
1819 address is in ARM or Thumb mode. If this is the case of your
1820 architecture, you should define this macro to
1821 @code{ptrmemfunc_vbit_in_delta}.
1823 In general, you should not have to define this macro. On architectures
1824 in which function addresses are always even, according to
1825 @code{FUNCTION_BOUNDARY}, GCC will automatically define this macro to
1826 @code{ptrmemfunc_vbit_in_pfn}.
1829 @defmac TARGET_VTABLE_USES_DESCRIPTORS
1830 Normally, the C++ compiler uses function pointers in vtables. This
1831 macro allows the target to change to use ``function descriptors''
1832 instead. Function descriptors are found on targets for whom a
1833 function pointer is actually a small data structure. Normally the
1834 data structure consists of the actual code address plus a data
1835 pointer to which the function's data is relative.
1837 If vtables are used, the value of this macro should be the number
1838 of words that the function descriptor occupies.
1841 @defmac TARGET_VTABLE_ENTRY_ALIGN
1842 By default, the vtable entries are void pointers, the so the alignment
1843 is the same as pointer alignment. The value of this macro specifies
1844 the alignment of the vtable entry in bits. It should be defined only
1845 when special alignment is necessary. */
1848 @defmac TARGET_VTABLE_DATA_ENTRY_DISTANCE
1849 There are a few non-descriptor entries in the vtable at offsets below
1850 zero. If these entries must be padded (say, to preserve the alignment
1851 specified by @code{TARGET_VTABLE_ENTRY_ALIGN}), set this to the number
1852 of words in each data entry.
1856 @section Register Usage
1857 @cindex register usage
1859 This section explains how to describe what registers the target machine
1860 has, and how (in general) they can be used.
1862 The description of which registers a specific instruction can use is
1863 done with register classes; see @ref{Register Classes}. For information
1864 on using registers to access a stack frame, see @ref{Frame Registers}.
1865 For passing values in registers, see @ref{Register Arguments}.
1866 For returning values in registers, see @ref{Scalar Return}.
1869 * Register Basics:: Number and kinds of registers.
1870 * Allocation Order:: Order in which registers are allocated.
1871 * Values in Registers:: What kinds of values each reg can hold.
1872 * Leaf Functions:: Renumbering registers for leaf functions.
1873 * Stack Registers:: Handling a register stack such as 80387.
1876 @node Register Basics
1877 @subsection Basic Characteristics of Registers
1879 @c prevent bad page break with this line
1880 Registers have various characteristics.
1882 @defmac FIRST_PSEUDO_REGISTER
1883 Number of hardware registers known to the compiler. They receive
1884 numbers 0 through @code{FIRST_PSEUDO_REGISTER-1}; thus, the first
1885 pseudo register's number really is assigned the number
1886 @code{FIRST_PSEUDO_REGISTER}.
1889 @defmac FIXED_REGISTERS
1890 @cindex fixed register
1891 An initializer that says which registers are used for fixed purposes
1892 all throughout the compiled code and are therefore not available for
1893 general allocation. These would include the stack pointer, the frame
1894 pointer (except on machines where that can be used as a general
1895 register when no frame pointer is needed), the program counter on
1896 machines where that is considered one of the addressable registers,
1897 and any other numbered register with a standard use.
1899 This information is expressed as a sequence of numbers, separated by
1900 commas and surrounded by braces. The @var{n}th number is 1 if
1901 register @var{n} is fixed, 0 otherwise.
1903 The table initialized from this macro, and the table initialized by
1904 the following one, may be overridden at run time either automatically,
1905 by the actions of the macro @code{CONDITIONAL_REGISTER_USAGE}, or by
1906 the user with the command options @option{-ffixed-@var{reg}},
1907 @option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}.
1910 @defmac CALL_USED_REGISTERS
1911 @cindex call-used register
1912 @cindex call-clobbered register
1913 @cindex call-saved register
1914 Like @code{FIXED_REGISTERS} but has 1 for each register that is
1915 clobbered (in general) by function calls as well as for fixed
1916 registers. This macro therefore identifies the registers that are not
1917 available for general allocation of values that must live across
1920 If a register has 0 in @code{CALL_USED_REGISTERS}, the compiler
1921 automatically saves it on function entry and restores it on function
1922 exit, if the register is used within the function.
1925 @defmac CALL_REALLY_USED_REGISTERS
1926 @cindex call-used register
1927 @cindex call-clobbered register
1928 @cindex call-saved register
1929 Like @code{CALL_USED_REGISTERS} except this macro doesn't require
1930 that the entire set of @code{FIXED_REGISTERS} be included.
1931 (@code{CALL_USED_REGISTERS} must be a superset of @code{FIXED_REGISTERS}).
1932 This macro is optional. If not specified, it defaults to the value
1933 of @code{CALL_USED_REGISTERS}.
1936 @defmac HARD_REGNO_CALL_PART_CLOBBERED (@var{regno}, @var{mode})
1937 @cindex call-used register
1938 @cindex call-clobbered register
1939 @cindex call-saved register
1940 A C expression that is nonzero if it is not permissible to store a
1941 value of mode @var{mode} in hard register number @var{regno} across a
1942 call without some part of it being clobbered. For most machines this
1943 macro need not be defined. It is only required for machines that do not
1944 preserve the entire contents of a register across a call.
1948 @findex call_used_regs
1951 @findex reg_class_contents
1952 @defmac CONDITIONAL_REGISTER_USAGE
1953 Zero or more C statements that may conditionally modify five variables
1954 @code{fixed_regs}, @code{call_used_regs}, @code{global_regs},
1955 @code{reg_names}, and @code{reg_class_contents}, to take into account
1956 any dependence of these register sets on target flags. The first three
1957 of these are of type @code{char []} (interpreted as Boolean vectors).
1958 @code{global_regs} is a @code{const char *[]}, and
1959 @code{reg_class_contents} is a @code{HARD_REG_SET}. Before the macro is
1960 called, @code{fixed_regs}, @code{call_used_regs},
1961 @code{reg_class_contents}, and @code{reg_names} have been initialized
1962 from @code{FIXED_REGISTERS}, @code{CALL_USED_REGISTERS},
1963 @code{REG_CLASS_CONTENTS}, and @code{REGISTER_NAMES}, respectively.
1964 @code{global_regs} has been cleared, and any @option{-ffixed-@var{reg}},
1965 @option{-fcall-used-@var{reg}} and @option{-fcall-saved-@var{reg}}
1966 command options have been applied.
1968 You need not define this macro if it has no work to do.
1970 @cindex disabling certain registers
1971 @cindex controlling register usage
1972 If the usage of an entire class of registers depends on the target
1973 flags, you may indicate this to GCC by using this macro to modify
1974 @code{fixed_regs} and @code{call_used_regs} to 1 for each of the
1975 registers in the classes which should not be used by GCC@. Also define
1976 the macro @code{REG_CLASS_FROM_LETTER} / @code{REG_CLASS_FROM_CONSTRAINT}
1977 to return @code{NO_REGS} if it
1978 is called with a letter for a class that shouldn't be used.
1980 (However, if this class is not included in @code{GENERAL_REGS} and all
1981 of the insn patterns whose constraints permit this class are
1982 controlled by target switches, then GCC will automatically avoid using
1983 these registers when the target switches are opposed to them.)
1986 @defmac INCOMING_REGNO (@var{out})
1987 Define this macro if the target machine has register windows. This C
1988 expression returns the register number as seen by the called function
1989 corresponding to the register number @var{out} as seen by the calling
1990 function. Return @var{out} if register number @var{out} is not an
1994 @defmac OUTGOING_REGNO (@var{in})
1995 Define this macro if the target machine has register windows. This C
1996 expression returns the register number as seen by the calling function
1997 corresponding to the register number @var{in} as seen by the called
1998 function. Return @var{in} if register number @var{in} is not an inbound
2002 @defmac LOCAL_REGNO (@var{regno})
2003 Define this macro if the target machine has register windows. This C
2004 expression returns true if the register is call-saved but is in the
2005 register window. Unlike most call-saved registers, such registers
2006 need not be explicitly restored on function exit or during non-local
2011 If the program counter has a register number, define this as that
2012 register number. Otherwise, do not define it.
2015 @node Allocation Order
2016 @subsection Order of Allocation of Registers
2017 @cindex order of register allocation
2018 @cindex register allocation order
2020 @c prevent bad page break with this line
2021 Registers are allocated in order.
2023 @defmac REG_ALLOC_ORDER
2024 If defined, an initializer for a vector of integers, containing the
2025 numbers of hard registers in the order in which GCC should prefer
2026 to use them (from most preferred to least).
2028 If this macro is not defined, registers are used lowest numbered first
2029 (all else being equal).
2031 One use of this macro is on machines where the highest numbered
2032 registers must always be saved and the save-multiple-registers
2033 instruction supports only sequences of consecutive registers. On such
2034 machines, define @code{REG_ALLOC_ORDER} to be an initializer that lists
2035 the highest numbered allocable register first.
2038 @defmac ADJUST_REG_ALLOC_ORDER
2039 A C statement (sans semicolon) to choose the order in which to allocate
2040 hard registers for pseudo-registers local to a basic block.
2042 Store the desired register order in the array @code{reg_alloc_order}.
2043 Element 0 should be the register to allocate first; element 1, the next
2044 register; and so on.
2046 The macro body should not assume anything about the contents of
2047 @code{reg_alloc_order} before execution of the macro.
2049 On most machines, it is not necessary to define this macro.
2052 @defmac HONOR_REG_ALLOC_ORDER
2053 Normally, IRA tries to estimate the costs for saving a register in the
2054 prologue and restoring it in the epilogue. This discourages it from
2055 using call-saved registers. If a machine wants to ensure that IRA
2056 allocates registers in the order given by REG_ALLOC_ORDER even if some
2057 call-saved registers appear earlier than call-used ones, this macro
2061 @defmac IRA_HARD_REGNO_ADD_COST_MULTIPLIER (@var{regno})
2062 In some case register allocation order is not enough for the
2063 Integrated Register Allocator (@acronym{IRA}) to generate a good code.
2064 If this macro is defined, it should return a floating point value
2065 based on @var{regno}. The cost of using @var{regno} for a pseudo will
2066 be increased by approximately the pseudo's usage frequency times the
2067 value returned by this macro. Not defining this macro is equivalent
2068 to having it always return @code{0.0}.
2070 On most machines, it is not necessary to define this macro.
2073 @node Values in Registers
2074 @subsection How Values Fit in Registers
2076 This section discusses the macros that describe which kinds of values
2077 (specifically, which machine modes) each register can hold, and how many
2078 consecutive registers are needed for a given mode.
2080 @defmac HARD_REGNO_NREGS (@var{regno}, @var{mode})
2081 A C expression for the number of consecutive hard registers, starting
2082 at register number @var{regno}, required to hold a value of mode
2083 @var{mode}. This macro must never return zero, even if a register
2084 cannot hold the requested mode - indicate that with HARD_REGNO_MODE_OK
2085 and/or CANNOT_CHANGE_MODE_CLASS instead.
2087 On a machine where all registers are exactly one word, a suitable
2088 definition of this macro is
2091 #define HARD_REGNO_NREGS(REGNO, MODE) \
2092 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \
2097 @defmac HARD_REGNO_NREGS_HAS_PADDING (@var{regno}, @var{mode})
2098 A C expression that is nonzero if a value of mode @var{mode}, stored
2099 in memory, ends with padding that causes it to take up more space than
2100 in registers starting at register number @var{regno} (as determined by
2101 multiplying GCC's notion of the size of the register when containing
2102 this mode by the number of registers returned by
2103 @code{HARD_REGNO_NREGS}). By default this is zero.
2105 For example, if a floating-point value is stored in three 32-bit
2106 registers but takes up 128 bits in memory, then this would be
2109 This macros only needs to be defined if there are cases where
2110 @code{subreg_get_info}
2111 would otherwise wrongly determine that a @code{subreg} can be
2112 represented by an offset to the register number, when in fact such a
2113 @code{subreg} would contain some of the padding not stored in
2114 registers and so not be representable.
2117 @defmac HARD_REGNO_NREGS_WITH_PADDING (@var{regno}, @var{mode})
2118 For values of @var{regno} and @var{mode} for which
2119 @code{HARD_REGNO_NREGS_HAS_PADDING} returns nonzero, a C expression
2120 returning the greater number of registers required to hold the value
2121 including any padding. In the example above, the value would be four.
2124 @defmac REGMODE_NATURAL_SIZE (@var{mode})
2125 Define this macro if the natural size of registers that hold values
2126 of mode @var{mode} is not the word size. It is a C expression that
2127 should give the natural size in bytes for the specified mode. It is
2128 used by the register allocator to try to optimize its results. This
2129 happens for example on SPARC 64-bit where the natural size of
2130 floating-point registers is still 32-bit.
2133 @defmac HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
2134 A C expression that is nonzero if it is permissible to store a value
2135 of mode @var{mode} in hard register number @var{regno} (or in several
2136 registers starting with that one). For a machine where all registers
2137 are equivalent, a suitable definition is
2140 #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
2143 You need not include code to check for the numbers of fixed registers,
2144 because the allocation mechanism considers them to be always occupied.
2146 @cindex register pairs
2147 On some machines, double-precision values must be kept in even/odd
2148 register pairs. You can implement that by defining this macro to reject
2149 odd register numbers for such modes.
2151 The minimum requirement for a mode to be OK in a register is that the
2152 @samp{mov@var{mode}} instruction pattern support moves between the
2153 register and other hard register in the same class and that moving a
2154 value into the register and back out not alter it.
2156 Since the same instruction used to move @code{word_mode} will work for
2157 all narrower integer modes, it is not necessary on any machine for
2158 @code{HARD_REGNO_MODE_OK} to distinguish between these modes, provided
2159 you define patterns @samp{movhi}, etc., to take advantage of this. This
2160 is useful because of the interaction between @code{HARD_REGNO_MODE_OK}
2161 and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes
2164 Many machines have special registers for floating point arithmetic.
2165 Often people assume that floating point machine modes are allowed only
2166 in floating point registers. This is not true. Any registers that
2167 can hold integers can safely @emph{hold} a floating point machine
2168 mode, whether or not floating arithmetic can be done on it in those
2169 registers. Integer move instructions can be used to move the values.
2171 On some machines, though, the converse is true: fixed-point machine
2172 modes may not go in floating registers. This is true if the floating
2173 registers normalize any value stored in them, because storing a
2174 non-floating value there would garble it. In this case,
2175 @code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
2176 floating registers. But if the floating registers do not automatically
2177 normalize, if you can store any bit pattern in one and retrieve it
2178 unchanged without a trap, then any machine mode may go in a floating
2179 register, so you can define this macro to say so.
2181 The primary significance of special floating registers is rather that
2182 they are the registers acceptable in floating point arithmetic
2183 instructions. However, this is of no concern to
2184 @code{HARD_REGNO_MODE_OK}. You handle it by writing the proper
2185 constraints for those instructions.
2187 On some machines, the floating registers are especially slow to access,
2188 so that it is better to store a value in a stack frame than in such a
2189 register if floating point arithmetic is not being done. As long as the
2190 floating registers are not in class @code{GENERAL_REGS}, they will not
2191 be used unless some pattern's constraint asks for one.
2194 @defmac HARD_REGNO_RENAME_OK (@var{from}, @var{to})
2195 A C expression that is nonzero if it is OK to rename a hard register
2196 @var{from} to another hard register @var{to}.
2198 One common use of this macro is to prevent renaming of a register to
2199 another register that is not saved by a prologue in an interrupt
2202 The default is always nonzero.
2205 @defmac MODES_TIEABLE_P (@var{mode1}, @var{mode2})
2206 A C expression that is nonzero if a value of mode
2207 @var{mode1} is accessible in mode @var{mode2} without copying.
2209 If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
2210 @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same for
2211 any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})}
2212 should be nonzero. If they differ for any @var{r}, you should define
2213 this macro to return zero unless some other mechanism ensures the
2214 accessibility of the value in a narrower mode.
2216 You should define this macro to return nonzero in as many cases as
2217 possible since doing so will allow GCC to perform better register
2221 @deftypefn {Target Hook} bool TARGET_HARD_REGNO_SCRATCH_OK (unsigned int @var{regno})
2222 This target hook should return @code{true} if it is OK to use a hard register
2223 @var{regno} as scratch reg in peephole2.
2225 One common use of this macro is to prevent using of a register that
2226 is not saved by a prologue in an interrupt handler.
2228 The default version of this hook always returns @code{true}.
2231 @defmac AVOID_CCMODE_COPIES
2232 Define this macro if the compiler should avoid copies to/from @code{CCmode}
2233 registers. You should only define this macro if support for copying to/from
2234 @code{CCmode} is incomplete.
2237 @node Leaf Functions
2238 @subsection Handling Leaf Functions
2240 @cindex leaf functions
2241 @cindex functions, leaf
2242 On some machines, a leaf function (i.e., one which makes no calls) can run
2243 more efficiently if it does not make its own register window. Often this
2244 means it is required to receive its arguments in the registers where they
2245 are passed by the caller, instead of the registers where they would
2248 The special treatment for leaf functions generally applies only when
2249 other conditions are met; for example, often they may use only those
2250 registers for its own variables and temporaries. We use the term ``leaf
2251 function'' to mean a function that is suitable for this special
2252 handling, so that functions with no calls are not necessarily ``leaf
2255 GCC assigns register numbers before it knows whether the function is
2256 suitable for leaf function treatment. So it needs to renumber the
2257 registers in order to output a leaf function. The following macros
2260 @defmac LEAF_REGISTERS
2261 Name of a char vector, indexed by hard register number, which
2262 contains 1 for a register that is allowable in a candidate for leaf
2265 If leaf function treatment involves renumbering the registers, then the
2266 registers marked here should be the ones before renumbering---those that
2267 GCC would ordinarily allocate. The registers which will actually be
2268 used in the assembler code, after renumbering, should not be marked with 1
2271 Define this macro only if the target machine offers a way to optimize
2272 the treatment of leaf functions.
2275 @defmac LEAF_REG_REMAP (@var{regno})
2276 A C expression whose value is the register number to which @var{regno}
2277 should be renumbered, when a function is treated as a leaf function.
2279 If @var{regno} is a register number which should not appear in a leaf
2280 function before renumbering, then the expression should yield @minus{}1, which
2281 will cause the compiler to abort.
2283 Define this macro only if the target machine offers a way to optimize the
2284 treatment of leaf functions, and registers need to be renumbered to do
2288 @findex current_function_is_leaf
2289 @findex current_function_uses_only_leaf_regs
2290 @code{TARGET_ASM_FUNCTION_PROLOGUE} and
2291 @code{TARGET_ASM_FUNCTION_EPILOGUE} must usually treat leaf functions
2292 specially. They can test the C variable @code{current_function_is_leaf}
2293 which is nonzero for leaf functions. @code{current_function_is_leaf} is
2294 set prior to local register allocation and is valid for the remaining
2295 compiler passes. They can also test the C variable
2296 @code{current_function_uses_only_leaf_regs} which is nonzero for leaf
2297 functions which only use leaf registers.
2298 @code{current_function_uses_only_leaf_regs} is valid after all passes
2299 that modify the instructions have been run and is only useful if
2300 @code{LEAF_REGISTERS} is defined.
2301 @c changed this to fix overfull. ALSO: why the "it" at the beginning
2302 @c of the next paragraph?! --mew 2feb93
2304 @node Stack Registers
2305 @subsection Registers That Form a Stack
2307 There are special features to handle computers where some of the
2308 ``registers'' form a stack. Stack registers are normally written by
2309 pushing onto the stack, and are numbered relative to the top of the
2312 Currently, GCC can only handle one group of stack-like registers, and
2313 they must be consecutively numbered. Furthermore, the existing
2314 support for stack-like registers is specific to the 80387 floating
2315 point coprocessor. If you have a new architecture that uses
2316 stack-like registers, you will need to do substantial work on
2317 @file{reg-stack.c} and write your machine description to cooperate
2318 with it, as well as defining these macros.
2321 Define this if the machine has any stack-like registers.
2324 @defmac STACK_REG_COVER_CLASS
2325 This is a cover class containing the stack registers. Define this if
2326 the machine has any stack-like registers.
2329 @defmac FIRST_STACK_REG
2330 The number of the first stack-like register. This one is the top
2334 @defmac LAST_STACK_REG
2335 The number of the last stack-like register. This one is the bottom of
2339 @node Register Classes
2340 @section Register Classes
2341 @cindex register class definitions
2342 @cindex class definitions, register
2344 On many machines, the numbered registers are not all equivalent.
2345 For example, certain registers may not be allowed for indexed addressing;
2346 certain registers may not be allowed in some instructions. These machine
2347 restrictions are described to the compiler using @dfn{register classes}.
2349 You define a number of register classes, giving each one a name and saying
2350 which of the registers belong to it. Then you can specify register classes
2351 that are allowed as operands to particular instruction patterns.
2355 In general, each register will belong to several classes. In fact, one
2356 class must be named @code{ALL_REGS} and contain all the registers. Another
2357 class must be named @code{NO_REGS} and contain no registers. Often the
2358 union of two classes will be another class; however, this is not required.
2360 @findex GENERAL_REGS
2361 One of the classes must be named @code{GENERAL_REGS}. There is nothing
2362 terribly special about the name, but the operand constraint letters
2363 @samp{r} and @samp{g} specify this class. If @code{GENERAL_REGS} is
2364 the same as @code{ALL_REGS}, just define it as a macro which expands
2367 Order the classes so that if class @var{x} is contained in class @var{y}
2368 then @var{x} has a lower class number than @var{y}.
2370 The way classes other than @code{GENERAL_REGS} are specified in operand
2371 constraints is through machine-dependent operand constraint letters.
2372 You can define such letters to correspond to various classes, then use
2373 them in operand constraints.
2375 You should define a class for the union of two classes whenever some
2376 instruction allows both classes. For example, if an instruction allows
2377 either a floating point (coprocessor) register or a general register for a
2378 certain operand, you should define a class @code{FLOAT_OR_GENERAL_REGS}
2379 which includes both of them. Otherwise you will get suboptimal code.
2381 You must also specify certain redundant information about the register
2382 classes: for each class, which classes contain it and which ones are
2383 contained in it; for each pair of classes, the largest class contained
2386 When a value occupying several consecutive registers is expected in a
2387 certain class, all the registers used must belong to that class.
2388 Therefore, register classes cannot be used to enforce a requirement for
2389 a register pair to start with an even-numbered register. The way to
2390 specify this requirement is with @code{HARD_REGNO_MODE_OK}.
2392 Register classes used for input-operands of bitwise-and or shift
2393 instructions have a special requirement: each such class must have, for
2394 each fixed-point machine mode, a subclass whose registers can transfer that
2395 mode to or from memory. For example, on some machines, the operations for
2396 single-byte values (@code{QImode}) are limited to certain registers. When
2397 this is so, each register class that is used in a bitwise-and or shift
2398 instruction must have a subclass consisting of registers from which
2399 single-byte values can be loaded or stored. This is so that
2400 @code{PREFERRED_RELOAD_CLASS} can always have a possible value to return.
2402 @deftp {Data type} {enum reg_class}
2403 An enumerated type that must be defined with all the register class names
2404 as enumerated values. @code{NO_REGS} must be first. @code{ALL_REGS}
2405 must be the last register class, followed by one more enumerated value,
2406 @code{LIM_REG_CLASSES}, which is not a register class but rather
2407 tells how many classes there are.
2409 Each register class has a number, which is the value of casting
2410 the class name to type @code{int}. The number serves as an index
2411 in many of the tables described below.
2414 @defmac N_REG_CLASSES
2415 The number of distinct register classes, defined as follows:
2418 #define N_REG_CLASSES (int) LIM_REG_CLASSES
2422 @defmac REG_CLASS_NAMES
2423 An initializer containing the names of the register classes as C string
2424 constants. These names are used in writing some of the debugging dumps.
2427 @defmac REG_CLASS_CONTENTS
2428 An initializer containing the contents of the register classes, as integers
2429 which are bit masks. The @var{n}th integer specifies the contents of class
2430 @var{n}. The way the integer @var{mask} is interpreted is that
2431 register @var{r} is in the class if @code{@var{mask} & (1 << @var{r})} is 1.
2433 When the machine has more than 32 registers, an integer does not suffice.
2434 Then the integers are replaced by sub-initializers, braced groupings containing
2435 several integers. Each sub-initializer must be suitable as an initializer
2436 for the type @code{HARD_REG_SET} which is defined in @file{hard-reg-set.h}.
2437 In this situation, the first integer in each sub-initializer corresponds to
2438 registers 0 through 31, the second integer to registers 32 through 63, and
2442 @defmac REGNO_REG_CLASS (@var{regno})
2443 A C expression whose value is a register class containing hard register
2444 @var{regno}. In general there is more than one such class; choose a class
2445 which is @dfn{minimal}, meaning that no smaller class also contains the
2449 @defmac BASE_REG_CLASS
2450 A macro whose definition is the name of the class to which a valid
2451 base register must belong. A base register is one used in an address
2452 which is the register value plus a displacement.
2455 @defmac MODE_BASE_REG_CLASS (@var{mode})
2456 This is a variation of the @code{BASE_REG_CLASS} macro which allows
2457 the selection of a base register in a mode dependent manner. If
2458 @var{mode} is VOIDmode then it should return the same value as
2459 @code{BASE_REG_CLASS}.
2462 @defmac MODE_BASE_REG_REG_CLASS (@var{mode})
2463 A C expression whose value is the register class to which a valid
2464 base register must belong in order to be used in a base plus index
2465 register address. You should define this macro if base plus index
2466 addresses have different requirements than other base register uses.
2469 @defmac MODE_CODE_BASE_REG_CLASS (@var{mode}, @var{outer_code}, @var{index_code})
2470 A C expression whose value is the register class to which a valid
2471 base register must belong. @var{outer_code} and @var{index_code} define the
2472 context in which the base register occurs. @var{outer_code} is the code of
2473 the immediately enclosing expression (@code{MEM} for the top level of an
2474 address, @code{ADDRESS} for something that occurs in an
2475 @code{address_operand}). @var{index_code} is the code of the corresponding
2476 index expression if @var{outer_code} is @code{PLUS}; @code{SCRATCH} otherwise.
2479 @defmac INDEX_REG_CLASS
2480 A macro whose definition is the name of the class to which a valid
2481 index register must belong. An index register is one used in an
2482 address where its value is either multiplied by a scale factor or
2483 added to another register (as well as added to a displacement).
2486 @defmac REGNO_OK_FOR_BASE_P (@var{num})
2487 A C expression which is nonzero if register number @var{num} is
2488 suitable for use as a base register in operand addresses.
2489 Like @code{TARGET_LEGITIMATE_ADDRESS_P}, this macro should also
2490 define a strict and a non-strict variant. Both variants behave
2491 the same for hard register; for pseudos, the strict variant will
2492 pass only those that have been allocated to a valid hard registers,
2493 while the non-strict variant will pass all pseudos.
2495 @findex REG_OK_STRICT
2496 Compiler source files that want to use the strict variant of this and
2497 other macros define the macro @code{REG_OK_STRICT}. You should use an
2498 @code{#ifdef REG_OK_STRICT} conditional to define the strict variant in
2499 that case and the non-strict variant otherwise.
2502 @defmac REGNO_MODE_OK_FOR_BASE_P (@var{num}, @var{mode})
2503 A C expression that is just like @code{REGNO_OK_FOR_BASE_P}, except that
2504 that expression may examine the mode of the memory reference in
2505 @var{mode}. You should define this macro if the mode of the memory
2506 reference affects whether a register may be used as a base register. If
2507 you define this macro, the compiler will use it instead of
2508 @code{REGNO_OK_FOR_BASE_P}. The mode may be @code{VOIDmode} for
2509 addresses that appear outside a @code{MEM}, i.e., as an
2510 @code{address_operand}.
2512 This macro also has strict and non-strict variants.
2515 @defmac REGNO_MODE_OK_FOR_REG_BASE_P (@var{num}, @var{mode})
2516 A C expression which is nonzero if register number @var{num} is suitable for
2517 use as a base register in base plus index operand addresses, accessing
2518 memory in mode @var{mode}. It may be either a suitable hard register or a
2519 pseudo register that has been allocated such a hard register. You should
2520 define this macro if base plus index addresses have different requirements
2521 than other base register uses.
2523 Use of this macro is deprecated; please use the more general
2524 @code{REGNO_MODE_CODE_OK_FOR_BASE_P}.
2526 This macro also has strict and non-strict variants.
2529 @defmac REGNO_MODE_CODE_OK_FOR_BASE_P (@var{num}, @var{mode}, @var{outer_code}, @var{index_code})
2530 A C expression that is just like @code{REGNO_MODE_OK_FOR_BASE_P}, except
2531 that that expression may examine the context in which the register
2532 appears in the memory reference. @var{outer_code} is the code of the
2533 immediately enclosing expression (@code{MEM} if at the top level of the
2534 address, @code{ADDRESS} for something that occurs in an
2535 @code{address_operand}). @var{index_code} is the code of the
2536 corresponding index expression if @var{outer_code} is @code{PLUS};
2537 @code{SCRATCH} otherwise. The mode may be @code{VOIDmode} for addresses
2538 that appear outside a @code{MEM}, i.e., as an @code{address_operand}.
2540 This macro also has strict and non-strict variants.
2543 @defmac REGNO_OK_FOR_INDEX_P (@var{num})
2544 A C expression which is nonzero if register number @var{num} is
2545 suitable for use as an index register in operand addresses. It may be
2546 either a suitable hard register or a pseudo register that has been
2547 allocated such a hard register.
2549 The difference between an index register and a base register is that
2550 the index register may be scaled. If an address involves the sum of
2551 two registers, neither one of them scaled, then either one may be
2552 labeled the ``base'' and the other the ``index''; but whichever
2553 labeling is used must fit the machine's constraints of which registers
2554 may serve in each capacity. The compiler will try both labelings,
2555 looking for one that is valid, and will reload one or both registers
2556 only if neither labeling works.
2558 This macro also has strict and non-strict variants.
2561 @deftypefn {Target Hook} reg_class_t TARGET_PREFERRED_RELOAD_CLASS (rtx @var{x}, reg_class_t @var{rclass})
2562 A target hook that places additional restrictions on the register class
2563 to use when it is necessary to copy value @var{x} into a register in class
2564 @var{rclass}. The value is a register class; perhaps @var{rclass}, or perhaps
2565 another, smaller class.
2567 The default version of this hook always returns value of @code{rclass} argument.
2569 Sometimes returning a more restrictive class makes better code. For
2570 example, on the 68000, when @var{x} is an integer constant that is in range
2571 for a @samp{moveq} instruction, the value of this macro is always
2572 @code{DATA_REGS} as long as @var{rclass} includes the data registers.
2573 Requiring a data register guarantees that a @samp{moveq} will be used.
2575 One case where @code{TARGET_PREFERRED_RELOAD_CLASS} must not return
2576 @var{rclass} is if @var{x} is a legitimate constant which cannot be
2577 loaded into some register class. By returning @code{NO_REGS} you can
2578 force @var{x} into a memory location. For example, rs6000 can load
2579 immediate values into general-purpose registers, but does not have an
2580 instruction for loading an immediate value into a floating-point
2581 register, so @code{TARGET_PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when
2582 @var{x} is a floating-point constant. If the constant can't be loaded
2583 into any kind of register, code generation will be better if
2584 @code{LEGITIMATE_CONSTANT_P} makes the constant illegitimate instead
2585 of using @code{TARGET_PREFERRED_RELOAD_CLASS}.
2587 If an insn has pseudos in it after register allocation, reload will go
2588 through the alternatives and call repeatedly @code{TARGET_PREFERRED_RELOAD_CLASS}
2589 to find the best one. Returning @code{NO_REGS}, in this case, makes
2590 reload add a @code{!} in front of the constraint: the x86 back-end uses
2591 this feature to discourage usage of 387 registers when math is done in
2592 the SSE registers (and vice versa).
2595 @defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class})
2596 A C expression that places additional restrictions on the register class
2597 to use when it is necessary to copy value @var{x} into a register in class
2598 @var{class}. The value is a register class; perhaps @var{class}, or perhaps
2599 another, smaller class. On many machines, the following definition is
2603 #define PREFERRED_RELOAD_CLASS(X,CLASS) CLASS
2606 Sometimes returning a more restrictive class makes better code. For
2607 example, on the 68000, when @var{x} is an integer constant that is in range
2608 for a @samp{moveq} instruction, the value of this macro is always
2609 @code{DATA_REGS} as long as @var{class} includes the data registers.
2610 Requiring a data register guarantees that a @samp{moveq} will be used.
2612 One case where @code{PREFERRED_RELOAD_CLASS} must not return
2613 @var{class} is if @var{x} is a legitimate constant which cannot be
2614 loaded into some register class. By returning @code{NO_REGS} you can
2615 force @var{x} into a memory location. For example, rs6000 can load
2616 immediate values into general-purpose registers, but does not have an
2617 instruction for loading an immediate value into a floating-point
2618 register, so @code{PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when
2619 @var{x} is a floating-point constant. If the constant can't be loaded
2620 into any kind of register, code generation will be better if
2621 @code{LEGITIMATE_CONSTANT_P} makes the constant illegitimate instead
2622 of using @code{PREFERRED_RELOAD_CLASS}.
2624 If an insn has pseudos in it after register allocation, reload will go
2625 through the alternatives and call repeatedly @code{PREFERRED_RELOAD_CLASS}
2626 to find the best one. Returning @code{NO_REGS}, in this case, makes
2627 reload add a @code{!} in front of the constraint: the x86 back-end uses
2628 this feature to discourage usage of 387 registers when math is done in
2629 the SSE registers (and vice versa).
2632 @defmac PREFERRED_OUTPUT_RELOAD_CLASS (@var{x}, @var{class})
2633 Like @code{PREFERRED_RELOAD_CLASS}, but for output reloads instead of
2634 input reloads. If you don't define this macro, the default is to use
2635 @var{class}, unchanged.
2637 You can also use @code{PREFERRED_OUTPUT_RELOAD_CLASS} to discourage
2638 reload from using some alternatives, like @code{PREFERRED_RELOAD_CLASS}.
2641 @deftypefn {Target Hook} reg_class_t TARGET_PREFERRED_OUTPUT_RELOAD_CLASS (rtx @var{x}, reg_class_t @var{rclass})
2642 Like @code{TARGET_PREFERRED_RELOAD_CLASS}, but for output reloads instead of
2645 The default version of this hook always returns value of @code{rclass}
2648 You can also use @code{TARGET_PREFERRED_OUTPUT_RELOAD_CLASS} to discourage
2649 reload from using some alternatives, like @code{TARGET_PREFERRED_RELOAD_CLASS}.
2652 @defmac LIMIT_RELOAD_CLASS (@var{mode}, @var{class})
2653 A C expression that places additional restrictions on the register class
2654 to use when it is necessary to be able to hold a value of mode
2655 @var{mode} in a reload register for which class @var{class} would
2658 Unlike @code{PREFERRED_RELOAD_CLASS}, this macro should be used when
2659 there are certain modes that simply can't go in certain reload classes.
2661 The value is a register class; perhaps @var{class}, or perhaps another,
2664 Don't define this macro unless the target machine has limitations which
2665 require the macro to do something nontrivial.
2668 @deftypefn {Target Hook} reg_class_t TARGET_SECONDARY_RELOAD (bool @var{in_p}, rtx @var{x}, reg_class_t @var{reload_class}, enum machine_mode @var{reload_mode}, secondary_reload_info *@var{sri})
2669 Many machines have some registers that cannot be copied directly to or
2670 from memory or even from other types of registers. An example is the
2671 @samp{MQ} register, which on most machines, can only be copied to or
2672 from general registers, but not memory. Below, we shall be using the
2673 term 'intermediate register' when a move operation cannot be performed
2674 directly, but has to be done by copying the source into the intermediate
2675 register first, and then copying the intermediate register to the
2676 destination. An intermediate register always has the same mode as
2677 source and destination. Since it holds the actual value being copied,
2678 reload might apply optimizations to re-use an intermediate register
2679 and eliding the copy from the source when it can determine that the
2680 intermediate register still holds the required value.
2682 Another kind of secondary reload is required on some machines which
2683 allow copying all registers to and from memory, but require a scratch
2684 register for stores to some memory locations (e.g., those with symbolic
2685 address on the RT, and those with certain symbolic address on the SPARC
2686 when compiling PIC)@. Scratch registers need not have the same mode
2687 as the value being copied, and usually hold a different value than
2688 that being copied. Special patterns in the md file are needed to
2689 describe how the copy is performed with the help of the scratch register;
2690 these patterns also describe the number, register class(es) and mode(s)
2691 of the scratch register(s).
2693 In some cases, both an intermediate and a scratch register are required.
2695 For input reloads, this target hook is called with nonzero @var{in_p},
2696 and @var{x} is an rtx that needs to be copied to a register of class
2697 @var{reload_class} in @var{reload_mode}. For output reloads, this target
2698 hook is called with zero @var{in_p}, and a register of class @var{reload_class}
2699 needs to be copied to rtx @var{x} in @var{reload_mode}.
2701 If copying a register of @var{reload_class} from/to @var{x} requires
2702 an intermediate register, the hook @code{secondary_reload} should
2703 return the register class required for this intermediate register.
2704 If no intermediate register is required, it should return NO_REGS.
2705 If more than one intermediate register is required, describe the one
2706 that is closest in the copy chain to the reload register.
2708 If scratch registers are needed, you also have to describe how to
2709 perform the copy from/to the reload register to/from this
2710 closest intermediate register. Or if no intermediate register is
2711 required, but still a scratch register is needed, describe the
2712 copy from/to the reload register to/from the reload operand @var{x}.
2714 You do this by setting @code{sri->icode} to the instruction code of a pattern
2715 in the md file which performs the move. Operands 0 and 1 are the output
2716 and input of this copy, respectively. Operands from operand 2 onward are
2717 for scratch operands. These scratch operands must have a mode, and a
2718 single-register-class
2719 @c [later: or memory]
2722 When an intermediate register is used, the @code{secondary_reload}
2723 hook will be called again to determine how to copy the intermediate
2724 register to/from the reload operand @var{x}, so your hook must also
2725 have code to handle the register class of the intermediate operand.
2727 @c [For later: maybe we'll allow multi-alternative reload patterns -
2728 @c the port maintainer could name a mov<mode> pattern that has clobbers -
2729 @c and match the constraints of input and output to determine the required
2730 @c alternative. A restriction would be that constraints used to match
2731 @c against reloads registers would have to be written as register class
2732 @c constraints, or we need a new target macro / hook that tells us if an
2733 @c arbitrary constraint can match an unknown register of a given class.
2734 @c Such a macro / hook would also be useful in other places.]
2737 @var{x} might be a pseudo-register or a @code{subreg} of a
2738 pseudo-register, which could either be in a hard register or in memory.
2739 Use @code{true_regnum} to find out; it will return @minus{}1 if the pseudo is
2740 in memory and the hard register number if it is in a register.
2742 Scratch operands in memory (constraint @code{"=m"} / @code{"=&m"}) are
2743 currently not supported. For the time being, you will have to continue
2744 to use @code{SECONDARY_MEMORY_NEEDED} for that purpose.
2746 @code{copy_cost} also uses this target hook to find out how values are
2747 copied. If you want it to include some extra cost for the need to allocate
2748 (a) scratch register(s), set @code{sri->extra_cost} to the additional cost.
2749 Or if two dependent moves are supposed to have a lower cost than the sum
2750 of the individual moves due to expected fortuitous scheduling and/or special
2751 forwarding logic, you can set @code{sri->extra_cost} to a negative amount.
2754 @defmac SECONDARY_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
2755 @defmacx SECONDARY_INPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
2756 @defmacx SECONDARY_OUTPUT_RELOAD_CLASS (@var{class}, @var{mode}, @var{x})
2757 These macros are obsolete, new ports should use the target hook
2758 @code{TARGET_SECONDARY_RELOAD} instead.
2760 These are obsolete macros, replaced by the @code{TARGET_SECONDARY_RELOAD}
2761 target hook. Older ports still define these macros to indicate to the
2762 reload phase that it may
2763 need to allocate at least one register for a reload in addition to the
2764 register to contain the data. Specifically, if copying @var{x} to a
2765 register @var{class} in @var{mode} requires an intermediate register,
2766 you were supposed to define @code{SECONDARY_INPUT_RELOAD_CLASS} to return the
2767 largest register class all of whose registers can be used as
2768 intermediate registers or scratch registers.
2770 If copying a register @var{class} in @var{mode} to @var{x} requires an
2771 intermediate or scratch register, @code{SECONDARY_OUTPUT_RELOAD_CLASS}
2772 was supposed to be defined be defined to return the largest register
2773 class required. If the
2774 requirements for input and output reloads were the same, the macro
2775 @code{SECONDARY_RELOAD_CLASS} should have been used instead of defining both
2778 The values returned by these macros are often @code{GENERAL_REGS}.
2779 Return @code{NO_REGS} if no spare register is needed; i.e., if @var{x}
2780 can be directly copied to or from a register of @var{class} in
2781 @var{mode} without requiring a scratch register. Do not define this
2782 macro if it would always return @code{NO_REGS}.
2784 If a scratch register is required (either with or without an
2785 intermediate register), you were supposed to define patterns for
2786 @samp{reload_in@var{m}} or @samp{reload_out@var{m}}, as required
2787 (@pxref{Standard Names}. These patterns, which were normally
2788 implemented with a @code{define_expand}, should be similar to the
2789 @samp{mov@var{m}} patterns, except that operand 2 is the scratch
2792 These patterns need constraints for the reload register and scratch
2794 contain a single register class. If the original reload register (whose
2795 class is @var{class}) can meet the constraint given in the pattern, the
2796 value returned by these macros is used for the class of the scratch
2797 register. Otherwise, two additional reload registers are required.
2798 Their classes are obtained from the constraints in the insn pattern.
2800 @var{x} might be a pseudo-register or a @code{subreg} of a
2801 pseudo-register, which could either be in a hard register or in memory.
2802 Use @code{true_regnum} to find out; it will return @minus{}1 if the pseudo is
2803 in memory and the hard register number if it is in a register.
2805 These macros should not be used in the case where a particular class of
2806 registers can only be copied to memory and not to another class of
2807 registers. In that case, secondary reload registers are not needed and
2808 would not be helpful. Instead, a stack location must be used to perform
2809 the copy and the @code{mov@var{m}} pattern should use memory as an
2810 intermediate storage. This case often occurs between floating-point and
2814 @defmac SECONDARY_MEMORY_NEEDED (@var{class1}, @var{class2}, @var{m})
2815 Certain machines have the property that some registers cannot be copied
2816 to some other registers without using memory. Define this macro on
2817 those machines to be a C expression that is nonzero if objects of mode
2818 @var{m} in registers of @var{class1} can only be copied to registers of
2819 class @var{class2} by storing a register of @var{class1} into memory
2820 and loading that memory location into a register of @var{class2}.
2822 Do not define this macro if its value would always be zero.
2825 @defmac SECONDARY_MEMORY_NEEDED_RTX (@var{mode})
2826 Normally when @code{SECONDARY_MEMORY_NEEDED} is defined, the compiler
2827 allocates a stack slot for a memory location needed for register copies.
2828 If this macro is defined, the compiler instead uses the memory location
2829 defined by this macro.
2831 Do not define this macro if you do not define
2832 @code{SECONDARY_MEMORY_NEEDED}.
2835 @defmac SECONDARY_MEMORY_NEEDED_MODE (@var{mode})
2836 When the compiler needs a secondary memory location to copy between two
2837 registers of mode @var{mode}, it normally allocates sufficient memory to
2838 hold a quantity of @code{BITS_PER_WORD} bits and performs the store and
2839 load operations in a mode that many bits wide and whose class is the
2840 same as that of @var{mode}.
2842 This is right thing to do on most machines because it ensures that all
2843 bits of the register are copied and prevents accesses to the registers
2844 in a narrower mode, which some machines prohibit for floating-point
2847 However, this default behavior is not correct on some machines, such as
2848 the DEC Alpha, that store short integers in floating-point registers
2849 differently than in integer registers. On those machines, the default
2850 widening will not work correctly and you must define this macro to
2851 suppress that widening in some cases. See the file @file{alpha.h} for
2854 Do not define this macro if you do not define
2855 @code{SECONDARY_MEMORY_NEEDED} or if widening @var{mode} to a mode that
2856 is @code{BITS_PER_WORD} bits wide is correct for your machine.
2859 @deftypefn {Target Hook} bool TARGET_CLASS_LIKELY_SPILLED_P (reg_class_t @var{rclass})
2860 A target hook which returns @code{true} if pseudos that have been assigned
2861 to registers of class @var{rclass} would likely be spilled because
2862 registers of @var{rclass} are needed for spill registers.
2864 The default version of this target hook returns @code{true} if @var{rclass}
2865 has exactly one register and @code{false} otherwise. On most machines, this
2866 default should be used. Only use this target hook to some other expression
2867 if pseudos allocated by @file{local-alloc.c} end up in memory because their
2868 hard registers were needed for spill registers. If this target hook returns
2869 @code{false} for those classes, those pseudos will only be allocated by
2870 @file{global.c}, which knows how to reallocate the pseudo to another
2871 register. If there would not be another register available for reallocation,
2872 you should not change the implementation of this target hook since
2873 the only effect of such implementation would be to slow down register
2877 @defmac CLASS_MAX_NREGS (@var{class}, @var{mode})
2878 A C expression for the maximum number of consecutive registers
2879 of class @var{class} needed to hold a value of mode @var{mode}.
2881 This is closely related to the macro @code{HARD_REGNO_NREGS}. In fact,
2882 the value of the macro @code{CLASS_MAX_NREGS (@var{class}, @var{mode})}
2883 should be the maximum value of @code{HARD_REGNO_NREGS (@var{regno},
2884 @var{mode})} for all @var{regno} values in the class @var{class}.
2886 This macro helps control the handling of multiple-word values
2890 @defmac CANNOT_CHANGE_MODE_CLASS (@var{from}, @var{to}, @var{class})
2891 If defined, a C expression that returns nonzero for a @var{class} for which
2892 a change from mode @var{from} to mode @var{to} is invalid.
2894 For the example, loading 32-bit integer or floating-point objects into
2895 floating-point registers on the Alpha extends them to 64 bits.
2896 Therefore loading a 64-bit object and then storing it as a 32-bit object
2897 does not store the low-order 32 bits, as would be the case for a normal
2898 register. Therefore, @file{alpha.h} defines @code{CANNOT_CHANGE_MODE_CLASS}
2902 #define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
2903 (GET_MODE_SIZE (FROM) != GET_MODE_SIZE (TO) \
2904 ? reg_classes_intersect_p (FLOAT_REGS, (CLASS)) : 0)
2908 @deftypefn {Target Hook} {const reg_class_t *} TARGET_IRA_COVER_CLASSES (void)
2909 Return an array of cover classes for the Integrated Register Allocator
2910 (@acronym{IRA}). Cover classes are a set of non-intersecting register
2911 classes covering all hard registers used for register allocation
2912 purposes. If a move between two registers in the same cover class is
2913 possible, it should be cheaper than a load or store of the registers.
2914 The array is terminated by a @code{LIM_REG_CLASSES} element.
2916 The order of cover classes in the array is important. If two classes
2917 have the same cost of usage for a pseudo, the class occurred first in
2918 the array is chosen for the pseudo.
2920 This hook is called once at compiler startup, after the command-line
2921 options have been processed. It is then re-examined by every call to
2922 @code{target_reinit}.
2924 The default implementation returns @code{IRA_COVER_CLASSES}, if defined,
2925 otherwise there is no default implementation. You must define either this
2926 macro or @code{IRA_COVER_CLASSES} in order to use the integrated register
2927 allocator with Chaitin-Briggs coloring. If the macro is not defined,
2928 the only available coloring algorithm is Chow's priority coloring.
2931 @defmac IRA_COVER_CLASSES
2932 See the documentation for @code{TARGET_IRA_COVER_CLASSES}.
2935 @node Old Constraints
2936 @section Obsolete Macros for Defining Constraints
2937 @cindex defining constraints, obsolete method
2938 @cindex constraints, defining, obsolete method
2940 Machine-specific constraints can be defined with these macros instead
2941 of the machine description constructs described in @ref{Define
2942 Constraints}. This mechanism is obsolete. New ports should not use
2943 it; old ports should convert to the new mechanism.
2945 @defmac CONSTRAINT_LEN (@var{char}, @var{str})
2946 For the constraint at the start of @var{str}, which starts with the letter
2947 @var{c}, return the length. This allows you to have register class /
2948 constant / extra constraints that are longer than a single letter;
2949 you don't need to define this macro if you can do with single-letter
2950 constraints only. The definition of this macro should use
2951 DEFAULT_CONSTRAINT_LEN for all the characters that you don't want
2952 to handle specially.
2953 There are some sanity checks in genoutput.c that check the constraint lengths
2954 for the md file, so you can also use this macro to help you while you are
2955 transitioning from a byzantine single-letter-constraint scheme: when you
2956 return a negative length for a constraint you want to re-use, genoutput
2957 will complain about every instance where it is used in the md file.
2960 @defmac REG_CLASS_FROM_LETTER (@var{char})
2961 A C expression which defines the machine-dependent operand constraint
2962 letters for register classes. If @var{char} is such a letter, the
2963 value should be the register class corresponding to it. Otherwise,
2964 the value should be @code{NO_REGS}. The register letter @samp{r},
2965 corresponding to class @code{GENERAL_REGS}, will not be passed
2966 to this macro; you do not need to handle it.
2969 @defmac REG_CLASS_FROM_CONSTRAINT (@var{char}, @var{str})
2970 Like @code{REG_CLASS_FROM_LETTER}, but you also get the constraint string
2971 passed in @var{str}, so that you can use suffixes to distinguish between
2975 @defmac CONST_OK_FOR_LETTER_P (@var{value}, @var{c})
2976 A C expression that defines the machine-dependent operand constraint
2977 letters (@samp{I}, @samp{J}, @samp{K}, @dots{} @samp{P}) that specify
2978 particular ranges of integer values. If @var{c} is one of those
2979 letters, the expression should check that @var{value}, an integer, is in
2980 the appropriate range and return 1 if so, 0 otherwise. If @var{c} is
2981 not one of those letters, the value should be 0 regardless of
2985 @defmac CONST_OK_FOR_CONSTRAINT_P (@var{value}, @var{c}, @var{str})
2986 Like @code{CONST_OK_FOR_LETTER_P}, but you also get the constraint
2987 string passed in @var{str}, so that you can use suffixes to distinguish
2988 between different variants.
2991 @defmac CONST_DOUBLE_OK_FOR_LETTER_P (@var{value}, @var{c})
2992 A C expression that defines the machine-dependent operand constraint
2993 letters that specify particular ranges of @code{const_double} values
2994 (@samp{G} or @samp{H}).
2996 If @var{c} is one of those letters, the expression should check that
2997 @var{value}, an RTX of code @code{const_double}, is in the appropriate
2998 range and return 1 if so, 0 otherwise. If @var{c} is not one of those
2999 letters, the value should be 0 regardless of @var{value}.
3001 @code{const_double} is used for all floating-point constants and for
3002 @code{DImode} fixed-point constants. A given letter can accept either
3003 or both kinds of values. It can use @code{GET_MODE} to distinguish
3004 between these kinds.
3007 @defmac CONST_DOUBLE_OK_FOR_CONSTRAINT_P (@var{value}, @var{c}, @var{str})
3008 Like @code{CONST_DOUBLE_OK_FOR_LETTER_P}, but you also get the constraint
3009 string passed in @var{str}, so that you can use suffixes to distinguish
3010 between different variants.
3013 @defmac EXTRA_CONSTRAINT (@var{value}, @var{c})
3014 A C expression that defines the optional machine-dependent constraint
3015 letters that can be used to segregate specific types of operands, usually
3016 memory references, for the target machine. Any letter that is not
3017 elsewhere defined and not matched by @code{REG_CLASS_FROM_LETTER} /
3018 @code{REG_CLASS_FROM_CONSTRAINT}
3019 may be used. Normally this macro will not be defined.
3021 If it is required for a particular target machine, it should return 1
3022 if @var{value} corresponds to the operand type represented by the
3023 constraint letter @var{c}. If @var{c} is not defined as an extra
3024 constraint, the value returned should be 0 regardless of @var{value}.
3026 For example, on the ROMP, load instructions cannot have their output
3027 in r0 if the memory reference contains a symbolic address. Constraint
3028 letter @samp{Q} is defined as representing a memory address that does
3029 @emph{not} contain a symbolic address. An alternative is specified with
3030 a @samp{Q} constraint on the input and @samp{r} on the output. The next
3031 alternative specifies @samp{m} on the input and a register class that
3032 does not include r0 on the output.
3035 @defmac EXTRA_CONSTRAINT_STR (@var{value}, @var{c}, @var{str})
3036 Like @code{EXTRA_CONSTRAINT}, but you also get the constraint string passed
3037 in @var{str}, so that you can use suffixes to distinguish between different
3041 @defmac EXTRA_MEMORY_CONSTRAINT (@var{c}, @var{str})
3042 A C expression that defines the optional machine-dependent constraint
3043 letters, amongst those accepted by @code{EXTRA_CONSTRAINT}, that should
3044 be treated like memory constraints by the reload pass.
3046 It should return 1 if the operand type represented by the constraint
3047 at the start of @var{str}, the first letter of which is the letter @var{c},
3048 comprises a subset of all memory references including
3049 all those whose address is simply a base register. This allows the reload
3050 pass to reload an operand, if it does not directly correspond to the operand
3051 type of @var{c}, by copying its address into a base register.
3053 For example, on the S/390, some instructions do not accept arbitrary
3054 memory references, but only those that do not make use of an index
3055 register. The constraint letter @samp{Q} is defined via
3056 @code{EXTRA_CONSTRAINT} as representing a memory address of this type.
3057 If the letter @samp{Q} is marked as @code{EXTRA_MEMORY_CONSTRAINT},
3058 a @samp{Q} constraint can handle any memory operand, because the
3059 reload pass knows it can be reloaded by copying the memory address
3060 into a base register if required. This is analogous to the way
3061 an @samp{o} constraint can handle any memory operand.
3064 @defmac EXTRA_ADDRESS_CONSTRAINT (@var{c}, @var{str})
3065 A C expression that defines the optional machine-dependent constraint
3066 letters, amongst those accepted by @code{EXTRA_CONSTRAINT} /
3067 @code{EXTRA_CONSTRAINT_STR}, that should
3068 be treated like address constraints by the reload pass.
3070 It should return 1 if the operand type represented by the constraint
3071 at the start of @var{str}, which starts with the letter @var{c}, comprises
3072 a subset of all memory addresses including
3073 all those that consist of just a base register. This allows the reload
3074 pass to reload an operand, if it does not directly correspond to the operand
3075 type of @var{str}, by copying it into a base register.
3077 Any constraint marked as @code{EXTRA_ADDRESS_CONSTRAINT} can only
3078 be used with the @code{address_operand} predicate. It is treated
3079 analogously to the @samp{p} constraint.
3082 @node Stack and Calling
3083 @section Stack Layout and Calling Conventions
3084 @cindex calling conventions
3086 @c prevent bad page break with this line
3087 This describes the stack layout and calling conventions.
3091 * Exception Handling::
3096 * Register Arguments::
3098 * Aggregate Return::
3103 * Stack Smashing Protection::
3107 @subsection Basic Stack Layout
3108 @cindex stack frame layout
3109 @cindex frame layout
3111 @c prevent bad page break with this line
3112 Here is the basic stack layout.
3114 @defmac STACK_GROWS_DOWNWARD
3115 Define this macro if pushing a word onto the stack moves the stack
3116 pointer to a smaller address.
3118 When we say, ``define this macro if @dots{}'', it means that the
3119 compiler checks this macro only with @code{#ifdef} so the precise
3120 definition used does not matter.
3123 @defmac STACK_PUSH_CODE
3124 This macro defines the operation used when something is pushed
3125 on the stack. In RTL, a push operation will be
3126 @code{(set (mem (STACK_PUSH_CODE (reg sp))) @dots{})}
3128 The choices are @code{PRE_DEC}, @code{POST_DEC}, @code{PRE_INC},
3129 and @code{POST_INC}. Which of these is correct depends on
3130 the stack direction and on whether the stack pointer points
3131 to the last item on the stack or whether it points to the
3132 space for the next item on the stack.
3134 The default is @code{PRE_DEC} when @code{STACK_GROWS_DOWNWARD} is
3135 defined, which is almost always right, and @code{PRE_INC} otherwise,
3136 which is often wrong.
3139 @defmac FRAME_GROWS_DOWNWARD
3140 Define this macro to nonzero value if the addresses of local variable slots
3141 are at negative offsets from the frame pointer.
3144 @defmac ARGS_GROW_DOWNWARD
3145 Define this macro if successive arguments to a function occupy decreasing
3146 addresses on the stack.
3149 @defmac STARTING_FRAME_OFFSET
3150 Offset from the frame pointer to the first local variable slot to be allocated.
3152 If @code{FRAME_GROWS_DOWNWARD}, find the next slot's offset by
3153 subtracting the first slot's length from @code{STARTING_FRAME_OFFSET}.
3154 Otherwise, it is found by adding the length of the first slot to the
3155 value @code{STARTING_FRAME_OFFSET}.
3156 @c i'm not sure if the above is still correct.. had to change it to get
3157 @c rid of an overfull. --mew 2feb93
3160 @defmac STACK_ALIGNMENT_NEEDED
3161 Define to zero to disable final alignment of the stack during reload.
3162 The nonzero default for this macro is suitable for most ports.
3164 On ports where @code{STARTING_FRAME_OFFSET} is nonzero or where there
3165 is a register save block following the local block that doesn't require
3166 alignment to @code{STACK_BOUNDARY}, it may be beneficial to disable
3167 stack alignment and do it in the backend.
3170 @defmac STACK_POINTER_OFFSET
3171 Offset from the stack pointer register to the first location at which
3172 outgoing arguments are placed. If not specified, the default value of
3173 zero is used. This is the proper value for most machines.
3175 If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
3176 the first location at which outgoing arguments are placed.
3179 @defmac FIRST_PARM_OFFSET (@var{fundecl})
3180 Offset from the argument pointer register to the first argument's
3181 address. On some machines it may depend on the data type of the
3184 If @code{ARGS_GROW_DOWNWARD}, this is the offset to the location above
3185 the first argument's address.
3188 @defmac STACK_DYNAMIC_OFFSET (@var{fundecl})
3189 Offset from the stack pointer register to an item dynamically allocated
3190 on the stack, e.g., by @code{alloca}.
3192 The default value for this macro is @code{STACK_POINTER_OFFSET} plus the
3193 length of the outgoing arguments. The default is correct for most
3194 machines. See @file{function.c} for details.
3197 @defmac INITIAL_FRAME_ADDRESS_RTX
3198 A C expression whose value is RTL representing the address of the initial
3199 stack frame. This address is passed to @code{RETURN_ADDR_RTX} and
3200 @code{DYNAMIC_CHAIN_ADDRESS}. If you don't define this macro, a reasonable
3201 default value will be used. Define this macro in order to make frame pointer
3202 elimination work in the presence of @code{__builtin_frame_address (count)} and
3203 @code{__builtin_return_address (count)} for @code{count} not equal to zero.
3206 @defmac DYNAMIC_CHAIN_ADDRESS (@var{frameaddr})
3207 A C expression whose value is RTL representing the address in a stack
3208 frame where the pointer to the caller's frame is stored. Assume that
3209 @var{frameaddr} is an RTL expression for the address of the stack frame
3212 If you don't define this macro, the default is to return the value
3213 of @var{frameaddr}---that is, the stack frame address is also the
3214 address of the stack word that points to the previous frame.
3217 @defmac SETUP_FRAME_ADDRESSES
3218 If defined, a C expression that produces the machine-specific code to
3219 setup the stack so that arbitrary frames can be accessed. For example,
3220 on the SPARC, we must flush all of the register windows to the stack
3221 before we can access arbitrary stack frames. You will seldom need to
3225 @deftypefn {Target Hook} rtx TARGET_BUILTIN_SETJMP_FRAME_VALUE (void)
3226 This target hook should return an rtx that is used to store
3227 the address of the current frame into the built in @code{setjmp} buffer.
3228 The default value, @code{virtual_stack_vars_rtx}, is correct for most
3229 machines. One reason you may need to define this target hook is if
3230 @code{hard_frame_pointer_rtx} is the appropriate value on your machine.
3233 @defmac FRAME_ADDR_RTX (@var{frameaddr})
3234 A C expression whose value is RTL representing the value of the frame
3235 address for the current frame. @var{frameaddr} is the frame pointer
3236 of the current frame. This is used for __builtin_frame_address.
3237 You need only define this macro if the frame address is not the same
3238 as the frame pointer. Most machines do not need to define it.
3241 @defmac RETURN_ADDR_RTX (@var{count}, @var{frameaddr})
3242 A C expression whose value is RTL representing the value of the return
3243 address for the frame @var{count} steps up from the current frame, after
3244 the prologue. @var{frameaddr} is the frame pointer of the @var{count}
3245 frame, or the frame pointer of the @var{count} @minus{} 1 frame if
3246 @code{RETURN_ADDR_IN_PREVIOUS_FRAME} is defined.
3248 The value of the expression must always be the correct address when
3249 @var{count} is zero, but may be @code{NULL_RTX} if there is no way to
3250 determine the return address of other frames.
3253 @defmac RETURN_ADDR_IN_PREVIOUS_FRAME
3254 Define this if the return address of a particular stack frame is accessed
3255 from the frame pointer of the previous stack frame.
3258 @defmac INCOMING_RETURN_ADDR_RTX
3259 A C expression whose value is RTL representing the location of the
3260 incoming return address at the beginning of any function, before the
3261 prologue. This RTL is either a @code{REG}, indicating that the return
3262 value is saved in @samp{REG}, or a @code{MEM} representing a location in
3265 You only need to define this macro if you want to support call frame
3266 debugging information like that provided by DWARF 2.
3268 If this RTL is a @code{REG}, you should also define
3269 @code{DWARF_FRAME_RETURN_COLUMN} to @code{DWARF_FRAME_REGNUM (REGNO)}.
3272 @defmac DWARF_ALT_FRAME_RETURN_COLUMN
3273 A C expression whose value is an integer giving a DWARF 2 column
3274 number that may be used as an alternative return column. The column
3275 must not correspond to any gcc hard register (that is, it must not
3276 be in the range of @code{DWARF_FRAME_REGNUM}).
3278 This macro can be useful if @code{DWARF_FRAME_RETURN_COLUMN} is set to a
3279 general register, but an alternative column needs to be used for signal
3280 frames. Some targets have also used different frame return columns
3284 @defmac DWARF_ZERO_REG
3285 A C expression whose value is an integer giving a DWARF 2 register
3286 number that is considered to always have the value zero. This should
3287 only be defined if the target has an architected zero register, and
3288 someone decided it was a good idea to use that register number to
3289 terminate the stack backtrace. New ports should avoid this.
3292 @deftypefn {Target Hook} void TARGET_DWARF_HANDLE_FRAME_UNSPEC (const char *@var{label}, rtx @var{pattern}, int @var{index})
3293 This target hook allows the backend to emit frame-related insns that
3294 contain UNSPECs or UNSPEC_VOLATILEs. The DWARF 2 call frame debugging
3295 info engine will invoke it on insns of the form
3297 (set (reg) (unspec [@dots{}] UNSPEC_INDEX))
3301 (set (reg) (unspec_volatile [@dots{}] UNSPECV_INDEX)).
3303 to let the backend emit the call frame instructions. @var{label} is
3304 the CFI label attached to the insn, @var{pattern} is the pattern of
3305 the insn and @var{index} is @code{UNSPEC_INDEX} or @code{UNSPECV_INDEX}.
3308 @defmac INCOMING_FRAME_SP_OFFSET
3309 A C expression whose value is an integer giving the offset, in bytes,
3310 from the value of the stack pointer register to the top of the stack
3311 frame at the beginning of any function, before the prologue. The top of
3312 the frame is defined to be the value of the stack pointer in the
3313 previous frame, just before the call instruction.
3315 You only need to define this macro if you want to support call frame
3316 debugging information like that provided by DWARF 2.
3319 @defmac ARG_POINTER_CFA_OFFSET (@var{fundecl})
3320 A C expression whose value is an integer giving the offset, in bytes,
3321 from the argument pointer to the canonical frame address (cfa). The
3322 final value should coincide with that calculated by
3323 @code{INCOMING_FRAME_SP_OFFSET}. Which is unfortunately not usable
3324 during virtual register instantiation.
3326 The default value for this macro is
3327 @code{FIRST_PARM_OFFSET (fundecl) + crtl->args.pretend_args_size},
3328 which is correct for most machines; in general, the arguments are found
3329 immediately before the stack frame. Note that this is not the case on
3330 some targets that save registers into the caller's frame, such as SPARC
3331 and rs6000, and so such targets need to define this macro.
3333 You only need to define this macro if the default is incorrect, and you
3334 want to support call frame debugging information like that provided by
3338 @defmac FRAME_POINTER_CFA_OFFSET (@var{fundecl})
3339 If defined, a C expression whose value is an integer giving the offset
3340 in bytes from the frame pointer to the canonical frame address (cfa).
3341 The final value should coincide with that calculated by
3342 @code{INCOMING_FRAME_SP_OFFSET}.
3344 Normally the CFA is calculated as an offset from the argument pointer,
3345 via @code{ARG_POINTER_CFA_OFFSET}, but if the argument pointer is
3346 variable due to the ABI, this may not be possible. If this macro is
3347 defined, it implies that the virtual register instantiation should be
3348 based on the frame pointer instead of the argument pointer. Only one
3349 of @code{FRAME_POINTER_CFA_OFFSET} and @code{ARG_POINTER_CFA_OFFSET}
3353 @defmac CFA_FRAME_BASE_OFFSET (@var{fundecl})
3354 If defined, a C expression whose value is an integer giving the offset
3355 in bytes from the canonical frame address (cfa) to the frame base used
3356 in DWARF 2 debug information. The default is zero. A different value
3357 may reduce the size of debug information on some ports.
3360 @node Exception Handling
3361 @subsection Exception Handling Support
3362 @cindex exception handling
3364 @defmac EH_RETURN_DATA_REGNO (@var{N})
3365 A C expression whose value is the @var{N}th register number used for
3366 data by exception handlers, or @code{INVALID_REGNUM} if fewer than
3367 @var{N} registers are usable.
3369 The exception handling library routines communicate with the exception
3370 handlers via a set of agreed upon registers. Ideally these registers
3371 should be call-clobbered; it is possible to use call-saved registers,
3372 but may negatively impact code size. The target must support at least
3373 2 data registers, but should define 4 if there are enough free registers.
3375 You must define this macro if you want to support call frame exception
3376 handling like that provided by DWARF 2.
3379 @defmac EH_RETURN_STACKADJ_RTX
3380 A C expression whose value is RTL representing a location in which
3381 to store a stack adjustment to be applied before function return.
3382 This is used to unwind the stack to an exception handler's call frame.
3383 It will be assigned zero on code paths that return normally.
3385 Typically this is a call-clobbered hard register that is otherwise
3386 untouched by the epilogue, but could also be a stack slot.
3388 Do not define this macro if the stack pointer is saved and restored
3389 by the regular prolog and epilog code in the call frame itself; in
3390 this case, the exception handling library routines will update the
3391 stack location to be restored in place. Otherwise, you must define
3392 this macro if you want to support call frame exception handling like
3393 that provided by DWARF 2.
3396 @defmac EH_RETURN_HANDLER_RTX
3397 A C expression whose value is RTL representing a location in which
3398 to store the address of an exception handler to which we should
3399 return. It will not be assigned on code paths that return normally.
3401 Typically this is the location in the call frame at which the normal
3402 return address is stored. For targets that return by popping an
3403 address off the stack, this might be a memory address just below
3404 the @emph{target} call frame rather than inside the current call
3405 frame. If defined, @code{EH_RETURN_STACKADJ_RTX} will have already
3406 been assigned, so it may be used to calculate the location of the
3409 Some targets have more complex requirements than storing to an
3410 address calculable during initial code generation. In that case
3411 the @code{eh_return} instruction pattern should be used instead.
3413 If you want to support call frame exception handling, you must
3414 define either this macro or the @code{eh_return} instruction pattern.
3417 @defmac RETURN_ADDR_OFFSET
3418 If defined, an integer-valued C expression for which rtl will be generated
3419 to add it to the exception handler address before it is searched in the
3420 exception handling tables, and to subtract it again from the address before
3421 using it to return to the exception handler.
3424 @defmac ASM_PREFERRED_EH_DATA_FORMAT (@var{code}, @var{global})
3425 This macro chooses the encoding of pointers embedded in the exception
3426 handling sections. If at all possible, this should be defined such
3427 that the exception handling section will not require dynamic relocations,
3428 and so may be read-only.
3430 @var{code} is 0 for data, 1 for code labels, 2 for function pointers.
3431 @var{global} is true if the symbol may be affected by dynamic relocations.
3432 The macro should return a combination of the @code{DW_EH_PE_*} defines
3433 as found in @file{dwarf2.h}.
3435 If this macro is not defined, pointers will not be encoded but
3436 represented directly.
3439 @defmac ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX (@var{file}, @var{encoding}, @var{size}, @var{addr}, @var{done})
3440 This macro allows the target to emit whatever special magic is required
3441 to represent the encoding chosen by @code{ASM_PREFERRED_EH_DATA_FORMAT}.
3442 Generic code takes care of pc-relative and indirect encodings; this must
3443 be defined if the target uses text-relative or data-relative encodings.
3445 This is a C statement that branches to @var{done} if the format was
3446 handled. @var{encoding} is the format chosen, @var{size} is the number
3447 of bytes that the format occupies, @var{addr} is the @code{SYMBOL_REF}
3451 @defmac MD_UNWIND_SUPPORT
3452 A string specifying a file to be #include'd in unwind-dw2.c. The file
3453 so included typically defines @code{MD_FALLBACK_FRAME_STATE_FOR}.
3456 @defmac MD_FALLBACK_FRAME_STATE_FOR (@var{context}, @var{fs})
3457 This macro allows the target to add CPU and operating system specific
3458 code to the call-frame unwinder for use when there is no unwind data
3459 available. The most common reason to implement this macro is to unwind
3460 through signal frames.
3462 This macro is called from @code{uw_frame_state_for} in
3463 @file{unwind-dw2.c}, @file{unwind-dw2-xtensa.c} and
3464 @file{unwind-ia64.c}. @var{context} is an @code{_Unwind_Context};
3465 @var{fs} is an @code{_Unwind_FrameState}. Examine @code{context->ra}
3466 for the address of the code being executed and @code{context->cfa} for
3467 the stack pointer value. If the frame can be decoded, the register
3468 save addresses should be updated in @var{fs} and the macro should
3469 evaluate to @code{_URC_NO_REASON}. If the frame cannot be decoded,
3470 the macro should evaluate to @code{_URC_END_OF_STACK}.
3472 For proper signal handling in Java this macro is accompanied by
3473 @code{MAKE_THROW_FRAME}, defined in @file{libjava/include/*-signal.h} headers.
3476 @defmac MD_HANDLE_UNWABI (@var{context}, @var{fs})
3477 This macro allows the target to add operating system specific code to the
3478 call-frame unwinder to handle the IA-64 @code{.unwabi} unwinding directive,
3479 usually used for signal or interrupt frames.
3481 This macro is called from @code{uw_update_context} in @file{unwind-ia64.c}.
3482 @var{context} is an @code{_Unwind_Context};
3483 @var{fs} is an @code{_Unwind_FrameState}. Examine @code{fs->unwabi}
3484 for the abi and context in the @code{.unwabi} directive. If the
3485 @code{.unwabi} directive can be handled, the register save addresses should
3486 be updated in @var{fs}.
3489 @defmac TARGET_USES_WEAK_UNWIND_INFO
3490 A C expression that evaluates to true if the target requires unwind
3491 info to be given comdat linkage. Define it to be @code{1} if comdat
3492 linkage is necessary. The default is @code{0}.
3495 @node Stack Checking
3496 @subsection Specifying How Stack Checking is Done
3498 GCC will check that stack references are within the boundaries of the
3499 stack, if the option @option{-fstack-check} is specified, in one of
3504 If the value of the @code{STACK_CHECK_BUILTIN} macro is nonzero, GCC
3505 will assume that you have arranged for full stack checking to be done
3506 at appropriate places in the configuration files. GCC will not do
3507 other special processing.
3510 If @code{STACK_CHECK_BUILTIN} is zero and the value of the
3511 @code{STACK_CHECK_STATIC_BUILTIN} macro is nonzero, GCC will assume
3512 that you have arranged for static stack checking (checking of the
3513 static stack frame of functions) to be done at appropriate places
3514 in the configuration files. GCC will only emit code to do dynamic
3515 stack checking (checking on dynamic stack allocations) using the third
3519 If neither of the above are true, GCC will generate code to periodically
3520 ``probe'' the stack pointer using the values of the macros defined below.
3523 If neither STACK_CHECK_BUILTIN nor STACK_CHECK_STATIC_BUILTIN is defined,
3524 GCC will change its allocation strategy for large objects if the option
3525 @option{-fstack-check} is specified: they will always be allocated
3526 dynamically if their size exceeds @code{STACK_CHECK_MAX_VAR_SIZE} bytes.
3528 @defmac STACK_CHECK_BUILTIN
3529 A nonzero value if stack checking is done by the configuration files in a
3530 machine-dependent manner. You should define this macro if stack checking
3531 is required by the ABI of your machine or if you would like to do stack
3532 checking in some more efficient way than the generic approach. The default
3533 value of this macro is zero.
3536 @defmac STACK_CHECK_STATIC_BUILTIN
3537 A nonzero value if static stack checking is done by the configuration files
3538 in a machine-dependent manner. You should define this macro if you would
3539 like to do static stack checking in some more efficient way than the generic
3540 approach. The default value of this macro is zero.
3543 @defmac STACK_CHECK_PROBE_INTERVAL_EXP
3544 An integer specifying the interval at which GCC must generate stack probe
3545 instructions, defined as 2 raised to this integer. You will normally
3546 define this macro so that the interval be no larger than the size of
3547 the ``guard pages'' at the end of a stack area. The default value
3548 of 12 (4096-byte interval) is suitable for most systems.
3551 @defmac STACK_CHECK_MOVING_SP
3552 An integer which is nonzero if GCC should move the stack pointer page by page
3553 when doing probes. This can be necessary on systems where the stack pointer
3554 contains the bottom address of the memory area accessible to the executing
3555 thread at any point in time. In this situation an alternate signal stack
3556 is required in order to be able to recover from a stack overflow. The
3557 default value of this macro is zero.
3560 @defmac STACK_CHECK_PROTECT
3561 The number of bytes of stack needed to recover from a stack overflow, for
3562 languages where such a recovery is supported. The default value of 75 words
3563 with the @code{setjmp}/@code{longjmp}-based exception handling mechanism and
3564 8192 bytes with other exception handling mechanisms should be adequate for
3568 The following macros are relevant only if neither STACK_CHECK_BUILTIN
3569 nor STACK_CHECK_STATIC_BUILTIN is defined; you can omit them altogether
3570 in the opposite case.
3572 @defmac STACK_CHECK_MAX_FRAME_SIZE
3573 The maximum size of a stack frame,&