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