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 mtypes_INCLUDED 00037 #define mtypes_INCLUDED 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00042 /* ==================================================================== 00043 * ==================================================================== 00044 * 00045 * 00046 * Revision history: 00047 * 11-Oct-89 - Original Version 00048 * 00049 * Description: 00050 * 00051 * Define IDs for the types supported by the target machine. Not all 00052 * of the predefined types will be supported on a given machine. 00053 * 00054 * ==================================================================== 00055 * ==================================================================== 00056 */ 00057 00058 00059 #ifdef _KEEP_RCS_ID 00060 #endif /* _KEEP_RCS_ID */ 00061 00062 /* The predefined machine data types, present on many machines: */ 00063 #define MTYPE_UNKNOWN 0 00064 #define MTYPE_FIRST 1 00065 #define MTYPE_B 1 /* BOOL */ 00066 #define MTYPE_I1 2 /* 8-bit integer */ 00067 #define MTYPE_I2 3 /* 16-bit integer */ 00068 #define MTYPE_I4 4 /* 32-bit integer */ 00069 #define MTYPE_I8 5 /* 64-bit integer */ 00070 #define MTYPE_U1 6 /* 8-bit unsigned integer */ 00071 #define MTYPE_U2 7 /* 16-bit unsigned integer */ 00072 #define MTYPE_U4 8 /* 32-bit unsigned integer */ 00073 #define MTYPE_U8 9 /* 64-bit unsigned integer */ 00074 #define MTYPE_F4 10 /* 32-bit IEEE floating point */ 00075 #define MTYPE_F8 11 /* 64-bit IEEE floating point */ 00076 #define MTYPE_F10 12 /* 80-bit IEEE floating point */ 00077 #define MTYPE_F16 13 /* 128-bit IEEE floating point */ 00078 00079 /* Define non-machine simulated types that are used in the compiler: */ 00080 #define MTYPE_STR 14 /* char strings - TCONs only */ 00081 #define MTYPE_STRING MTYPE_STR 00082 #define MTYPE_FQ 15 /* for SGI long double */ 00083 #define MTYPE_M 16 /* memory chunk, for structures */ 00084 #define MTYPE_C4 17 /* for 32-bit complex */ 00085 #define MTYPE_C8 18 /* for 64-bit complex */ 00086 #define MTYPE_CQ 19 /* for quad complex */ 00087 #define MTYPE_V 20 /* for void type */ 00088 00089 #define MTYPE_BS 21 /* Bits */ 00090 #define MTYPE_A4 22 /* 32-bit address */ 00091 #define MTYPE_A8 23 /* 64-bit address */ 00092 #define MTYPE_C10 24 /* 80-bit IEEE floating point complex */ 00093 #define MTYPE_C16 25 /* 128-bit IEEE floating point complex */ 00094 #define MTYPE_I16 26 /* 128-bit signed integer */ 00095 #define MTYPE_U16 27 /* 128-bit unsigned integer */ 00096 00097 /* must define MTYPE_LAST as the index of the last one defined. */ 00098 #define MTYPE_LAST 27 /* Must be defined */ 00099 00100 /* Define the type: */ 00101 typedef UINT8 TYPE_ID; 00102 typedef mUINT8 mTYPE_ID; 00103 00104 00105 /* Type_class_bits */ 00106 #define MTYPE_CLASS_INTEGER 0x01 00107 #define MTYPE_CLASS_FLOAT 0x02 00108 #define MTYPE_CLASS_COMPLEX 0x04 00109 #define MTYPE_CLASS_UNSIGNED 0x08 00110 #define MTYPE_CLASS_STR 0x10 00111 #define MTYPE_CLASS_UNSIGNED_INTEGER (MTYPE_CLASS_UNSIGNED|MTYPE_CLASS_INTEGER) 00112 #define MTYPE_CLASS_COMPLEX_FLOAT (MTYPE_CLASS_COMPLEX|MTYPE_CLASS_FLOAT) 00113 00114 /* Define the type descriptor: */ 00115 typedef struct type_desc { 00116 mCLASS_INDEX id; /* Type index -- MTYPE_xxx above */ 00117 mUINT16 bit_size; /* bit size */ 00118 mUINT16 byte_size; /* byte size (NYI) */ 00119 mUINT16 dummy1; /* remove when incompatible change */ 00120 mUINT8 alignment; /* byte alignment */ 00121 mUINT8 dummy2; /* remove when incompatible change */ 00122 mUINT8 dummy3; /* remove when incompatible change */ 00123 00124 mBOOL signed_type; /* Signed numeric type? */ 00125 mBOOL float_type; /* Floating point type? */ 00126 mCLASS_INDEX dummy4; /* remove when incompatible change */ 00127 mUINT8 type_class_bits;/* The classification bits used by the simplifier */ 00128 mUINT8 type_order; /* The order of types (I8 > I4 for example) */ 00129 mCLASS_INDEX complement; /* complementary signed partner (ex. U1 -> I1) */ 00130 } TYPE_DESC; 00131 /* Types which are not supported in memory should have memory sizes 00132 * and alignment values of 0. */ 00133 00134 /* Declare the type descriptor table: */ 00135 extern TYPE_DESC Machine_Types[]; 00136 00137 /* Define the access functions: */ 00138 #define MTYPE_id(n) (Machine_Types[n].id) 00139 #define MTYPE_bit_size(n) (Machine_Types[n].bit_size) 00140 #define MTYPE_byte_size(n) (MTYPE_bit_size(n) >> 3) 00141 #define MTYPE_size_reg(n) MTYPE_bit_size(n) 00142 #define MTYPE_size_min(n) MTYPE_bit_size(n) 00143 #define MTYPE_size_best(n) MTYPE_bit_size(n) 00144 #define MTYPE_alignment(n) (Machine_Types[n].alignment) 00145 #define MTYPE_align_min(n) MTYPE_alignment(n) 00146 #define MTYPE_align_req(n) MTYPE_alignment(n) 00147 #define MTYPE_align_best(n) MTYPE_alignment(n) 00148 #define MTYPE_signed(n) (Machine_Types[n].signed_type) 00149 #define MTYPE_float(n) (Machine_Types[n].float_type) 00150 #define MTYPE_name(n) Mtype_Name(n) 00151 #define MTYPE_type_class(n) (Machine_Types[n].type_class_bits) 00152 #define MTYPE_type_order(n) (Machine_Types[n].type_order) 00153 #define MTYPE_complement(n) (Machine_Types[n].complement) 00154 00155 /* define register classes */ 00156 #define MTYPE_is_integral(n) (MTYPE_type_class(n) & MTYPE_CLASS_INTEGER) 00157 #define MTYPE_is_signed(n) (MTYPE_type_class(n)==MTYPE_CLASS_INTEGER) 00158 #define MTYPE_is_unsigned(n) (MTYPE_type_class(n)==MTYPE_CLASS_UNSIGNED_INTEGER) 00159 #define MTYPE_is_float(n) (MTYPE_type_class(n) & MTYPE_CLASS_FLOAT) 00160 #define MTYPE_is_complex(n) (MTYPE_type_class(n) & MTYPE_CLASS_COMPLEX) 00161 #define MTYPE_is_str(n) (MTYPE_type_class(n)==MTYPE_STR) 00162 #define MTYPE_is_m(n) ((n)==MTYPE_M) 00163 #define MTYPE_is_void(n) ((n)==MTYPE_V) 00164 00165 #define MTYPE_is_quad(n) ((n)==MTYPE_FQ || (n)==MTYPE_CQ) 00166 #define MTYPE_is_pointer(n) ((n)==Pointer_type || (n)==Pointer_type2) 00167 #define MTYPE_is_boolean(n) ((n)==Boolean_type || (n)==Boolean_type2) 00168 00169 /* Register size in bytes */ 00170 #define MTYPE_RegisterSize(n) MTYPE_byte_size(n) 00171 00172 #define MTYPE_is_size_double(n) (MTYPE_bit_size(n) == MTYPE_bit_size(MTYPE_I8)) 00173 00174 /* Define a mask of machine types, for use in register descriptors: */ 00175 typedef UINT32 MTYPE_MASK; 00176 00177 /* Convert TYPE_ID to MTYPE_MASK: */ 00178 #define Type_Mask(t) ( ((MTYPE_MASK) 1) << (t) ) 00179 00180 /* Operations on type masks: */ 00181 #define TMASK_Element(m,k) (((m) & Type_Mask(k))!=0) 00182 #define TMASK_And(m1,m2) ((m1) & (m2)) 00183 #define TMASK_Or(m1,m2) ((m1) | (m2)) 00184 #define TMASK_Included(m1,m2) (TMASK_And(m1,m2)==(m1)) 00185 00186 /* Define which types are available on the target: */ 00187 extern MTYPE_MASK Machine_Types_Available; 00188 #define MTYPE_Avail(k) TMASK_Element(Machine_Types_Available,k) 00189 00190 /* ======================================================================= 00191 * 00192 * Exported Functions 00193 * 00194 * const char * Mtype_Name (TYPE_ID tid) 00195 * 00196 * given a MTYPE, return a string representation 00197 * 00198 * TYPE_ID Name_To_Mtype (const char * nm) 00199 * 00200 * given a string, return a MTYPE 00201 * 00202 * TYPE_ID Mtype_AlignmentClass(INT32 align, mUINT8 class) 00203 * 00204 * Routine to return a type that matches exact byte alignment 00205 * and class 00206 * 00207 * 00208 * TYPE_ID Mtype_TransferSign(TYPE_ID type) 00209 * 00210 * Routine to return the unsigned type corresponding to type 00211 * 00212 */ 00213 00214 extern const char* Mtype_Name ( TYPE_ID ); 00215 extern TYPE_ID Name_To_Mtype ( const char* nm ); 00216 00217 extern TYPE_ID Mtype_AlignmentClass( INT32 , mUINT8 ); 00218 extern TYPE_ID Mtype_Promote_to_A4A8( TYPE_ID ); 00219 extern TYPE_ID Mtype_TransferSign( TYPE_ID, TYPE_ID ); 00220 extern TYPE_ID Mtype_TransferSize( TYPE_ID, TYPE_ID ); 00221 extern TYPE_ID Mtype_complex_to_real( TYPE_ID); 00222 extern TYPE_ID Mtype_comparison( TYPE_ID ); 00223 extern TYPE_ID Mtype_next_alignment( TYPE_ID); 00224 extern TYPE_ID Mtype_prev_alignment( TYPE_ID); 00225 00226 00227 #ifdef __cplusplus 00228 } 00229 #endif 00230 #endif /* mtypes_INCLUDED */