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