configure.in (GLIBCPP_ENABLE_CXX_FLAGS): Do not pass arguments, let the defaults...
[official-gcc.git] / gcc / libgcc2.h
blob260cd7c9f573b965379c4216fe1d5d45435431e4
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 exception_descriptor;
31 extern short int __get_eh_table_language (struct exception_descriptor *);
32 extern short int __get_eh_table_version (struct exception_descriptor *);
34 /* Permit the tm.h file to select the endianness to use just for this
35 file. This is used when the endianness is determined when the
36 compiler is run. */
38 #ifndef LIBGCC2_WORDS_BIG_ENDIAN
39 #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
40 #endif
42 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
43 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
44 #endif
46 #ifndef MIN_UNITS_PER_WORD
47 #define MIN_UNITS_PER_WORD UNITS_PER_WORD
48 #endif
50 /* In the first part of this file, we are interfacing to calls generated
51 by the compiler itself. These calls pass values into these routines
52 which have very specific modes (rather than very specific types), and
53 these compiler-generated calls also expect any return values to have
54 very specific modes (rather than very specific types). Thus, we need
55 to avoid using regular C language type names in this part of the file
56 because the sizes for those types can be configured to be anything.
57 Instead we use the following special type names. */
59 typedef int QItype __attribute__ ((mode (QI)));
60 typedef unsigned int UQItype __attribute__ ((mode (QI)));
61 typedef int HItype __attribute__ ((mode (HI)));
62 typedef unsigned int UHItype __attribute__ ((mode (HI)));
63 #if MIN_UNITS_PER_WORD > 1
64 /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1 */
65 typedef int SItype __attribute__ ((mode (SI)));
66 typedef unsigned int USItype __attribute__ ((mode (SI)));
67 #if LONG_LONG_TYPE_SIZE > 32
68 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2 */
69 typedef int DItype __attribute__ ((mode (DI)));
70 typedef unsigned int UDItype __attribute__ ((mode (DI)));
71 #if MIN_UNITS_PER_WORD > 4
72 /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4 */
73 typedef int TItype __attribute__ ((mode (TI)));
74 typedef unsigned int UTItype __attribute__ ((mode (TI)));
75 #endif
76 #endif
77 #endif
79 #if BITS_PER_UNIT == 8
81 typedef float SFtype __attribute__ ((mode (SF)));
82 typedef float DFtype __attribute__ ((mode (DF)));
84 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
85 typedef float XFtype __attribute__ ((mode (XF)));
86 #endif
87 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
88 typedef float TFtype __attribute__ ((mode (TF)));
89 #endif
91 #else /* BITS_PER_UNIT != 8 */
93 /* On dsp's there are usually qf/hf/tqf modes used instead of the above.
94 For now we don't support them in libgcc2.c. */
96 #undef L_fixdfdi
97 #undef L_fixsfdi
98 #undef L_fixtfdi
99 #undef L_fixunsdfdi
100 #undef L_fixunsdfsi
101 #undef L_fixunssfdi
102 #undef L_fixunssfsi
103 #undef L_fixunstfdi
104 #undef L_fixunsxfdi
105 #undef L_fixunsxfsi
106 #undef L_fixxfdi
107 #undef L_floatdidf
108 #undef L_floatdisf
109 #undef L_floatditf
110 #undef L_floatdixf
112 #endif /* BITS_PER_UNIT != 8 */
114 typedef int word_type __attribute__ ((mode (__word__)));
116 /* Make sure that we don't accidentally use any normal C language built-in
117 type names in the first part of this file. Instead we want to use *only*
118 the type names defined above. The following macro definitions insure
119 that if we *do* accidentally use some normal C language built-in type name,
120 we will get a syntax error. */
122 #define char bogus_type
123 #define short bogus_type
124 #define int bogus_type
125 #define long bogus_type
126 #define unsigned bogus_type
127 #define float bogus_type
128 #define double bogus_type
130 #if MIN_UNITS_PER_WORD > 4
131 #define W_TYPE_SIZE (8 * BITS_PER_UNIT)
132 #define Wtype DItype
133 #define UWtype UDItype
134 #define HWtype DItype
135 #define UHWtype UDItype
136 #define DWtype TItype
137 #define UDWtype UTItype
138 #define __NW(a,b) __ ## a ## di ## b
139 #define __NDW(a,b) __ ## a ## ti ## b
140 #elif MIN_UNITS_PER_WORD > 2 \
141 || (MIN_UNITS_PER_WORD > 1 && LONG_LONG_TYPE_SIZE > 32)
142 #define W_TYPE_SIZE (4 * BITS_PER_UNIT)
143 #define Wtype SItype
144 #define UWtype USItype
145 #define HWtype SItype
146 #define UHWtype USItype
147 #define DWtype DItype
148 #define UDWtype UDItype
149 #define __NW(a,b) __ ## a ## si ## b
150 #define __NDW(a,b) __ ## a ## di ## b
151 #elif MIN_UNITS_PER_WORD > 1
152 #define W_TYPE_SIZE (2 * BITS_PER_UNIT)
153 #define Wtype HItype
154 #define UWtype UHItype
155 #define HWtype HItype
156 #define UHWtype UHItype
157 #define DWtype SItype
158 #define UDWtype USItype
159 #define __NW(a,b) __ ## a ## hi ## b
160 #define __NDW(a,b) __ ## a ## si ## b
161 #else
162 #define W_TYPE_SIZE BITS_PER_UNIT
163 #define Wtype QItype
164 #define UWtype UQItype
165 #define HWtype QItype
166 #define UHWtype UQItype
167 #define DWtype HItype
168 #define UDWtype UHItype
169 #define __NW(a,b) __ ## a ## qi ## b
170 #define __NDW(a,b) __ ## a ## hi ## b
171 #endif
173 #define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1))
174 #define Wtype_MIN (- Wtype_MAX - 1)
176 #define __muldi3 __NDW(mul,3)
177 #define __divdi3 __NDW(div,3)
178 #define __udivdi3 __NDW(udiv,3)
179 #define __moddi3 __NDW(mod,3)
180 #define __umoddi3 __NDW(umod,3)
181 #define __negdi2 __NDW(neg,2)
182 #define __lshrdi3 __NDW(lshr,3)
183 #define __ashldi3 __NDW(ashl,3)
184 #define __ashrdi3 __NDW(ashr,3)
185 #define __ffsdi2 __NDW(ffs,2)
186 #define __cmpdi2 __NDW(cmp,2)
187 #define __ucmpdi2 __NDW(ucmp,2)
188 #define __udivmoddi4 __NDW(udivmod,4)
189 #define __fixunstfDI __NDW(fixunstf,)
190 #define __fixtfdi __NDW(fixtf,)
191 #define __fixunsxfDI __NDW(fixunsxf,)
192 #define __fixxfdi __NDW(fixxf,)
193 #define __fixunsdfDI __NDW(fixunsdf,)
194 #define __fixdfdi __NDW(fixdf,)
195 #define __fixunssfDI __NDW(fixunssf,)
196 #define __fixsfdi __NDW(fixsf,)
197 #define __floatdixf __NDW(float,xf)
198 #define __floatditf __NDW(float,tf)
199 #define __floatdidf __NDW(float,df)
200 #define __floatdisf __NDW(float,sf)
201 #define __fixunsxfSI __NW(fixunsxf,)
202 #define __fixunstfSI __NW(fixunstf,)
203 #define __fixunsdfSI __NW(fixunsdf,)
204 #define __fixunssfSI __NW(fixunssf,)
206 extern DWtype __muldi3 (DWtype, DWtype);
207 extern DWtype __divdi3 (DWtype, DWtype);
208 extern UDWtype __udivdi3 (UDWtype, UDWtype);
209 extern UDWtype __umoddi3 (UDWtype, UDWtype);
210 extern DWtype __moddi3 (DWtype, DWtype);
212 /* __udivmoddi4 is static inline when building other libgcc2 portions. */
213 #if (!defined (L_udivdi3) && !defined (L_divdi3) && \
214 !defined (L_umoddi3) && !defined (L_moddi3))
215 extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
216 #endif
218 /* __negdi2 is static inline when building other libgcc2 portions. */
219 #if !defined(L_divdi3) && !defined(L_moddi3)
220 extern DWtype __negdi2 (DWtype);
221 #endif
223 extern DWtype __lshrdi3 (DWtype, word_type);
224 extern DWtype __ashldi3 (DWtype, word_type);
225 extern DWtype __ashrdi3 (DWtype, word_type);
226 extern DWtype __ffsdi2 (DWtype);
228 /* __udiv_w_sdiv is static inline when building other libgcc2 portions. */
229 #if (!defined(L_udivdi3) && !defined(L_divdi3) && \
230 !defined(L_umoddi3) && !defined(L_moddi3))
231 extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
232 #endif
234 extern word_type __cmpdi2 (DWtype, DWtype);
235 extern word_type __ucmpdi2 (DWtype, DWtype);
237 extern Wtype __absvsi2 (Wtype);
238 extern DWtype __absvdi2 (DWtype);
239 extern Wtype __addvsi3 (Wtype, Wtype);
240 extern DWtype __addvdi3 (DWtype, DWtype);
241 extern Wtype __subvsi3 (Wtype, Wtype);
242 extern DWtype __subvdi3 (DWtype, DWtype);
243 extern Wtype __mulvsi3 (Wtype, Wtype);
244 extern DWtype __mulvdi3 (DWtype, DWtype);
245 extern Wtype __negvsi2 (Wtype);
246 extern DWtype __negvdi2 (DWtype);
248 #if BITS_PER_UNIT == 8
249 extern DWtype __fixdfdi (DFtype);
250 extern DWtype __fixsfdi (SFtype);
251 extern DFtype __floatdidf (DWtype);
252 extern SFtype __floatdisf (DWtype);
253 extern UWtype __fixunsdfSI (DFtype);
254 extern UWtype __fixunssfSI (SFtype);
255 extern DWtype __fixunsdfDI (DFtype);
256 extern DWtype __fixunssfDI (SFtype);
258 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 96
259 extern DWtype __fixxfdi (XFtype);
260 extern DWtype __fixunsxfDI (XFtype);
261 extern XFtype __floatdixf (DWtype);
262 extern UWtype __fixunsxfSI (XFtype);
263 #endif
265 #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
266 extern DWtype __fixunstfDI (TFtype);
267 extern DWtype __fixtfdi (TFtype);
268 extern TFtype __floatditf (DWtype);
269 #endif
270 #endif /* BITS_PER_UNIT == 8 */
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;};
277 #else
278 struct DWstruct {Wtype low, high;};
279 #endif
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'. */
285 typedef union
287 struct DWstruct s;
288 DWtype ll;
289 } DWunion;
291 #include "longlong.h"
293 #endif /* ! GCC_LIBGCC2_H */