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