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. */
22 /* As a special exception, if you link this library with other files,
23 some of which are compiled with GCC, to produce an executable,
24 this library does not by itself cause the resulting executable
25 to be covered by the GNU General Public License.
26 This exception does not however invalidate any other reasons why
27 the executable file might be covered by the GNU General Public License. */
32 extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t);
33 extern void *__builtin_saveregs (void);
34 extern void __dummy (void);
35 extern void __clear_cache (char *, char *);
36 extern void __pure_virtual (void) __attribute__ ((__noreturn__
));
37 extern void __terminate (void) __attribute__ ((__noreturn__
));
38 extern void __default_terminate (void) __attribute__ ((__noreturn__
));
39 extern void *__throw_type_match (void *, void *, void *);
40 extern void __empty (void);
41 extern void *__get_eh_context (void);
42 extern void **__get_eh_info (void);
43 extern void ***__get_dynamic_handler_chain (void);
44 extern int __eh_rtime_match (void *);
45 extern void __unwinding_cleanup (void);
46 extern void __rethrow (void *);
47 extern void __throw (void);
48 extern void __sjthrow (void) __attribute__ ((__noreturn__
));
49 extern void __sjpopnthrow (void) __attribute__ ((__noreturn__
));
50 extern void __eprintf (const char *, const char *, unsigned int, const char *)
51 __attribute__ ((__noreturn__
));
54 extern void __bb_exit_func (void);
55 extern void __bb_init_func (struct bb
*);
56 extern void __bb_fork_func (void);
57 extern void __bb_trace_func (void);
58 extern void __bb_trace_ret (void);
59 extern void __bb_init_trace_func (struct bb
*, unsigned long);
61 struct exception_descriptor
;
62 extern short int __get_eh_table_language (struct exception_descriptor
*);
63 extern short int __get_eh_table_version (struct exception_descriptor
*);
65 /* Permit the tm.h file to select the endianness to use just for this
66 file. This is used when the endianness is determined when the
69 #ifndef LIBGCC2_WORDS_BIG_ENDIAN
70 #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
73 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
74 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
77 #ifndef MIN_UNITS_PER_WORD
78 #define MIN_UNITS_PER_WORD UNITS_PER_WORD
81 /* In the first part of this file, we are interfacing to calls generated
82 by the compiler itself. These calls pass values into these routines
83 which have very specific modes (rather than very specific types), and
84 these compiler-generated calls also expect any return values to have
85 very specific modes (rather than very specific types). Thus, we need
86 to avoid using regular C language type names in this part of the file
87 because the sizes for those types can be configured to be anything.
88 Instead we use the following special type names. */
90 typedef int QItype
__attribute__ ((mode (QI
)));
91 typedef unsigned int UQItype
__attribute__ ((mode (QI
)));
92 typedef int HItype
__attribute__ ((mode (HI
)));
93 typedef unsigned int UHItype
__attribute__ ((mode (HI
)));
94 #if MIN_UNITS_PER_WORD > 1
95 /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1 */
96 typedef int SItype
__attribute__ ((mode (SI
)));
97 typedef unsigned int USItype
__attribute__ ((mode (SI
)));
98 #if MIN_UNITS_PER_WORD > 2
99 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2 */
100 typedef int DItype
__attribute__ ((mode (DI
)));
101 typedef unsigned int UDItype
__attribute__ ((mode (DI
)));
105 #if BITS_PER_UNIT == 8
107 typedef float SFtype
__attribute__ ((mode (SF
)));
108 typedef float DFtype
__attribute__ ((mode (DF
)));
110 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
111 typedef float XFtype
__attribute__ ((mode (XF
)));
113 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
114 typedef float TFtype
__attribute__ ((mode (TF
)));
117 #else /* BITS_PER_UNIT != 8 */
119 /* On dsp's there are usually qf/hf/tqf modes used instead of the above.
120 For now we don't support them in libgcc2.c. */
138 #endif /* BITS_PER_UNIT != 8 */
140 typedef int word_type
__attribute__ ((mode (__word__
)));
142 /* Make sure that we don't accidentally use any normal C language built-in
143 type names in the first part of this file. Instead we want to use *only*
144 the type names defined above. The following macro definitions insure
145 that if we *do* accidentally use some normal C language built-in type name,
146 we will get a syntax error. */
148 #define char bogus_type
149 #define short bogus_type
150 #define int bogus_type
151 #define long bogus_type
152 #define unsigned bogus_type
153 #define float bogus_type
154 #define double bogus_type
156 #if MIN_UNITS_PER_WORD > 2
157 #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
159 #define UWtype USItype
160 #define HWtype SItype
161 #define UHWtype USItype
162 #define DWtype DItype
163 #define UDWtype UDItype
164 #define __NW(a,b) __ ## a ## si ## b
165 #define __NDW(a,b) __ ## a ## di ## b
166 #elif MIN_UNITS_PER_WORD > 1
167 #define W_TYPE_SIZE (2 * BITS_PER_UNIT)
169 #define UWtype UHItype
170 #define HWtype HItype
171 #define UHWtype UHItype
172 #define DWtype SItype
173 #define UDWtype USItype
174 #define __NW(a,b) __ ## a ## hi ## b
175 #define __NDW(a,b) __ ## a ## si ## b
177 #define W_TYPE_SIZE BITS_PER_UNIT
179 #define UWtype UQItype
180 #define HWtype QItype
181 #define UHWtype UQItype
182 #define DWtype HItype
183 #define UDWtype UHItype
184 #define __NW(a,b) __ ## a ## qi ## b
185 #define __NDW(a,b) __ ## a ## hi ## b
188 extern DWtype
__muldi3 (DWtype
, DWtype
);
189 extern DWtype
__divdi3 (DWtype
, DWtype
);
190 extern UDWtype
__udivdi3 (UDWtype
, UDWtype
);
191 extern UDWtype
__umoddi3 (UDWtype
, UDWtype
);
192 extern DWtype
__moddi3 (DWtype
, DWtype
);
193 /* __udivmoddi4 is static inline when building other libgcc2 portions. */
194 #if (!defined (L_udivdi3) && !defined (L_divdi3) && \
195 !defined (L_umoddi3) && !defined (L_moddi3))
196 extern UDWtype
__udivmoddi4 (UDWtype
, UDWtype
, UDWtype
*);
199 /* __negdi2 is static inline when building other libgcc2 portions. */
200 #if !defined(L_divdi3) && !defined(L_moddi3)
201 extern DWtype
__negdi2 (DWtype
);
204 extern DWtype
__lshrdi3 (DWtype
, word_type
);
205 extern DWtype
__ashldi3 (DWtype
, word_type
);
206 extern DWtype
__ashrdi3 (DWtype
, word_type
);
207 extern DWtype
__ffsdi2 (DWtype
);
209 /* __udiv_w_sdiv is static inline when building other libgcc2 portions. */
210 #if (!defined(L_udivdi3) && !defined(L_divdi3) && \
211 !defined(L_umoddi3) && !defined(L_moddi3))
212 extern UWtype
__udiv_w_sdiv (UWtype
*, UWtype
, UWtype
, UWtype
);
215 extern word_type
__cmpdi2 (DWtype
, DWtype
);
216 extern word_type
__ucmpdi2 (DWtype
, DWtype
);
218 #if BITS_PER_UNIT == 8
219 extern DWtype
__fixdfdi (DFtype
);
220 extern DWtype
__fixsfdi (SFtype
);
221 extern DFtype
__floatdidf (DWtype
);
222 extern SFtype
__floatdisf (DWtype
);
223 extern UWtype
__fixunsdfsi (DFtype
);
224 extern UWtype
__fixunssfsi (SFtype
);
225 extern DWtype
__fixunsdfdi (DFtype
);
226 extern DWtype
__fixunssfdi (SFtype
);
228 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
229 extern DWtype
__fixxfdi (XFtype
);
230 extern DWtype
__fixunsxfdi (XFtype
);
231 extern XFtype
__floatdixf (DWtype
);
232 extern UWtype
__fixunsxfsi (XFtype
);
235 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
236 extern DWtype
__fixunstfdi (TFtype
);
237 extern DWtype
__fixtfdi (TFtype
);
238 extern TFtype
__floatditf (DWtype
);
240 #endif /* BITS_PER_UNIT == 8 */
242 #define __muldi3 __NDW(mul,3)
243 #define __divdi3 __NDW(div,3)
244 #define __udivdi3 __NDW(udiv,3)
245 #define __moddi3 __NDW(mod,3)
246 #define __umoddi3 __NDW(umod,3)
247 #define __negdi2 __NDW(neg,2)
248 #define __lshrdi3 __NDW(lshr,3)
249 #define __ashldi3 __NDW(ashl,3)
250 #define __ashrdi3 __NDW(ashr,3)
251 #define __ffsdi2 __NDW(ffs,2)
252 #define __cmpdi2 __NDW(cmp,2)
253 #define __ucmpdi2 __NDW(ucmp,2)
254 #define __udivmoddi4 __NDW(udivmod,4)
255 #define __fixunstfdi __NDW(fixunstf,)
256 #define __fixtfdi __NDW(fixtf,)
257 #define __fixunsxfdi __NDW(fixunsxf,)
258 #define __fixxfdi __NDW(fixxf,)
259 #define __fixunsdfdi __NDW(fixunsdf,)
260 #define __fixdfdi __NDW(fixdf,)
261 #define __fixunssfdi __NDW(fixunssf,)
262 #define __fixsfdi __NDW(fixsf,)
263 #define __floatdixf __NDW(float,xf)
264 #define __floatditf __NDW(float,tf)
265 #define __floatdidf __NDW(float,df)
266 #define __floatdisf __NDW(float,sf)
267 #define __fixunsxfsi __NW(fixunsxf,)
268 #define __fixunstfsi __NW(fixunstf,)
269 #define __fixunsdfsi __NW(fixunsdf,)
270 #define __fixunssfsi __NW(fixunssf,)
272 /* DWstructs are pairs of Wtype values in the order determined by
273 LIBGCC2_WORDS_BIG_ENDIAN. */
275 #if LIBGCC2_WORDS_BIG_ENDIAN
276 struct DWstruct
{Wtype high
, low
;};
278 struct DWstruct
{Wtype low
, high
;};
281 /* We need this union to unpack/pack DImode values, since we don't have
282 any arithmetic yet. Incoming DImode parameters are stored into the
283 `ll' field, and the unpacked result is read from the struct `s'. */
291 #if (defined (L_udivmoddi4) || defined (L_muldi3) || defined (L_udiv_w_sdiv)\
292 || defined (L_divdi3) || defined (L_udivdi3) \
293 || defined (L_moddi3) || defined (L_umoddi3))
295 #include "longlong.h"
297 #endif /* udiv or mul */
299 #endif /* __LIBGCC2_H__ */