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