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