* $(HOST_PREFIX_1)errors.o, $(HOST_PREFIX_1)ggc-none.o,
[official-gcc.git] / gcc / libgcc2.h
blob7a26e33ea0b2375276f474c95bd60c2a7d2ff790
1 /* Header file for libgcc2.c. */
2 /* Copyright (C) 2000, 2001
3 Free Software Foundation, Inc.
5 This file is part of GNU CC.
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING. If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
22 #ifndef __LIBGCC2_H__
23 #define __LIBGCC2_H__
25 typedef void (*__terminate_func_ptr)(void) __attribute__ ((__noreturn__));
27 extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t);
28 extern void *__builtin_saveregs (void);
29 extern void __dummy (void);
30 extern void __clear_cache (char *, char *);
31 extern void __pure_virtual (void) __attribute__ ((__noreturn__));
32 extern void __terminate (void) __attribute__ ((__noreturn__));
33 extern __terminate_func_ptr __terminate_set_func (__terminate_func_ptr);
34 extern void __default_terminate (void) __attribute__ ((__noreturn__));
35 extern void *__throw_type_match (void *, void *, void *);
36 extern void __empty (void);
37 extern void *__get_eh_context (void);
38 extern void **__get_eh_info (void);
39 extern void ***__get_dynamic_handler_chain (void);
40 extern int __eh_rtime_match (void *);
41 extern void __unwinding_cleanup (void);
42 extern void __rethrow (void *);
43 extern void __throw (void);
44 extern void __sjthrow (void) __attribute__ ((__noreturn__));
45 extern void __sjpopnthrow (void) __attribute__ ((__noreturn__));
46 extern void __eprintf (const char *, const char *, unsigned int, const char *)
47 __attribute__ ((__noreturn__));
48 extern void *__eh_alloc (size_t);
49 extern void __eh_free (void *);
51 struct bb;
52 extern void __bb_exit_func (void);
53 extern void __bb_init_func (struct bb *);
54 extern void __bb_fork_func (void);
55 extern void __bb_trace_func (void);
56 extern void __bb_trace_ret (void);
57 extern void __bb_init_trace_func (struct bb *, unsigned long);
59 struct exception_descriptor;
60 extern short int __get_eh_table_language (struct exception_descriptor *);
61 extern short int __get_eh_table_version (struct exception_descriptor *);
63 /* Permit the tm.h file to select the endianness to use just for this
64 file. This is used when the endianness is determined when the
65 compiler is run. */
67 #ifndef LIBGCC2_WORDS_BIG_ENDIAN
68 #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
69 #endif
71 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
72 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
73 #endif
75 #ifndef MIN_UNITS_PER_WORD
76 #define MIN_UNITS_PER_WORD UNITS_PER_WORD
77 #endif
79 /* In the first part of this file, we are interfacing to calls generated
80 by the compiler itself. These calls pass values into these routines
81 which have very specific modes (rather than very specific types), and
82 these compiler-generated calls also expect any return values to have
83 very specific modes (rather than very specific types). Thus, we need
84 to avoid using regular C language type names in this part of the file
85 because the sizes for those types can be configured to be anything.
86 Instead we use the following special type names. */
88 typedef int QItype __attribute__ ((mode (QI)));
89 typedef unsigned int UQItype __attribute__ ((mode (QI)));
90 typedef int HItype __attribute__ ((mode (HI)));
91 typedef unsigned int UHItype __attribute__ ((mode (HI)));
92 #if MIN_UNITS_PER_WORD > 1
93 /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1 */
94 typedef int SItype __attribute__ ((mode (SI)));
95 typedef unsigned int USItype __attribute__ ((mode (SI)));
96 #if LONG_LONG_TYPE_SIZE > 32
97 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2 */
98 typedef int DItype __attribute__ ((mode (DI)));
99 typedef unsigned int UDItype __attribute__ ((mode (DI)));
100 #if MIN_UNITS_PER_WORD > 4
101 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4 */
102 typedef int TItype __attribute__ ((mode (TI)));
103 typedef unsigned int UTItype __attribute__ ((mode (TI)));
104 #endif
105 #endif
106 #endif
108 #if BITS_PER_UNIT == 8
110 typedef float SFtype __attribute__ ((mode (SF)));
111 typedef float DFtype __attribute__ ((mode (DF)));
113 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
114 typedef float XFtype __attribute__ ((mode (XF)));
115 #endif
116 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
117 typedef float TFtype __attribute__ ((mode (TF)));
118 #endif
120 #else /* BITS_PER_UNIT != 8 */
122 /* On dsp's there are usually qf/hf/tqf modes used instead of the above.
123 For now we don't support them in libgcc2.c. */
125 #undef L_fixdfdi
126 #undef L_fixsfdi
127 #undef L_fixtfdi
128 #undef L_fixunsdfdi
129 #undef L_fixunsdfsi
130 #undef L_fixunssfdi
131 #undef L_fixunssfsi
132 #undef L_fixunstfdi
133 #undef L_fixunsxfdi
134 #undef L_fixunsxfsi
135 #undef L_fixxfdi
136 #undef L_floatdidf
137 #undef L_floatdisf
138 #undef L_floatditf
139 #undef L_floatdixf
141 #endif /* BITS_PER_UNIT != 8 */
143 typedef int word_type __attribute__ ((mode (__word__)));
145 /* Make sure that we don't accidentally use any normal C language built-in
146 type names in the first part of this file. Instead we want to use *only*
147 the type names defined above. The following macro definitions insure
148 that if we *do* accidentally use some normal C language built-in type name,
149 we will get a syntax error. */
151 #define char bogus_type
152 #define short bogus_type
153 #define int bogus_type
154 #define long bogus_type
155 #define unsigned bogus_type
156 #define float bogus_type
157 #define double bogus_type
159 #if MIN_UNITS_PER_WORD > 4
160 #define W_TYPE_SIZE (8 * BITS_PER_UNIT)
161 #define Wtype DItype
162 #define UWtype UDItype
163 #define HWtype DItype
164 #define UHWtype UDItype
165 #define DWtype TItype
166 #define UDWtype UTItype
167 #define __NW(a,b) __ ## a ## di ## b
168 #define __NDW(a,b) __ ## a ## ti ## b
169 #elif MIN_UNITS_PER_WORD > 2 \
170 || (MIN_UNITS_PER_WORD > 1 && LONG_LONG_TYPE_SIZE > 32)
171 #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
172 #define Wtype SItype
173 #define UWtype USItype
174 #define HWtype SItype
175 #define UHWtype USItype
176 #define DWtype DItype
177 #define UDWtype UDItype
178 #define __NW(a,b) __ ## a ## si ## b
179 #define __NDW(a,b) __ ## a ## di ## b
180 #elif MIN_UNITS_PER_WORD > 1
181 #define W_TYPE_SIZE (2 * BITS_PER_UNIT)
182 #define Wtype HItype
183 #define UWtype UHItype
184 #define HWtype HItype
185 #define UHWtype UHItype
186 #define DWtype SItype
187 #define UDWtype USItype
188 #define __NW(a,b) __ ## a ## hi ## b
189 #define __NDW(a,b) __ ## a ## si ## b
190 #else
191 #define W_TYPE_SIZE BITS_PER_UNIT
192 #define Wtype QItype
193 #define UWtype UQItype
194 #define HWtype QItype
195 #define UHWtype UQItype
196 #define DWtype HItype
197 #define UDWtype UHItype
198 #define __NW(a,b) __ ## a ## qi ## b
199 #define __NDW(a,b) __ ## a ## hi ## b
200 #endif
202 #define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1))
203 #define Wtype_MIN (- Wtype_MAX - 1)
205 #define __muldi3 __NDW(mul,3)
206 #define __divdi3 __NDW(div,3)
207 #define __udivdi3 __NDW(udiv,3)
208 #define __moddi3 __NDW(mod,3)
209 #define __umoddi3 __NDW(umod,3)
210 #define __negdi2 __NDW(neg,2)
211 #define __lshrdi3 __NDW(lshr,3)
212 #define __ashldi3 __NDW(ashl,3)
213 #define __ashrdi3 __NDW(ashr,3)
214 #define __ffsdi2 __NDW(ffs,2)
215 #define __cmpdi2 __NDW(cmp,2)
216 #define __ucmpdi2 __NDW(ucmp,2)
217 #define __udivmoddi4 __NDW(udivmod,4)
218 #define __fixunstfDI __NDW(fixunstf,)
219 #define __fixtfdi __NDW(fixtf,)
220 #define __fixunsxfDI __NDW(fixunsxf,)
221 #define __fixxfdi __NDW(fixxf,)
222 #define __fixunsdfDI __NDW(fixunsdf,)
223 #define __fixdfdi __NDW(fixdf,)
224 #define __fixunssfDI __NDW(fixunssf,)
225 #define __fixsfdi __NDW(fixsf,)
226 #define __floatdixf __NDW(float,xf)
227 #define __floatditf __NDW(float,tf)
228 #define __floatdidf __NDW(float,df)
229 #define __floatdisf __NDW(float,sf)
230 #define __fixunsxfSI __NW(fixunsxf,)
231 #define __fixunstfSI __NW(fixunstf,)
232 #define __fixunsdfSI __NW(fixunsdf,)
233 #define __fixunssfSI __NW(fixunssf,)
235 extern DWtype __muldi3 (DWtype, DWtype);
236 extern DWtype __divdi3 (DWtype, DWtype);
237 extern UDWtype __udivdi3 (UDWtype, UDWtype);
238 extern UDWtype __umoddi3 (UDWtype, UDWtype);
239 extern DWtype __moddi3 (DWtype, DWtype);
241 /* __udivmoddi4 is static inline when building other libgcc2 portions. */
242 #if (!defined (L_udivdi3) && !defined (L_divdi3) && \
243 !defined (L_umoddi3) && !defined (L_moddi3))
244 extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
245 #endif
247 /* __negdi2 is static inline when building other libgcc2 portions. */
248 #if !defined(L_divdi3) && !defined(L_moddi3)
249 extern DWtype __negdi2 (DWtype);
250 #endif
252 extern DWtype __lshrdi3 (DWtype, word_type);
253 extern DWtype __ashldi3 (DWtype, word_type);
254 extern DWtype __ashrdi3 (DWtype, word_type);
255 extern DWtype __ffsdi2 (DWtype);
257 /* __udiv_w_sdiv is static inline when building other libgcc2 portions. */
258 #if (!defined(L_udivdi3) && !defined(L_divdi3) && \
259 !defined(L_umoddi3) && !defined(L_moddi3))
260 extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
261 #endif
263 extern word_type __cmpdi2 (DWtype, DWtype);
264 extern word_type __ucmpdi2 (DWtype, DWtype);
266 extern Wtype __absvsi2 (Wtype);
267 extern DWtype __absvdi2 (DWtype);
268 extern Wtype __addvsi3 (Wtype, Wtype);
269 extern DWtype __addvdi3 (DWtype, DWtype);
270 extern Wtype __subvsi3 (Wtype, Wtype);
271 extern DWtype __subvdi3 (DWtype, DWtype);
272 extern Wtype __mulvsi3 (Wtype, Wtype);
273 extern DWtype __mulvdi3 (DWtype, DWtype);
274 extern Wtype __negvsi2 (Wtype);
275 extern DWtype __negvdi2 (DWtype);
277 #if BITS_PER_UNIT == 8
278 extern DWtype __fixdfdi (DFtype);
279 extern DWtype __fixsfdi (SFtype);
280 extern DFtype __floatdidf (DWtype);
281 extern SFtype __floatdisf (DWtype);
282 extern UWtype __fixunsdfSI (DFtype);
283 extern UWtype __fixunssfSI (SFtype);
284 extern DWtype __fixunsdfDI (DFtype);
285 extern DWtype __fixunssfDI (SFtype);
287 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
288 extern DWtype __fixxfdi (XFtype);
289 extern DWtype __fixunsxfDI (XFtype);
290 extern XFtype __floatdixf (DWtype);
291 extern UWtype __fixunsxfSI (XFtype);
292 #endif
294 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
295 extern DWtype __fixunstfDI (TFtype);
296 extern DWtype __fixtfdi (TFtype);
297 extern TFtype __floatditf (DWtype);
298 #endif
299 #endif /* BITS_PER_UNIT == 8 */
301 /* DWstructs are pairs of Wtype values in the order determined by
302 LIBGCC2_WORDS_BIG_ENDIAN. */
304 #if LIBGCC2_WORDS_BIG_ENDIAN
305 struct DWstruct {Wtype high, low;};
306 #else
307 struct DWstruct {Wtype low, high;};
308 #endif
310 /* We need this union to unpack/pack DImode values, since we don't have
311 any arithmetic yet. Incoming DImode parameters are stored into the
312 `ll' field, and the unpacked result is read from the struct `s'. */
314 typedef union
316 struct DWstruct s;
317 DWtype ll;
318 } DWunion;
320 #include "longlong.h"
322 #endif /* __LIBGCC2_H__ */