]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/libgcc2.h
Fix ada enabled "make html".
[thirdparty/gcc.git] / gcc / libgcc2.h
CommitLineData
299b83b7 1/* Header file for libgcc2.c. */
c486021d 2/* Copyright (C) 2000, 2001, 2004, 2005
299b83b7
KG
3 Free Software Foundation, Inc.
4
1322177d 5This file is part of GCC.
299b83b7 6
1322177d
LB
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
299b83b7 11
1322177d
LB
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
299b83b7
KG
16
17You should have received a copy of the GNU General Public License
1322177d
LB
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
299b83b7 21
77c915d8
DT
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. */
28
29
88657302
RH
30#ifndef GCC_LIBGCC2_H
31#define GCC_LIBGCC2_H
299b83b7 32
7370bebd 33#ifndef HIDE_EXPORTS
3fc1f660 34#pragma GCC visibility push(default)
7370bebd 35#endif
3fc1f660 36
299b83b7 37extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t);
299b83b7 38extern void __clear_cache (char *, char *);
3fe68d0a
ZW
39extern void __eprintf (const char *, const char *, unsigned int, const char *)
40 __attribute__ ((__noreturn__));
299b83b7 41
299b83b7
KG
42struct exception_descriptor;
43extern short int __get_eh_table_language (struct exception_descriptor *);
44extern short int __get_eh_table_version (struct exception_descriptor *);
45
46/* Permit the tm.h file to select the endianness to use just for this
47 file. This is used when the endianness is determined when the
48 compiler is run. */
49
50#ifndef LIBGCC2_WORDS_BIG_ENDIAN
51#define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
52#endif
53
4f2e0d5e
RH
54#ifndef LIBGCC2_DOUBLE_TYPE_SIZE
55#define LIBGCC2_DOUBLE_TYPE_SIZE DOUBLE_TYPE_SIZE
56#endif
299b83b7
KG
57#ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
58#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
59#endif
60
cfa7bd9c
RS
61#ifndef LIBGCC2_HAS_SF_MODE
62#define LIBGCC2_HAS_SF_MODE (BITS_PER_UNIT == 8)
63#endif
64
4e9db8b2
SE
65#ifndef LIBGCC2_HAS_DF_MODE
66#define LIBGCC2_HAS_DF_MODE \
cfa7bd9c
RS
67 (BITS_PER_UNIT == 8 \
68 && (LIBGCC2_DOUBLE_TYPE_SIZE == 64 \
69 || LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64))
4e9db8b2
SE
70#endif
71
72#ifndef LIBGCC2_HAS_XF_MODE
cfa7bd9c
RS
73#define LIBGCC2_HAS_XF_MODE \
74 (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80)
4e9db8b2
SE
75#endif
76
77#ifndef LIBGCC2_HAS_TF_MODE
cfa7bd9c
RS
78#define LIBGCC2_HAS_TF_MODE \
79 (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
4e9db8b2
SE
80#endif
81
32b32c8f
JJ
82#ifndef MIN_UNITS_PER_WORD
83#define MIN_UNITS_PER_WORD UNITS_PER_WORD
84#endif
85
299b83b7
KG
86/* In the first part of this file, we are interfacing to calls generated
87 by the compiler itself. These calls pass values into these routines
88 which have very specific modes (rather than very specific types), and
89 these compiler-generated calls also expect any return values to have
90 very specific modes (rather than very specific types). Thus, we need
91 to avoid using regular C language type names in this part of the file
92 because the sizes for those types can be configured to be anything.
93 Instead we use the following special type names. */
94
95typedef int QItype __attribute__ ((mode (QI)));
96typedef unsigned int UQItype __attribute__ ((mode (QI)));
97typedef int HItype __attribute__ ((mode (HI)));
98typedef unsigned int UHItype __attribute__ ((mode (HI)));
aa63d244 99#if MIN_UNITS_PER_WORD > 1
6614fd40 100/* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1. */
299b83b7
KG
101typedef int SItype __attribute__ ((mode (SI)));
102typedef unsigned int USItype __attribute__ ((mode (SI)));
a746dbf5 103#if LONG_LONG_TYPE_SIZE > 32
6614fd40 104/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2. */
299b83b7
KG
105typedef int DItype __attribute__ ((mode (DI)));
106typedef unsigned int UDItype __attribute__ ((mode (DI)));
6da9c622 107#if MIN_UNITS_PER_WORD > 4
6614fd40 108/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4. */
6da9c622
RK
109typedef int TItype __attribute__ ((mode (TI)));
110typedef unsigned int UTItype __attribute__ ((mode (TI)));
111#endif
299b83b7
KG
112#endif
113#endif
114
cfa7bd9c 115#if LIBGCC2_HAS_SF_MODE
299b83b7 116typedef float SFtype __attribute__ ((mode (SF)));
7e7e470f 117typedef _Complex float SCtype __attribute__ ((mode (SC)));
cfa7bd9c 118#endif
4e9db8b2 119#if LIBGCC2_HAS_DF_MODE
4f2e0d5e
RH
120typedef float DFtype __attribute__ ((mode (DF)));
121typedef _Complex float DCtype __attribute__ ((mode (DC)));
122#endif
4e9db8b2 123#if LIBGCC2_HAS_XF_MODE
299b83b7 124typedef float XFtype __attribute__ ((mode (XF)));
7e7e470f 125typedef _Complex float XCtype __attribute__ ((mode (XC)));
299b83b7 126#endif
4e9db8b2 127#if LIBGCC2_HAS_TF_MODE
299b83b7 128typedef float TFtype __attribute__ ((mode (TF)));
7e7e470f 129typedef _Complex float TCtype __attribute__ ((mode (TC)));
299b83b7
KG
130#endif
131
299b83b7
KG
132typedef int word_type __attribute__ ((mode (__word__)));
133
134/* Make sure that we don't accidentally use any normal C language built-in
135 type names in the first part of this file. Instead we want to use *only*
136 the type names defined above. The following macro definitions insure
137 that if we *do* accidentally use some normal C language built-in type name,
138 we will get a syntax error. */
139
140#define char bogus_type
141#define short bogus_type
142#define int bogus_type
143#define long bogus_type
144#define unsigned bogus_type
145#define float bogus_type
146#define double bogus_type
147
0aec6014
EB
148/* Versions prior to 3.4.4 were not taking into account the word size for
149 the 5 trapping arithmetic functions absv, addv, subv, mulv and negv. As
150 a consequence, the si and di variants were always and the only ones emitted.
151 To maintain backward compatibility, COMPAT_SIMODE_TRAPPING_ARITHMETIC is
152 defined on platforms where it makes sense to still have the si variants
153 emitted. As a bonus, their implementation is now correct. Note that the
154 same mechanism should have been implemented for the di variants, but it
155 turns out that no platform would define COMPAT_DIMODE_TRAPPING_ARITHMETIC
156 if it existed. */
157
6da9c622
RK
158#if MIN_UNITS_PER_WORD > 4
159#define W_TYPE_SIZE (8 * BITS_PER_UNIT)
160#define Wtype DItype
161#define UWtype UDItype
162#define HWtype DItype
163#define UHWtype UDItype
164#define DWtype TItype
165#define UDWtype UTItype
166#define __NW(a,b) __ ## a ## di ## b
167#define __NDW(a,b) __ ## a ## ti ## b
0aec6014 168#define COMPAT_SIMODE_TRAPPING_ARITHMETIC
a8b462be
MH
169#elif MIN_UNITS_PER_WORD > 2 \
170 || (MIN_UNITS_PER_WORD > 1 && LONG_LONG_TYPE_SIZE > 32)
299b83b7
KG
171#define W_TYPE_SIZE (4 * BITS_PER_UNIT)
172#define Wtype SItype
173#define UWtype USItype
174#define HWtype SItype
175#define UHWtype USItype
176#define DWtype DItype
177#define UDWtype UDItype
178#define __NW(a,b) __ ## a ## si ## b
179#define __NDW(a,b) __ ## a ## di ## b
aa63d244 180#elif MIN_UNITS_PER_WORD > 1
299b83b7
KG
181#define W_TYPE_SIZE (2 * BITS_PER_UNIT)
182#define Wtype HItype
183#define UWtype UHItype
184#define HWtype HItype
185#define UHWtype UHItype
186#define DWtype SItype
187#define UDWtype USItype
188#define __NW(a,b) __ ## a ## hi ## b
189#define __NDW(a,b) __ ## a ## si ## b
190#else
191#define W_TYPE_SIZE BITS_PER_UNIT
192#define Wtype QItype
193#define UWtype UQItype
194#define HWtype QItype
195#define UHWtype UQItype
196#define DWtype HItype
197#define UDWtype UHItype
198#define __NW(a,b) __ ## a ## qi ## b
199#define __NDW(a,b) __ ## a ## hi ## b
200#endif
201
5d0e6486
AO
202#define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1))
203#define Wtype_MIN (- Wtype_MAX - 1)
204
4f2e0d5e
RH
205#if W_TYPE_SIZE == 8
206# define Wtype_MAXp1_F 0x1p8f
207#elif W_TYPE_SIZE == 16
208# define Wtype_MAXp1_F 0x1p16f
209#elif W_TYPE_SIZE == 32
210# define Wtype_MAXp1_F 0x1p32f
211#elif W_TYPE_SIZE == 64
212# define Wtype_MAXp1_F 0x1p64f
213#else
214# error "expand the table"
215#endif
216
6da9c622
RK
217#define __muldi3 __NDW(mul,3)
218#define __divdi3 __NDW(div,3)
219#define __udivdi3 __NDW(udiv,3)
220#define __moddi3 __NDW(mod,3)
221#define __umoddi3 __NDW(umod,3)
222#define __negdi2 __NDW(neg,2)
223#define __lshrdi3 __NDW(lshr,3)
224#define __ashldi3 __NDW(ashl,3)
225#define __ashrdi3 __NDW(ashr,3)
6da9c622
RK
226#define __cmpdi2 __NDW(cmp,2)
227#define __ucmpdi2 __NDW(ucmp,2)
228#define __udivmoddi4 __NDW(udivmod,4)
229#define __fixunstfDI __NDW(fixunstf,)
230#define __fixtfdi __NDW(fixtf,)
231#define __fixunsxfDI __NDW(fixunsxf,)
232#define __fixxfdi __NDW(fixxf,)
233#define __fixunsdfDI __NDW(fixunsdf,)
234#define __fixdfdi __NDW(fixdf,)
235#define __fixunssfDI __NDW(fixunssf,)
236#define __fixsfdi __NDW(fixsf,)
237#define __floatdixf __NDW(float,xf)
238#define __floatditf __NDW(float,tf)
239#define __floatdidf __NDW(float,df)
240#define __floatdisf __NDW(float,sf)
241#define __fixunsxfSI __NW(fixunsxf,)
242#define __fixunstfSI __NW(fixunstf,)
243#define __fixunsdfSI __NW(fixunsdf,)
244#define __fixunssfSI __NW(fixunssf,)
245
0aec6014
EB
246#define __absvSI2 __NW(absv,2)
247#define __addvSI3 __NW(addv,3)
248#define __subvSI3 __NW(subv,3)
249#define __mulvSI3 __NW(mulv,3)
250#define __negvSI2 __NW(negv,2)
251#define __absvDI2 __NDW(absv,2)
252#define __addvDI3 __NDW(addv,3)
253#define __subvDI3 __NDW(subv,3)
254#define __mulvDI3 __NDW(mulv,3)
255#define __negvDI2 __NDW(negv,2)
256
dfff898c 257#define __ffsSI2 __NW(ffs,2)
8275b011
RH
258#define __clzSI2 __NW(clz,2)
259#define __ctzSI2 __NW(ctz,2)
260#define __popcountSI2 __NW(popcount,2)
261#define __paritySI2 __NW(parity,2)
dfff898c 262#define __ffsDI2 __NDW(ffs,2)
8275b011
RH
263#define __clzDI2 __NDW(clz,2)
264#define __ctzDI2 __NDW(ctz,2)
265#define __popcountDI2 __NDW(popcount,2)
266#define __parityDI2 __NDW(parity,2)
dfff898c 267
d30d6e76
KG
268extern DWtype __muldi3 (DWtype, DWtype);
269extern DWtype __divdi3 (DWtype, DWtype);
270extern UDWtype __udivdi3 (UDWtype, UDWtype);
271extern UDWtype __umoddi3 (UDWtype, UDWtype);
272extern DWtype __moddi3 (DWtype, DWtype);
6da9c622 273
d30d6e76
KG
274/* __udivmoddi4 is static inline when building other libgcc2 portions. */
275#if (!defined (L_udivdi3) && !defined (L_divdi3) && \
276 !defined (L_umoddi3) && !defined (L_moddi3))
277extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *);
278#endif
279
280/* __negdi2 is static inline when building other libgcc2 portions. */
281#if !defined(L_divdi3) && !defined(L_moddi3)
282extern DWtype __negdi2 (DWtype);
283#endif
284
285extern DWtype __lshrdi3 (DWtype, word_type);
286extern DWtype __ashldi3 (DWtype, word_type);
287extern DWtype __ashrdi3 (DWtype, word_type);
2928cd7a 288
d30d6e76
KG
289/* __udiv_w_sdiv is static inline when building other libgcc2 portions. */
290#if (!defined(L_udivdi3) && !defined(L_divdi3) && \
291 !defined(L_umoddi3) && !defined(L_moddi3))
292extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype);
293#endif
294
295extern word_type __cmpdi2 (DWtype, DWtype);
296extern word_type __ucmpdi2 (DWtype, DWtype);
297
0aec6014
EB
298extern Wtype __absvSI2 (Wtype);
299extern Wtype __addvSI3 (Wtype, Wtype);
300extern Wtype __subvSI3 (Wtype, Wtype);
301extern Wtype __mulvSI3 (Wtype, Wtype);
302extern Wtype __negvSI2 (Wtype);
303extern DWtype __absvDI2 (DWtype);
304extern DWtype __addvDI3 (DWtype, DWtype);
305extern DWtype __subvDI3 (DWtype, DWtype);
306extern DWtype __mulvDI3 (DWtype, DWtype);
307extern DWtype __negvDI2 (DWtype);
308
309#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
310extern SItype __absvsi2 (SItype);
311extern SItype __addvsi3 (SItype, SItype);
312extern SItype __subvsi3 (SItype, SItype);
313extern SItype __mulvsi3 (SItype, SItype);
314extern SItype __negvsi2 (SItype);
315#endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
8f54374e 316
0b8495ae 317#undef int
cfa7bd9c 318#if LIBGCC2_HAS_SF_MODE
d30d6e76 319extern DWtype __fixsfdi (SFtype);
d30d6e76 320extern SFtype __floatdisf (DWtype);
6da9c622 321extern UWtype __fixunssfSI (SFtype);
6da9c622 322extern DWtype __fixunssfDI (SFtype);
0b8495ae 323extern SFtype __powisf2 (SFtype, int);
7e7e470f
RH
324extern SCtype __divsc3 (SFtype, SFtype, SFtype, SFtype);
325extern SCtype __mulsc3 (SFtype, SFtype, SFtype, SFtype);
cfa7bd9c 326#endif
4e9db8b2 327#if LIBGCC2_HAS_DF_MODE
4f2e0d5e
RH
328extern DWtype __fixdfdi (DFtype);
329extern DFtype __floatdidf (DWtype);
330extern UWtype __fixunsdfSI (DFtype);
331extern DWtype __fixunsdfDI (DFtype);
0b8495ae 332extern DFtype __powidf2 (DFtype, int);
7e7e470f
RH
333extern DCtype __divdc3 (DFtype, DFtype, DFtype, DFtype);
334extern DCtype __muldc3 (DFtype, DFtype, DFtype, DFtype);
4f2e0d5e 335#endif
7e7e470f 336
4e9db8b2 337#if LIBGCC2_HAS_XF_MODE
d30d6e76 338extern DWtype __fixxfdi (XFtype);
6da9c622 339extern DWtype __fixunsxfDI (XFtype);
d30d6e76 340extern XFtype __floatdixf (DWtype);
6da9c622 341extern UWtype __fixunsxfSI (XFtype);
0b8495ae 342extern XFtype __powixf2 (XFtype, int);
7e7e470f
RH
343extern XCtype __divxc3 (XFtype, XFtype, XFtype, XFtype);
344extern XCtype __mulxc3 (XFtype, XFtype, XFtype, XFtype);
d30d6e76
KG
345#endif
346
4e9db8b2 347#if LIBGCC2_HAS_TF_MODE
6da9c622 348extern DWtype __fixunstfDI (TFtype);
d30d6e76
KG
349extern DWtype __fixtfdi (TFtype);
350extern TFtype __floatditf (DWtype);
0b8495ae 351extern TFtype __powitf2 (TFtype, int);
7e7e470f
RH
352extern TCtype __divtc3 (TFtype, TFtype, TFtype, TFtype);
353extern TCtype __multc3 (TFtype, TFtype, TFtype, TFtype);
d30d6e76 354#endif
0b8495ae 355#define int bogus_type
d30d6e76 356
299b83b7
KG
357/* DWstructs are pairs of Wtype values in the order determined by
358 LIBGCC2_WORDS_BIG_ENDIAN. */
359
360#if LIBGCC2_WORDS_BIG_ENDIAN
361 struct DWstruct {Wtype high, low;};
362#else
363 struct DWstruct {Wtype low, high;};
364#endif
365
366/* We need this union to unpack/pack DImode values, since we don't have
367 any arithmetic yet. Incoming DImode parameters are stored into the
368 `ll' field, and the unpacked result is read from the struct `s'. */
369
370typedef union
371{
372 struct DWstruct s;
373 DWtype ll;
374} DWunion;
375
299b83b7
KG
376#include "longlong.h"
377
3fc1f660
MM
378#undef int
379extern int __clzDI2 (UDWtype);
380extern int __clzSI2 (UWtype);
381extern int __ctzSI2 (UWtype);
382extern int __ffsSI2 (UWtype);
383extern int __ffsDI2 (DWtype);
384extern int __ctzDI2 (UDWtype);
385extern int __popcountSI2 (UWtype);
386extern int __popcountDI2 (UDWtype);
387extern int __paritySI2 (UWtype);
388extern int __parityDI2 (UDWtype);
389#define int bogus_type
390
391extern void __enable_execute_stack (void *);
392
7370bebd 393#ifndef HIDE_EXPORTS
3fc1f660 394#pragma GCC visibility pop
7370bebd 395#endif
3fc1f660 396
88657302 397#endif /* ! GCC_LIBGCC2_H */