OSDN Git Service

2000-12-30 Jeffrey Oldham <oldham@codesourcery.com>
[pf3gnuchains/gcc-fork.git] / gcc / defaults.h
1 /* Definitions of various defaults for how to do assembler output
2    (most of which are designed to be appropriate for GAS or for
3    some BSD assembler).
4    Copyright (C) 1992, 1996, 1997, 1998, 1999, 2000
5    Free Software Foundation, Inc.
6    Contributed by Ron Guilmette (rfg@monkeys.com)
7
8 This file is part of GNU CC.
9
10 GNU CC is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
14
15 GNU CC is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with GNU CC; see the file COPYING.  If not, write to
22 the Free Software Foundation, 59 Temple Place - Suite 330,
23 Boston, MA 02111-1307, USA.  */
24
25 #ifndef GCC_DEFAULTS_H
26 #define GCC_DEFAULTS_H
27
28 /* Store in OUTPUT a string (made with alloca) containing
29    an assembler-name for a local static variable or function named NAME.
30    LABELNO is an integer which is different for each call.  */
31
32 #ifndef ASM_FORMAT_PRIVATE_NAME
33 #define ASM_FORMAT_PRIVATE_NAME(OUTPUT, NAME, LABELNO)                  \
34   do {                                                                  \
35     int len = strlen (NAME);                                            \
36     char *temp = (char *) alloca (len + 3);                             \
37     temp[0] = 'L';                                                      \
38     strcpy (&temp[1], (NAME));                                          \
39     temp[len + 1] = '.';                                                \
40     temp[len + 2] = 0;                                                  \
41     (OUTPUT) = (char *) alloca (strlen (NAME) + 11);                    \
42     ASM_GENERATE_INTERNAL_LABEL (OUTPUT, temp, LABELNO);                \
43   } while (0)
44 #endif
45
46 #ifndef ASM_STABD_OP
47 #define ASM_STABD_OP "\t.stabd\t"
48 #endif
49
50 /* This is how to output an element of a case-vector that is absolute.
51    Some targets don't use this, but we have to define it anyway.  */
52
53 #ifndef ASM_OUTPUT_ADDR_VEC_ELT
54 #define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE)  \
55 do { fprintf (FILE, "\t%s\t", ASM_LONG);                                \
56      ASM_OUTPUT_INTERNAL_LABEL (FILE, "L", (VALUE));                    \
57      fputc ('\n', FILE);                                                \
58    } while (0)
59 #endif
60
61 /* Provide default for ASM_OUTPUT_ALTERNATE_LABEL_NAME.  */
62 #ifndef ASM_OUTPUT_ALTERNATE_LABEL_NAME
63 #define ASM_OUTPUT_ALTERNATE_LABEL_NAME(FILE,INSN) \
64 do { ASM_OUTPUT_LABEL(FILE,LABEL_ALTERNATE_NAME (INSN)); } while (0)
65 #endif
66
67 /* choose a reasonable default for ASM_OUTPUT_ASCII.  */
68
69 #ifndef ASM_OUTPUT_ASCII
70 #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
71   do {                                                                        \
72     FILE *_hide_asm_out_file = (MYFILE);                                      \
73     const unsigned char *_hide_p = (const unsigned char *) (MYSTRING);        \
74     int _hide_thissize = (MYLENGTH);                                          \
75     {                                                                         \
76       FILE *asm_out_file = _hide_asm_out_file;                                \
77       const unsigned char *p = _hide_p;                                       \
78       int thissize = _hide_thissize;                                          \
79       int i;                                                                  \
80       fprintf (asm_out_file, "\t.ascii \"");                                  \
81                                                                               \
82       for (i = 0; i < thissize; i++)                                          \
83         {                                                                     \
84           register int c = p[i];                                              \
85           if (c == '\"' || c == '\\')                                         \
86             putc ('\\', asm_out_file);                                        \
87           if (ISPRINT(c))                                                     \
88             putc (c, asm_out_file);                                           \
89           else                                                                \
90             {                                                                 \
91               fprintf (asm_out_file, "\\%o", c);                              \
92               /* After an octal-escape, if a digit follows,                   \
93                  terminate one string constant and start another.             \
94                  The Vax assembler fails to stop reading the escape           \
95                  after three digits, so this is the only way we               \
96                  can get it to parse the data properly.  */                   \
97               if (i < thissize - 1 && ISDIGIT(p[i + 1]))                      \
98                 fprintf (asm_out_file, "\"\n\t.ascii \"");                    \
99           }                                                                   \
100         }                                                                     \
101       fprintf (asm_out_file, "\"\n");                                         \
102     }                                                                         \
103   }                                                                           \
104   while (0)
105 #endif
106
107 #ifndef ASM_IDENTIFY_GCC
108   /* Default the definition, only if ASM_IDENTIFY_GCC is not set,
109      because if it is set, we might not want ASM_IDENTIFY_LANGUAGE
110      outputting labels, if we do want it to, then it must be defined
111      in the tm.h file.  */
112 #ifndef ASM_IDENTIFY_LANGUAGE
113 #define ASM_IDENTIFY_LANGUAGE(FILE) output_lang_identify (FILE);
114 #endif
115 #endif
116
117 /* This is how we tell the assembler to equate two values.  */
118 #ifdef SET_ASM_OP
119 #ifndef ASM_OUTPUT_DEF
120 #define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2)                              \
121  do {   fprintf ((FILE), "%s", SET_ASM_OP);                             \
122         assemble_name (FILE, LABEL1);                                   \
123         fprintf (FILE, ",");                                            \
124         assemble_name (FILE, LABEL2);                                   \
125         fprintf (FILE, "\n");                                           \
126   } while (0)
127 #endif
128 #endif
129
130 /* This is how to output a reference to a user-level label named NAME.  */
131
132 #ifndef ASM_OUTPUT_LABELREF
133 #define ASM_OUTPUT_LABELREF(FILE,NAME)  asm_fprintf ((FILE), "%U%s", (NAME))
134 #endif
135
136 /* Allow target to print debug info labels specially.  This is useful for
137    VLIW targets, since debug info labels should go into the middle of
138    instruction bundles instead of breaking them.  */
139
140 #ifndef ASM_OUTPUT_DEBUG_LABEL
141 #define ASM_OUTPUT_DEBUG_LABEL(FILE, PREFIX, NUM) \
142   ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM)
143 #endif
144
145 /* This determines whether or not we support weak symbols.  */
146 #ifndef SUPPORTS_WEAK
147 #ifdef ASM_WEAKEN_LABEL
148 #define SUPPORTS_WEAK 1
149 #else
150 #define SUPPORTS_WEAK 0
151 #endif
152 #endif
153
154 /* If the target supports weak symbols, define TARGET_ATTRIBUTE_WEAK to
155    provide a weak attribute.  Else define it to nothing. 
156
157    This would normally belong in gansidecl.h, but SUPPORTS_WEAK is
158    not available at that time.
159
160    Note, this is only for use by target files which we know are to be
161    compiled by GCC.  */
162 #ifndef TARGET_ATTRIBUTE_WEAK
163 # if SUPPORTS_WEAK
164 #  define TARGET_ATTRIBUTE_WEAK __attribute__ ((weak))
165 # else
166 #  define TARGET_ATTRIBUTE_WEAK
167 # endif
168 #endif
169
170 /* If we have a definition of INCOMING_RETURN_ADDR_RTX, assume that
171    the rest of the DWARF 2 frame unwind support is also provided.  */
172 #if !defined (DWARF2_UNWIND_INFO) && defined (INCOMING_RETURN_ADDR_RTX)
173 #define DWARF2_UNWIND_INFO 1
174 #endif
175
176 #if defined (DWARF2_UNWIND_INFO) && !defined (EH_FRAME_SECTION)
177 # if defined (EH_FRAME_SECTION_ASM_OP)
178 #  define EH_FRAME_SECTION() eh_frame_section ()
179 # else
180    /* If we aren't using crtstuff to run ctors, don't use it for EH.  */
181 #  if defined (ASM_OUTPUT_SECTION_NAME) && defined (ASM_OUTPUT_CONSTRUCTOR)
182 #   define EH_FRAME_SECTION_ASM_OP      "\t.section\t.eh_frame,\"aw\""
183 #   define EH_FRAME_SECTION() \
184      do { named_section (NULL_TREE, ".eh_frame", 0); } while (0)
185 #  endif
186 # endif
187 #endif
188
189 /* By default, we generate a label at the beginning and end of the
190    text section, and compute the size of the text section by
191    subtracting the two.  However, on some platforms that doesn't 
192    work, and we use the section itself, rather than a label at the
193    beginning of it, to indicate the start of the section.  On such
194    platforms, define this to zero.  */
195 #ifndef DWARF2_GENERATE_TEXT_SECTION_LABEL
196 #define DWARF2_GENERATE_TEXT_SECTION_LABEL 1
197 #endif
198
199 /* Supply a default definition for PROMOTE_PROTOTYPES.  */
200 #ifndef PROMOTE_PROTOTYPES
201 #define PROMOTE_PROTOTYPES      0
202 #endif
203
204 /* Number of hardware registers that go into the DWARF-2 unwind info.
205    If not defined, equals FIRST_PSEUDO_REGISTER  */
206
207 #ifndef DWARF_FRAME_REGISTERS
208 #define DWARF_FRAME_REGISTERS FIRST_PSEUDO_REGISTER
209 #endif
210
211 /* Default sizes for base C types.  If the sizes are different for
212    your target, you should override these values by defining the
213    appropriate symbols in your tm.h file.  */
214
215 #ifndef CHAR_TYPE_SIZE
216 #define CHAR_TYPE_SIZE BITS_PER_UNIT
217 #endif
218
219 #ifndef SHORT_TYPE_SIZE
220 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
221 #endif
222
223 #ifndef INT_TYPE_SIZE
224 #define INT_TYPE_SIZE BITS_PER_WORD
225 #endif
226
227 #ifndef LONG_TYPE_SIZE
228 #define LONG_TYPE_SIZE BITS_PER_WORD
229 #endif
230
231 #ifndef LONG_LONG_TYPE_SIZE
232 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
233 #endif
234
235 #ifndef WCHAR_TYPE_SIZE
236 #define WCHAR_TYPE_SIZE INT_TYPE_SIZE
237 #endif
238
239 #ifndef WCHAR_UNSIGNED
240 #define WCHAR_UNSIGNED 0
241 #endif
242
243 #ifndef FLOAT_TYPE_SIZE
244 #define FLOAT_TYPE_SIZE BITS_PER_WORD
245 #endif
246
247 #ifndef DOUBLE_TYPE_SIZE
248 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
249 #endif
250
251 #ifndef LONG_DOUBLE_TYPE_SIZE
252 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
253 #endif
254
255 #ifndef BUILD_VA_LIST_TYPE
256 #define BUILD_VA_LIST_TYPE(X) ((X) = ptr_type_node)
257 #endif
258
259 #endif  /* GCC_DEFAULTS_H */
260