00001 /* 00002 * Copyright 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2 of the GNU General Public License as 00011 published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with this program; if not, write the Free Software Foundation, Inc., 59 00026 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00027 00028 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00029 Mountain View, CA 94043, or: 00030 00031 http://www.sgi.com 00032 00033 For further information regarding this notice, see: 00034 00035 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00036 00037 */ 00038 00039 00040 #ifndef defs_INCLUDED 00041 #define defs_INCLUDED 00042 /* ==================================================================== 00043 * ==================================================================== 00044 * 00045 * Module: defs.h 00046 * $Revision: 1.1.1.1 $ 00047 * $Date: 2005/10/21 19:00:00 $ 00048 * $Author: marcel $ 00049 * $Source: /proj/osprey/CVS/open64/osprey1.0/common/com/defs.h,v $ 00050 * 00051 * Revision history: 00052 * 21-Aug-89 - Original Version 00053 * 24-Jan-91 - Copied for TP/Muse 00054 * 00055 * Description: 00056 * 00057 * This header file contains definitions of ubiquitous configuration 00058 * parameters used in the microcode compiler, in particular mappings 00059 * of the host-independent type names used to the host-supported basic 00060 * types. 00061 * 00062 * ==================================================================== 00063 * ==================================================================== 00064 */ 00065 00066 #ifdef _KEEP_RCS_ID 00067 static char *defs_rcs_id = "$Source: /home/bos/bk/kpro64-pending/common/com/SCCS/s.defs.h $ $Revision: 1.6 $"; 00068 #endif /* _KEEP_RCS_ID */ 00069 00070 #define PROTOTYPES 1 00071 /* We always want Insist error messages: */ 00072 #define Insist_On 1 00073 00074 /* ==================================================================== 00075 * 00076 * System libraries to be made generally available 00077 * 00078 * ==================================================================== 00079 */ 00080 00081 /* Make stdio, and string support generally available: */ 00082 #include <stdio.h> 00083 #include <stdlib.h> 00084 #include <stddef.h> 00085 #include <string.h> 00086 #include <bstring.h> /* for bzero */ 00087 00088 #ifndef __STDC_CONSTANT_MACROS 00089 #define __STDC_CONSTANT_MACROS 00090 #endif 00091 #include <stdint.h> 00092 #include <limits.h> 00093 00094 #ifdef __cplusplus 00095 extern "C" { 00096 #endif 00097 00098 00099 /* Since <signal.h> doesn't prototype signal, upsetting ccom: */ 00100 /* extern void (*signal(int, void (*) (int, ...)))(int, ...); */ 00101 00102 00103 /* ==================================================================== 00104 * 00105 * Characterize the host machine 00106 * 00107 * ==================================================================== 00108 */ 00109 00110 #ifdef __sgi 00111 # define HOST_SGI 00112 #endif 00113 00114 /***** Note the size of a word (in malloc units): *****/ 00115 #ifndef HOST_WORD_SIZE 00116 # define HOST_WORD_SIZE 4 00117 #endif 00118 #define WORDSIZE HOST_WORD_SIZE /* OBSOLETE */ 00119 #if HOST_WORD_SIZE == 2 00120 # define TWO_BYTE_WORDS 00121 #endif 00122 #if HOST_WORD_SIZE == 4 00123 # define FOUR_BYTE_WORDS 00124 #endif 00125 #if HOST_WORD_SIZE == 8 00126 # define EIGHT_BYTE_WORDS 00127 #endif 00128 #if defined(BUILD_OS_DARWIN) 00129 # define BITSPERBYTE CHAR_BIT 00130 #endif /* defined(BUILD_OS_DARWIN) */ 00131 00132 /* Map low indices to low-order bits in the bit vector package: */ 00133 #define BV_LITTLE_ENDIAN_BIT_NUMBERING 1 00134 00135 /* Should bit vector packages use table lookup instead of shifts? */ 00136 #if 0 00137 #define BV_MEMORY_BIT_MASKS /* when shifting is slow */ 00138 #endif 00139 00140 /* ==================================================================== 00141 * 00142 * The compiler process being compiled 00143 * 00144 * The command line must specify one of -DDRIVER, -DFRONT_END_xxx, or 00145 * -DBACK_END. The following sets related defines based on those. 00146 * 00147 * NOTE: The original Josie sources sometimes used aliases C_FRONT_END 00148 * for FRONT_END_C, FETYPE_CH for F77_FRONT_END, COMMON_CORE for 00149 * BACK_END, and ONE_PROC for SINGLE_PROCESS. These have all been 00150 * eliminated except for uses of FETYPE_CH specifically to refer to 00151 * the FORTRAN front end's CHARACTER type. 00152 * 00153 * ==================================================================== 00154 */ 00155 00156 #define COMPILER_DRIVER 1 00157 #define COMPILER_FE_C 2 00158 #define COMPILER_FE_CC 3 00159 #define COMPILER_FE_F77 4 00160 #define COMPILER_FE_F90 5 00161 #define COMPILER_BE 6 00162 #define COMPILER_TDGEN 7 00163 00164 #ifdef DRIVER 00165 # define COMPILER_PROCESS COMPILER_DRIVER 00166 # define COMPILER 1 00167 #endif 00168 #if defined(FRONT_END_C) 00169 # define COMPILER_PROCESS COMPILER_FE_C 00170 # define FRONT_END 1 00171 # define COMPILER 1 00172 #endif 00173 #if defined(FRONT_END_CPLUSPLUS) 00174 # define COMPILER_PROCESS COMPILER_FE_CC 00175 # define FRONT_END 1 00176 # define COMPILER 1 00177 #endif 00178 #ifdef FRONT_END_F77 00179 # define COMPILER_PROCESS COMPILER_FE_F77 00180 # define FRONT_END_FORTRAN 1 00181 # define FRONT_END 1 00182 # define COMPILER 1 00183 #endif 00184 #ifdef FRONT_END_F90 00185 # define COMPILER_PROCESS COMPILER_FE_F90 00186 # define FRONT_END_FORTRAN 1 00187 # define FRONT_END 1 00188 # define COMPILER 1 00189 #endif 00190 #ifdef BACK_END 00191 # define COMPILER_PROCESS COMPILER_BE 00192 # define COMPILER 1 00193 #endif 00194 #ifdef TDGEN 00195 # define COMPILER_PROCESS COMPILER_TDGEN 00196 #endif 00197 00198 /* Are we compiling front end and back end as a single process? */ 00199 #if defined(FRONT_END) && defined(BACK_END) 00200 # define SINGLE_PROCESS 1 00201 #endif 00202 00203 00204 /* Allow inline keyword, making it 'static' for debugging if Is_True_On */ 00205 #ifdef _LANGUAGE_C 00206 #ifndef inline 00207 #ifdef Is_True_On 00208 #define inline static 00209 #else 00210 #define inline static __inline 00211 #endif 00212 #endif 00213 #endif 00214 00215 #ifdef __GNUC__ 00216 /* gcc allows us to put attribute weak after a prototype */ 00217 #define WEAK __attribute__((weak)) 00218 #else 00219 #define WEAK 00220 #endif 00221 00222 00223 /* ==================================================================== 00224 * 00225 * Type mapping 00226 * 00227 * The following type names are to be used in general to avoid host 00228 * dependencies. Two sets are provided. The first, without a prefix, 00229 * specifies a minimum bit length for the object being defined of 8, 00230 * 16, or 32 bits. It is to be interpreted as a host-efficient type 00231 * of at least that size. The second, with a "m" prefix, also gives 00232 * a minimum bit length, but that bit length is preferred (minimizing 00233 * memory usage is the priority) if remotely reasonable on the host. 00234 * The latter types should be used only for objects which will be 00235 * replicated extensively. 00236 * 00237 * ==================================================================== 00238 */ 00239 00240 #if (defined(HOST_SGI) || defined(__GNUC__)) 00241 typedef signed int INT; /* The natural integer on the host */ 00242 typedef signed int INT8; /* Use the natural integer */ 00243 typedef signed int INT16; /* Use the natural integer */ 00244 typedef signed int INT32; /* The natural integer matches */ 00245 typedef signed long long INT64; 00246 typedef unsigned long INTPTR; /* Integer the same size as pointer*/ 00247 typedef unsigned int UINT; /* The natural integer on the host */ 00248 typedef unsigned int UINT8; /* Use the natural integer */ 00249 typedef unsigned int UINT16; /* Use the natural integer */ 00250 typedef unsigned int UINT32; /* The natural integer matches */ 00251 typedef unsigned long long UINT64; 00252 typedef int BOOL; /* Natural size Boolean value */ 00253 typedef signed char mINT8; /* Avoid - often very inefficient */ 00254 typedef signed short mINT16; /* Use a 16-bit integer */ 00255 typedef signed int mINT32; /* The natural integer matches */ 00256 typedef signed long long mINT64; 00257 typedef unsigned char mUINT8; /* Use the natural integer */ 00258 typedef unsigned short mUINT16;/* Use a 16-bit integer */ 00259 typedef unsigned int mUINT32;/* The natural integer matches */ 00260 typedef unsigned long long mUINT64; 00261 typedef unsigned char mBOOL; /* Minimal size Boolean value */ 00262 00263 /* Define largest efficient integers for the host machine: */ 00264 typedef signed long INTSC; /* Scaled integer */ 00265 typedef unsigned long UINTSC; /* Scaled integer */ 00266 00267 /* Define pointer-sized integers for the host machine: */ 00268 typedef signed long INTPS; /* Pointer-sized integer */ 00269 typedef unsigned long UINTPS; /* Pointer-sized integer */ 00270 00271 #define INTSC_MAX INT32_MAX /* Max scaled int */ 00272 #define INTSC_MIN INT32_MIN /* Min scaled int */ 00273 #define UINTSC_MAX UINT32_MAX /* Max scaled uint */ 00274 #define INTPS_MAX INT32_MAX /* Max pointer-sized int */ 00275 #define INTPS_MIN INT32_MIN /* Min pointer-sized int */ 00276 #define UINTPS_MAX UINT32_MAX /* Max pointer-sized uint */ 00277 00278 /* Define quad-precision floating point for the host machine. 00279 * WARNING: Depending on the host, this type need not be usable. 00280 * Instead, see QUAD_TYPE in targ_const.h and its reference to 00281 * HOST_SUPPORTS_QUAD_FLOAT in config_host.h. We do this this way to 00282 * avoid needing to allow the standard type names whenever 00283 * targ_const.h is included. 00284 */ 00285 #if (defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 400) && _SGIAPI) || defined(__GNUC__) 00286 #define HOST_SUPPORTS_QUAD_FLOAT 1 00287 #else 00288 #define HOST_SUPPORTS_QUAD_FLOAT 0 00289 #endif 00290 00291 #if HOST_SUPPORTS_QUAD_FLOAT 00292 /* Temporarily remove this to get rid of warnings: */ 00293 typedef long double QUADFP; /* 128-bit floating point */ 00294 #else 00295 typedef double QUADFP; /* 128-bit floating point */ 00296 #endif 00297 00298 #endif /* HOST_SGI || __GNUC__ */ 00299 00300 /* We would like a generic memory pointer type, e.g. for use in the 00301 * memory allocation routines. Ideally, it is (void *), but some 00302 * hosts, e.g. ca. 1988 MIPS, can't handle that... 00303 */ 00304 #if(defined(HOST_SGI) || defined(__GNUC__)) 00305 typedef void *MEM_PTR; 00306 #endif /* HOST_SGI || __GNUC__*/ 00307 00308 /* Short hand for those who don't like "char *" */ 00309 typedef char *STRING; 00310 00311 /* Define the target's basic INT type: */ 00312 /* WARNING: This isn't quite accurate. A single compiler may 00313 * support multiple targets with multiple possibilities for these 00314 * types. They should be viewed as maximal for the supported 00315 * targets. 00316 * TODO: They aren't there yet (e.g. the 64-bit targets). 00317 * Determine how to deal with this -- maybe a completely different 00318 * mechanism is required. 00319 */ 00320 typedef INT64 TARG_INT; /* Individual objects */ 00321 typedef mINT64 mTARG_INT; /* Table components */ 00322 typedef UINT64 TARG_UINT; 00323 typedef mUINT64 mTARG_UINT; 00324 00325 /* Define standard values: */ 00326 #ifndef TRUE 00327 #define TRUE ((BOOL) 1) 00328 #endif 00329 #ifndef FALSE 00330 #define FALSE ((BOOL) 0) 00331 #endif 00332 00333 /* Something to use to represent undefined positive integers. Perahps we 00334 * could generalize this somehow, but it is useful the way it is. 00335 */ 00336 #ifndef UNDEFINED 00337 #define UNDEFINED -1 00338 #endif 00339 00340 /* Finally, eliminate the standard type names to prevent their 00341 * accidental use. We must, however, allow this to be overridden for 00342 * files which need them, e.g. to use /usr/include expansions which 00343 * require them. 00344 */ 00345 #if 0 /* !defined(USE_STANDARD_TYPES) && !defined(_NEW_SYMTAB) */ 00346 # define short SYNTAX_ERROR_short 00347 # define int SYNTAX_ERROR_int 00348 # define long SYNTAX_ERROR_long 00349 #endif /* USE_STANDARD_TYPES */ 00350 00351 00352 00353 /* ==================================================================== 00354 * 00355 * Ubiquitous compiler types and macros 00356 * 00357 * We want several compiler standard types to be universally available 00358 * to allow their use without including their natural defining header 00359 * files. 00360 * 00361 * ==================================================================== 00362 */ 00363 00364 /* Define the general TDT table index type: */ 00365 typedef UINT16 CLASS_INDEX; /* Individual objects */ 00366 typedef mUINT16 mCLASS_INDEX; /* Table components */ 00367 00368 /* Define the PREG offset type: */ 00369 typedef INT32 PREG_NUM; /* Individual objects */ 00370 typedef mINT32 mPREG_NUM; /* Table components */ 00371 00372 /* Define the IDTYPE used by wopt */ 00373 typedef mUINT32 IDTYPE; 00374 00375 /* Define standard functions: */ 00376 #ifdef MAX 00377 # undef MAX 00378 #endif 00379 #ifdef MIN 00380 # undef MIN 00381 #endif 00382 #define MAX(a,b) ((a>=b)?a:b) 00383 #define MIN(a,b) ((a<=b)?a:b) 00384 00385 #ifdef KEY 00386 #ifdef Is_True_On 00387 static 00388 #else 00389 static __inline__ /* GNU 4.2 does not support non-static C99 inline functions. */ 00390 #endif 00391 #else 00392 inline 00393 #endif 00394 INT Max(INT i, INT j) 00395 { 00396 return MAX(i,j); 00397 } 00398 00399 #ifdef KEY 00400 #ifdef Is_True_On 00401 static 00402 #else 00403 static __inline__ /* GNU 4.2 does not support non-static C99 inline functions. */ 00404 #endif 00405 #else 00406 inline 00407 #endif 00408 INT Min(INT i, INT j) 00409 { 00410 return MIN(i,j); 00411 } 00412 00413 00414 /* -------------------------------------------------------------------- 00415 * VERY_BAD_PTR 00416 * a memory address that is almost certainly going to cause 00417 * a SIG. Many pointer values are initialized to this value to 00418 * catch any uninitialized uses of that pointer. 00419 * 00420 * Actually this could be host dependent, but the value below 00421 * is good enough for all current hosts 00422 * -------------------------------------------------------------------- 00423 */ 00424 #define VERY_BAD_PTR (0xfffffff) 00425 00426 /* mingw uses %I64 to print a long long rather than %ll */ 00427 #ifdef __MINGW32__ 00428 #define LL_FORMAT "I64" 00429 #else 00430 #define LL_FORMAT "ll" 00431 #endif 00432 00433 00434 #ifdef __cplusplus 00435 } 00436 #endif 00437 #endif /* defs_INCLUDED */
1.5.6