1 | This is Info file gcc.info, produced by Makeinfo-1.55 from the input |
---|
2 | file gcc.texi. |
---|
3 | |
---|
4 | This file documents the use and the internals of the GNU compiler. |
---|
5 | |
---|
6 | Published by the Free Software Foundation 59 Temple Place - Suite 330 |
---|
7 | Boston, MA 02111-1307 USA |
---|
8 | |
---|
9 | Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995 Free Software |
---|
10 | Foundation, Inc. |
---|
11 | |
---|
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. |
---|
15 | |
---|
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. |
---|
23 | |
---|
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 |
---|
30 | original English. |
---|
31 | |
---|
32 | |
---|
33 | File: gcc.info, Node: Driver, Next: Run-time Target, Up: Target Macros |
---|
34 | |
---|
35 | Controlling the Compilation Driver, `gcc' |
---|
36 | ========================================= |
---|
37 | |
---|
38 | You can control the compilation driver. |
---|
39 | |
---|
40 | `SWITCH_TAKES_ARG (CHAR)' |
---|
41 | A C expression which determines whether the option `-CHAR' takes |
---|
42 | arguments. The value should be the number of arguments that |
---|
43 | option takes-zero, for many options. |
---|
44 | |
---|
45 | By default, this macro is defined to handle the standard options |
---|
46 | properly. You need not define it unless you wish to add additional |
---|
47 | options which take arguments. |
---|
48 | |
---|
49 | `WORD_SWITCH_TAKES_ARG (NAME)' |
---|
50 | A C expression which determines whether the option `-NAME' takes |
---|
51 | arguments. The value should be the number of arguments that |
---|
52 | option takes-zero, for many options. This macro rather than |
---|
53 | `SWITCH_TAKES_ARG' is used for multi-character option names. |
---|
54 | |
---|
55 | By default, this macro is defined as |
---|
56 | `DEFAULT_WORD_SWITCH_TAKES_ARG', which handles the standard options |
---|
57 | properly. You need not define `WORD_SWITCH_TAKES_ARG' unless you |
---|
58 | wish to add additional options which take arguments. Any |
---|
59 | redefinition should call `DEFAULT_WORD_SWITCH_TAKES_ARG' and then |
---|
60 | check for additional options. |
---|
61 | |
---|
62 | `SWITCHES_NEED_SPACES' |
---|
63 | A string-valued C expression which is nonempty if the linker needs |
---|
64 | a space between the `-L' or `-o' option and its argument. |
---|
65 | |
---|
66 | If this macro is not defined, the default value is 0. |
---|
67 | |
---|
68 | `CPP_SPEC' |
---|
69 | A C string constant that tells the GNU CC driver program options to |
---|
70 | pass to CPP. It can also specify how to translate options you |
---|
71 | give to GNU CC into options for GNU CC to pass to the CPP. |
---|
72 | |
---|
73 | Do not define this macro if it does not need to do anything. |
---|
74 | |
---|
75 | `NO_BUILTIN_SIZE_TYPE' |
---|
76 | If this macro is defined, the preprocessor will not define the |
---|
77 | builtin macro `__SIZE_TYPE__'. The macro `__SIZE_TYPE__' must |
---|
78 | then be defined by `CPP_SPEC' instead. |
---|
79 | |
---|
80 | This should be defined if `SIZE_TYPE' depends on target dependent |
---|
81 | flags which are not accessible to the preprocessor. Otherwise, it |
---|
82 | should not be defined. |
---|
83 | |
---|
84 | `NO_BUILTIN_PTRDIFF_TYPE' |
---|
85 | If this macro is defined, the preprocessor will not define the |
---|
86 | builtin macro `__PTRDIFF_TYPE__'. The macro `__PTRDIFF_TYPE__' |
---|
87 | must then be defined by `CPP_SPEC' instead. |
---|
88 | |
---|
89 | This should be defined if `PTRDIFF_TYPE' depends on target |
---|
90 | dependent flags which are not accessible to the preprocessor. |
---|
91 | Otherwise, it should not be defined. |
---|
92 | |
---|
93 | `SIGNED_CHAR_SPEC' |
---|
94 | A C string constant that tells the GNU CC driver program options to |
---|
95 | pass to CPP. By default, this macro is defined to pass the option |
---|
96 | `-D__CHAR_UNSIGNED__' to CPP if `char' will be treated as |
---|
97 | `unsigned char' by `cc1'. |
---|
98 | |
---|
99 | Do not define this macro unless you need to override the default |
---|
100 | definition. |
---|
101 | |
---|
102 | `CC1_SPEC' |
---|
103 | A C string constant that tells the GNU CC driver program options to |
---|
104 | pass to `cc1'. It can also specify how to translate options you |
---|
105 | give to GNU CC into options for GNU CC to pass to the `cc1'. |
---|
106 | |
---|
107 | Do not define this macro if it does not need to do anything. |
---|
108 | |
---|
109 | `CC1PLUS_SPEC' |
---|
110 | A C string constant that tells the GNU CC driver program options to |
---|
111 | pass to `cc1plus'. It can also specify how to translate options |
---|
112 | you give to GNU CC into options for GNU CC to pass to the |
---|
113 | `cc1plus'. |
---|
114 | |
---|
115 | Do not define this macro if it does not need to do anything. |
---|
116 | |
---|
117 | `ASM_SPEC' |
---|
118 | A C string constant that tells the GNU CC driver program options to |
---|
119 | pass to the assembler. It can also specify how to translate |
---|
120 | options you give to GNU CC into options for GNU CC to pass to the |
---|
121 | assembler. See the file `sun3.h' for an example of this. |
---|
122 | |
---|
123 | Do not define this macro if it does not need to do anything. |
---|
124 | |
---|
125 | `ASM_FINAL_SPEC' |
---|
126 | A C string constant that tells the GNU CC driver program how to |
---|
127 | run any programs which cleanup after the normal assembler. |
---|
128 | Normally, this is not needed. See the file `mips.h' for an |
---|
129 | example of this. |
---|
130 | |
---|
131 | Do not define this macro if it does not need to do anything. |
---|
132 | |
---|
133 | `LINK_SPEC' |
---|
134 | A C string constant that tells the GNU CC driver program options to |
---|
135 | pass to the linker. It can also specify how to translate options |
---|
136 | you give to GNU CC into options for GNU CC to pass to the linker. |
---|
137 | |
---|
138 | Do not define this macro if it does not need to do anything. |
---|
139 | |
---|
140 | `LIB_SPEC' |
---|
141 | Another C string constant used much like `LINK_SPEC'. The |
---|
142 | difference between the two is that `LIB_SPEC' is used at the end |
---|
143 | of the command given to the linker. |
---|
144 | |
---|
145 | If this macro is not defined, a default is provided that loads the |
---|
146 | standard C library from the usual place. See `gcc.c'. |
---|
147 | |
---|
148 | `LIBGCC_SPEC' |
---|
149 | Another C string constant that tells the GNU CC driver program how |
---|
150 | and when to place a reference to `libgcc.a' into the linker |
---|
151 | command line. This constant is placed both before and after the |
---|
152 | value of `LIB_SPEC'. |
---|
153 | |
---|
154 | If this macro is not defined, the GNU CC driver provides a default |
---|
155 | that passes the string `-lgcc' to the linker unless the `-shared' |
---|
156 | option is specified. |
---|
157 | |
---|
158 | `STARTFILE_SPEC' |
---|
159 | Another C string constant used much like `LINK_SPEC'. The |
---|
160 | difference between the two is that `STARTFILE_SPEC' is used at the |
---|
161 | very beginning of the command given to the linker. |
---|
162 | |
---|
163 | If this macro is not defined, a default is provided that loads the |
---|
164 | standard C startup file from the usual place. See `gcc.c'. |
---|
165 | |
---|
166 | `ENDFILE_SPEC' |
---|
167 | Another C string constant used much like `LINK_SPEC'. The |
---|
168 | difference between the two is that `ENDFILE_SPEC' is used at the |
---|
169 | very end of the command given to the linker. |
---|
170 | |
---|
171 | Do not define this macro if it does not need to do anything. |
---|
172 | |
---|
173 | `LINK_LIBGCC_SPECIAL' |
---|
174 | Define this macro if the driver program should find the library |
---|
175 | `libgcc.a' itself and should not pass `-L' options to the linker. |
---|
176 | If you do not define this macro, the driver program will pass the |
---|
177 | argument `-lgcc' to tell the linker to do the search and will pass |
---|
178 | `-L' options to it. |
---|
179 | |
---|
180 | `LINK_LIBGCC_SPECIAL_1' |
---|
181 | Define this macro if the driver program should find the library |
---|
182 | `libgcc.a'. If you do not define this macro, the driver program |
---|
183 | will pass the argument `-lgcc' to tell the linker to do the search. |
---|
184 | This macro is similar to `LINK_LIBGCC_SPECIAL', except that it does |
---|
185 | not affect `-L' options. |
---|
186 | |
---|
187 | `MULTILIB_DEFAULTS' |
---|
188 | Define this macro as a C expression for the initializer of an |
---|
189 | array of string to tell the driver program which options are |
---|
190 | defaults for this target and thus do not need to be handled |
---|
191 | specially when using `MULTILIB_OPTIONS'. |
---|
192 | |
---|
193 | Do not define this macro if `MULTILIB_OPTIONS' is not defined in |
---|
194 | the target makefile fragment or if none of the options listed in |
---|
195 | `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. |
---|
196 | |
---|
197 | `RELATIVE_PREFIX_NOT_LINKDIR' |
---|
198 | Define this macro to tell `gcc' that it should only translate a |
---|
199 | `-B' prefix into a `-L' linker option if the prefix indicates an |
---|
200 | absolute file name. |
---|
201 | |
---|
202 | `STANDARD_EXEC_PREFIX' |
---|
203 | Define this macro as a C string constant if you wish to override |
---|
204 | the standard choice of `/usr/local/lib/gcc-lib/' as the default |
---|
205 | prefix to try when searching for the executable files of the |
---|
206 | compiler. |
---|
207 | |
---|
208 | `MD_EXEC_PREFIX' |
---|
209 | If defined, this macro is an additional prefix to try after |
---|
210 | `STANDARD_EXEC_PREFIX'. `MD_EXEC_PREFIX' is not searched when the |
---|
211 | `-b' option is used, or the compiler is built as a cross compiler. |
---|
212 | |
---|
213 | `STANDARD_STARTFILE_PREFIX' |
---|
214 | Define this macro as a C string constant if you wish to override |
---|
215 | the standard choice of `/usr/local/lib/' as the default prefix to |
---|
216 | try when searching for startup files such as `crt0.o'. |
---|
217 | |
---|
218 | `MD_STARTFILE_PREFIX' |
---|
219 | If defined, this macro supplies an additional prefix to try after |
---|
220 | the standard prefixes. `MD_EXEC_PREFIX' is not searched when the |
---|
221 | `-b' option is used, or when the compiler is built as a cross |
---|
222 | compiler. |
---|
223 | |
---|
224 | `MD_STARTFILE_PREFIX_1' |
---|
225 | If defined, this macro supplies yet another prefix to try after the |
---|
226 | standard prefixes. It is not searched when the `-b' option is |
---|
227 | used, or when the compiler is built as a cross compiler. |
---|
228 | |
---|
229 | `INIT_ENVIRONMENT' |
---|
230 | Define this macro as a C string constant if you with to set |
---|
231 | environment variables for programs called by the driver, such as |
---|
232 | the assembler and loader. The driver passes the value of this |
---|
233 | macro to `putenv' to initialize the necessary environment |
---|
234 | variables. |
---|
235 | |
---|
236 | `LOCAL_INCLUDE_DIR' |
---|
237 | Define this macro as a C string constant if you wish to override |
---|
238 | the standard choice of `/usr/local/include' as the default prefix |
---|
239 | to try when searching for local header files. `LOCAL_INCLUDE_DIR' |
---|
240 | comes before `SYSTEM_INCLUDE_DIR' in the search order. |
---|
241 | |
---|
242 | Cross compilers do not use this macro and do not search either |
---|
243 | `/usr/local/include' or its replacement. |
---|
244 | |
---|
245 | `SYSTEM_INCLUDE_DIR' |
---|
246 | Define this macro as a C string constant if you wish to specify a |
---|
247 | system-specific directory to search for header files before the |
---|
248 | standard directory. `SYSTEM_INCLUDE_DIR' comes before |
---|
249 | `STANDARD_INCLUDE_DIR' in the search order. |
---|
250 | |
---|
251 | Cross compilers do not use this macro and do not search the |
---|
252 | directory specified. |
---|
253 | |
---|
254 | `STANDARD_INCLUDE_DIR' |
---|
255 | Define this macro as a C string constant if you wish to override |
---|
256 | the standard choice of `/usr/include' as the default prefix to try |
---|
257 | when searching for header files. |
---|
258 | |
---|
259 | Cross compilers do not use this macro and do not search either |
---|
260 | `/usr/include' or its replacement. |
---|
261 | |
---|
262 | `INCLUDE_DEFAULTS' |
---|
263 | Define this macro if you wish to override the entire default |
---|
264 | search path for include files. The default search path includes |
---|
265 | `GCC_INCLUDE_DIR', `LOCAL_INCLUDE_DIR', `SYSTEM_INCLUDE_DIR', |
---|
266 | `GPLUSPLUS_INCLUDE_DIR', and `STANDARD_INCLUDE_DIR'. In addition, |
---|
267 | `GPLUSPLUS_INCLUDE_DIR' and `GCC_INCLUDE_DIR' are defined |
---|
268 | automatically by `Makefile', and specify private search areas for |
---|
269 | GCC. The directory `GPLUSPLUS_INCLUDE_DIR' is used only for C++ |
---|
270 | programs. |
---|
271 | |
---|
272 | The definition should be an initializer for an array of structures. |
---|
273 | Each array element should have two elements: the directory name (a |
---|
274 | string constant) and a flag for C++-only directories. Mark the |
---|
275 | end of the array with a null element. For example, here is the |
---|
276 | definition used for VMS: |
---|
277 | |
---|
278 | #define INCLUDE_DEFAULTS \ |
---|
279 | { \ |
---|
280 | { "GNU_GXX_INCLUDE:", 1}, \ |
---|
281 | { "GNU_CC_INCLUDE:", 0}, \ |
---|
282 | { "SYS$SYSROOT:[SYSLIB.]", 0}, \ |
---|
283 | { ".", 0}, \ |
---|
284 | { 0, 0} \ |
---|
285 | } |
---|
286 | |
---|
287 | Here is the order of prefixes tried for exec files: |
---|
288 | |
---|
289 | 1. Any prefixes specified by the user with `-B'. |
---|
290 | |
---|
291 | 2. The environment variable `GCC_EXEC_PREFIX', if any. |
---|
292 | |
---|
293 | 3. The directories specified by the environment variable |
---|
294 | `COMPILER_PATH'. |
---|
295 | |
---|
296 | 4. The macro `STANDARD_EXEC_PREFIX'. |
---|
297 | |
---|
298 | 5. `/usr/lib/gcc/'. |
---|
299 | |
---|
300 | 6. The macro `MD_EXEC_PREFIX', if any. |
---|
301 | |
---|
302 | Here is the order of prefixes tried for startfiles: |
---|
303 | |
---|
304 | 1. Any prefixes specified by the user with `-B'. |
---|
305 | |
---|
306 | 2. The environment variable `GCC_EXEC_PREFIX', if any. |
---|
307 | |
---|
308 | 3. The directories specified by the environment variable |
---|
309 | `LIBRARY_PATH' (native only, cross compilers do not use this). |
---|
310 | |
---|
311 | 4. The macro `STANDARD_EXEC_PREFIX'. |
---|
312 | |
---|
313 | 5. `/usr/lib/gcc/'. |
---|
314 | |
---|
315 | 6. The macro `MD_EXEC_PREFIX', if any. |
---|
316 | |
---|
317 | 7. The macro `MD_STARTFILE_PREFIX', if any. |
---|
318 | |
---|
319 | 8. The macro `STANDARD_STARTFILE_PREFIX'. |
---|
320 | |
---|
321 | 9. `/lib/'. |
---|
322 | |
---|
323 | 10. `/usr/lib/'. |
---|
324 | |
---|
325 | |
---|
326 | File: gcc.info, Node: Run-time Target, Next: Storage Layout, Prev: Driver, Up: Target Macros |
---|
327 | |
---|
328 | Run-time Target Specification |
---|
329 | ============================= |
---|
330 | |
---|
331 | Here are run-time target specifications. |
---|
332 | |
---|
333 | `CPP_PREDEFINES' |
---|
334 | Define this to be a string constant containing `-D' options to |
---|
335 | define the predefined macros that identify this machine and system. |
---|
336 | These macros will be predefined unless the `-ansi' option is |
---|
337 | specified. |
---|
338 | |
---|
339 | In addition, a parallel set of macros are predefined, whose names |
---|
340 | are made by appending `__' at the beginning and at the end. These |
---|
341 | `__' macros are permitted by the ANSI standard, so they are |
---|
342 | predefined regardless of whether `-ansi' is specified. |
---|
343 | |
---|
344 | For example, on the Sun, one can use the following value: |
---|
345 | |
---|
346 | "-Dmc68000 -Dsun -Dunix" |
---|
347 | |
---|
348 | The result is to define the macros `__mc68000__', `__sun__' and |
---|
349 | `__unix__' unconditionally, and the macros `mc68000', `sun' and |
---|
350 | `unix' provided `-ansi' is not specified. |
---|
351 | |
---|
352 | `extern int target_flags;' |
---|
353 | This declaration should be present. |
---|
354 | |
---|
355 | `TARGET_...' |
---|
356 | This series of macros is to allow compiler command arguments to |
---|
357 | enable or disable the use of optional features of the target |
---|
358 | machine. For example, one machine description serves both the |
---|
359 | 68000 and the 68020; a command argument tells the compiler whether |
---|
360 | it should use 68020-only instructions or not. This command |
---|
361 | argument works by means of a macro `TARGET_68020' that tests a bit |
---|
362 | in `target_flags'. |
---|
363 | |
---|
364 | Define a macro `TARGET_FEATURENAME' for each such option. Its |
---|
365 | definition should test a bit in `target_flags'; for example: |
---|
366 | |
---|
367 | #define TARGET_68020 (target_flags & 1) |
---|
368 | |
---|
369 | One place where these macros are used is in the |
---|
370 | condition-expressions of instruction patterns. Note how |
---|
371 | `TARGET_68020' appears frequently in the 68000 machine description |
---|
372 | file, `m68k.md'. Another place they are used is in the |
---|
373 | definitions of the other macros in the `MACHINE.h' file. |
---|
374 | |
---|
375 | `TARGET_SWITCHES' |
---|
376 | This macro defines names of command options to set and clear bits |
---|
377 | in `target_flags'. Its definition is an initializer with a |
---|
378 | subgrouping for each command option. |
---|
379 | |
---|
380 | Each subgrouping contains a string constant, that defines the |
---|
381 | option name, and a number, which contains the bits to set in |
---|
382 | `target_flags'. A negative number says to clear bits instead; the |
---|
383 | negative of the number is which bits to clear. The actual option |
---|
384 | name is made by appending `-m' to the specified name. |
---|
385 | |
---|
386 | One of the subgroupings should have a null string. The number in |
---|
387 | this grouping is the default value for `target_flags'. Any target |
---|
388 | options act starting with that value. |
---|
389 | |
---|
390 | Here is an example which defines `-m68000' and `-m68020' with |
---|
391 | opposite meanings, and picks the latter as the default: |
---|
392 | |
---|
393 | #define TARGET_SWITCHES \ |
---|
394 | { { "68020", 1}, \ |
---|
395 | { "68000", -1}, \ |
---|
396 | { "", 1}} |
---|
397 | |
---|
398 | `TARGET_OPTIONS' |
---|
399 | This macro is similar to `TARGET_SWITCHES' but defines names of |
---|
400 | command options that have values. Its definition is an |
---|
401 | initializer with a subgrouping for each command option. |
---|
402 | |
---|
403 | Each subgrouping contains a string constant, that defines the |
---|
404 | fixed part of the option name, and the address of a variable. The |
---|
405 | variable, type `char *', is set to the variable part of the given |
---|
406 | option if the fixed part matches. The actual option name is made |
---|
407 | by appending `-m' to the specified name. |
---|
408 | |
---|
409 | Here is an example which defines `-mshort-data-NUMBER'. If the |
---|
410 | given option is `-mshort-data-512', the variable `m88k_short_data' |
---|
411 | will be set to the string `"512"'. |
---|
412 | |
---|
413 | extern char *m88k_short_data; |
---|
414 | #define TARGET_OPTIONS \ |
---|
415 | { { "short-data-", &m88k_short_data } } |
---|
416 | |
---|
417 | `TARGET_VERSION' |
---|
418 | This macro is a C statement to print on `stderr' a string |
---|
419 | describing the particular machine description choice. Every |
---|
420 | machine description should define `TARGET_VERSION'. For example: |
---|
421 | |
---|
422 | #ifdef MOTOROLA |
---|
423 | #define TARGET_VERSION \ |
---|
424 | fprintf (stderr, " (68k, Motorola syntax)"); |
---|
425 | #else |
---|
426 | #define TARGET_VERSION \ |
---|
427 | fprintf (stderr, " (68k, MIT syntax)"); |
---|
428 | #endif |
---|
429 | |
---|
430 | `OVERRIDE_OPTIONS' |
---|
431 | Sometimes certain combinations of command options do not make |
---|
432 | sense on a particular target machine. You can define a macro |
---|
433 | `OVERRIDE_OPTIONS' to take account of this. This macro, if |
---|
434 | defined, is executed once just after all the command options have |
---|
435 | been parsed. |
---|
436 | |
---|
437 | Don't use this macro to turn on various extra optimizations for |
---|
438 | `-O'. That is what `OPTIMIZATION_OPTIONS' is for. |
---|
439 | |
---|
440 | `OPTIMIZATION_OPTIONS (LEVEL)' |
---|
441 | Some machines may desire to change what optimizations are |
---|
442 | performed for various optimization levels. This macro, if |
---|
443 | defined, is executed once just after the optimization level is |
---|
444 | determined and before the remainder of the command options have |
---|
445 | been parsed. Values set in this macro are used as the default |
---|
446 | values for the other command line options. |
---|
447 | |
---|
448 | LEVEL is the optimization level specified; 2 if `-O2' is |
---|
449 | specified, 1 if `-O' is specified, and 0 if neither is specified. |
---|
450 | |
---|
451 | You should not use this macro to change options that are not |
---|
452 | machine-specific. These should uniformly selected by the same |
---|
453 | optimization level on all supported machines. Use this macro to |
---|
454 | enable machbine-specific optimizations. |
---|
455 | |
---|
456 | *Do not examine `write_symbols' in this macro!* The debugging |
---|
457 | options are not supposed to alter the generated code. |
---|
458 | |
---|
459 | `CAN_DEBUG_WITHOUT_FP' |
---|
460 | Define this macro if debugging can be performed even without a |
---|
461 | frame pointer. If this macro is defined, GNU CC will turn on the |
---|
462 | `-fomit-frame-pointer' option whenever `-O' is specified. |
---|
463 | |
---|
464 | |
---|
465 | File: gcc.info, Node: Storage Layout, Next: Type Layout, Prev: Run-time Target, Up: Target Macros |
---|
466 | |
---|
467 | Storage Layout |
---|
468 | ============== |
---|
469 | |
---|
470 | Note that the definitions of the macros in this table which are |
---|
471 | sizes or alignments measured in bits do not need to be constant. They |
---|
472 | can be C expressions that refer to static variables, such as the |
---|
473 | `target_flags'. *Note Run-time Target::. |
---|
474 | |
---|
475 | `BITS_BIG_ENDIAN' |
---|
476 | Define this macro to have the value 1 if the most significant bit |
---|
477 | in a byte has the lowest number; otherwise define it to have the |
---|
478 | value zero. This means that bit-field instructions count from the |
---|
479 | most significant bit. If the machine has no bit-field |
---|
480 | instructions, then this must still be defined, but it doesn't |
---|
481 | matter which value it is defined to. This macro need not be a |
---|
482 | constant. |
---|
483 | |
---|
484 | This macro does not affect the way structure fields are packed into |
---|
485 | bytes or words; that is controlled by `BYTES_BIG_ENDIAN'. |
---|
486 | |
---|
487 | `BYTES_BIG_ENDIAN' |
---|
488 | Define this macro to have the value 1 if the most significant byte |
---|
489 | in a word has the lowest number. This macro need not be a |
---|
490 | constant. |
---|
491 | |
---|
492 | `WORDS_BIG_ENDIAN' |
---|
493 | Define this macro to have the value 1 if, in a multiword object, |
---|
494 | the most significant word has the lowest number. This applies to |
---|
495 | both memory locations and registers; GNU CC fundamentally assumes |
---|
496 | that the order of words in memory is the same as the order in |
---|
497 | registers. This macro need not be a constant. |
---|
498 | |
---|
499 | `LIBGCC2_WORDS_BIG_ENDIAN' |
---|
500 | Define this macro if WORDS_BIG_ENDIAN is not constant. This must |
---|
501 | be a constant value with the same meaning as WORDS_BIG_ENDIAN, |
---|
502 | which will be used only when compiling libgcc2.c. Typically the |
---|
503 | value will be set based on preprocessor defines. |
---|
504 | |
---|
505 | `FLOAT_WORDS_BIG_ENDIAN' |
---|
506 | Define this macro to have the value 1 if `DFmode', `XFmode' or |
---|
507 | `TFmode' floating point numbers are stored in memory with the word |
---|
508 | containing the sign bit at the lowest address; otherwise define it |
---|
509 | to have the value 0. This macro need not be a constant. |
---|
510 | |
---|
511 | You need not define this macro if the ordering is the same as for |
---|
512 | multi-word integers. |
---|
513 | |
---|
514 | `BITS_PER_UNIT' |
---|
515 | Define this macro to be the number of bits in an addressable |
---|
516 | storage unit (byte); normally 8. |
---|
517 | |
---|
518 | `BITS_PER_WORD' |
---|
519 | Number of bits in a word; normally 32. |
---|
520 | |
---|
521 | `MAX_BITS_PER_WORD' |
---|
522 | Maximum number of bits in a word. If this is undefined, the |
---|
523 | default is `BITS_PER_WORD'. Otherwise, it is the constant value |
---|
524 | that is the largest value that `BITS_PER_WORD' can have at |
---|
525 | run-time. |
---|
526 | |
---|
527 | `UNITS_PER_WORD' |
---|
528 | Number of storage units in a word; normally 4. |
---|
529 | |
---|
530 | `MIN_UNITS_PER_WORD' |
---|
531 | Minimum number of units in a word. If this is undefined, the |
---|
532 | default is `UNITS_PER_WORD'. Otherwise, it is the constant value |
---|
533 | that is the smallest value that `UNITS_PER_WORD' can have at |
---|
534 | run-time. |
---|
535 | |
---|
536 | `POINTER_SIZE' |
---|
537 | Width of a pointer, in bits. You must specify a value no wider |
---|
538 | than the width of `Pmode'. If it is not equal to the width of |
---|
539 | `Pmode', you must define `POINTERS_EXTEND_UNSIGNED'. |
---|
540 | |
---|
541 | `POINTERS_EXTEND_UNSIGNED' |
---|
542 | A C expression whose value is nonzero if pointers that need to be |
---|
543 | extended from being `POINTER_SIZE' bits wide to `Pmode' are |
---|
544 | sign-extended and zero if they are zero-extended. |
---|
545 | |
---|
546 | You need not define this macro if the `POINTER_SIZE' is equal to |
---|
547 | the width of `Pmode'. |
---|
548 | |
---|
549 | `PROMOTE_MODE (M, UNSIGNEDP, TYPE)' |
---|
550 | A macro to update M and UNSIGNEDP when an object whose type is |
---|
551 | TYPE and which has the specified mode and signedness is to be |
---|
552 | stored in a register. This macro is only called when TYPE is a |
---|
553 | scalar type. |
---|
554 | |
---|
555 | On most RISC machines, which only have operations that operate on |
---|
556 | a full register, define this macro to set M to `word_mode' if M is |
---|
557 | an integer mode narrower than `BITS_PER_WORD'. In most cases, |
---|
558 | only integer modes should be widened because wider-precision |
---|
559 | floating-point operations are usually more expensive than their |
---|
560 | narrower counterparts. |
---|
561 | |
---|
562 | For most machines, the macro definition does not change UNSIGNEDP. |
---|
563 | However, some machines, have instructions that preferentially |
---|
564 | handle either signed or unsigned quantities of certain modes. For |
---|
565 | example, on the DEC Alpha, 32-bit loads from memory and 32-bit add |
---|
566 | instructions sign-extend the result to 64 bits. On such machines, |
---|
567 | set UNSIGNEDP according to which kind of extension is more |
---|
568 | efficient. |
---|
569 | |
---|
570 | Do not define this macro if it would never modify M. |
---|
571 | |
---|
572 | `PROMOTE_FUNCTION_ARGS' |
---|
573 | Define this macro if the promotion described by `PROMOTE_MODE' |
---|
574 | should also be done for outgoing function arguments. |
---|
575 | |
---|
576 | `PROMOTE_FUNCTION_RETURN' |
---|
577 | Define this macro if the promotion described by `PROMOTE_MODE' |
---|
578 | should also be done for the return value of functions. |
---|
579 | |
---|
580 | If this macro is defined, `FUNCTION_VALUE' must perform the same |
---|
581 | promotions done by `PROMOTE_MODE'. |
---|
582 | |
---|
583 | `PROMOTE_FOR_CALL_ONLY' |
---|
584 | Define this macro if the promotion described by `PROMOTE_MODE' |
---|
585 | should *only* be performed for outgoing function arguments or |
---|
586 | function return values, as specified by `PROMOTE_FUNCTION_ARGS' |
---|
587 | and `PROMOTE_FUNCTION_RETURN', respectively. |
---|
588 | |
---|
589 | `PARM_BOUNDARY' |
---|
590 | Normal alignment required for function parameters on the stack, in |
---|
591 | bits. All stack parameters receive at least this much alignment |
---|
592 | regardless of data type. On most machines, this is the same as the |
---|
593 | size of an integer. |
---|
594 | |
---|
595 | `STACK_BOUNDARY' |
---|
596 | Define this macro if you wish to preserve a certain alignment for |
---|
597 | the stack pointer. The definition is a C expression for the |
---|
598 | desired alignment (measured in bits). |
---|
599 | |
---|
600 | If `PUSH_ROUNDING' is not defined, the stack will always be aligned |
---|
601 | to the specified boundary. If `PUSH_ROUNDING' is defined and |
---|
602 | specifies a less strict alignment than `STACK_BOUNDARY', the stack |
---|
603 | may be momentarily unaligned while pushing arguments. |
---|
604 | |
---|
605 | `FUNCTION_BOUNDARY' |
---|
606 | Alignment required for a function entry point, in bits. |
---|
607 | |
---|
608 | `BIGGEST_ALIGNMENT' |
---|
609 | Biggest alignment that any data type can require on this machine, |
---|
610 | in bits. |
---|
611 | |
---|
612 | `BIGGEST_FIELD_ALIGNMENT' |
---|
613 | Biggest alignment that any structure field can require on this |
---|
614 | machine, in bits. If defined, this overrides `BIGGEST_ALIGNMENT' |
---|
615 | for structure fields only. |
---|
616 | |
---|
617 | `MAX_OFILE_ALIGNMENT' |
---|
618 | Biggest alignment supported by the object file format of this |
---|
619 | machine. Use this macro to limit the alignment which can be |
---|
620 | specified using the `__attribute__ ((aligned (N)))' construct. If |
---|
621 | not defined, the default value is `BIGGEST_ALIGNMENT'. |
---|
622 | |
---|
623 | `DATA_ALIGNMENT (TYPE, BASIC-ALIGN)' |
---|
624 | If defined, a C expression to compute the alignment for a static |
---|
625 | variable. TYPE is the data type, and BASIC-ALIGN is the alignment |
---|
626 | that the object would ordinarily have. The value of this macro is |
---|
627 | used instead of that alignment to align the object. |
---|
628 | |
---|
629 | If this macro is not defined, then BASIC-ALIGN is used. |
---|
630 | |
---|
631 | One use of this macro is to increase alignment of medium-size data |
---|
632 | to make it all fit in fewer cache lines. Another is to cause |
---|
633 | character arrays to be word-aligned so that `strcpy' calls that |
---|
634 | copy constants to character arrays can be done inline. |
---|
635 | |
---|
636 | `CONSTANT_ALIGNMENT (CONSTANT, BASIC-ALIGN)' |
---|
637 | If defined, a C expression to compute the alignment given to a |
---|
638 | constant that is being placed in memory. CONSTANT is the constant |
---|
639 | and BASIC-ALIGN is the alignment that the object would ordinarily |
---|
640 | have. The value of this macro is used instead of that alignment to |
---|
641 | align the object. |
---|
642 | |
---|
643 | If this macro is not defined, then BASIC-ALIGN is used. |
---|
644 | |
---|
645 | The typical use of this macro is to increase alignment for string |
---|
646 | constants to be word aligned so that `strcpy' calls that copy |
---|
647 | constants can be done inline. |
---|
648 | |
---|
649 | `EMPTY_FIELD_BOUNDARY' |
---|
650 | Alignment in bits to be given to a structure bit field that |
---|
651 | follows an empty field such as `int : 0;'. |
---|
652 | |
---|
653 | Note that `PCC_BITFIELD_TYPE_MATTERS' also affects the alignment |
---|
654 | that results from an empty field. |
---|
655 | |
---|
656 | `STRUCTURE_SIZE_BOUNDARY' |
---|
657 | Number of bits which any structure or union's size must be a |
---|
658 | multiple of. Each structure or union's size is rounded up to a |
---|
659 | multiple of this. |
---|
660 | |
---|
661 | If you do not define this macro, the default is the same as |
---|
662 | `BITS_PER_UNIT'. |
---|
663 | |
---|
664 | `STRICT_ALIGNMENT' |
---|
665 | Define this macro to be the value 1 if instructions will fail to |
---|
666 | work if given data not on the nominal alignment. If instructions |
---|
667 | will merely go slower in that case, define this macro as 0. |
---|
668 | |
---|
669 | `PCC_BITFIELD_TYPE_MATTERS' |
---|
670 | Define this if you wish to imitate the way many other C compilers |
---|
671 | handle alignment of bitfields and the structures that contain them. |
---|
672 | |
---|
673 | The behavior is that the type written for a bitfield (`int', |
---|
674 | `short', or other integer type) imposes an alignment for the |
---|
675 | entire structure, as if the structure really did contain an |
---|
676 | ordinary field of that type. In addition, the bitfield is placed |
---|
677 | within the structure so that it would fit within such a field, not |
---|
678 | crossing a boundary for it. |
---|
679 | |
---|
680 | Thus, on most machines, a bitfield whose type is written as `int' |
---|
681 | would not cross a four-byte boundary, and would force four-byte |
---|
682 | alignment for the whole structure. (The alignment used may not be |
---|
683 | four bytes; it is controlled by the other alignment parameters.) |
---|
684 | |
---|
685 | If the macro is defined, its definition should be a C expression; |
---|
686 | a nonzero value for the expression enables this behavior. |
---|
687 | |
---|
688 | Note that if this macro is not defined, or its value is zero, some |
---|
689 | bitfields may cross more than one alignment boundary. The |
---|
690 | compiler can support such references if there are `insv', `extv', |
---|
691 | and `extzv' insns that can directly reference memory. |
---|
692 | |
---|
693 | The other known way of making bitfields work is to define |
---|
694 | `STRUCTURE_SIZE_BOUNDARY' as large as `BIGGEST_ALIGNMENT'. Then |
---|
695 | every structure can be accessed with fullwords. |
---|
696 | |
---|
697 | Unless the machine has bitfield instructions or you define |
---|
698 | `STRUCTURE_SIZE_BOUNDARY' that way, you must define |
---|
699 | `PCC_BITFIELD_TYPE_MATTERS' to have a nonzero value. |
---|
700 | |
---|
701 | If your aim is to make GNU CC use the same conventions for laying |
---|
702 | out bitfields as are used by another compiler, here is how to |
---|
703 | investigate what the other compiler does. Compile and run this |
---|
704 | program: |
---|
705 | |
---|
706 | struct foo1 |
---|
707 | { |
---|
708 | char x; |
---|
709 | char :0; |
---|
710 | char y; |
---|
711 | }; |
---|
712 | |
---|
713 | struct foo2 |
---|
714 | { |
---|
715 | char x; |
---|
716 | int :0; |
---|
717 | char y; |
---|
718 | }; |
---|
719 | |
---|
720 | main () |
---|
721 | { |
---|
722 | printf ("Size of foo1 is %d\n", |
---|
723 | sizeof (struct foo1)); |
---|
724 | printf ("Size of foo2 is %d\n", |
---|
725 | sizeof (struct foo2)); |
---|
726 | exit (0); |
---|
727 | } |
---|
728 | |
---|
729 | If this prints 2 and 5, then the compiler's behavior is what you |
---|
730 | would get from `PCC_BITFIELD_TYPE_MATTERS'. |
---|
731 | |
---|
732 | `BITFIELD_NBYTES_LIMITED' |
---|
733 | Like PCC_BITFIELD_TYPE_MATTERS except that its effect is limited to |
---|
734 | aligning a bitfield within the structure. |
---|
735 | |
---|
736 | `ROUND_TYPE_SIZE (STRUCT, SIZE, ALIGN)' |
---|
737 | Define this macro as an expression for the overall size of a |
---|
738 | structure (given by STRUCT as a tree node) when the size computed |
---|
739 | from the fields is SIZE and the alignment is ALIGN. |
---|
740 | |
---|
741 | The default is to round SIZE up to a multiple of ALIGN. |
---|
742 | |
---|
743 | `ROUND_TYPE_ALIGN (STRUCT, COMPUTED, SPECIFIED)' |
---|
744 | Define this macro as an expression for the alignment of a structure |
---|
745 | (given by STRUCT as a tree node) if the alignment computed in the |
---|
746 | usual way is COMPUTED and the alignment explicitly specified was |
---|
747 | SPECIFIED. |
---|
748 | |
---|
749 | The default is to use SPECIFIED if it is larger; otherwise, use |
---|
750 | the smaller of COMPUTED and `BIGGEST_ALIGNMENT' |
---|
751 | |
---|
752 | `MAX_FIXED_MODE_SIZE' |
---|
753 | An integer expression for the size in bits of the largest integer |
---|
754 | machine mode that should actually be used. All integer machine |
---|
755 | modes of this size or smaller can be used for structures and |
---|
756 | unions with the appropriate sizes. If this macro is undefined, |
---|
757 | `GET_MODE_BITSIZE (DImode)' is assumed. |
---|
758 | |
---|
759 | `CHECK_FLOAT_VALUE (MODE, VALUE, OVERFLOW)' |
---|
760 | A C statement to validate the value VALUE (of type `double') for |
---|
761 | mode MODE. This means that you check whether VALUE fits within |
---|
762 | the possible range of values for mode MODE on this target machine. |
---|
763 | The mode MODE is always a mode of class `MODE_FLOAT'. OVERFLOW |
---|
764 | is nonzero if the value is already known to be out of range. |
---|
765 | |
---|
766 | If VALUE is not valid or if OVERFLOW is nonzero, you should set |
---|
767 | OVERFLOW to 1 and then assign some valid value to VALUE. Allowing |
---|
768 | an invalid value to go through the compiler can produce incorrect |
---|
769 | assembler code which may even cause Unix assemblers to crash. |
---|
770 | |
---|
771 | This macro need not be defined if there is no work for it to do. |
---|
772 | |
---|
773 | `TARGET_FLOAT_FORMAT' |
---|
774 | A code distinguishing the floating point format of the target |
---|
775 | machine. There are three defined values: |
---|
776 | |
---|
777 | `IEEE_FLOAT_FORMAT' |
---|
778 | This code indicates IEEE floating point. It is the default; |
---|
779 | there is no need to define this macro when the format is IEEE. |
---|
780 | |
---|
781 | `VAX_FLOAT_FORMAT' |
---|
782 | This code indicates the peculiar format used on the Vax. |
---|
783 | |
---|
784 | `UNKNOWN_FLOAT_FORMAT' |
---|
785 | This code indicates any other format. |
---|
786 | |
---|
787 | The value of this macro is compared with `HOST_FLOAT_FORMAT' |
---|
788 | (*note Config::.) to determine whether the target machine has the |
---|
789 | same format as the host machine. If any other formats are |
---|
790 | actually in use on supported machines, new codes should be defined |
---|
791 | for them. |
---|
792 | |
---|
793 | The ordering of the component words of floating point values |
---|
794 | stored in memory is controlled by `FLOAT_WORDS_BIG_ENDIAN' for the |
---|
795 | target machine and `HOST_FLOAT_WORDS_BIG_ENDIAN' for the host. |
---|
796 | |
---|
797 | |
---|
798 | File: gcc.info, Node: Type Layout, Next: Registers, Prev: Storage Layout, Up: Target Macros |
---|
799 | |
---|
800 | Layout of Source Language Data Types |
---|
801 | ==================================== |
---|
802 | |
---|
803 | These macros define the sizes and other characteristics of the |
---|
804 | standard basic data types used in programs being compiled. Unlike the |
---|
805 | macros in the previous section, these apply to specific features of C |
---|
806 | and related languages, rather than to fundamental aspects of storage |
---|
807 | layout. |
---|
808 | |
---|
809 | `INT_TYPE_SIZE' |
---|
810 | A C expression for the size in bits of the type `int' on the |
---|
811 | target machine. If you don't define this, the default is one word. |
---|
812 | |
---|
813 | `MAX_INT_TYPE_SIZE' |
---|
814 | Maximum number for the size in bits of the type `int' on the target |
---|
815 | machine. If this is undefined, the default is `INT_TYPE_SIZE'. |
---|
816 | Otherwise, it is the constant value that is the largest value that |
---|
817 | `INT_TYPE_SIZE' can have at run-time. This is used in `cpp'. |
---|
818 | |
---|
819 | `SHORT_TYPE_SIZE' |
---|
820 | A C expression for the size in bits of the type `short' on the |
---|
821 | target machine. If you don't define this, the default is half a |
---|
822 | word. (If this would be less than one storage unit, it is rounded |
---|
823 | up to one unit.) |
---|
824 | |
---|
825 | `LONG_TYPE_SIZE' |
---|
826 | A C expression for the size in bits of the type `long' on the |
---|
827 | target machine. If you don't define this, the default is one word. |
---|
828 | |
---|
829 | `MAX_LONG_TYPE_SIZE' |
---|
830 | Maximum number for the size in bits of the type `long' on the |
---|
831 | target machine. If this is undefined, the default is |
---|
832 | `LONG_TYPE_SIZE'. Otherwise, it is the constant value that is the |
---|
833 | largest value that `LONG_TYPE_SIZE' can have at run-time. This is |
---|
834 | used in `cpp'. |
---|
835 | |
---|
836 | `LONG_LONG_TYPE_SIZE' |
---|
837 | A C expression for the size in bits of the type `long long' on the |
---|
838 | target machine. If you don't define this, the default is two |
---|
839 | words. If you want to support GNU Ada on your machine, the value |
---|
840 | of macro must be at least 64. |
---|
841 | |
---|
842 | `CHAR_TYPE_SIZE' |
---|
843 | A C expression for the size in bits of the type `char' on the |
---|
844 | target machine. If you don't define this, the default is one |
---|
845 | quarter of a word. (If this would be less than one storage unit, |
---|
846 | it is rounded up to one unit.) |
---|
847 | |
---|
848 | `MAX_CHAR_TYPE_SIZE' |
---|
849 | Maximum number for the size in bits of the type `char' on the |
---|
850 | target machine. If this is undefined, the default is |
---|
851 | `CHAR_TYPE_SIZE'. Otherwise, it is the constant value that is the |
---|
852 | largest value that `CHAR_TYPE_SIZE' can have at run-time. This is |
---|
853 | used in `cpp'. |
---|
854 | |
---|
855 | `FLOAT_TYPE_SIZE' |
---|
856 | A C expression for the size in bits of the type `float' on the |
---|
857 | target machine. If you don't define this, the default is one word. |
---|
858 | |
---|
859 | `DOUBLE_TYPE_SIZE' |
---|
860 | A C expression for the size in bits of the type `double' on the |
---|
861 | target machine. If you don't define this, the default is two |
---|
862 | words. |
---|
863 | |
---|
864 | `LONG_DOUBLE_TYPE_SIZE' |
---|
865 | A C expression for the size in bits of the type `long double' on |
---|
866 | the target machine. If you don't define this, the default is two |
---|
867 | words. |
---|
868 | |
---|
869 | `DEFAULT_SIGNED_CHAR' |
---|
870 | An expression whose value is 1 or 0, according to whether the type |
---|
871 | `char' should be signed or unsigned by default. The user can |
---|
872 | always override this default with the options `-fsigned-char' and |
---|
873 | `-funsigned-char'. |
---|
874 | |
---|
875 | `DEFAULT_SHORT_ENUMS' |
---|
876 | A C expression to determine whether to give an `enum' type only as |
---|
877 | many bytes as it takes to represent the range of possible values |
---|
878 | of that type. A nonzero value means to do that; a zero value |
---|
879 | means all `enum' types should be allocated like `int'. |
---|
880 | |
---|
881 | If you don't define the macro, the default is 0. |
---|
882 | |
---|
883 | `SIZE_TYPE' |
---|
884 | A C expression for a string describing the name of the data type |
---|
885 | to use for size values. The typedef name `size_t' is defined |
---|
886 | using the contents of the string. |
---|
887 | |
---|
888 | The string can contain more than one keyword. If so, separate |
---|
889 | them with spaces, and write first any length keyword, then |
---|
890 | `unsigned' if appropriate, and finally `int'. The string must |
---|
891 | exactly match one of the data type names defined in the function |
---|
892 | `init_decl_processing' in the file `c-decl.c'. You may not omit |
---|
893 | `int' or change the order--that would cause the compiler to crash |
---|
894 | on startup. |
---|
895 | |
---|
896 | If you don't define this macro, the default is `"long unsigned |
---|
897 | int"'. |
---|
898 | |
---|
899 | `PTRDIFF_TYPE' |
---|
900 | A C expression for a string describing the name of the data type |
---|
901 | to use for the result of subtracting two pointers. The typedef |
---|
902 | name `ptrdiff_t' is defined using the contents of the string. See |
---|
903 | `SIZE_TYPE' above for more information. |
---|
904 | |
---|
905 | If you don't define this macro, the default is `"long int"'. |
---|
906 | |
---|
907 | `WCHAR_TYPE' |
---|
908 | A C expression for a string describing the name of the data type |
---|
909 | to use for wide characters. The typedef name `wchar_t' is defined |
---|
910 | using the contents of the string. See `SIZE_TYPE' above for more |
---|
911 | information. |
---|
912 | |
---|
913 | If you don't define this macro, the default is `"int"'. |
---|
914 | |
---|
915 | `WCHAR_TYPE_SIZE' |
---|
916 | A C expression for the size in bits of the data type for wide |
---|
917 | characters. This is used in `cpp', which cannot make use of |
---|
918 | `WCHAR_TYPE'. |
---|
919 | |
---|
920 | `MAX_WCHAR_TYPE_SIZE' |
---|
921 | Maximum number for the size in bits of the data type for wide |
---|
922 | characters. If this is undefined, the default is |
---|
923 | `WCHAR_TYPE_SIZE'. Otherwise, it is the constant value that is the |
---|
924 | largest value that `WCHAR_TYPE_SIZE' can have at run-time. This is |
---|
925 | used in `cpp'. |
---|
926 | |
---|
927 | `OBJC_INT_SELECTORS' |
---|
928 | Define this macro if the type of Objective C selectors should be |
---|
929 | `int'. |
---|
930 | |
---|
931 | If this macro is not defined, then selectors should have the type |
---|
932 | `struct objc_selector *'. |
---|
933 | |
---|
934 | `OBJC_SELECTORS_WITHOUT_LABELS' |
---|
935 | Define this macro if the compiler can group all the selectors |
---|
936 | together into a vector and use just one label at the beginning of |
---|
937 | the vector. Otherwise, the compiler must give each selector its |
---|
938 | own assembler label. |
---|
939 | |
---|
940 | On certain machines, it is important to have a separate label for |
---|
941 | each selector because this enables the linker to eliminate |
---|
942 | duplicate selectors. |
---|
943 | |
---|
944 | `TARGET_BELL' |
---|
945 | A C constant expression for the integer value for escape sequence |
---|
946 | `\a'. |
---|
947 | |
---|
948 | `TARGET_BS' |
---|
949 | `TARGET_TAB' |
---|
950 | `TARGET_NEWLINE' |
---|
951 | C constant expressions for the integer values for escape sequences |
---|
952 | `\b', `\t' and `\n'. |
---|
953 | |
---|
954 | `TARGET_VT' |
---|
955 | `TARGET_FF' |
---|
956 | `TARGET_CR' |
---|
957 | C constant expressions for the integer values for escape sequences |
---|
958 | `\v', `\f' and `\r'. |
---|
959 | |
---|
960 | |
---|
961 | File: gcc.info, Node: Registers, Next: Register Classes, Prev: Type Layout, Up: Target Macros |
---|
962 | |
---|
963 | Register Usage |
---|
964 | ============== |
---|
965 | |
---|
966 | This section explains how to describe what registers the target |
---|
967 | machine has, and how (in general) they can be used. |
---|
968 | |
---|
969 | The description of which registers a specific instruction can use is |
---|
970 | done with register classes; see *Note Register Classes::. For |
---|
971 | information on using registers to access a stack frame, see *Note Frame |
---|
972 | Registers::. For passing values in registers, see *Note Register |
---|
973 | Arguments::. For returning values in registers, see *Note Scalar |
---|
974 | Return::. |
---|
975 | |
---|
976 | * Menu: |
---|
977 | |
---|
978 | * Register Basics:: Number and kinds of registers. |
---|
979 | * Allocation Order:: Order in which registers are allocated. |
---|
980 | * Values in Registers:: What kinds of values each reg can hold. |
---|
981 | * Leaf Functions:: Renumbering registers for leaf functions. |
---|
982 | * Stack Registers:: Handling a register stack such as 80387. |
---|
983 | * Obsolete Register Macros:: Macros formerly used for the 80387. |
---|
984 | |
---|
985 | |
---|
986 | File: gcc.info, Node: Register Basics, Next: Allocation Order, Up: Registers |
---|
987 | |
---|
988 | Basic Characteristics of Registers |
---|
989 | ---------------------------------- |
---|
990 | |
---|
991 | Registers have various characteristics. |
---|
992 | |
---|
993 | `FIRST_PSEUDO_REGISTER' |
---|
994 | Number of hardware registers known to the compiler. They receive |
---|
995 | numbers 0 through `FIRST_PSEUDO_REGISTER-1'; thus, the first |
---|
996 | pseudo register's number really is assigned the number |
---|
997 | `FIRST_PSEUDO_REGISTER'. |
---|
998 | |
---|
999 | `FIXED_REGISTERS' |
---|
1000 | An initializer that says which registers are used for fixed |
---|
1001 | purposes all throughout the compiled code and are therefore not |
---|
1002 | available for general allocation. These would include the stack |
---|
1003 | pointer, the frame pointer (except on machines where that can be |
---|
1004 | used as a general register when no frame pointer is needed), the |
---|
1005 | program counter on machines where that is considered one of the |
---|
1006 | addressable registers, and any other numbered register with a |
---|
1007 | standard use. |
---|
1008 | |
---|
1009 | This information is expressed as a sequence of numbers, separated |
---|
1010 | by commas and surrounded by braces. The Nth number is 1 if |
---|
1011 | register N is fixed, 0 otherwise. |
---|
1012 | |
---|
1013 | The table initialized from this macro, and the table initialized by |
---|
1014 | the following one, may be overridden at run time either |
---|
1015 | automatically, by the actions of the macro |
---|
1016 | `CONDITIONAL_REGISTER_USAGE', or by the user with the command |
---|
1017 | options `-ffixed-REG', `-fcall-used-REG' and `-fcall-saved-REG'. |
---|
1018 | |
---|
1019 | `CALL_USED_REGISTERS' |
---|
1020 | Like `FIXED_REGISTERS' but has 1 for each register that is |
---|
1021 | clobbered (in general) by function calls as well as for fixed |
---|
1022 | registers. This macro therefore identifies the registers that are |
---|
1023 | not available for general allocation of values that must live |
---|
1024 | across function calls. |
---|
1025 | |
---|
1026 | If a register has 0 in `CALL_USED_REGISTERS', the compiler |
---|
1027 | automatically saves it on function entry and restores it on |
---|
1028 | function exit, if the register is used within the function. |
---|
1029 | |
---|
1030 | `CONDITIONAL_REGISTER_USAGE' |
---|
1031 | Zero or more C statements that may conditionally modify two |
---|
1032 | variables `fixed_regs' and `call_used_regs' (both of type `char |
---|
1033 | []') after they have been initialized from the two preceding |
---|
1034 | macros. |
---|
1035 | |
---|
1036 | This is necessary in case the fixed or call-clobbered registers |
---|
1037 | depend on target flags. |
---|
1038 | |
---|
1039 | You need not define this macro if it has no work to do. |
---|
1040 | |
---|
1041 | If the usage of an entire class of registers depends on the target |
---|
1042 | flags, you may indicate this to GCC by using this macro to modify |
---|
1043 | `fixed_regs' and `call_used_regs' to 1 for each of the registers |
---|
1044 | in the classes which should not be used by GCC. Also define the |
---|
1045 | macro `REG_CLASS_FROM_LETTER' to return `NO_REGS' if it is called |
---|
1046 | with a letter for a class that shouldn't be used. |
---|
1047 | |
---|
1048 | (However, if this class is not included in `GENERAL_REGS' and all |
---|
1049 | of the insn patterns whose constraints permit this class are |
---|
1050 | controlled by target switches, then GCC will automatically avoid |
---|
1051 | using these registers when the target switches are opposed to |
---|
1052 | them.) |
---|
1053 | |
---|
1054 | `NON_SAVING_SETJMP' |
---|
1055 | If this macro is defined and has a nonzero value, it means that |
---|
1056 | `setjmp' and related functions fail to save the registers, or that |
---|
1057 | `longjmp' fails to restore them. To compensate, the compiler |
---|
1058 | avoids putting variables in registers in functions that use |
---|
1059 | `setjmp'. |
---|
1060 | |
---|
1061 | `INCOMING_REGNO (OUT)' |
---|
1062 | Define this macro if the target machine has register windows. |
---|
1063 | This C expression returns the register number as seen by the |
---|
1064 | called function corresponding to the register number OUT as seen |
---|
1065 | by the calling function. Return OUT if register number OUT is not |
---|
1066 | an outbound register. |
---|
1067 | |
---|
1068 | `OUTGOING_REGNO (IN)' |
---|
1069 | Define this macro if the target machine has register windows. |
---|
1070 | This C expression returns the register number as seen by the |
---|
1071 | calling function corresponding to the register number IN as seen |
---|
1072 | by the called function. Return IN if register number IN is not an |
---|
1073 | inbound register. |
---|
1074 | |
---|
1075 | |
---|
1076 | File: gcc.info, Node: Allocation Order, Next: Values in Registers, Prev: Register Basics, Up: Registers |
---|
1077 | |
---|
1078 | Order of Allocation of Registers |
---|
1079 | -------------------------------- |
---|
1080 | |
---|
1081 | Registers are allocated in order. |
---|
1082 | |
---|
1083 | `REG_ALLOC_ORDER' |
---|
1084 | If defined, an initializer for a vector of integers, containing the |
---|
1085 | numbers of hard registers in the order in which GNU CC should |
---|
1086 | prefer to use them (from most preferred to least). |
---|
1087 | |
---|
1088 | If this macro is not defined, registers are used lowest numbered |
---|
1089 | first (all else being equal). |
---|
1090 | |
---|
1091 | One use of this macro is on machines where the highest numbered |
---|
1092 | registers must always be saved and the save-multiple-registers |
---|
1093 | instruction supports only sequences of consecutive registers. On |
---|
1094 | such machines, define `REG_ALLOC_ORDER' to be an initializer that |
---|
1095 | lists the highest numbered allocatable register first. |
---|
1096 | |
---|
1097 | `ORDER_REGS_FOR_LOCAL_ALLOC' |
---|
1098 | A C statement (sans semicolon) to choose the order in which to |
---|
1099 | allocate hard registers for pseudo-registers local to a basic |
---|
1100 | block. |
---|
1101 | |
---|
1102 | Store the desired register order in the array `reg_alloc_order'. |
---|
1103 | Element 0 should be the register to allocate first; element 1, the |
---|
1104 | next register; and so on. |
---|
1105 | |
---|
1106 | The macro body should not assume anything about the contents of |
---|
1107 | `reg_alloc_order' before execution of the macro. |
---|
1108 | |
---|
1109 | On most machines, it is not necessary to define this macro. |
---|
1110 | |
---|
1111 | |
---|
1112 | File: gcc.info, Node: Values in Registers, Next: Leaf Functions, Prev: Allocation Order, Up: Registers |
---|
1113 | |
---|
1114 | How Values Fit in Registers |
---|
1115 | --------------------------- |
---|
1116 | |
---|
1117 | This section discusses the macros that describe which kinds of values |
---|
1118 | (specifically, which machine modes) each register can hold, and how many |
---|
1119 | consecutive registers are needed for a given mode. |
---|
1120 | |
---|
1121 | `HARD_REGNO_NREGS (REGNO, MODE)' |
---|
1122 | A C expression for the number of consecutive hard registers, |
---|
1123 | starting at register number REGNO, required to hold a value of mode |
---|
1124 | MODE. |
---|
1125 | |
---|
1126 | On a machine where all registers are exactly one word, a suitable |
---|
1127 | definition of this macro is |
---|
1128 | |
---|
1129 | #define HARD_REGNO_NREGS(REGNO, MODE) \ |
---|
1130 | ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) \ |
---|
1131 | / UNITS_PER_WORD)) |
---|
1132 | |
---|
1133 | `HARD_REGNO_MODE_OK (REGNO, MODE)' |
---|
1134 | A C expression that is nonzero if it is permissible to store a |
---|
1135 | value of mode MODE in hard register number REGNO (or in several |
---|
1136 | registers starting with that one). For a machine where all |
---|
1137 | registers are equivalent, a suitable definition is |
---|
1138 | |
---|
1139 | #define HARD_REGNO_MODE_OK(REGNO, MODE) 1 |
---|
1140 | |
---|
1141 | It is not necessary for this macro to check for the numbers of |
---|
1142 | fixed registers, because the allocation mechanism considers them |
---|
1143 | to be always occupied. |
---|
1144 | |
---|
1145 | On some machines, double-precision values must be kept in even/odd |
---|
1146 | register pairs. The way to implement that is to define this macro |
---|
1147 | to reject odd register numbers for such modes. |
---|
1148 | |
---|
1149 | The minimum requirement for a mode to be OK in a register is that |
---|
1150 | the `movMODE' instruction pattern support moves between the |
---|
1151 | register and any other hard register for which the mode is OK; and |
---|
1152 | that moving a value into the register and back out not alter it. |
---|
1153 | |
---|
1154 | Since the same instruction used to move `SImode' will work for all |
---|
1155 | narrower integer modes, it is not necessary on any machine for |
---|
1156 | `HARD_REGNO_MODE_OK' to distinguish between these modes, provided |
---|
1157 | you define patterns `movhi', etc., to take advantage of this. This |
---|
1158 | is useful because of the interaction between `HARD_REGNO_MODE_OK' |
---|
1159 | and `MODES_TIEABLE_P'; it is very desirable for all integer modes |
---|
1160 | to be tieable. |
---|
1161 | |
---|
1162 | Many machines have special registers for floating point arithmetic. |
---|
1163 | Often people assume that floating point machine modes are allowed |
---|
1164 | only in floating point registers. This is not true. Any |
---|
1165 | registers that can hold integers can safely *hold* a floating |
---|
1166 | point machine mode, whether or not floating arithmetic can be done |
---|
1167 | on it in those registers. Integer move instructions can be used |
---|
1168 | to move the values. |
---|
1169 | |
---|
1170 | On some machines, though, the converse is true: fixed-point machine |
---|
1171 | modes may not go in floating registers. This is true if the |
---|
1172 | floating registers normalize any value stored in them, because |
---|
1173 | storing a non-floating value there would garble it. In this case, |
---|
1174 | `HARD_REGNO_MODE_OK' should reject fixed-point machine modes in |
---|
1175 | floating registers. But if the floating registers do not |
---|
1176 | automatically normalize, if you can store any bit pattern in one |
---|
1177 | and retrieve it unchanged without a trap, then any machine mode |
---|
1178 | may go in a floating register, so you can define this macro to say |
---|
1179 | so. |
---|
1180 | |
---|
1181 | The primary significance of special floating registers is rather |
---|
1182 | that they are the registers acceptable in floating point arithmetic |
---|
1183 | instructions. However, this is of no concern to |
---|
1184 | `HARD_REGNO_MODE_OK'. You handle it by writing the proper |
---|
1185 | constraints for those instructions. |
---|
1186 | |
---|
1187 | On some machines, the floating registers are especially slow to |
---|
1188 | access, so that it is better to store a value in a stack frame |
---|
1189 | than in such a register if floating point arithmetic is not being |
---|
1190 | done. As long as the floating registers are not in class |
---|
1191 | `GENERAL_REGS', they will not be used unless some pattern's |
---|
1192 | constraint asks for one. |
---|
1193 | |
---|
1194 | `MODES_TIEABLE_P (MODE1, MODE2)' |
---|
1195 | A C expression that is nonzero if it is desirable to choose |
---|
1196 | register allocation so as to avoid move instructions between a |
---|
1197 | value of mode MODE1 and a value of mode MODE2. |
---|
1198 | |
---|
1199 | If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, |
---|
1200 | MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1, |
---|
1201 | MODE2)' must be zero. |
---|
1202 | |
---|