00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef mtypes_INCLUDED
00041 #define mtypes_INCLUDED
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 #ifdef _KEEP_RCS_ID
00069 static char *mtypes_rcs_id = "$Source: common/com/SCCS/s.mtypes.h $ $Revision: 1.16 $";
00070 #endif
00071
00072
00073 #define MTYPE_UNKNOWN 0
00074 #define MTYPE_FIRST 1
00075 #define MTYPE_B 1
00076 #define MTYPE_I1 2
00077 #define MTYPE_I2 3
00078 #define MTYPE_I4 4
00079 #define MTYPE_I8 5
00080 #define MTYPE_U1 6
00081 #define MTYPE_U2 7
00082 #define MTYPE_U4 8
00083 #define MTYPE_U8 9
00084 #define MTYPE_F4 10
00085 #define MTYPE_F8 11
00086 #define MTYPE_F10 12
00087 #define MTYPE_F16 13
00088
00089 #define MTYPE_STR 14
00090 #define MTYPE_STRING MTYPE_STR
00091 #define MTYPE_FQ 15
00092 #define MTYPE_M 16
00093 #define MTYPE_C4 17
00094 #define MTYPE_C8 18
00095 #define MTYPE_CQ 19
00096 #define MTYPE_V 20
00097
00098 #define MTYPE_BS 21
00099 #define MTYPE_A4 22
00100 #define MTYPE_A8 23
00101 #define MTYPE_C10 24
00102 #define MTYPE_C16 25
00103 #define MTYPE_I16 26
00104 #define MTYPE_U16 27
00105
00106 #ifdef TARG_X8664
00107 #define MTYPE_V16C4 28
00108 #define MTYPE_V16C8 29
00109 #define MTYPE_V16I1 30
00110 #define MTYPE_V16I2 31
00111 #define MTYPE_V16I4 32
00112 #define MTYPE_V16I8 33
00113 #define MTYPE_V16F4 34
00114 #define MTYPE_V16F8 35
00115
00116 #define MTYPE_V8I1 36
00117 #define MTYPE_V8I2 37
00118 #define MTYPE_V8I4 38
00119 #define MTYPE_V8F4 39
00120
00121 #define MTYPE_M8I1 40
00122 #define MTYPE_M8I2 41
00123 #define MTYPE_M8I4 42
00124 #define MTYPE_M8F4 43
00125
00126
00127 #define MTYPE_LAST 43
00128 #elif !defined(TARG_SL)
00129 #define MTYPE_LAST 27
00130 #else // TARG_SL
00131
00132 #define MTYPE_SB1 28
00133 #define MTYPE_SB2 29
00134 #define MTYPE_SB4 30
00135 #define MTYPE_SB8 31
00136 #define MTYPE_SBU1 32
00137 #define MTYPE_SBU2 33
00138 #define MTYPE_SBU4 34
00139 #define MTYPE_SBU8 35
00140
00141 #define MTYPE_SD1 36
00142 #define MTYPE_SD2 37
00143 #define MTYPE_SD4 38
00144 #define MTYPE_SD8 39
00145 #define MTYPE_SDU1 40
00146 #define MTYPE_SDU2 41
00147 #define MTYPE_SDU4 42
00148 #define MTYPE_SDU8 43
00149
00150 #define MTYPE_VBUF1 44
00151 #define MTYPE_VBUF2 45
00152 #define MTYPE_VBUF4 46
00153 #define MTYPE_LAST 46
00154 #endif // TARG_X8664
00155
00156
00157 typedef UINT8 TYPE_ID;
00158 typedef mUINT8 mTYPE_ID;
00159
00160
00161
00162 #define MTYPE_CLASS_INTEGER 0x01
00163 #define MTYPE_CLASS_FLOAT 0x02
00164 #define MTYPE_CLASS_COMPLEX 0x04
00165 #define MTYPE_CLASS_UNSIGNED 0x08
00166 #define MTYPE_CLASS_STR 0x10
00167 #define MTYPE_CLASS_VECTOR 0x20
00168 #ifdef KEY
00169 #define MTYPE_CLASS_SVECTOR 0x60 // 2 bits for short vector (64-bit vector)
00170 #endif
00171 #ifdef TARG_X8664
00172 #define MTYPE_CLASS_MVECTOR 0xa0 // 2 bits for MMX vector (64-bit vector)
00173 #endif
00174 #define MTYPE_CLASS_UNSIGNED_INTEGER (MTYPE_CLASS_UNSIGNED|MTYPE_CLASS_INTEGER)
00175 #define MTYPE_CLASS_COMPLEX_FLOAT (MTYPE_CLASS_COMPLEX|MTYPE_CLASS_FLOAT)
00176
00177
00178 typedef struct type_desc {
00179 mCLASS_INDEX id;
00180 mUINT16 bit_size;
00181 mUINT16 byte_size;
00182 mUINT16 dummy1;
00183 mUINT8 alignment;
00184 mUINT8 dummy2;
00185 mUINT8 dummy3;
00186
00187 mBOOL signed_type;
00188 mBOOL float_type;
00189 mCLASS_INDEX dummy4;
00190 const char *name;
00191 mUINT8 type_class_bits;
00192 mUINT8 type_order;
00193 mCLASS_INDEX complement;
00194 } TYPE_DESC;
00195
00196
00197
00198
00199 extern TYPE_DESC Machine_Types[];
00200
00201
00202 #define MTYPE_id(n) (Machine_Types[n].id)
00203 #define MTYPE_bit_size(n) (Machine_Types[n].bit_size)
00204 #define MTYPE_byte_size(n) (MTYPE_bit_size(n) >> 3)
00205 #define MTYPE_size_reg(n) MTYPE_bit_size(n)
00206 #define MTYPE_size_min(n) MTYPE_bit_size(n)
00207 #define MTYPE_size_best(n) MTYPE_bit_size(n)
00208 #define MTYPE_alignment(n) (Machine_Types[n].alignment)
00209 #define MTYPE_align_min(n) MTYPE_alignment(n)
00210 #define MTYPE_align_req(n) MTYPE_alignment(n)
00211 #define MTYPE_align_best(n) MTYPE_alignment(n)
00212 #define MTYPE_signed(n) (Machine_Types[n].signed_type)
00213 #define MTYPE_float(n) (Machine_Types[n].float_type)
00214 #define MTYPE_name(n) (Machine_Types[n].name)
00215 #define MTYPE_type_class(n) (Machine_Types[n].type_class_bits)
00216 #define MTYPE_type_order(n) (Machine_Types[n].type_order)
00217 #define MTYPE_complement(n) (Machine_Types[n].complement)
00218
00219
00220 #define MTYPE_is_integral(n) (MTYPE_type_class(n) & MTYPE_CLASS_INTEGER)
00221 #define MTYPE_is_signed(n) (MTYPE_type_class(n)==MTYPE_CLASS_INTEGER)
00222 #define MTYPE_is_unsigned(n) (MTYPE_type_class(n)==MTYPE_CLASS_UNSIGNED_INTEGER)
00223 #define MTYPE_is_float(n) (MTYPE_type_class(n) & MTYPE_CLASS_FLOAT)
00224 #define MTYPE_is_complex(n) (MTYPE_type_class(n) & MTYPE_CLASS_COMPLEX)
00225 #define MTYPE_is_vector(n) (MTYPE_type_class(n) & MTYPE_CLASS_VECTOR)
00226 #ifdef TARG_X8664
00227 #define MTYPE_is_short_vector(n) ((MTYPE_type_class(n) & MTYPE_CLASS_SVECTOR) == MTYPE_CLASS_SVECTOR)
00228 #define MTYPE_is_mmx_vector(n) ((MTYPE_type_class(n) & MTYPE_CLASS_MVECTOR) == MTYPE_CLASS_MVECTOR)
00229 #endif // TARG_X8664
00230 #ifdef KEY
00231 #ifndef MTYPE_is_short_vector
00232 #define MTYPE_is_short_vector(n) (MTYPE_type_class(n)==MTYPE_CLASS_SVECTOR)
00233 #endif
00234 #define MTYPE_is_str(n) (MTYPE_type_class(n)==MTYPE_CLASS_STR)
00235 #else
00236 #define MTYPE_is_str(n) (MTYPE_type_class(n)==MTYPE_STR)
00237 #endif // KEY
00238 #define MTYPE_is_m(n) ((n)==MTYPE_M)
00239 #define MTYPE_is_void(n) ((n)==MTYPE_V)
00240
00241 #define MTYPE_is_quad(n) ((n)==MTYPE_FQ || (n)==MTYPE_CQ)
00242 #define MTYPE_is_pointer(n) ((n)==Pointer_type || (n)==Pointer_type2)
00243 #define MTYPE_is_boolean(n) ((n)==Boolean_type || (n)==Boolean_type2)
00244
00245
00246 #define MTYPE_RegisterSize(n) MTYPE_byte_size(n)
00247
00248 #define MTYPE_is_size_double(n) (MTYPE_bit_size(n) == MTYPE_bit_size(MTYPE_I8))
00249
00250 #ifdef TARG_SL
00251 #define MTYPE_is_longlong(n) (MTYPE_is_integral(n) && (MTYPE_bit_size(n) == 64))
00252 #define MTYPE_is_double(n) (MTYPE_is_float(n) && (MTYPE_bit_size(n) == 64))
00253 #endif
00254
00255
00256 typedef UINT32 MTYPE_MASK;
00257
00258
00259 #define Type_Mask(t) ( ((MTYPE_MASK) 1) << (t) )
00260
00261
00262 #define TMASK_Element(m,k) (((m) & Type_Mask(k))!=0)
00263 #define TMASK_And(m1,m2) ((m1) & (m2))
00264 #define TMASK_Or(m1,m2) ((m1) | (m2))
00265 #define TMASK_Included(m1,m2) (TMASK_And(m1,m2)==(m1))
00266
00267
00268 extern MTYPE_MASK Machine_Types_Available;
00269 #define MTYPE_Avail(k) TMASK_Element(Machine_Types_Available,k)
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292 extern const char *Mtype_Name ( TYPE_ID );
00293 extern TYPE_ID Mtype_AlignmentClass( INT32 , mUINT8 );
00294 extern TYPE_ID Mtype_Promote_to_A4A8( TYPE_ID );
00295 extern TYPE_ID Mtype_TransferSign( TYPE_ID, TYPE_ID );
00296 extern TYPE_ID Mtype_TransferSize( TYPE_ID, TYPE_ID );
00297 extern TYPE_ID Mtype_complex_to_real( TYPE_ID);
00298 extern TYPE_ID Mtype_comparison( TYPE_ID );
00299 extern TYPE_ID Mtype_next_alignment( TYPE_ID);
00300 extern TYPE_ID Mtype_prev_alignment( TYPE_ID);
00301
00302
00303 #ifdef __cplusplus
00304 }
00305 #endif
00306 #endif