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 /* In the first part of this file, we are interfacing to calls generated
78 by the compiler itself. These calls pass values into these routines
79 which have very specific modes (rather than very specific types), and
80 these compiler-generated calls also expect any return values to have
81 very specific modes (rather than very specific types). Thus, we need
82 to avoid using regular C language type names in this part of the file
83 because the sizes for those types can be configured to be anything.
84 Instead we use the following special type names. */
86 typedef int QItype __attribute__ ((mode (QI)));
87 typedef unsigned int UQItype __attribute__ ((mode (QI)));
88 typedef int HItype __attribute__ ((mode (HI)));
89 typedef unsigned int UHItype __attribute__ ((mode (HI)));
90 #if MIN_UNITS_PER_WORD > 1
91 /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1 */
92 typedef int SItype __attribute__ ((mode (SI)));
93 typedef unsigned int USItype __attribute__ ((mode (SI)));
94 #if MIN_UNITS_PER_WORD > 2
95 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2 */
96 typedef int DItype __attribute__ ((mode (DI)));
97 typedef unsigned int UDItype __attribute__ ((mode (DI)));
101 #if BITS_PER_UNIT == 8
103 typedef float SFtype __attribute__ ((mode (SF)));
104 typedef float DFtype __attribute__ ((mode (DF)));
106 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
107 typedef float XFtype __attribute__ ((mode (XF)));
109 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
110 typedef float TFtype __attribute__ ((mode (TF)));
113 #else /* BITS_PER_UNIT != 8 */
115 /* On dsp's there are usually qf/hf/tqf modes used instead of the above.
116 For now we don't support them in libgcc2.c. */
134 #endif /* BITS_PER_UNIT != 8 */
136 typedef int word_type __attribute__ ((mode (__word__)));
138 /* Make sure that we don't accidentally use any normal C language built-in
139 type names in the first part of this file. Instead we want to use *only*
140 the type names defined above. The following macro definitions insure
141 that if we *do* accidentally use some normal C language built-in type name,
142 we will get a syntax error. */
144 #define char bogus_type
145 #define short bogus_type
146 #define int bogus_type
147 #define long bogus_type
148 #define unsigned bogus_type
149 #define float bogus_type
150 #define double bogus_type
152 #if MIN_UNITS_PER_WORD > 2
153 #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
155 #define UWtype USItype
156 #define HWtype SItype
157 #define UHWtype USItype
158 #define DWtype DItype
159 #define UDWtype UDItype
160 #define __NW(a,b) __ ## a ## si ## b
161 #define __NDW(a,b) __ ## a ## di ## b
162 #elif MIN_UNITS_PER_WORD > 1
163 #define W_TYPE_SIZE (2 * BITS_PER_UNIT)
165 #define UWtype UHItype
166 #define HWtype HItype
167 #define UHWtype UHItype
168 #define DWtype SItype
169 #define UDWtype USItype
170 #define __NW(a,b) __ ## a ## hi ## b
171 #define __NDW(a,b) __ ## a ## si ## b
173 #define W_TYPE_SIZE BITS_PER_UNIT
175 #define UWtype UQItype
176 #define HWtype QItype
177 #define UHWtype UQItype
178 #define DWtype HItype
179 #define UDWtype UHItype
180 #define __NW(a,b) __ ## a ## qi ## b
181 #define __NDW(a,b) __ ## a ## hi ## b
184 extern DWtype __muldi3 (DWtype, DWtype);
185 extern DWtype __divdi3 (DWtype, DWtype);
186 extern UDWtype __udivdi3 (UDWtype, UDWtype);
187 extern UDWtype __umoddi3 (UDWtype, UDWtype);
188 extern DWtype __moddi3 (DWtype, DWtype);
189 /* __udivmoddi4 is static inline when building other libgcc2 portions. */
190 #if (!defined (L_udivdi3) && !defined (L_divdi3) && \
191 !defined (L_umoddi3) && !defined (L_moddi3))
192 extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
195 /* __negdi2 is static inline when building other libgcc2 portions. */
196 #if !defined(L_divdi3) && !defined(L_moddi3)
197 extern DWtype __negdi2 (DWtype);
200 extern DWtype __lshrdi3 (DWtype, word_type);
201 extern DWtype __ashldi3 (DWtype, word_type);
202 extern DWtype __ashrdi3 (DWtype, word_type);
203 extern DWtype __ffsdi2 (DWtype);
205 /* __udiv_w_sdiv is static inline when building other libgcc2 portions. */
206 #if (!defined(L_udivdi3) && !defined(L_divdi3) && \
207 !defined(L_umoddi3) && !defined(L_moddi3))
208 extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
211 extern word_type __cmpdi2 (DWtype, DWtype);
212 extern word_type __ucmpdi2 (DWtype, DWtype);
214 #if BITS_PER_UNIT == 8
215 extern DWtype __fixdfdi (DFtype);
216 extern DWtype __fixsfdi (SFtype);
217 extern DFtype __floatdidf (DWtype);
218 extern SFtype __floatdisf (DWtype);
219 extern UWtype __fixunsdfsi (DFtype);
220 extern UWtype __fixunssfsi (SFtype);
221 extern DWtype __fixunsdfdi (DFtype);
222 extern DWtype __fixunssfdi (SFtype);
224 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
225 extern DWtype __fixxfdi (XFtype);
226 extern DWtype __fixunsxfdi (XFtype);
227 extern XFtype __floatdixf (DWtype);
228 extern UWtype __fixunsxfsi (XFtype);
231 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
232 extern DWtype __fixunstfdi (TFtype);
233 extern DWtype __fixtfdi (TFtype);
234 extern TFtype __floatditf (DWtype);
236 #endif /* BITS_PER_UNIT == 8 */
238 #define __muldi3 __NDW(mul,3)
239 #define __divdi3 __NDW(div,3)
240 #define __udivdi3 __NDW(udiv,3)
241 #define __moddi3 __NDW(mod,3)
242 #define __umoddi3 __NDW(umod,3)
243 #define __negdi2 __NDW(neg,2)
244 #define __lshrdi3 __NDW(lshr,3)
245 #define __ashldi3 __NDW(ashl,3)
246 #define __ashrdi3 __NDW(ashr,3)
247 #define __ffsdi2 __NDW(ffs,2)
248 #define __cmpdi2 __NDW(cmp,2)
249 #define __ucmpdi2 __NDW(ucmp,2)
250 #define __udivmoddi4 __NDW(udivmod,4)
251 #define __fixunstfdi __NDW(fixunstf,)
252 #define __fixtfdi __NDW(fixtf,)
253 #define __fixunsxfdi __NDW(fixunsxf,)
254 #define __fixxfdi __NDW(fixxf,)
255 #define __fixunsdfdi __NDW(fixunsdf,)
256 #define __fixdfdi __NDW(fixdf,)
257 #define __fixunssfdi __NDW(fixunssf,)
258 #define __fixsfdi __NDW(fixsf,)
259 #define __floatdixf __NDW(float,xf)
260 #define __floatditf __NDW(float,tf)
261 #define __floatdidf __NDW(float,df)
262 #define __floatdisf __NDW(float,sf)
263 #define __fixunsxfsi __NW(fixunsxf,)
264 #define __fixunstfsi __NW(fixunstf,)
265 #define __fixunsdfsi __NW(fixunsdf,)
266 #define __fixunssfsi __NW(fixunssf,)
268 /* DWstructs are pairs of Wtype values in the order determined by
269 LIBGCC2_WORDS_BIG_ENDIAN. */
271 #if LIBGCC2_WORDS_BIG_ENDIAN
272 struct DWstruct {Wtype high, low;};
274 struct DWstruct {Wtype low, high;};
277 /* We need this union to unpack/pack DImode values, since we don't have
278 any arithmetic yet. Incoming DImode parameters are stored into the
279 `ll' field, and the unpacked result is read from the struct `s'. */
287 #if (defined (L_udivmoddi4) || defined (L_muldi3) || defined (L_udiv_w_sdiv)\
288 || defined (L_divdi3) || defined (L_udivdi3) \
289 || defined (L_moddi3) || defined (L_umoddi3))
291 #include "longlong.h"
293 #endif /* udiv or mul */
295 #endif /* __LIBGCC2_H__ */