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)
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. */
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 __clear_cache (char *, char *);
29 extern void __pure_virtual (void) __attribute__ ((__noreturn__
));
30 extern void __terminate (void) __attribute__ ((__noreturn__
));
31 extern __terminate_func_ptr
__terminate_set_func (__terminate_func_ptr
);
32 extern void __default_terminate (void) __attribute__ ((__noreturn__
));
33 extern void *__throw_type_match (void *, void *, void *);
34 extern void *__get_eh_context (void);
35 extern void **__get_eh_info (void);
36 extern void ***__get_dynamic_handler_chain (void);
37 extern int __eh_rtime_match (void *);
38 extern void __unwinding_cleanup (void);
39 extern void __rethrow (void *);
40 extern void __throw (void);
41 extern void __sjthrow (void) __attribute__ ((__noreturn__
));
42 extern void __sjpopnthrow (void) __attribute__ ((__noreturn__
));
43 extern void __eprintf (const char *, const char *, unsigned int, const char *)
44 __attribute__ ((__noreturn__
));
45 extern void *__eh_alloc (size_t);
46 extern void __eh_free (void *);
49 extern void __bb_exit_func (void);
50 extern void __bb_init_func (struct bb
*);
51 extern void __bb_fork_func (void);
52 extern void __bb_trace_func (void);
53 extern void __bb_trace_ret (void);
54 extern void __bb_init_trace_func (struct bb
*, unsigned long);
56 struct exception_descriptor
;
57 extern short int __get_eh_table_language (struct exception_descriptor
*);
58 extern short int __get_eh_table_version (struct exception_descriptor
*);
60 /* Permit the tm.h file to select the endianness to use just for this
61 file. This is used when the endianness is determined when the
64 #ifndef LIBGCC2_WORDS_BIG_ENDIAN
65 #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
68 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
69 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
72 #ifndef MIN_UNITS_PER_WORD
73 #define MIN_UNITS_PER_WORD UNITS_PER_WORD
76 /* In the first part of this file, we are interfacing to calls generated
77 by the compiler itself. These calls pass values into these routines
78 which have very specific modes (rather than very specific types), and
79 these compiler-generated calls also expect any return values to have
80 very specific modes (rather than very specific types). Thus, we need
81 to avoid using regular C language type names in this part of the file
82 because the sizes for those types can be configured to be anything.
83 Instead we use the following special type names. */
85 typedef int QItype
__attribute__ ((mode (QI
)));
86 typedef unsigned int UQItype
__attribute__ ((mode (QI
)));
87 typedef int HItype
__attribute__ ((mode (HI
)));
88 typedef unsigned int UHItype
__attribute__ ((mode (HI
)));
89 #if MIN_UNITS_PER_WORD > 1
90 /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1 */
91 typedef int SItype
__attribute__ ((mode (SI
)));
92 typedef unsigned int USItype
__attribute__ ((mode (SI
)));
93 #if LONG_LONG_TYPE_SIZE > 32
94 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2 */
95 typedef int DItype
__attribute__ ((mode (DI
)));
96 typedef unsigned int UDItype
__attribute__ ((mode (DI
)));
97 /* We cannot represent a TItype constant on a machine with 32-bit
98 HOST_WIDE_INTs, so it doesn't make sense to define these types. */
99 #if MIN_UNITS_PER_WORD > 4 && HOST_BITS_PER_WIDE_INT >= 64
100 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4 */
101 typedef int TItype
__attribute__ ((mode (TI
)));
102 typedef unsigned int UTItype
__attribute__ ((mode (TI
)));
107 #if BITS_PER_UNIT == 8
109 typedef float SFtype
__attribute__ ((mode (SF
)));
110 typedef float DFtype
__attribute__ ((mode (DF
)));
112 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
113 typedef float XFtype
__attribute__ ((mode (XF
)));
115 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
116 typedef float TFtype
__attribute__ ((mode (TF
)));
119 #else /* BITS_PER_UNIT != 8 */
121 /* On dsp's there are usually qf/hf/tqf modes used instead of the above.
122 For now we don't support them in libgcc2.c. */
140 #endif /* BITS_PER_UNIT != 8 */
142 typedef int word_type
__attribute__ ((mode (__word__
)));
144 /* Make sure that we don't accidentally use any normal C language built-in
145 type names in the first part of this file. Instead we want to use *only*
146 the type names defined above. The following macro definitions insure
147 that if we *do* accidentally use some normal C language built-in type name,
148 we will get a syntax error. */
150 #define char bogus_type
151 #define short bogus_type
152 #define int bogus_type
153 #define long bogus_type
154 #define unsigned bogus_type
155 #define float bogus_type
156 #define double bogus_type
158 /* We can only support a Wtype that fits within a HOST_WIDE_INT. Otherwise,
159 DWtype overflows the tree and RTL types. */
160 #if MIN_UNITS_PER_WORD > 4 && HOST_BITS_PER_WIDE_INT >= 64
161 #define W_TYPE_SIZE (8 * BITS_PER_UNIT)
163 #define UWtype UDItype
164 #define HWtype DItype
165 #define UHWtype UDItype
166 #define DWtype TItype
167 #define UDWtype UTItype
168 #define __NW(a,b) __ ## a ## di ## b
169 #define __NDW(a,b) __ ## a ## ti ## b
170 #elif MIN_UNITS_PER_WORD > 2 \
171 || (MIN_UNITS_PER_WORD > 1 && LONG_LONG_TYPE_SIZE > 32)
172 #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
174 #define UWtype USItype
175 #define HWtype SItype
176 #define UHWtype USItype
177 #define DWtype DItype
178 #define UDWtype UDItype
179 #define __NW(a,b) __ ## a ## si ## b
180 #define __NDW(a,b) __ ## a ## di ## b
181 #elif MIN_UNITS_PER_WORD > 1
182 #define W_TYPE_SIZE (2 * BITS_PER_UNIT)
184 #define UWtype UHItype
185 #define HWtype HItype
186 #define UHWtype UHItype
187 #define DWtype SItype
188 #define UDWtype USItype
189 #define __NW(a,b) __ ## a ## hi ## b
190 #define __NDW(a,b) __ ## a ## si ## b
192 #define W_TYPE_SIZE BITS_PER_UNIT
194 #define UWtype UQItype
195 #define HWtype QItype
196 #define UHWtype UQItype
197 #define DWtype HItype
198 #define UDWtype UHItype
199 #define __NW(a,b) __ ## a ## qi ## b
200 #define __NDW(a,b) __ ## a ## hi ## b
203 #define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1))
204 #define Wtype_MIN (- Wtype_MAX - 1)
206 #define __muldi3 __NDW(mul,3)
207 #define __divdi3 __NDW(div,3)
208 #define __udivdi3 __NDW(udiv,3)
209 #define __moddi3 __NDW(mod,3)
210 #define __umoddi3 __NDW(umod,3)
211 #define __negdi2 __NDW(neg,2)
212 #define __lshrdi3 __NDW(lshr,3)
213 #define __ashldi3 __NDW(ashl,3)
214 #define __ashrdi3 __NDW(ashr,3)
215 #define __ffsdi2 __NDW(ffs,2)
216 #define __cmpdi2 __NDW(cmp,2)
217 #define __ucmpdi2 __NDW(ucmp,2)
218 #define __udivmoddi4 __NDW(udivmod,4)
219 #define __fixunstfDI __NDW(fixunstf,)
220 #define __fixtfdi __NDW(fixtf,)
221 #define __fixunsxfDI __NDW(fixunsxf,)
222 #define __fixxfdi __NDW(fixxf,)
223 #define __fixunsdfDI __NDW(fixunsdf,)
224 #define __fixdfdi __NDW(fixdf,)
225 #define __fixunssfDI __NDW(fixunssf,)
226 #define __fixsfdi __NDW(fixsf,)
227 #define __floatdixf __NDW(float,xf)
228 #define __floatditf __NDW(float,tf)
229 #define __floatdidf __NDW(float,df)
230 #define __floatdisf __NDW(float,sf)
231 #define __fixunsxfSI __NW(fixunsxf,)
232 #define __fixunstfSI __NW(fixunstf,)
233 #define __fixunsdfSI __NW(fixunsdf,)
234 #define __fixunssfSI __NW(fixunssf,)
236 extern DWtype
__muldi3 (DWtype
, DWtype
);
237 extern DWtype
__divdi3 (DWtype
, DWtype
);
238 extern UDWtype
__udivdi3 (UDWtype
, UDWtype
);
239 extern UDWtype
__umoddi3 (UDWtype
, UDWtype
);
240 extern DWtype
__moddi3 (DWtype
, DWtype
);
242 /* __udivmoddi4 is static inline when building other libgcc2 portions. */
243 #if (!defined (L_udivdi3) && !defined (L_divdi3) && \
244 !defined (L_umoddi3) && !defined (L_moddi3))
245 extern UDWtype
__udivmoddi4 (UDWtype
, UDWtype
, UDWtype
*);
248 /* __negdi2 is static inline when building other libgcc2 portions. */
249 #if !defined(L_divdi3) && !defined(L_moddi3)
250 extern DWtype
__negdi2 (DWtype
);
253 extern DWtype
__lshrdi3 (DWtype
, word_type
);
254 extern DWtype
__ashldi3 (DWtype
, word_type
);
255 extern DWtype
__ashrdi3 (DWtype
, word_type
);
256 extern DWtype
__ffsdi2 (DWtype
);
258 /* __udiv_w_sdiv is static inline when building other libgcc2 portions. */
259 #if (!defined(L_udivdi3) && !defined(L_divdi3) && \
260 !defined(L_umoddi3) && !defined(L_moddi3))
261 extern UWtype
__udiv_w_sdiv (UWtype
*, UWtype
, UWtype
, UWtype
);
264 extern word_type
__cmpdi2 (DWtype
, DWtype
);
265 extern word_type
__ucmpdi2 (DWtype
, DWtype
);
267 extern Wtype
__absvsi2 (Wtype
);
268 extern DWtype
__absvdi2 (DWtype
);
269 extern Wtype
__addvsi3 (Wtype
, Wtype
);
270 extern DWtype
__addvdi3 (DWtype
, DWtype
);
271 extern Wtype
__subvsi3 (Wtype
, Wtype
);
272 extern DWtype
__subvdi3 (DWtype
, DWtype
);
273 extern Wtype
__mulvsi3 (Wtype
, Wtype
);
274 extern DWtype
__mulvdi3 (DWtype
, DWtype
);
275 extern Wtype
__negvsi2 (Wtype
);
276 extern DWtype
__negvdi2 (DWtype
);
278 #if BITS_PER_UNIT == 8
279 extern DWtype
__fixdfdi (DFtype
);
280 extern DWtype
__fixsfdi (SFtype
);
281 extern DFtype
__floatdidf (DWtype
);
282 extern SFtype
__floatdisf (DWtype
);
283 extern UWtype
__fixunsdfSI (DFtype
);
284 extern UWtype
__fixunssfSI (SFtype
);
285 extern DWtype
__fixunsdfDI (DFtype
);
286 extern DWtype
__fixunssfDI (SFtype
);
288 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
289 extern DWtype
__fixxfdi (XFtype
);
290 extern DWtype
__fixunsxfDI (XFtype
);
291 extern XFtype
__floatdixf (DWtype
);
292 extern UWtype
__fixunsxfSI (XFtype
);
295 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
296 extern DWtype
__fixunstfDI (TFtype
);
297 extern DWtype
__fixtfdi (TFtype
);
298 extern TFtype
__floatditf (DWtype
);
300 #endif /* BITS_PER_UNIT == 8 */
302 /* DWstructs are pairs of Wtype values in the order determined by
303 LIBGCC2_WORDS_BIG_ENDIAN. */
305 #if LIBGCC2_WORDS_BIG_ENDIAN
306 struct DWstruct
{Wtype high
, low
;};
308 struct DWstruct
{Wtype low
, high
;};
311 /* We need this union to unpack/pack DImode values, since we don't have
312 any arithmetic yet. Incoming DImode parameters are stored into the
313 `ll' field, and the unpacked result is read from the struct `s'. */
321 #include "longlong.h"
323 #endif /* __LIBGCC2_H__ */