31f5a96c1ad56ef2fcfb24f9cc8b01f09fc13b90
1 /* Header file for libgcc2.c. */
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 extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t);
26 extern void *__builtin_saveregs (void);
27 extern void __dummy (void);
28 extern void __clear_cache (char *, char *);
29 extern void __pure_virtual (void) __attribute__ ((__noreturn__
));
30 extern void __terminate (void) __attribute__ ((__noreturn__
));
31 extern void __default_terminate (void) __attribute__ ((__noreturn__
));
32 extern void *__throw_type_match (void *, void *, void *);
33 extern void __empty (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__
));
47 extern void __bb_exit_func (void);
48 extern void __bb_init_func (struct bb
*);
49 extern void __bb_fork_func (void);
50 extern void __bb_trace_func (void);
51 extern void __bb_trace_ret (void);
52 extern void __bb_init_trace_func (struct bb
*, unsigned long);
54 struct exception_descriptor
;
55 extern short int __get_eh_table_language (struct exception_descriptor
*);
56 extern short int __get_eh_table_version (struct exception_descriptor
*);
58 /* Permit the tm.h file to select the endianness to use just for this
59 file. This is used when the endianness is determined when the
62 #ifndef LIBGCC2_WORDS_BIG_ENDIAN
63 #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
66 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
67 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
70 #ifndef MIN_UNITS_PER_WORD
71 #define MIN_UNITS_PER_WORD UNITS_PER_WORD
74 /* In the first part of this file, we are interfacing to calls generated
75 by the compiler itself. These calls pass values into these routines
76 which have very specific modes (rather than very specific types), and
77 these compiler-generated calls also expect any return values to have
78 very specific modes (rather than very specific types). Thus, we need
79 to avoid using regular C language type names in this part of the file
80 because the sizes for those types can be configured to be anything.
81 Instead we use the following special type names. */
83 typedef int QItype
__attribute__ ((mode (QI
)));
84 typedef unsigned int UQItype
__attribute__ ((mode (QI
)));
85 typedef int HItype
__attribute__ ((mode (HI
)));
86 typedef unsigned int UHItype
__attribute__ ((mode (HI
)));
87 #if MIN_UNITS_PER_WORD > 1
88 /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1 */
89 typedef int SItype
__attribute__ ((mode (SI
)));
90 typedef unsigned int USItype
__attribute__ ((mode (SI
)));
91 #if MIN_UNITS_PER_WORD > 2
92 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2 */
93 typedef int DItype
__attribute__ ((mode (DI
)));
94 typedef unsigned int UDItype
__attribute__ ((mode (DI
)));
95 #if MIN_UNITS_PER_WORD > 4
96 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4 */
97 typedef int TItype
__attribute__ ((mode (TI
)));
98 typedef unsigned int UTItype
__attribute__ ((mode (TI
)));
103 #if BITS_PER_UNIT == 8
105 typedef float SFtype
__attribute__ ((mode (SF
)));
106 typedef float DFtype
__attribute__ ((mode (DF
)));
108 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
109 typedef float XFtype
__attribute__ ((mode (XF
)));
111 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
112 typedef float TFtype
__attribute__ ((mode (TF
)));
115 #else /* BITS_PER_UNIT != 8 */
117 /* On dsp's there are usually qf/hf/tqf modes used instead of the above.
118 For now we don't support them in libgcc2.c. */
136 #endif /* BITS_PER_UNIT != 8 */
138 typedef int word_type
__attribute__ ((mode (__word__
)));
140 /* Make sure that we don't accidentally use any normal C language built-in
141 type names in the first part of this file. Instead we want to use *only*
142 the type names defined above. The following macro definitions insure
143 that if we *do* accidentally use some normal C language built-in type name,
144 we will get a syntax error. */
146 #define char bogus_type
147 #define short bogus_type
148 #define int bogus_type
149 #define long bogus_type
150 #define unsigned bogus_type
151 #define float bogus_type
152 #define double bogus_type
154 #if MIN_UNITS_PER_WORD > 4
155 #define W_TYPE_SIZE (8 * BITS_PER_UNIT)
157 #define UWtype UDItype
158 #define HWtype DItype
159 #define UHWtype UDItype
160 #define DWtype TItype
161 #define UDWtype UTItype
162 #define __NW(a,b) __ ## a ## di ## b
163 #define __NDW(a,b) __ ## a ## ti ## b
164 #elif MIN_UNITS_PER_WORD > 2
165 #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
167 #define UWtype USItype
168 #define HWtype SItype
169 #define UHWtype USItype
170 #define DWtype DItype
171 #define UDWtype UDItype
172 #define __NW(a,b) __ ## a ## si ## b
173 #define __NDW(a,b) __ ## a ## di ## b
174 #elif MIN_UNITS_PER_WORD > 1
175 #define W_TYPE_SIZE (2 * BITS_PER_UNIT)
177 #define UWtype UHItype
178 #define HWtype HItype
179 #define UHWtype UHItype
180 #define DWtype SItype
181 #define UDWtype USItype
182 #define __NW(a,b) __ ## a ## hi ## b
183 #define __NDW(a,b) __ ## a ## si ## b
185 #define W_TYPE_SIZE BITS_PER_UNIT
187 #define UWtype UQItype
188 #define HWtype QItype
189 #define UHWtype UQItype
190 #define DWtype HItype
191 #define UDWtype UHItype
192 #define __NW(a,b) __ ## a ## qi ## b
193 #define __NDW(a,b) __ ## a ## hi ## b
196 #define __muldi3 __NDW(mul,3)
197 #define __divdi3 __NDW(div,3)
198 #define __udivdi3 __NDW(udiv,3)
199 #define __moddi3 __NDW(mod,3)
200 #define __umoddi3 __NDW(umod,3)
201 #define __negdi2 __NDW(neg,2)
202 #define __lshrdi3 __NDW(lshr,3)
203 #define __ashldi3 __NDW(ashl,3)
204 #define __ashrdi3 __NDW(ashr,3)
205 #define __ffsdi2 __NDW(ffs,2)
206 #define __cmpdi2 __NDW(cmp,2)
207 #define __ucmpdi2 __NDW(ucmp,2)
208 #define __udivmoddi4 __NDW(udivmod,4)
209 #define __fixunstfDI __NDW(fixunstf,)
210 #define __fixtfdi __NDW(fixtf,)
211 #define __fixunsxfDI __NDW(fixunsxf,)
212 #define __fixxfdi __NDW(fixxf,)
213 #define __fixunsdfDI __NDW(fixunsdf,)
214 #define __fixdfdi __NDW(fixdf,)
215 #define __fixunssfDI __NDW(fixunssf,)
216 #define __fixsfdi __NDW(fixsf,)
217 #define __floatdixf __NDW(float,xf)
218 #define __floatditf __NDW(float,tf)
219 #define __floatdidf __NDW(float,df)
220 #define __floatdisf __NDW(float,sf)
221 #define __fixunsxfSI __NW(fixunsxf,)
222 #define __fixunstfSI __NW(fixunstf,)
223 #define __fixunsdfSI __NW(fixunsdf,)
224 #define __fixunssfSI __NW(fixunssf,)
226 extern DWtype
__muldi3 (DWtype
, DWtype
);
227 extern DWtype
__divdi3 (DWtype
, DWtype
);
228 extern UDWtype
__udivdi3 (UDWtype
, UDWtype
);
229 extern UDWtype
__umoddi3 (UDWtype
, UDWtype
);
230 extern DWtype
__moddi3 (DWtype
, DWtype
);
232 /* __udivmoddi4 is static inline when building other libgcc2 portions. */
233 #if (!defined (L_udivdi3) && !defined (L_divdi3) && \
234 !defined (L_umoddi3) && !defined (L_moddi3))
235 extern UDWtype
__udivmoddi4 (UDWtype
, UDWtype
, UDWtype
*);
238 /* __negdi2 is static inline when building other libgcc2 portions. */
239 #if !defined(L_divdi3) && !defined(L_moddi3)
240 extern DWtype
__negdi2 (DWtype
);
243 extern DWtype
__lshrdi3 (DWtype
, word_type
);
244 extern DWtype
__ashldi3 (DWtype
, word_type
);
245 extern DWtype
__ashrdi3 (DWtype
, word_type
);
246 extern DWtype
__ffsdi2 (DWtype
);
248 /* __udiv_w_sdiv is static inline when building other libgcc2 portions. */
249 #if (!defined(L_udivdi3) && !defined(L_divdi3) && \
250 !defined(L_umoddi3) && !defined(L_moddi3))
251 extern UWtype
__udiv_w_sdiv (UWtype
*, UWtype
, UWtype
, UWtype
);
254 extern word_type
__cmpdi2 (DWtype
, DWtype
);
255 extern word_type
__ucmpdi2 (DWtype
, DWtype
);
257 #if BITS_PER_UNIT == 8
258 extern DWtype
__fixdfdi (DFtype
);
259 extern DWtype
__fixsfdi (SFtype
);
260 extern DFtype
__floatdidf (DWtype
);
261 extern SFtype
__floatdisf (DWtype
);
262 extern UWtype
__fixunsdfSI (DFtype
);
263 extern UWtype
__fixunssfSI (SFtype
);
264 extern DWtype
__fixunsdfDI (DFtype
);
265 extern DWtype
__fixunssfDI (SFtype
);
267 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
268 extern DWtype
__fixxfdi (XFtype
);
269 extern DWtype
__fixunsxfDI (XFtype
);
270 extern XFtype
__floatdixf (DWtype
);
271 extern UWtype
__fixunsxfSI (XFtype
);
274 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
275 extern DWtype
__fixunstfDI (TFtype
);
276 extern DWtype
__fixtfdi (TFtype
);
277 extern TFtype
__floatditf (DWtype
);
279 #endif /* BITS_PER_UNIT == 8 */
281 /* DWstructs are pairs of Wtype values in the order determined by
282 LIBGCC2_WORDS_BIG_ENDIAN. */
284 #if LIBGCC2_WORDS_BIG_ENDIAN
285 struct DWstruct
{Wtype high
, low
;};
287 struct DWstruct
{Wtype low
, high
;};
290 /* We need this union to unpack/pack DImode values, since we don't have
291 any arithmetic yet. Incoming DImode parameters are stored into the
292 `ll' field, and the unpacked result is read from the struct `s'. */
300 #if (defined (L_udivmoddi4) || defined (L_muldi3) || defined (L_udiv_w_sdiv)\
301 || defined (L_divdi3) || defined (L_udivdi3) \
302 || defined (L_moddi3) || defined (L_umoddi3))
304 #include "longlong.h"
306 #endif /* udiv or mul */
308 #endif /* __LIBGCC2_H__ */