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