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 /* USMID @(#) clibinc/cray/dopevec.h 92.3 06/16/99 15:48:24 */ 00036 #ifndef _DOPEVEC_H /* prevent multiple inclusions */ 00037 #define _DOPEVEC_H 00038 00039 /* 00040 * Header file describing the Fortran 90 and CF77 Dope Vector structure 00041 */ 00042 00043 #include <fortran.h> 00044 00045 /* 00046 * STRUCTURES 00047 */ 00048 00049 /* 00050 * Word 4 contains type and length information so the libraries can perform 00051 * conversion when specified through FFIO. int_len is the container bit 00052 * size used on a cray. el_len and int_len fields are the same for integer, 00053 * real, complex, and logical. For ASCII character, int_len is 8 to specify 00054 * the length of a single character. int_len and dec_len are not used for 00055 * derived type entities. F90 array intrinsics use type and int_len. 00056 */ 00057 00058 typedef struct f90_type { 00059 #if defined(__mips) || !defined(_WORD32) || defined(_LITTLE_ENDIAN) 00060 unsigned int :32; /* used for future development */ 00061 #endif 00062 00063 enum typecodes { 00064 DVTYPE_UNUSED = 0, 00065 DVTYPE_TYPELESS = 1, 00066 DVTYPE_INTEGER = 2, 00067 DVTYPE_REAL = 3, 00068 DVTYPE_COMPLEX = 4, 00069 DVTYPE_LOGICAL = 5, 00070 DVTYPE_ASCII = 6, 00071 DVTYPE_DERIVEDBYTE = 7, 00072 DVTYPE_DERIVEDWORD = 8 00073 } type :8; /* type code */ 00074 unsigned int dpflag :1; /* set if declared double precision 00075 * or double complex */ 00076 enum dec_codes { 00077 DVD_DEFAULT = 0, /* KIND= and *n absent, or 00078 * KIND=expression which evaluates to 00079 * the default KIND, ie.: 00080 * KIND(0) for integer 00081 * KIND(0.0) for real 00082 * KIND((0,0)) for complex 00083 * KIND(.TRUE.) for logical 00084 * KIND('A') for character 00085 * across on all ANSI-conformant 00086 * implementations. */ 00087 DVD_KIND = 1, /* KIND=expression which does not 00088 * qualify to be DVD_DEFAULT or 00089 * DVD_KIND_CONST or DVD_KIND_DOUBLE */ 00090 DVD_STAR = 2, /* *n is specified (example: REAL*8 */ 00091 DVD_KIND_CONST = 3, /* KIND=expression constant across 00092 * all implementations. */ 00093 DVD_KIND_DOUBLE = 4 /* KIND=expression which evaluates to 00094 * KIND(1.0D0) for real across all 00095 * implementations. This code may be 00096 * passed for real or complex type. */ 00097 } kind_or_star :3; /* Set if KIND= or *n appears in the 00098 * variable declaration. Values 00099 * are from enum dec_codes */ 00100 unsigned int int_len :12; /* internal length in bits of iolist 00101 * entity. 8 for character data to 00102 * indicate size of each character */ 00103 unsigned int dec_len :8; /* declared length in bytes for *n 00104 * or KIND value. Ignored if 00105 * kind_or_star==DVD_DEFAULT */ 00106 } f90_type_t; 00107 00108 /* Header 00109 * 00110 * The three types of data objects described by this dope vector are listed 00111 * here with the valid address/size fields which may be referenced. 00112 * 00113 * 00114 * 1. Word aligned data types. 00115 * 00116 * Type Codes 00117 * ---------- 00118 * DVTYPE_TYPELESS 00119 * DVTYPE_INTEGER 00120 * DVTYPE_REAL 00121 * DVTYPE_COMPLEX 00122 * DVTYPE_LOGICAL 00123 * DVTYPE_DERIVEDWORD 00124 * 00125 * This includes: 00126 * a. All intrinsic noncharacter data types 00127 * b. All word-aligned sequence derived data types. This includes 00128 * noncharacter sequence derived data types and mixed character 00129 * and noncharacter sequence derived data types. 00130 * 00131 * If the object is a mixed character and noncharacter sequence derived 00132 * type, the element length includes any padding to word boundaries. 00133 * 00134 * Valid base_addr Fields 00135 * ---------------------- 00136 * 00137 * base_addr.a.ptr - address of the first element 00138 * base_addr.a.el_len - the bit length of each data element 00139 * 00140 * 00141 * 2. Character sequence derived type. 00142 * 00143 * Type Codes 00144 * ---------- 00145 * DVTYPE_DERIVEDBYTE 00146 * 00147 * Valid base_addr Fields 00148 * ---------------------- 00149 * 00150 * base_addr.a.ptr - address of the first element 00151 * base_addr.a.el_len - the bit length of each data element 00152 * 00153 * 00154 * 3. The array is intrinsic character and byte-aligned. 00155 * 00156 * Type Codes 00157 * ---------- 00158 * 00159 * DVTYPE_ASCII 00160 * 00161 * Valid base_addr Fields 00162 * ---------------------- 00163 * 00164 * base_addr.a.charptr - fcd which describes the first element 00165 * 00166 * YMP/C90 only: 00167 * base_addr.a.el_len - the bit length of each data element 00168 * 00169 * 00170 * Note that for an array, the _fcdlen() value corresponds to 00171 * one element of the array, not the entire array. 00172 * 00173 * Also note that on YMP or C90 systems with one-word FCDs, 00174 * the el_len field is also valid. By convention, the libraries do 00175 * not read this field for DVTYPE_ASCII type, but the field is set 00176 * because the YMP/C90 compiler needs the element length information to 00177 * be in both _fcdlen(base_addr.a.charptr) and in base_addr.a.el_len. 00178 */ 00179 00180 /* 00181 * PROPOSED CHANGE: 00182 * 00183 * fcd must contain the void pointer and a 64-bit element length. 00184 * The length is still in bits but is in a 64-bit container. 00185 * 00186 * union { 00187 * _fcd charptr; 00188 * struct { 00189 * void *ptr; 00190 * unsigned long long el_len; 00191 * } a; 00192 * } base_addr; 00193 */ 00194 typedef struct DopeVector { 00195 union { 00196 _fcd charptr; /* Fortran character descriptor */ 00197 struct { 00198 void *ptr; /* pointer to base address */ 00199 /* or shared data desc */ 00200 unsigned long el_len; /* element length in bits */ 00201 } a; 00202 } base_addr; 00203 00204 /* 00205 * flags and information fields within word 3 of the header 00206 */ 00207 unsigned int assoc :1; /* associated flag */ 00208 unsigned int ptr_alloc :1; /* set if allocated by pointer */ 00209 enum ptrarray { 00210 NOT_P_OR_A = 0, 00211 POINTTR = 1, 00212 ALLOC_ARRY = 2 00213 } p_or_a :2; /* pointer or allocatable array. Use */ 00214 /* enum ptrarray values. */ 00215 unsigned int a_contig :1; /* array storage contiguous flag */ 00216 /* 00217 * PROPOSED CHANGE: 00218 * 00219 * Add version and coarray n_dim fields. Update the n_dim to all 00220 * up to 255 dimensions although only 20 may be the actual MAXDIM. 00221 * The f95 standard is still only 7. 00222 * 00223 * unsigned long dv_versn :6; 00224 * unsigned long :21; 00225 * unsigned long :8; 00226 * unsigned long n_codim :8; 00227 * unsigned long :8; 00228 * unsigned long n_dim :8; 00229 */ 00230 #if defined(__mips) || defined(_LITTLE_ENDIAN) 00231 unsigned int :27; /* pad for first 32 bits */ 00232 unsigned int :29; /* pad for second 32-bits */ 00233 #elif defined( _WORD32) 00234 unsigned long unused1 :24; /* unused */ 00235 #else 00236 unsigned long unused1 :56; /* unused */ 00237 #endif 00238 unsigned int n_dim :3; /* number of dimensions */ 00239 f90_type_t type_lens; /* data type and lengths */ 00240 void *orig_base; /* original base address */ 00241 /* 00242 * PROPOSED CHANGE: 00243 * 00244 * orig_size must be 64 bits always and is in bits. 00245 * 00246 * unsigned long long orig_size; 00247 */ 00248 unsigned long orig_size; /* original size */ 00249 /* 00250 * Per Dimension Information 00251 */ 00252 #define MAXDIM 7 00253 /* 00254 * PROPOSED CHANGE: 00255 * 00256 * The maximum number of dimensions may be 255 with 8 bits but 00257 * allow only 20 for now. See Section 5.1.2.4 of f95 standard. 00258 * 00259 * define MAXDIM 20 00260 * 00261 * The dimension structure must contain 64-bit fields with the 00262 * changes to n_dim to 8 bits or 255. Therefore, low_bound, extent, 00263 * and stride_mult will be long long or int64 in the future. 00264 * 00265 * struct DvDimen { 00266 * signed long long low_bound; 00267 * signed long long extent; 00268 * signed long long stride_mult; 00269 * }dimension[MAXDIM]; 00270 * 00271 * The stride multiplier will be in terms of elements in the future. 00272 * In terms of the library on some systems, the library will need to 00273 * change from multiplying the stride mult by 2 for 32-bit sizes. 00274 * The version flag is needed to allow the library to handle this 00275 * change. 00276 * 00277 * The number of elements in the dimension structure array will match 00278 * the number of dimensions in n_dim, i.e., if n_dim = 3, then 00279 * dimension will have only three elements (dimension[3]). 00280 * 00281 * The coarray dimension information will follow the non-coarray 00282 * dimension array. The number of elements in the codimension 00283 * structure array will match the number of dimensions in n_codim, 00284 * i.e., if n_codim = 2, then codimension will have only two elements. 00285 * 00286 * struct CoDvDimen { 00287 * signed long long low_bound; 00288 * signed long long extent; 00289 * signed long long stride_mult; 00290 * }codimension[MAXDIM]; 00291 */ 00292 struct DvDimen { 00293 signed long low_bound; /* lower bound for ith dimension */ 00294 /* may be negative */ 00295 signed long extent; /* number of elts for ith dimension */ 00296 /* 00297 * The stride mult is not defined in constant units so that address 00298 * calculations do not always require a divide by 8 or 64. For 00299 * double and complex, stride mult has a factor of 2 in it. For 00300 * double complex, stride mult has a factor of 4 in it. 00301 */ 00302 signed long stride_mult; /* stride multiplier */ 00303 }dimension[MAXDIM]; 00304 } DopeVectorType; 00305 00306 00307 /* 00308 * MACROS and TYPEDEFS 00309 */ 00310 00311 #define DVTYPE_NTYPES 9 /* number of data type codes */ 00312 typedef enum typecodes ftype_t; /* Fortran 90 type code */ 00313 00314 /* 00315 * SMSCALE computes the scale of stride_mult for a non-character 00316 * dopevector. This is the number of bytes per stride_mult. On some 00317 * architectures, this always evaluates to sizeof(long). 00318 * 00319 * Parameter: 00320 * dv - pointer to dope vector. 00321 * 00322 * Return value: 00323 * The size of one stride_mult in bytes. 00324 */ 00325 00326 #if defined(__mips) || defined(_LITTLE_ENDIAN) 00327 #define SMSCALE(dv) \ 00328 (((dv)->type_lens.int_len >= 8*sizeof(_f_int4)) ? 4 : \ 00329 (((dv)->type_lens.int_len == 8*sizeof(_f_int2)) ? 2 : \ 00330 (((dv)->type_lens.int_len == 8*sizeof(_f_int1)) ? 1 : 4))) 00331 #elif !defined(_WORD32) && (defined(_F_INT4) || defined(_F_REAL4)) 00332 #define SMSCALE(dv) \ 00333 (((dv)->type_lens.int_len < 8*sizeof(long)) ? 4 : sizeof(long)) 00334 #else 00335 #define SMSCALE(dv) (sizeof(long)) 00336 #endif 00337 00338 #define CPPLOG2(x) \ 00339 (x == 1 ? 0 : \ 00340 (x == 2 ? 1 : \ 00341 (x == 4 ? 2 : \ 00342 (x == 8 ? 3 : \ 00343 (x == 16 ? 4 : \ 00344 (x == 32 ? 5 : \ 00345 -1)))))) 00346 00347 #define SMSHIFT(dv) CPPLOG2(SMSCALE(dv)/sizeof(bcont)) 00348 00349 #endif /* !_DOPEVEC_H */ 00350