1 This is Info file gcc.info, produced by Makeinfo version 1.68 from the
4 This file documents the use and the internals of the GNU compiler.
6 Published by the Free Software Foundation 59 Temple Place - Suite 330
7 Boston, MA 02111-1307 USA
9 Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998
10 Free Software Foundation, Inc.
12 Permission is granted to make and distribute verbatim copies of this
13 manual provided the copyright notice and this permission notice are
14 preserved on all copies.
16 Permission is granted to copy and distribute modified versions of
17 this manual under the conditions for verbatim copying, provided also
18 that the sections entitled "GNU General Public License," "Funding for
19 Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are
20 included exactly as in the original, and provided that the entire
21 resulting derived work is distributed under the terms of a permission
22 notice identical to this one.
24 Permission is granted to copy and distribute translations of this
25 manual into another language, under the above conditions for modified
26 versions, except that the sections entitled "GNU General Public
27 License," "Funding for Free Software," and "Protect Your Freedom--Fight
28 `Look And Feel'", and this permission notice, may be included in
29 translations approved by the Free Software Foundation instead of in the
33 File: gcc.info, Node: Function Units, Prev: Delay Slots, Up: Insn Attributes
35 Specifying Function Units
36 -------------------------
38 On most RISC machines, there are instructions whose results are not
39 available for a specific number of cycles. Common cases are
40 instructions that load data from memory. On many machines, a pipeline
41 stall will result if the data is referenced too soon after the load
44 In addition, many newer microprocessors have multiple function
45 units, usually one for integer and one for floating point, and often
46 will incur pipeline stalls when a result that is needed is not yet
49 The descriptions in this section allow the specification of how much
50 time must elapse between the execution of an instruction and the time
51 when its result is used. It also allows specification of when the
52 execution of an instruction will delay execution of similar instructions
53 due to function unit conflicts.
55 For the purposes of the specifications in this section, a machine is
56 divided into "function units", each of which execute a specific class
57 of instructions in first-in-first-out order. Function units that
58 accept one instruction each cycle and allow a result to be used in the
59 succeeding instruction (usually via forwarding) need not be specified.
60 Classic RISC microprocessors will normally have a single function unit,
61 which we can call `memory'. The newer "superscalar" processors will
62 often have function units for floating point operations, usually at
63 least a floating point adder and multiplier.
65 Each usage of a function units by a class of insns is specified with
66 a `define_function_unit' expression, which looks like this:
68 (define_function_unit NAME MULTIPLICITY SIMULTANEITY
69 TEST READY-DELAY ISSUE-DELAY
72 NAME is a string giving the name of the function unit.
74 MULTIPLICITY is an integer specifying the number of identical units
75 in the processor. If more than one unit is specified, they will be
76 scheduled independently. Only truly independent units should be
77 counted; a pipelined unit should be specified as a single unit. (The
78 only common example of a machine that has multiple function units for a
79 single instruction class that are truly independent and not pipelined
80 are the two multiply and two increment units of the CDC 6600.)
82 SIMULTANEITY specifies the maximum number of insns that can be
83 executing in each instance of the function unit simultaneously or zero
84 if the unit is pipelined and has no limit.
86 All `define_function_unit' definitions referring to function unit
87 NAME must have the same name and values for MULTIPLICITY and
90 TEST is an attribute test that selects the insns we are describing
91 in this definition. Note that an insn may use more than one function
92 unit and a function unit may be specified in more than one
93 `define_function_unit'.
95 READY-DELAY is an integer that specifies the number of cycles after
96 which the result of the instruction can be used without introducing any
99 ISSUE-DELAY is an integer that specifies the number of cycles after
100 the instruction matching the TEST expression begins using this unit
101 until a subsequent instruction can begin. A cost of N indicates an N-1
102 cycle delay. A subsequent instruction may also be delayed if an
103 earlier instruction has a longer READY-DELAY value. This blocking
104 effect is computed using the SIMULTANEITY, READY-DELAY, ISSUE-DELAY,
105 and CONFLICT-LIST terms. For a normal non-pipelined function unit,
106 SIMULTANEITY is one, the unit is taken to block for the READY-DELAY
107 cycles of the executing insn, and smaller values of ISSUE-DELAY are
110 CONFLICT-LIST is an optional list giving detailed conflict costs for
111 this unit. If specified, it is a list of condition test expressions to
112 be applied to insns chosen to execute in NAME following the particular
113 insn matching TEST that is already executing in NAME. For each insn in
114 the list, ISSUE-DELAY specifies the conflict cost; for insns not in the
115 list, the cost is zero. If not specified, CONFLICT-LIST defaults to
116 all instructions that use the function unit.
118 Typical uses of this vector are where a floating point function unit
119 can pipeline either single- or double-precision operations, but not
120 both, or where a memory unit can pipeline loads, but not stores, etc.
122 As an example, consider a classic RISC machine where the result of a
123 load instruction is not available for two cycles (a single "delay"
124 instruction is required) and where only one load instruction can be
125 executed simultaneously. This would be specified as:
127 (define_function_unit "memory" 1 1 (eq_attr "type" "load") 2 0)
129 For the case of a floating point function unit that can pipeline
130 either single or double precision, but not both, the following could be
133 (define_function_unit
134 "fp" 1 0 (eq_attr "type" "sp_fp") 4 4 [(eq_attr "type" "dp_fp")])
135 (define_function_unit
136 "fp" 1 0 (eq_attr "type" "dp_fp") 4 4 [(eq_attr "type" "sp_fp")])
138 *Note:* The scheduler attempts to avoid function unit conflicts and
139 uses all the specifications in the `define_function_unit' expression.
140 It has recently come to our attention that these specifications may not
141 allow modeling of some of the newer "superscalar" processors that have
142 insns using multiple pipelined units. These insns will cause a
143 potential conflict for the second unit used during their execution and
144 there is no way of representing that conflict. We welcome any examples
145 of how function unit conflicts work in such processors and suggestions
146 for their representation.
149 File: gcc.info, Node: Target Macros, Next: Config, Prev: Machine Desc, Up: Top
151 Target Description Macros
152 *************************
154 In addition to the file `MACHINE.md', a machine description includes
155 a C header file conventionally given the name `MACHINE.h'. This header
156 file defines numerous macros that convey the information about the
157 target machine that does not fit into the scheme of the `.md' file.
158 The file `tm.h' should be a link to `MACHINE.h'. The header file
159 `config.h' includes `tm.h' and most compiler source files include
164 * Driver:: Controlling how the driver runs the compilation passes.
165 * Run-time Target:: Defining `-m' options like `-m68000' and `-m68020'.
166 * Storage Layout:: Defining sizes and alignments of data.
167 * Type Layout:: Defining sizes and properties of basic user data types.
168 * Registers:: Naming and describing the hardware registers.
169 * Register Classes:: Defining the classes of hardware registers.
170 * Stack and Calling:: Defining which way the stack grows and by how much.
171 * Varargs:: Defining the varargs macros.
172 * Trampolines:: Code set up at run time to enter a nested function.
173 * Library Calls:: Controlling how library routines are implicitly called.
174 * Addressing Modes:: Defining addressing modes valid for memory operands.
175 * Condition Code:: Defining how insns update the condition code.
176 * Costs:: Defining relative costs of different operations.
177 * Sections:: Dividing storage into text, data, and other sections.
178 * PIC:: Macros for position independent code.
179 * Assembler Format:: Defining how to write insns and pseudo-ops to output.
180 * Debugging Info:: Defining the format of debugging output.
181 * Cross-compilation:: Handling floating point for cross-compilers.
182 * Misc:: Everything else.
185 File: gcc.info, Node: Driver, Next: Run-time Target, Up: Target Macros
187 Controlling the Compilation Driver, `gcc'
188 =========================================
190 You can control the compilation driver.
192 `SWITCH_TAKES_ARG (CHAR)'
193 A C expression which determines whether the option `-CHAR' takes
194 arguments. The value should be the number of arguments that
195 option takes-zero, for many options.
197 By default, this macro is defined as `DEFAULT_SWITCH_TAKES_ARG',
198 which handles the standard options properly. You need not define
199 `SWITCH_TAKES_ARG' unless you wish to add additional options which
200 take arguments. Any redefinition should call
201 `DEFAULT_SWITCH_TAKES_ARG' and then check for additional options.
203 `WORD_SWITCH_TAKES_ARG (NAME)'
204 A C expression which determines whether the option `-NAME' takes
205 arguments. The value should be the number of arguments that
206 option takes-zero, for many options. This macro rather than
207 `SWITCH_TAKES_ARG' is used for multi-character option names.
209 By default, this macro is defined as
210 `DEFAULT_WORD_SWITCH_TAKES_ARG', which handles the standard options
211 properly. You need not define `WORD_SWITCH_TAKES_ARG' unless you
212 wish to add additional options which take arguments. Any
213 redefinition should call `DEFAULT_WORD_SWITCH_TAKES_ARG' and then
214 check for additional options.
216 `SWITCHES_NEED_SPACES'
217 A string-valued C expression which enumerates the options for which
218 the linker needs a space between the option and its argument.
220 If this macro is not defined, the default value is `""'.
223 A C string constant that tells the GNU CC driver program options to
224 pass to CPP. It can also specify how to translate options you
225 give to GNU CC into options for GNU CC to pass to the CPP.
227 Do not define this macro if it does not need to do anything.
229 `NO_BUILTIN_SIZE_TYPE'
230 If this macro is defined, the preprocessor will not define the
231 builtin macro `__SIZE_TYPE__'. The macro `__SIZE_TYPE__' must
232 then be defined by `CPP_SPEC' instead.
234 This should be defined if `SIZE_TYPE' depends on target dependent
235 flags which are not accessible to the preprocessor. Otherwise, it
236 should not be defined.
238 `NO_BUILTIN_PTRDIFF_TYPE'
239 If this macro is defined, the preprocessor will not define the
240 builtin macro `__PTRDIFF_TYPE__'. The macro `__PTRDIFF_TYPE__'
241 must then be defined by `CPP_SPEC' instead.
243 This should be defined if `PTRDIFF_TYPE' depends on target
244 dependent flags which are not accessible to the preprocessor.
245 Otherwise, it should not be defined.
248 A C string constant that tells the GNU CC driver program options to
249 pass to CPP. By default, this macro is defined to pass the option
250 `-D__CHAR_UNSIGNED__' to CPP if `char' will be treated as
251 `unsigned char' by `cc1'.
253 Do not define this macro unless you need to override the default
257 A C string constant that tells the GNU CC driver program options to
258 pass to `cc1'. It can also specify how to translate options you
259 give to GNU CC into options for GNU CC to pass to the `cc1'.
261 Do not define this macro if it does not need to do anything.
264 A C string constant that tells the GNU CC driver program options to
265 pass to `cc1plus'. It can also specify how to translate options
266 you give to GNU CC into options for GNU CC to pass to the
269 Do not define this macro if it does not need to do anything.
272 A C string constant that tells the GNU CC driver program options to
273 pass to the assembler. It can also specify how to translate
274 options you give to GNU CC into options for GNU CC to pass to the
275 assembler. See the file `sun3.h' for an example of this.
277 Do not define this macro if it does not need to do anything.
280 A C string constant that tells the GNU CC driver program how to
281 run any programs which cleanup after the normal assembler.
282 Normally, this is not needed. See the file `mips.h' for an
285 Do not define this macro if it does not need to do anything.
288 A C string constant that tells the GNU CC driver program options to
289 pass to the linker. It can also specify how to translate options
290 you give to GNU CC into options for GNU CC to pass to the linker.
292 Do not define this macro if it does not need to do anything.
295 Another C string constant used much like `LINK_SPEC'. The
296 difference between the two is that `LIB_SPEC' is used at the end
297 of the command given to the linker.
299 If this macro is not defined, a default is provided that loads the
300 standard C library from the usual place. See `gcc.c'.
303 Another C string constant that tells the GNU CC driver program how
304 and when to place a reference to `libgcc.a' into the linker
305 command line. This constant is placed both before and after the
308 If this macro is not defined, the GNU CC driver provides a default
309 that passes the string `-lgcc' to the linker unless the `-shared'
313 Another C string constant used much like `LINK_SPEC'. The
314 difference between the two is that `STARTFILE_SPEC' is used at the
315 very beginning of the command given to the linker.
317 If this macro is not defined, a default is provided that loads the
318 standard C startup file from the usual place. See `gcc.c'.
321 Another C string constant used much like `LINK_SPEC'. The
322 difference between the two is that `ENDFILE_SPEC' is used at the
323 very end of the command given to the linker.
325 Do not define this macro if it does not need to do anything.
328 Define this macro to provide additional specifications to put in
329 the `specs' file that can be used in various specifications like
332 The definition should be an initializer for an array of structures,
333 containing a string constant, that defines the specification name,
334 and a string constant that provides the specification.
336 Do not define this macro if it does not need to do anything.
338 `EXTRA_SPECS' is useful when an architecture contains several
339 related targets, which have various `..._SPECS' which are similar
340 to each other, and the maintainer would like one central place to
341 keep these definitions.
343 For example, the PowerPC System V.4 targets use `EXTRA_SPECS' to
344 define either `_CALL_SYSV' when the System V calling sequence is
345 used or `_CALL_AIX' when the older AIX-based calling sequence is
348 The `config/rs6000/rs6000.h' target file defines:
350 #define EXTRA_SPECS \
351 { "cpp_sysv_default", CPP_SYSV_DEFAULT },
353 #define CPP_SYS_DEFAULT ""
355 The `config/rs6000/sysv.h' target file defines:
358 "%{posix: -D_POSIX_SOURCE } \
359 %{mcall-sysv: -D_CALL_SYSV } %{mcall-aix: -D_CALL_AIX } \
360 %{!mcall-sysv: %{!mcall-aix: %(cpp_sysv_default) }} \
361 %{msoft-float: -D_SOFT_FLOAT} %{mcpu=403: -D_SOFT_FLOAT}"
363 #undef CPP_SYSV_DEFAULT
364 #define CPP_SYSV_DEFAULT "-D_CALL_SYSV"
366 while the `config/rs6000/eabiaix.h' target file defines
367 `CPP_SYSV_DEFAULT' as:
369 #undef CPP_SYSV_DEFAULT
370 #define CPP_SYSV_DEFAULT "-D_CALL_AIX"
372 `LINK_LIBGCC_SPECIAL'
373 Define this macro if the driver program should find the library
374 `libgcc.a' itself and should not pass `-L' options to the linker.
375 If you do not define this macro, the driver program will pass the
376 argument `-lgcc' to tell the linker to do the search and will pass
379 `LINK_LIBGCC_SPECIAL_1'
380 Define this macro if the driver program should find the library
381 `libgcc.a'. If you do not define this macro, the driver program
382 will pass the argument `-lgcc' to tell the linker to do the search.
383 This macro is similar to `LINK_LIBGCC_SPECIAL', except that it does
384 not affect `-L' options.
387 Define this macro as a C expression for the initializer of an
388 array of string to tell the driver program which options are
389 defaults for this target and thus do not need to be handled
390 specially when using `MULTILIB_OPTIONS'.
392 Do not define this macro if `MULTILIB_OPTIONS' is not defined in
393 the target makefile fragment or if none of the options listed in
394 `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::.
396 `RELATIVE_PREFIX_NOT_LINKDIR'
397 Define this macro to tell `gcc' that it should only translate a
398 `-B' prefix into a `-L' linker option if the prefix indicates an
401 `STANDARD_EXEC_PREFIX'
402 Define this macro as a C string constant if you wish to override
403 the standard choice of `/usr/local/lib/gcc-lib/' as the default
404 prefix to try when searching for the executable files of the
408 If defined, this macro is an additional prefix to try after
409 `STANDARD_EXEC_PREFIX'. `MD_EXEC_PREFIX' is not searched when the
410 `-b' option is used, or the compiler is built as a cross compiler.
412 `STANDARD_STARTFILE_PREFIX'
413 Define this macro as a C string constant if you wish to override
414 the standard choice of `/usr/local/lib/' as the default prefix to
415 try when searching for startup files such as `crt0.o'.
417 `MD_STARTFILE_PREFIX'
418 If defined, this macro supplies an additional prefix to try after
419 the standard prefixes. `MD_EXEC_PREFIX' is not searched when the
420 `-b' option is used, or when the compiler is built as a cross
423 `MD_STARTFILE_PREFIX_1'
424 If defined, this macro supplies yet another prefix to try after the
425 standard prefixes. It is not searched when the `-b' option is
426 used, or when the compiler is built as a cross compiler.
429 Define this macro as a C string constant if you wish to set
430 environment variables for programs called by the driver, such as
431 the assembler and loader. The driver passes the value of this
432 macro to `putenv' to initialize the necessary environment
436 Define this macro as a C string constant if you wish to override
437 the standard choice of `/usr/local/include' as the default prefix
438 to try when searching for local header files. `LOCAL_INCLUDE_DIR'
439 comes before `SYSTEM_INCLUDE_DIR' in the search order.
441 Cross compilers do not use this macro and do not search either
442 `/usr/local/include' or its replacement.
445 Define this macro as a C string constant if you wish to specify a
446 system-specific directory to search for header files before the
447 standard directory. `SYSTEM_INCLUDE_DIR' comes before
448 `STANDARD_INCLUDE_DIR' in the search order.
450 Cross compilers do not use this macro and do not search the
453 `STANDARD_INCLUDE_DIR'
454 Define this macro as a C string constant if you wish to override
455 the standard choice of `/usr/include' as the default prefix to try
456 when searching for header files.
458 Cross compilers do not use this macro and do not search either
459 `/usr/include' or its replacement.
461 `STANDARD_INCLUDE_COMPONENT'
462 The "component" corresponding to `STANDARD_INCLUDE_DIR'. See
463 `INCLUDE_DEFAULTS', below, for the description of components. If
464 you do not define this macro, no component is used.
467 Define this macro if you wish to override the entire default
468 search path for include files. For a native compiler, the default
469 search path usually consists of `GCC_INCLUDE_DIR',
470 `LOCAL_INCLUDE_DIR', `SYSTEM_INCLUDE_DIR',
471 `GPLUSPLUS_INCLUDE_DIR', and `STANDARD_INCLUDE_DIR'. In addition,
472 `GPLUSPLUS_INCLUDE_DIR' and `GCC_INCLUDE_DIR' are defined
473 automatically by `Makefile', and specify private search areas for
474 GCC. The directory `GPLUSPLUS_INCLUDE_DIR' is used only for C++
477 The definition should be an initializer for an array of structures.
478 Each array element should have four elements: the directory name (a
479 string constant), the component name, and flag for C++-only
480 directories, and a flag showing that the includes in the directory
481 don't need to be wrapped in `extern `C'' when compiling C++. Mark
482 the end of the array with a null element.
484 The component name denotes what GNU package the include file is
485 part of, if any, in all upper-case letters. For example, it might
486 be `GCC' or `BINUTILS'. If the package is part of the a
487 vendor-supplied operating system, code the component name as `0'.
489 For example, here is the definition used for VAX/VMS:
491 #define INCLUDE_DEFAULTS \
493 { "GNU_GXX_INCLUDE:", "G++", 1, 1}, \
494 { "GNU_CC_INCLUDE:", "GCC", 0, 0}, \
495 { "SYS$SYSROOT:[SYSLIB.]", 0, 0, 0}, \
500 Here is the order of prefixes tried for exec files:
502 1. Any prefixes specified by the user with `-B'.
504 2. The environment variable `GCC_EXEC_PREFIX', if any.
506 3. The directories specified by the environment variable
509 4. The macro `STANDARD_EXEC_PREFIX'.
513 6. The macro `MD_EXEC_PREFIX', if any.
515 Here is the order of prefixes tried for startfiles:
517 1. Any prefixes specified by the user with `-B'.
519 2. The environment variable `GCC_EXEC_PREFIX', if any.
521 3. The directories specified by the environment variable
522 `LIBRARY_PATH' (native only, cross compilers do not use this).
524 4. The macro `STANDARD_EXEC_PREFIX'.
528 6. The macro `MD_EXEC_PREFIX', if any.
530 7. The macro `MD_STARTFILE_PREFIX', if any.
532 8. The macro `STANDARD_STARTFILE_PREFIX'.
539 File: gcc.info, Node: Run-time Target, Next: Storage Layout, Prev: Driver, Up: Target Macros
541 Run-time Target Specification
542 =============================
544 Here are run-time target specifications.
547 Define this to be a string constant containing `-D' options to
548 define the predefined macros that identify this machine and system.
549 These macros will be predefined unless the `-ansi' option is
552 In addition, a parallel set of macros are predefined, whose names
553 are made by appending `__' at the beginning and at the end. These
554 `__' macros are permitted by the ANSI standard, so they are
555 predefined regardless of whether `-ansi' is specified.
557 For example, on the Sun, one can use the following value:
559 "-Dmc68000 -Dsun -Dunix"
561 The result is to define the macros `__mc68000__', `__sun__' and
562 `__unix__' unconditionally, and the macros `mc68000', `sun' and
563 `unix' provided `-ansi' is not specified.
565 `extern int target_flags;'
566 This declaration should be present.
569 This series of macros is to allow compiler command arguments to
570 enable or disable the use of optional features of the target
571 machine. For example, one machine description serves both the
572 68000 and the 68020; a command argument tells the compiler whether
573 it should use 68020-only instructions or not. This command
574 argument works by means of a macro `TARGET_68020' that tests a bit
577 Define a macro `TARGET_FEATURENAME' for each such option. Its
578 definition should test a bit in `target_flags'; for example:
580 #define TARGET_68020 (target_flags & 1)
582 One place where these macros are used is in the
583 condition-expressions of instruction patterns. Note how
584 `TARGET_68020' appears frequently in the 68000 machine description
585 file, `m68k.md'. Another place they are used is in the
586 definitions of the other macros in the `MACHINE.h' file.
589 This macro defines names of command options to set and clear bits
590 in `target_flags'. Its definition is an initializer with a
591 subgrouping for each command option.
593 Each subgrouping contains a string constant, that defines the
594 option name, and a number, which contains the bits to set in
595 `target_flags'. A negative number says to clear bits instead; the
596 negative of the number is which bits to clear. The actual option
597 name is made by appending `-m' to the specified name.
599 One of the subgroupings should have a null string. The number in
600 this grouping is the default value for `target_flags'. Any target
601 options act starting with that value.
603 Here is an example which defines `-m68000' and `-m68020' with
604 opposite meanings, and picks the latter as the default:
606 #define TARGET_SWITCHES \
612 This macro is similar to `TARGET_SWITCHES' but defines names of
613 command options that have values. Its definition is an
614 initializer with a subgrouping for each command option.
616 Each subgrouping contains a string constant, that defines the
617 fixed part of the option name, and the address of a variable. The
618 variable, type `char *', is set to the variable part of the given
619 option if the fixed part matches. The actual option name is made
620 by appending `-m' to the specified name.
622 Here is an example which defines `-mshort-data-NUMBER'. If the
623 given option is `-mshort-data-512', the variable `m88k_short_data'
624 will be set to the string `"512"'.
626 extern char *m88k_short_data;
627 #define TARGET_OPTIONS \
628 { { "short-data-", &m88k_short_data } }
631 This macro is a C statement to print on `stderr' a string
632 describing the particular machine description choice. Every
633 machine description should define `TARGET_VERSION'. For example:
636 #define TARGET_VERSION \
637 fprintf (stderr, " (68k, Motorola syntax)");
639 #define TARGET_VERSION \
640 fprintf (stderr, " (68k, MIT syntax)");
644 Sometimes certain combinations of command options do not make
645 sense on a particular target machine. You can define a macro
646 `OVERRIDE_OPTIONS' to take account of this. This macro, if
647 defined, is executed once just after all the command options have
650 Don't use this macro to turn on various extra optimizations for
651 `-O'. That is what `OPTIMIZATION_OPTIONS' is for.
653 `OPTIMIZATION_OPTIONS (LEVEL)'
654 Some machines may desire to change what optimizations are
655 performed for various optimization levels. This macro, if
656 defined, is executed once just after the optimization level is
657 determined and before the remainder of the command options have
658 been parsed. Values set in this macro are used as the default
659 values for the other command line options.
661 LEVEL is the optimization level specified; 2 if `-O2' is
662 specified, 1 if `-O' is specified, and 0 if neither is specified.
664 You should not use this macro to change options that are not
665 machine-specific. These should uniformly selected by the same
666 optimization level on all supported machines. Use this macro to
667 enable machine-specific optimizations.
669 *Do not examine `write_symbols' in this macro!* The debugging
670 options are not supposed to alter the generated code.
672 `CAN_DEBUG_WITHOUT_FP'
673 Define this macro if debugging can be performed even without a
674 frame pointer. If this macro is defined, GNU CC will turn on the
675 `-fomit-frame-pointer' option whenever `-O' is specified.
678 File: gcc.info, Node: Storage Layout, Next: Type Layout, Prev: Run-time Target, Up: Target Macros
683 Note that the definitions of the macros in this table which are
684 sizes or alignments measured in bits do not need to be constant. They
685 can be C expressions that refer to static variables, such as the
686 `target_flags'. *Note Run-time Target::.
689 Define this macro to have the value 1 if the most significant bit
690 in a byte has the lowest number; otherwise define it to have the
691 value zero. This means that bit-field instructions count from the
692 most significant bit. If the machine has no bit-field
693 instructions, then this must still be defined, but it doesn't
694 matter which value it is defined to. This macro need not be a
697 This macro does not affect the way structure fields are packed into
698 bytes or words; that is controlled by `BYTES_BIG_ENDIAN'.
701 Define this macro to have the value 1 if the most significant byte
702 in a word has the lowest number. This macro need not be a
706 Define this macro to have the value 1 if, in a multiword object,
707 the most significant word has the lowest number. This applies to
708 both memory locations and registers; GNU CC fundamentally assumes
709 that the order of words in memory is the same as the order in
710 registers. This macro need not be a constant.
712 `LIBGCC2_WORDS_BIG_ENDIAN'
713 Define this macro if WORDS_BIG_ENDIAN is not constant. This must
714 be a constant value with the same meaning as WORDS_BIG_ENDIAN,
715 which will be used only when compiling libgcc2.c. Typically the
716 value will be set based on preprocessor defines.
718 `FLOAT_WORDS_BIG_ENDIAN'
719 Define this macro to have the value 1 if `DFmode', `XFmode' or
720 `TFmode' floating point numbers are stored in memory with the word
721 containing the sign bit at the lowest address; otherwise define it
722 to have the value 0. This macro need not be a constant.
724 You need not define this macro if the ordering is the same as for
728 Define this macro to be the number of bits in an addressable
729 storage unit (byte); normally 8.
732 Number of bits in a word; normally 32.
735 Maximum number of bits in a word. If this is undefined, the
736 default is `BITS_PER_WORD'. Otherwise, it is the constant value
737 that is the largest value that `BITS_PER_WORD' can have at
741 Number of storage units in a word; normally 4.
744 Minimum number of units in a word. If this is undefined, the
745 default is `UNITS_PER_WORD'. Otherwise, it is the constant value
746 that is the smallest value that `UNITS_PER_WORD' can have at
750 Width of a pointer, in bits. You must specify a value no wider
751 than the width of `Pmode'. If it is not equal to the width of
752 `Pmode', you must define `POINTERS_EXTEND_UNSIGNED'.
754 `POINTERS_EXTEND_UNSIGNED'
755 A C expression whose value is nonzero if pointers that need to be
756 extended from being `POINTER_SIZE' bits wide to `Pmode' are
757 sign-extended and zero if they are zero-extended.
759 You need not define this macro if the `POINTER_SIZE' is equal to
760 the width of `Pmode'.
762 `PROMOTE_MODE (M, UNSIGNEDP, TYPE)'
763 A macro to update M and UNSIGNEDP when an object whose type is
764 TYPE and which has the specified mode and signedness is to be
765 stored in a register. This macro is only called when TYPE is a
768 On most RISC machines, which only have operations that operate on
769 a full register, define this macro to set M to `word_mode' if M is
770 an integer mode narrower than `BITS_PER_WORD'. In most cases,
771 only integer modes should be widened because wider-precision
772 floating-point operations are usually more expensive than their
773 narrower counterparts.
775 For most machines, the macro definition does not change UNSIGNEDP.
776 However, some machines, have instructions that preferentially
777 handle either signed or unsigned quantities of certain modes. For
778 example, on the DEC Alpha, 32-bit loads from memory and 32-bit add
779 instructions sign-extend the result to 64 bits. On such machines,
780 set UNSIGNEDP according to which kind of extension is more
783 Do not define this macro if it would never modify M.
785 `PROMOTE_FUNCTION_ARGS'
786 Define this macro if the promotion described by `PROMOTE_MODE'
787 should also be done for outgoing function arguments.
789 `PROMOTE_FUNCTION_RETURN'
790 Define this macro if the promotion described by `PROMOTE_MODE'
791 should also be done for the return value of functions.
793 If this macro is defined, `FUNCTION_VALUE' must perform the same
794 promotions done by `PROMOTE_MODE'.
796 `PROMOTE_FOR_CALL_ONLY'
797 Define this macro if the promotion described by `PROMOTE_MODE'
798 should *only* be performed for outgoing function arguments or
799 function return values, as specified by `PROMOTE_FUNCTION_ARGS'
800 and `PROMOTE_FUNCTION_RETURN', respectively.
803 Normal alignment required for function parameters on the stack, in
804 bits. All stack parameters receive at least this much alignment
805 regardless of data type. On most machines, this is the same as the
809 Define this macro if you wish to preserve a certain alignment for
810 the stack pointer. The definition is a C expression for the
811 desired alignment (measured in bits).
813 If `PUSH_ROUNDING' is not defined, the stack will always be aligned
814 to the specified boundary. If `PUSH_ROUNDING' is defined and
815 specifies a less strict alignment than `STACK_BOUNDARY', the stack
816 may be momentarily unaligned while pushing arguments.
819 Alignment required for a function entry point, in bits.
822 Biggest alignment that any data type can require on this machine,
825 `MINIMUM_ATOMIC_ALIGNMENT'
826 If defined, the smallest alignment, in bits, that can be given to
827 an object that can be referenced in one operation, without
828 disturbing any nearby object. Normally, this is `BITS_PER_UNIT',
829 but may be larger on machines that don't have byte or half-word
832 `BIGGEST_FIELD_ALIGNMENT'
833 Biggest alignment that any structure field can require on this
834 machine, in bits. If defined, this overrides `BIGGEST_ALIGNMENT'
835 for structure fields only.
837 `ADJUST_FIELD_ALIGN (FIELD, COMPUTED)'
838 An expression for the alignment of a structure field FIELD if the
839 alignment computed in the usual way is COMPUTED. GNU CC uses this
840 value instead of the value in `BIGGEST_ALIGNMENT' or
841 `BIGGEST_FIELD_ALIGNMENT', if defined, for structure fields only.
843 `MAX_OFILE_ALIGNMENT'
844 Biggest alignment supported by the object file format of this
845 machine. Use this macro to limit the alignment which can be
846 specified using the `__attribute__ ((aligned (N)))' construct. If
847 not defined, the default value is `BIGGEST_ALIGNMENT'.
849 `DATA_ALIGNMENT (TYPE, BASIC-ALIGN)'
850 If defined, a C expression to compute the alignment for a static
851 variable. TYPE is the data type, and BASIC-ALIGN is the alignment
852 that the object would ordinarily have. The value of this macro is
853 used instead of that alignment to align the object.
855 If this macro is not defined, then BASIC-ALIGN is used.
857 One use of this macro is to increase alignment of medium-size data
858 to make it all fit in fewer cache lines. Another is to cause
859 character arrays to be word-aligned so that `strcpy' calls that
860 copy constants to character arrays can be done inline.
862 `CONSTANT_ALIGNMENT (CONSTANT, BASIC-ALIGN)'
863 If defined, a C expression to compute the alignment given to a
864 constant that is being placed in memory. CONSTANT is the constant
865 and BASIC-ALIGN is the alignment that the object would ordinarily
866 have. The value of this macro is used instead of that alignment to
869 If this macro is not defined, then BASIC-ALIGN is used.
871 The typical use of this macro is to increase alignment for string
872 constants to be word aligned so that `strcpy' calls that copy
873 constants can be done inline.
875 `EMPTY_FIELD_BOUNDARY'
876 Alignment in bits to be given to a structure bit field that
877 follows an empty field such as `int : 0;'.
879 Note that `PCC_BITFIELD_TYPE_MATTERS' also affects the alignment
880 that results from an empty field.
882 `STRUCTURE_SIZE_BOUNDARY'
883 Number of bits which any structure or union's size must be a
884 multiple of. Each structure or union's size is rounded up to a
887 If you do not define this macro, the default is the same as
891 Define this macro to be the value 1 if instructions will fail to
892 work if given data not on the nominal alignment. If instructions
893 will merely go slower in that case, define this macro as 0.
895 `PCC_BITFIELD_TYPE_MATTERS'
896 Define this if you wish to imitate the way many other C compilers
897 handle alignment of bitfields and the structures that contain them.
899 The behavior is that the type written for a bitfield (`int',
900 `short', or other integer type) imposes an alignment for the
901 entire structure, as if the structure really did contain an
902 ordinary field of that type. In addition, the bitfield is placed
903 within the structure so that it would fit within such a field, not
904 crossing a boundary for it.
906 Thus, on most machines, a bitfield whose type is written as `int'
907 would not cross a four-byte boundary, and would force four-byte
908 alignment for the whole structure. (The alignment used may not be
909 four bytes; it is controlled by the other alignment parameters.)
911 If the macro is defined, its definition should be a C expression;
912 a nonzero value for the expression enables this behavior.
914 Note that if this macro is not defined, or its value is zero, some
915 bitfields may cross more than one alignment boundary. The
916 compiler can support such references if there are `insv', `extv',
917 and `extzv' insns that can directly reference memory.
919 The other known way of making bitfields work is to define
920 `STRUCTURE_SIZE_BOUNDARY' as large as `BIGGEST_ALIGNMENT'. Then
921 every structure can be accessed with fullwords.
923 Unless the machine has bitfield instructions or you define
924 `STRUCTURE_SIZE_BOUNDARY' that way, you must define
925 `PCC_BITFIELD_TYPE_MATTERS' to have a nonzero value.
927 If your aim is to make GNU CC use the same conventions for laying
928 out bitfields as are used by another compiler, here is how to
929 investigate what the other compiler does. Compile and run this
948 printf ("Size of foo1 is %d\n",
949 sizeof (struct foo1));
950 printf ("Size of foo2 is %d\n",
951 sizeof (struct foo2));
955 If this prints 2 and 5, then the compiler's behavior is what you
956 would get from `PCC_BITFIELD_TYPE_MATTERS'.
958 `BITFIELD_NBYTES_LIMITED'
959 Like PCC_BITFIELD_TYPE_MATTERS except that its effect is limited to
960 aligning a bitfield within the structure.
962 `ROUND_TYPE_SIZE (STRUCT, SIZE, ALIGN)'
963 Define this macro as an expression for the overall size of a
964 structure (given by STRUCT as a tree node) when the size computed
965 from the fields is SIZE and the alignment is ALIGN.
967 The default is to round SIZE up to a multiple of ALIGN.
969 `ROUND_TYPE_ALIGN (STRUCT, COMPUTED, SPECIFIED)'
970 Define this macro as an expression for the alignment of a structure
971 (given by STRUCT as a tree node) if the alignment computed in the
972 usual way is COMPUTED and the alignment explicitly specified was
975 The default is to use SPECIFIED if it is larger; otherwise, use
976 the smaller of COMPUTED and `BIGGEST_ALIGNMENT'
978 `MAX_FIXED_MODE_SIZE'
979 An integer expression for the size in bits of the largest integer
980 machine mode that should actually be used. All integer machine
981 modes of this size or smaller can be used for structures and
982 unions with the appropriate sizes. If this macro is undefined,
983 `GET_MODE_BITSIZE (DImode)' is assumed.
985 `CHECK_FLOAT_VALUE (MODE, VALUE, OVERFLOW)'
986 A C statement to validate the value VALUE (of type `double') for
987 mode MODE. This means that you check whether VALUE fits within
988 the possible range of values for mode MODE on this target machine.
989 The mode MODE is always a mode of class `MODE_FLOAT'. OVERFLOW
990 is nonzero if the value is already known to be out of range.
992 If VALUE is not valid or if OVERFLOW is nonzero, you should set
993 OVERFLOW to 1 and then assign some valid value to VALUE. Allowing
994 an invalid value to go through the compiler can produce incorrect
995 assembler code which may even cause Unix assemblers to crash.
997 This macro need not be defined if there is no work for it to do.
999 `TARGET_FLOAT_FORMAT'
1000 A code distinguishing the floating point format of the target
1001 machine. There are three defined values:
1004 This code indicates IEEE floating point. It is the default;
1005 there is no need to define this macro when the format is IEEE.
1008 This code indicates the peculiar format used on the Vax.
1010 `UNKNOWN_FLOAT_FORMAT'
1011 This code indicates any other format.
1013 The value of this macro is compared with `HOST_FLOAT_FORMAT'
1014 (*note Config::.) to determine whether the target machine has the
1015 same format as the host machine. If any other formats are
1016 actually in use on supported machines, new codes should be defined
1019 The ordering of the component words of floating point values
1020 stored in memory is controlled by `FLOAT_WORDS_BIG_ENDIAN' for the
1021 target machine and `HOST_FLOAT_WORDS_BIG_ENDIAN' for the host.
1023 `DEFAULT_VTABLE_THUNKS'
1024 GNU CC supports two ways of implementing C++ vtables: traditional
1025 or with so-called "thunks". The flag `-fvtable-thunk' chooses
1026 between them. Define this macro to be a C expression for the
1027 default value of that flag. If `DEFAULT_VTABLE_THUNKS' is 0, GNU
1028 CC uses the traditional implementation by default. The "thunk"
1029 implementation is more efficient (especially if you have provided
1030 an implementation of `ASM_OUTPUT_MI_THUNK', see *Note Function
1031 Entry::), but is not binary compatible with code compiled using
1032 the traditional implementation. If you are writing a new ports,
1033 define `DEFAULT_VTABLE_THUNKS' to 1.
1035 If you do not define this macro, the default for `-fvtable-thunk'
1039 File: gcc.info, Node: Type Layout, Next: Registers, Prev: Storage Layout, Up: Target Macros
1041 Layout of Source Language Data Types
1042 ====================================
1044 These macros define the sizes and other characteristics of the
1045 standard basic data types used in programs being compiled. Unlike the
1046 macros in the previous section, these apply to specific features of C
1047 and related languages, rather than to fundamental aspects of storage
1051 A C expression for the size in bits of the type `int' on the
1052 target machine. If you don't define this, the default is one word.
1055 Maximum number for the size in bits of the type `int' on the target
1056 machine. If this is undefined, the default is `INT_TYPE_SIZE'.
1057 Otherwise, it is the constant value that is the largest value that
1058 `INT_TYPE_SIZE' can have at run-time. This is used in `cpp'.
1061 A C expression for the size in bits of the type `short' on the
1062 target machine. If you don't define this, the default is half a
1063 word. (If this would be less than one storage unit, it is rounded
1067 A C expression for the size in bits of the type `long' on the
1068 target machine. If you don't define this, the default is one word.
1070 `MAX_LONG_TYPE_SIZE'
1071 Maximum number for the size in bits of the type `long' on the
1072 target machine. If this is undefined, the default is
1073 `LONG_TYPE_SIZE'. Otherwise, it is the constant value that is the
1074 largest value that `LONG_TYPE_SIZE' can have at run-time. This is
1077 `LONG_LONG_TYPE_SIZE'
1078 A C expression for the size in bits of the type `long long' on the
1079 target machine. If you don't define this, the default is two
1080 words. If you want to support GNU Ada on your machine, the value
1081 of macro must be at least 64.
1084 A C expression for the size in bits of the type `char' on the
1085 target machine. If you don't define this, the default is one
1086 quarter of a word. (If this would be less than one storage unit,
1087 it is rounded up to one unit.)
1089 `MAX_CHAR_TYPE_SIZE'
1090 Maximum number for the size in bits of the type `char' on the
1091 target machine. If this is undefined, the default is
1092 `CHAR_TYPE_SIZE'. Otherwise, it is the constant value that is the
1093 largest value that `CHAR_TYPE_SIZE' can have at run-time. This is
1097 A C expression for the size in bits of the type `float' on the
1098 target machine. If you don't define this, the default is one word.
1101 A C expression for the size in bits of the type `double' on the
1102 target machine. If you don't define this, the default is two
1105 `LONG_DOUBLE_TYPE_SIZE'
1106 A C expression for the size in bits of the type `long double' on
1107 the target machine. If you don't define this, the default is two
1110 `WIDEST_HARDWARE_FP_SIZE'
1111 A C expression for the size in bits of the widest floating-point
1112 format supported by the hardware. If you define this macro, you
1113 must specify a value less than or equal to the value of
1114 `LONG_DOUBLE_TYPE_SIZE'. If you do not define this macro, the
1115 value of `LONG_DOUBLE_TYPE_SIZE' is the default.
1117 `DEFAULT_SIGNED_CHAR'
1118 An expression whose value is 1 or 0, according to whether the type
1119 `char' should be signed or unsigned by default. The user can
1120 always override this default with the options `-fsigned-char' and
1123 `DEFAULT_SHORT_ENUMS'
1124 A C expression to determine whether to give an `enum' type only as
1125 many bytes as it takes to represent the range of possible values
1126 of that type. A nonzero value means to do that; a zero value
1127 means all `enum' types should be allocated like `int'.
1129 If you don't define the macro, the default is 0.
1132 A C expression for a string describing the name of the data type
1133 to use for size values. The typedef name `size_t' is defined
1134 using the contents of the string.
1136 The string can contain more than one keyword. If so, separate
1137 them with spaces, and write first any length keyword, then
1138 `unsigned' if appropriate, and finally `int'. The string must
1139 exactly match one of the data type names defined in the function
1140 `init_decl_processing' in the file `c-decl.c'. You may not omit
1141 `int' or change the order--that would cause the compiler to crash
1144 If you don't define this macro, the default is `"long unsigned
1148 A C expression for a string describing the name of the data type
1149 to use for the result of subtracting two pointers. The typedef
1150 name `ptrdiff_t' is defined using the contents of the string. See
1151 `SIZE_TYPE' above for more information.
1153 If you don't define this macro, the default is `"long int"'.
1156 A C expression for a string describing the name of the data type
1157 to use for wide characters. The typedef name `wchar_t' is defined
1158 using the contents of the string. See `SIZE_TYPE' above for more
1161 If you don't define this macro, the default is `"int"'.
1164 A C expression for the size in bits of the data type for wide
1165 characters. This is used in `cpp', which cannot make use of
1168 `MAX_WCHAR_TYPE_SIZE'
1169 Maximum number for the size in bits of the data type for wide
1170 characters. If this is undefined, the default is
1171 `WCHAR_TYPE_SIZE'. Otherwise, it is the constant value that is the
1172 largest value that `WCHAR_TYPE_SIZE' can have at run-time. This is
1175 `OBJC_INT_SELECTORS'
1176 Define this macro if the type of Objective C selectors should be
1179 If this macro is not defined, then selectors should have the type
1180 `struct objc_selector *'.
1182 `OBJC_SELECTORS_WITHOUT_LABELS'
1183 Define this macro if the compiler can group all the selectors
1184 together into a vector and use just one label at the beginning of
1185 the vector. Otherwise, the compiler must give each selector its
1186 own assembler label.
1188 On certain machines, it is important to have a separate label for
1189 each selector because this enables the linker to eliminate
1190 duplicate selectors.
1193 A C constant expression for the integer value for escape sequence
1199 C constant expressions for the integer values for escape sequences
1200 `\b', `\t' and `\n'.
1205 C constant expressions for the integer values for escape sequences
1206 `\v', `\f' and `\r'.