Merge from mainline
[official-gcc.git] / gcc / defaults.h
blob3bbf231c2f07d94d7bb531003327bb6183d9563c
1 /* Definitions of various defaults for tm.h macros.
2 Copyright (C) 1992, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 Free Software Foundation, Inc.
4 Contributed by Ron Guilmette (rfg@monkeys.com)
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 02111-1307, USA. */
23 #ifndef GCC_DEFAULTS_H
24 #define GCC_DEFAULTS_H
26 /* Define default standard character escape sequences. */
27 #ifndef TARGET_BELL
28 # define TARGET_BELL 007
29 # define TARGET_BS 010
30 # define TARGET_TAB 011
31 # define TARGET_NEWLINE 012
32 # define TARGET_VT 013
33 # define TARGET_FF 014
34 # define TARGET_CR 015
35 # define TARGET_ESC 033
36 #endif
38 /* When removal of CPP_PREDEFINES is complete, TARGET_CPU_CPP_BULITINS
39 can also be removed from here. */
40 #ifndef TARGET_OS_CPP_BUILTINS
41 # define TARGET_OS_CPP_BUILTINS()
42 #endif
43 #ifndef TARGET_CPU_CPP_BUILTINS
44 # define TARGET_CPU_CPP_BUILTINS()
45 #endif
46 #ifndef CPP_PREDEFINES
47 # define CPP_PREDEFINES ""
48 #endif
50 /* Store in OUTPUT a string (made with alloca) containing
51 an assembler-name for a local static variable or function named NAME.
52 LABELNO is an integer which is different for each call. */
54 #ifndef ASM_FORMAT_PRIVATE_NAME
55 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO) \
56 do { \
57 int len = strlen (NAME); \
58 char *temp = (char *) alloca (len + 3); \
59 temp[0] = 'L'; \
60 strcpy (&temp[1], (NAME)); \
61 temp[len + 1] = '.'; \
62 temp[len + 2] = 0; \
63 (OUTPUT) = (char *) alloca (strlen (NAME) + 11); \
64 ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO); \
65 } while (0)
66 #endif
68 #ifndef ASM_STABD_OP
69 #define ASM_STABD_OP "\t.stabd\t"
70 #endif
72 /* This is how to output an element of a case-vector that is absolute.
73 Some targets don't use this, but we have to define it anyway. */
75 #ifndef ASM_OUTPUT_ADDR_VEC_ELT
76 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
77 do { fputs (integer_asm_op (POINTER_SIZE / UNITS_PER_WORD, TRUE), FILE); \
78 ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE)); \
79 fputc ('\n', FILE); \
80 } while (0)
81 #endif
83 /* Provide default for ASM_OUTPUT_ALTERNATE_LABEL_NAME. */
84 #ifndef ASM_OUTPUT_ALTERNATE_LABEL_NAME
85 #define ASM_OUTPUT_ALTERNATE_LABEL_NAME(FILE,INSN) \
86 do { ASM_OUTPUT_LABEL(FILE,LABEL_ALTERNATE_NAME (INSN)); } while (0)
87 #endif
89 /* choose a reasonable default for ASM_OUTPUT_ASCII. */
91 #ifndef ASM_OUTPUT_ASCII
92 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
93 do { \
94 FILE *_hide_asm_out_file = (MYFILE); \
95 const unsigned char *_hide_p = (const unsigned char *) (MYSTRING); \
96 int _hide_thissize = (MYLENGTH); \
97 { \
98 FILE *asm_out_file = _hide_asm_out_file; \
99 const unsigned char *p = _hide_p; \
100 int thissize = _hide_thissize; \
101 int i; \
102 fprintf (asm_out_file, "\t.ascii \""); \
104 for (i = 0; i < thissize; i++) \
106 int c = p[i]; \
107 if (c == '\"' || c == '\\') \
108 putc ('\\', asm_out_file); \
109 if (ISPRINT(c)) \
110 putc (c, asm_out_file); \
111 else \
113 fprintf (asm_out_file, "\\%o", c); \
114 /* After an octal-escape, if a digit follows, \
115 terminate one string constant and start another. \
116 The VAX assembler fails to stop reading the escape \
117 after three digits, so this is the only way we \
118 can get it to parse the data properly. */ \
119 if (i < thissize - 1 && ISDIGIT(p[i + 1])) \
120 fprintf (asm_out_file, "\"\n\t.ascii \""); \
123 fprintf (asm_out_file, "\"\n"); \
126 while (0)
127 #endif
129 /* This is how we tell the assembler to equate two values. */
130 #ifdef SET_ASM_OP
131 #ifndef ASM_OUTPUT_DEF
132 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
133 do { fprintf ((FILE), "%s", SET_ASM_OP); \
134 assemble_name (FILE, LABEL1); \
135 fprintf (FILE, ","); \
136 assemble_name (FILE, LABEL2); \
137 fprintf (FILE, "\n"); \
138 } while (0)
139 #endif
140 #endif
142 /* This is how to output a reference to a user-level label named NAME. */
144 #ifndef ASM_OUTPUT_LABELREF
145 #define ASM_OUTPUT_LABELREF(FILE,NAME) asm_fprintf ((FILE), "%U%s", (NAME))
146 #endif
148 /* Allow target to print debug info labels specially. This is useful for
149 VLIW targets, since debug info labels should go into the middle of
150 instruction bundles instead of breaking them. */
152 #ifndef ASM_OUTPUT_DEBUG_LABEL
153 #define ASM_OUTPUT_DEBUG_LABEL(FILE, PREFIX, NUM) \
154 ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM)
155 #endif
157 /* This is how we tell the assembler that a symbol is weak. */
158 #ifndef ASM_OUTPUT_WEAK_ALIAS
159 #if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF)
160 #define ASM_OUTPUT_WEAK_ALIAS(STREAM, NAME, VALUE) \
161 do \
163 ASM_WEAKEN_LABEL (STREAM, NAME); \
164 if (VALUE) \
165 ASM_OUTPUT_DEF (STREAM, NAME, VALUE); \
167 while (0)
168 #endif
169 #endif
171 /* This determines whether or not we support weak symbols. */
172 #ifndef SUPPORTS_WEAK
173 #if defined (ASM_WEAKEN_LABEL) || defined (ASM_WEAKEN_DECL)
174 #define SUPPORTS_WEAK 1
175 #else
176 #define SUPPORTS_WEAK 0
177 #endif
178 #endif
180 /* This determines whether or not we support link-once semantics. */
181 #ifndef SUPPORTS_ONE_ONLY
182 #ifdef MAKE_DECL_ONE_ONLY
183 #define SUPPORTS_ONE_ONLY 1
184 #else
185 #define SUPPORTS_ONE_ONLY 0
186 #endif
187 #endif
189 /* If the target supports weak symbols, define TARGET_ATTRIBUTE_WEAK to
190 provide a weak attribute. Else define it to nothing.
192 This would normally belong in ansidecl.h, but SUPPORTS_WEAK is
193 not available at that time.
195 Note, this is only for use by target files which we know are to be
196 compiled by GCC. */
197 #ifndef TARGET_ATTRIBUTE_WEAK
198 # if SUPPORTS_WEAK
199 # define TARGET_ATTRIBUTE_WEAK __attribute__ ((weak))
200 # else
201 # define TARGET_ATTRIBUTE_WEAK
202 # endif
203 #endif
205 /* If the target supports init_priority C++ attribute, give
206 SUPPORTS_INIT_PRIORITY a nonzero value. */
207 #ifndef SUPPORTS_INIT_PRIORITY
208 #define SUPPORTS_INIT_PRIORITY 1
209 #endif /* SUPPORTS_INIT_PRIORITY */
211 /* If duplicate library search directories can be removed from a
212 linker command without changing the linker's semantics, give this
213 symbol a nonzero. */
214 #ifndef LINK_ELIMINATE_DUPLICATE_LDIRECTORIES
215 #define LINK_ELIMINATE_DUPLICATE_LDIRECTORIES 0
216 #endif /* LINK_ELIMINATE_DUPLICATE_LDIRECTORIES */
218 /* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that
219 the rest of the DWARF 2 frame unwind support is also provided. */
220 #if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX)
221 #define DWARF2_UNWIND_INFO 1
222 #endif
224 /* If we have named sections, and we're using crtstuff to run ctors,
225 use them for registering eh frame information. */
226 #if defined (TARGET_ASM_NAMED_SECTION) && DWARF2_UNWIND_INFO \
227 && !defined(EH_FRAME_IN_DATA_SECTION)
228 #ifndef EH_FRAME_SECTION_NAME
229 #define EH_FRAME_SECTION_NAME ".eh_frame"
230 #endif
231 #endif
233 /* If we have named section and we support weak symbols, then use the
234 .jcr section for recording java classes which need to be registered
235 at program start-up time. */
236 #if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
237 #ifndef JCR_SECTION_NAME
238 #define JCR_SECTION_NAME ".jcr"
239 #endif
240 #endif
242 /* By default, we generate a label at the beginning and end of the
243 text section, and compute the size of the text section by
244 subtracting the two. However, on some platforms that doesn't
245 work, and we use the section itself, rather than a label at the
246 beginning of it, to indicate the start of the section. On such
247 platforms, define this to zero. */
248 #ifndef DWARF2_GENERATE_TEXT_SECTION_LABEL
249 #define DWARF2_GENERATE_TEXT_SECTION_LABEL 1
250 #endif
252 /* Supply a default definition for PROMOTE_PROTOTYPES. */
253 #ifndef PROMOTE_PROTOTYPES
254 #define PROMOTE_PROTOTYPES 0
255 #endif
257 /* Number of hardware registers that go into the DWARF-2 unwind info.
258 If not defined, equals FIRST_PSEUDO_REGISTER */
260 #ifndef DWARF_FRAME_REGISTERS
261 #define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER
262 #endif
264 /* How to renumber registers for dbx and gdb. If not defined, assume
265 no renumbering is necessary. */
267 #ifndef DBX_REGISTER_NUMBER
268 #define DBX_REGISTER_NUMBER(REGNO) (REGNO)
269 #endif
271 /* Default sizes for base C types. If the sizes are different for
272 your target, you should override these values by defining the
273 appropriate symbols in your tm.h file. */
275 #ifndef BITS_PER_UNIT
276 #define BITS_PER_UNIT 8
277 #endif
279 #ifndef BITS_PER_WORD
280 #define BITS_PER_WORD (BITS_PER_UNIT * UNITS_PER_WORD)
281 #endif
283 #ifndef CHAR_TYPE_SIZE
284 #define CHAR_TYPE_SIZE BITS_PER_UNIT
285 #endif
287 #ifndef BOOL_TYPE_SIZE
288 /* `bool' has size and alignment `1', on almost all platforms. */
289 #define BOOL_TYPE_SIZE CHAR_TYPE_SIZE
290 #endif
292 #ifndef SHORT_TYPE_SIZE
293 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
294 #endif
296 #ifndef INT_TYPE_SIZE
297 #define INT_TYPE_SIZE BITS_PER_WORD
298 #endif
300 #ifndef LONG_TYPE_SIZE
301 #define LONG_TYPE_SIZE BITS_PER_WORD
302 #endif
304 #ifndef LONG_LONG_TYPE_SIZE
305 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
306 #endif
308 #ifndef WCHAR_TYPE_SIZE
309 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
310 #endif
312 #ifndef FLOAT_TYPE_SIZE
313 #define FLOAT_TYPE_SIZE BITS_PER_WORD
314 #endif
316 #ifndef DOUBLE_TYPE_SIZE
317 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
318 #endif
320 #ifndef LONG_DOUBLE_TYPE_SIZE
321 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
322 #endif
324 /* Width in bits of a pointer. Mind the value of the macro `Pmode'. */
325 #ifndef POINTER_SIZE
326 #define POINTER_SIZE BITS_PER_WORD
327 #endif
329 #ifndef BUILD_VA_LIST_TYPE
330 #define BUILD_VA_LIST_TYPE(X) ((X) = ptr_type_node)
331 #endif
333 #ifndef PIC_OFFSET_TABLE_REGNUM
334 #define PIC_OFFSET_TABLE_REGNUM INVALID_REGNUM
335 #endif
337 /* Type used by GCOV counters. Use 64bit data type if target supports
338 it. */
339 #if LONG_TYPE_SIZE >= 64
340 #define GCOV_TYPE_SIZE LONG_TYPE_SIZE
341 #else
342 #define GCOV_TYPE_SIZE LONG_LONG_TYPE_SIZE
343 #endif
346 /* By default, the preprocessor should be invoked the same way in C++
347 as in C. */
348 #ifndef CPLUSPLUS_CPP_SPEC
349 #ifdef CPP_SPEC
350 #define CPLUSPLUS_CPP_SPEC CPP_SPEC
351 #endif
352 #endif
354 #ifndef ACCUMULATE_OUTGOING_ARGS
355 #define ACCUMULATE_OUTGOING_ARGS 0
356 #endif
358 /* Supply a default definition for PUSH_ARGS. */
359 #ifndef PUSH_ARGS
360 #ifdef PUSH_ROUNDING
361 #define PUSH_ARGS !ACCUMULATE_OUTGOING_ARGS
362 #else
363 #define PUSH_ARGS 0
364 #endif
365 #endif
367 /* If PREFERRED_STACK_BOUNDARY is not defined, set it to STACK_BOUNDARY.
368 STACK_BOUNDARY is required. */
369 #ifndef PREFERRED_STACK_BOUNDARY
370 #define PREFERRED_STACK_BOUNDARY STACK_BOUNDARY
371 #endif
373 /* By default, the C++ compiler will use function addresses in the
374 vtable entries. Setting this non-zero tells the compiler to use
375 function descriptors instead. The value of this macro says how
376 many words wide the descriptor is (normally 2). It is assumed
377 that the address of a function descriptor may be treated as a
378 pointer to a function. */
379 #ifndef TARGET_VTABLE_USES_DESCRIPTORS
380 #define TARGET_VTABLE_USES_DESCRIPTORS 0
381 #endif
383 /* By default, the vtable entries are void pointers, the so the alignment
384 is the same as pointer alignment. The value of this macro specifies
385 the alignment of the vtable entry in bits. It should be defined only
386 when special alignment is necessary. */
387 #ifndef TARGET_VTABLE_ENTRY_ALIGN
388 #define TARGET_VTABLE_ENTRY_ALIGN POINTER_SIZE
389 #endif
391 /* There are a few non-descriptor entries in the vtable at offsets below
392 zero. If these entries must be padded (say, to preserve the alignment
393 specified by TARGET_VTABLE_ENTRY_ALIGN), set this to the number of
394 words in each data entry. */
395 #ifndef TARGET_VTABLE_DATA_ENTRY_DISTANCE
396 #define TARGET_VTABLE_DATA_ENTRY_DISTANCE 1
397 #endif
399 /* Select a format to encode pointers in exception handling data. We
400 prefer those that result in fewer dynamic relocations. Assume no
401 special support here and encode direct references. */
402 #ifndef ASM_PREFERRED_EH_DATA_FORMAT
403 #define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) DW_EH_PE_absptr
404 #endif
406 /* By default, the C++ compiler will use the lowest bit of the pointer
407 to function to indicate a pointer-to-member-function points to a
408 virtual member function. However, if FUNCTION_BOUNDARY indicates
409 function addresses aren't always even, the lowest bit of the delta
410 field will be used. */
411 #ifndef TARGET_PTRMEMFUNC_VBIT_LOCATION
412 #define TARGET_PTRMEMFUNC_VBIT_LOCATION \
413 (FUNCTION_BOUNDARY >= 2 * BITS_PER_UNIT \
414 ? ptrmemfunc_vbit_in_pfn : ptrmemfunc_vbit_in_delta)
415 #endif
417 #ifndef DEFAULT_GDB_EXTENSIONS
418 #define DEFAULT_GDB_EXTENSIONS 1
419 #endif
421 /* If more than one debugging type is supported, you must define
422 PREFERRED_DEBUGGING_TYPE to choose a format in a system-dependent way.
424 This is one long line cause VAXC can't handle a \-newline. */
425 #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (DWARF2_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO) + defined (VMS_DEBUGGING_INFO))
426 #ifndef PREFERRED_DEBUGGING_TYPE
427 You Lose! You must define PREFERRED_DEBUGGING_TYPE!
428 #endif /* no PREFERRED_DEBUGGING_TYPE */
429 #else /* Only one debugging format supported. Define PREFERRED_DEBUGGING_TYPE
430 so other code needn't care. */
431 #ifdef DBX_DEBUGGING_INFO
432 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
433 #endif
434 #ifdef SDB_DEBUGGING_INFO
435 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
436 #endif
437 #ifdef DWARF_DEBUGGING_INFO
438 #define PREFERRED_DEBUGGING_TYPE DWARF_DEBUG
439 #endif
440 #ifdef DWARF2_DEBUGGING_INFO
441 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
442 #endif
443 #ifdef VMS_DEBUGGING_INFO
444 #define PREFERRED_DEBUGGING_TYPE VMS_AND_DWARF2_DEBUG
445 #endif
446 #ifdef XCOFF_DEBUGGING_INFO
447 #define PREFERRED_DEBUGGING_TYPE XCOFF_DEBUG
448 #endif
449 #endif /* More than one debugger format enabled. */
451 /* If still not defined, must have been because no debugging formats
452 are supported. */
453 #ifndef PREFERRED_DEBUGGING_TYPE
454 #define PREFERRED_DEBUGGING_TYPE NO_DEBUG
455 #endif
457 /* This is set to 1 if BYTES_BIG_ENDIAN is defined but the target uses a
458 little-endian method of passing and returning structures in registers.
459 On the HP-UX IA64 and PA64 platforms structures are aligned differently
460 then integral values and setting this value to 1 will allow for the
461 special handling of structure arguments and return values in regs. */
463 #ifndef FUNCTION_ARG_REG_LITTLE_ENDIAN
464 #define FUNCTION_ARG_REG_LITTLE_ENDIAN 0
465 #endif
467 /* Determine the register class for registers suitable to be the base
468 address register in a MEM. Allow the choice to be dependent upon
469 the mode of the memory access. */
470 #ifndef MODE_BASE_REG_CLASS
471 #define MODE_BASE_REG_CLASS(MODE) BASE_REG_CLASS
472 #endif
474 #ifndef LARGEST_EXPONENT_IS_NORMAL
475 #define LARGEST_EXPONENT_IS_NORMAL(SIZE) 0
476 #endif
478 #ifndef ROUND_TOWARDS_ZERO
479 #define ROUND_TOWARDS_ZERO 0
480 #endif
482 #ifndef MODE_HAS_NANS
483 #define MODE_HAS_NANS(MODE) \
484 (FLOAT_MODE_P (MODE) \
485 && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT \
486 && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
487 #endif
489 #ifndef MODE_HAS_INFINITIES
490 #define MODE_HAS_INFINITIES(MODE) \
491 (FLOAT_MODE_P (MODE) \
492 && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT \
493 && !LARGEST_EXPONENT_IS_NORMAL (GET_MODE_BITSIZE (MODE)))
494 #endif
496 #ifndef MODE_HAS_SIGNED_ZEROS
497 #define MODE_HAS_SIGNED_ZEROS(MODE) \
498 (FLOAT_MODE_P (MODE) && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT)
499 #endif
501 #ifndef MODE_HAS_SIGN_DEPENDENT_ROUNDING
502 #define MODE_HAS_SIGN_DEPENDENT_ROUNDING(MODE) \
503 (FLOAT_MODE_P (MODE) \
504 && TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT \
505 && !ROUND_TOWARDS_ZERO)
506 #endif
508 #ifndef HOT_TEXT_SECTION_NAME
509 #define HOT_TEXT_SECTION_NAME "text.hot"
510 #endif
512 #ifndef UNLIKELY_EXECUTED_TEXT_SECTION_NAME
513 #define UNLIKELY_EXECUTED_TEXT_SECTION_NAME "text.unlikely"
514 #endif
516 #ifndef VECTOR_MODE_SUPPORTED_P
517 #define VECTOR_MODE_SUPPORTED_P(MODE) 0
518 #endif
520 /* Determine whether __cxa_atexit, rather than atexit, is used to
521 register C++ destructors for local statics and global objects. */
522 #ifndef DEFAULT_USE_CXA_ATEXIT
523 #define DEFAULT_USE_CXA_ATEXIT 0
524 #endif
526 #endif /* ! GCC_DEFAULTS_H */