%token PERCENT 1 %token AMPERSAND 2 %token ASTER 3 %token CLUSTER 4 %token COLON 5 %token COMMA 6 %token DASTER 7 %token DEFINED_OPERATOR 8 %token DOT 9 %token DQUOTE 10 %token GLOBAL_A 11 %token LEFTAB 12 %token LEFTPAR 13 %token MINUS 14 %token PLUS 15 %token POINT_TO 16 %token QUOTE 17 %token RIGHTAB 18 %token RIGHTPAR 19 %token AND 20 %token DSLASH 21 %token EQV 22 %token EQ 23 %token EQUAL 24 %token FFALSE 25 %token GE 26 %token GT 27 %token LE 28 %token LT 29 %token NE 30 %token NEQV 31 %token NOT 32 %token OR 33 %token TTRUE 34 %token SLASH 35 %token XOR 36 %token REFERENCE 37 %token AT 38 %token ACROSS 39 %token ALIGN_WITH 40 %token ALIGN 41 %token ALLOCATABLE 42 %token ALLOCATE 43 %token ARITHIF 44 %token ASSIGNMENT 45 %token ASSIGN 46 %token ASSIGNGOTO 47 %token ASYNCHRONOUS 48 %token ASYNCID 49 %token ASYNCWAIT 50 %token BACKSPACE 51 %token BAD_CCONST 52 %token BAD_SYMBOL 53 %token BARRIER 54 %token BLOCKDATA 55 %token BLOCK 56 %token BOZ_CONSTANT 57 %token BYTE 58 %token CALL 59 %token CASE 60 %token CHARACTER 61 %token CHAR_CONSTANT 62 %token CHECK 63 %token CLOSE 64 %token COMMON 65 %token COMPLEX 66 %token COMPGOTO 67 %token CONSISTENT_GROUP 68 %token CONSISTENT_SPEC 69 %token CONSISTENT_START 70 %token CONSISTENT_WAIT 71 %token CONSISTENT 72 %token CONSTRUCT_ID 73 %token CONTAINS 74 %token CONTINUE 75 %token CORNER 76 %token CYCLE 77 %token DATA 78 %token DEALLOCATE 79 %token HPF_TEMPLATE 80 %token DEBUG 81 %token DEFAULT_CASE 82 %token DEFINE 83 %token DERIVED 84 %token DIMENSION 85 %token DISTRIBUTE 86 %token DOWHILE 87 %token DOUBLEPRECISION 88 %token DOUBLECOMPLEX 89 %token DP_CONSTANT 90 %token DVM_POINTER 91 %token DYNAMIC 92 %token ELEMENTAL 93 %token ELSE 94 %token ELSEIF 95 %token ELSEWHERE 96 %token ENDASYNCHRONOUS 97 %token ENDDEBUG 98 %token ENDINTERVAL 99 %token ENDUNIT 100 %token ENDDO 101 %token ENDFILE 102 %token ENDFORALL 103 %token ENDIF 104 %token ENDINTERFACE 105 %token ENDMODULE 106 %token ENDON 107 %token ENDSELECT 108 %token ENDTASK_REGION 109 %token ENDTYPE 110 %token ENDWHERE 111 %token ENTRY 112 %token EXIT 113 %token EOLN 114 %token EQUIVALENCE 115 %token ERROR 116 %token EXTERNAL 117 %token F90 118 %token FIND 119 %token FORALL 120 %token FORMAT 121 %token FUNCTION 122 %token GATE 123 %token GEN_BLOCK 124 %token HEAP 125 %token HIGH 126 %token IDENTIFIER 127 %token IMPLICIT 128 %token IMPLICITNONE 129 %token INCLUDE_TO 130 %token INCLUDE 131 %token INDEPENDENT 132 %token INDIRECT_ACCESS 133 %token INDIRECT_GROUP 134 %token INDIRECT 135 %token INHERIT 136 %token INQUIRE 137 %token INTERFACEASSIGNMENT 138 %token INTERFACEOPERATOR 139 %token INTERFACE 140 %token INTRINSIC 141 %token INTEGER 142 %token INTENT 143 %token INTERVAL 144 %token INOUT 145 %token IN 146 %token INT_CONSTANT 147 %token LABEL 148 %token LABEL_DECLARE 149 %token LET 150 %token LOCALIZE 151 %token LOGICAL 152 %token LOGICALIF 153 %token LOOP 154 %token LOW 155 %token MAXLOC 156 %token MAX 157 %token MAP 158 %token MINLOC 159 %token MIN 160 %token MODULE_PROCEDURE 161 %token MODULE 162 %token MULT_BLOCK 163 %token NAMEEQ 164 %token NAMELIST 165 %token NEW_VALUE 166 %token NEW 167 %token NULLIFY 168 %token OCTAL_CONSTANT 169 %token ONLY 170 %token ON 171 %token ON_DIR 172 %token ONTO 173 %token OPEN 174 %token OPERATOR 175 %token OPTIONAL 176 %token OTHERWISE 177 %token OUT 178 %token OWN 179 %token PARALLEL 180 %token PARAMETER 181 %token PAUSE 182 %token PLAINDO 183 %token PLAINGOTO 184 %token POINTER 185 %token POINTERLET 186 %token PREFETCH 187 %token PRINT 188 %token PRIVATE 189 %token PRODUCT 190 %token PROGRAM 191 %token PUBLIC 192 %token PURE 193 %token RANGE 194 %token READ 195 %token REALIGN_WITH 196 %token REALIGN 197 %token REAL 198 %token REAL_CONSTANT 199 %token RECURSIVE 200 %token REDISTRIBUTE_NEW 201 %token REDISTRIBUTE 202 %token REDUCTION_GROUP 203 %token REDUCTION_START 204 %token REDUCTION_WAIT 205 %token REDUCTION 206 %token REMOTE_ACCESS_SPEC 207 %token REMOTE_ACCESS 208 %token REMOTE_GROUP 209 %token RESET 210 %token RESULT 211 %token RETURN 212 %token REWIND 213 %token SAVE 214 %token SECTION 215 %token SELECT 216 %token SEQUENCE 217 %token SHADOW_ADD 218 %token SHADOW_COMPUTE 219 %token SHADOW_GROUP 220 %token SHADOW_RENEW 221 %token SHADOW_START_SPEC 222 %token SHADOW_START 223 %token SHADOW_WAIT_SPEC 224 %token SHADOW_WAIT 225 %token SHADOW 226 %token STAGE 227 %token STATIC 228 %token STAT 229 %token STOP 230 %token SUBROUTINE 231 %token SUM 232 %token SYNC 233 %token TARGET 234 %token TASK 235 %token TASK_REGION 236 %token THEN 237 %token TO 238 %token TRACEON 239 %token TRACEOFF 240 %token TRUNC 241 %token TYPE 242 %token TYPE_DECL 243 %token UNDER 244 %token UNKNOWN 245 %token USE 246 %token VIRTUAL 247 %token VARIABLE 248 %token WAIT 249 %token WHERE 250 %token WHERE_ASSIGN 251 %token WHILE 252 %token WITH 253 %token WRITE 254 %token COMMENT 255 %token WGT_BLOCK 256 %token HPF_PROCESSORS 257 %token IOSTAT 258 %token ERR 259 %token END 260 %token OMPDVM_ATOMIC 261 %token OMPDVM_BARRIER 262 %token OMPDVM_COPYIN 263 %token OMPDVM_COPYPRIVATE 264 %token OMPDVM_CRITICAL 265 %token OMPDVM_ONETHREAD 266 %token OMPDVM_DO 267 %token OMPDVM_DYNAMIC 268 %token OMPDVM_ENDCRITICAL 269 %token OMPDVM_ENDDO 270 %token OMPDVM_ENDMASTER 271 %token OMPDVM_ENDORDERED 272 %token OMPDVM_ENDPARALLEL 273 %token OMPDVM_ENDPARALLELDO 274 %token OMPDVM_ENDPARALLELSECTIONS 275 %token OMPDVM_ENDPARALLELWORKSHARE 276 %token OMPDVM_ENDSECTIONS 277 %token OMPDVM_ENDSINGLE 278 %token OMPDVM_ENDWORKSHARE 279 %token OMPDVM_FIRSTPRIVATE 280 %token OMPDVM_FLUSH 281 %token OMPDVM_GUIDED 282 %token OMPDVM_LASTPRIVATE 283 %token OMPDVM_MASTER 284 %token OMPDVM_NOWAIT 285 %token OMPDVM_NONE 286 %token OMPDVM_NUM_THREADS 287 %token OMPDVM_ORDERED 288 %token OMPDVM_PARALLEL 289 %token OMPDVM_PARALLELDO 290 %token OMPDVM_PARALLELSECTIONS 291 %token OMPDVM_PARALLELWORKSHARE 292 %token OMPDVM_RUNTIME 293 %token OMPDVM_SECTION 294 %token OMPDVM_SECTIONS 295 %token OMPDVM_SCHEDULE 296 %token OMPDVM_SHARED 297 %token OMPDVM_SINGLE 298 %token OMPDVM_THREADPRIVATE 299 %token OMPDVM_WORKSHARE 300 %token OMPDVM_NODES 301 %token OMPDVM_IF 302 %token IAND 303 %token IEOR 304 %token IOR 305 %token ACC_REGION 306 %token ACC_END_REGION 307 %token ACC_CHECKSECTION 308 %token ACC_END_CHECKSECTION 309 %token ACC_GET_ACTUAL 310 %token ACC_ACTUAL 311 %token ACC_TARGETS 312 %token ACC_ASYNC 313 %token ACC_HOST 314 %token ACC_CUDA 315 %token ACC_LOCAL 316 %token ACC_INLOCAL 317 %token ACC_CUDA_BLOCK 318 %token ACC_ROUTINE 319 %token ACC_TIE 320 %token ACC_DECLARE 321 %token BY 322 %token IO_MODE 323 %token CP_CREATE 324 %token CP_LOAD 325 %token CP_SAVE 326 %token CP_WAIT 327 %token FILES 328 %token VARLIST 329 %token STATUS 330 %token EXITINTERVAL 331 %token TEMPLATE_CREATE 332 %token TEMPLATE_DELETE 333 %token SPF_ANALYSIS 334 %token SPF_PARALLEL 335 %token SPF_TRANSFORM 336 %token SPF_NOINLINE 337 %token SPF_PARALLEL_REG 338 %token SPF_END_PARALLEL_REG 339 %token SPF_EXPAND 340 %token SPF_FISSION 341 %token SPF_SHRINK 342 %token SPF_CHECKPOINT 343 %token SPF_EXCEPT 344 %token SPF_FILES_COUNT 345 %token SPF_INTERVAL 346 %token SPF_TIME 347 %token SPF_ITER 348 %token SPF_FLEXIBLE 349 %token SPF_APPLY_REGION 350 %token SPF_APPLY_FRAGMENT 351 %token SPF_CODE_COVERAGE 352 %token SPF_UNROLL 353 %token SPF_MERGE 354 %token SPF_COVER 355 %token SPF_PROCESS_PRIVATE 356 %token SPF_WEIGHT 357 %{ #include #include "inc.h" #include "extern.h" #include "defines.h" #include "fdvm.h" #include "fm.h" /* We may use builtin alloca */ #include "compatible.h" #ifdef _NEEDALLOCAH_ # include #endif #define EXTEND_NODE 2 /* move the definition to h/ files. */ extern PTR_BFND global_bfnd, pred_bfnd; extern PTR_SYMB star_symb; extern PTR_SYMB global_list; extern PTR_TYPE global_bool; extern PTR_TYPE global_int; extern PTR_TYPE global_float; extern PTR_TYPE global_double; extern PTR_TYPE global_char; extern PTR_TYPE global_string; extern PTR_TYPE global_string_2; extern PTR_TYPE global_complex; extern PTR_TYPE global_dcomplex; extern PTR_TYPE global_gate; extern PTR_TYPE global_event; extern PTR_TYPE global_sequence; extern PTR_TYPE global_default; extern PTR_LABEL thislabel; extern PTR_CMNT comments, cur_comment; extern PTR_BFND last_bfnd; extern PTR_TYPE impltype[]; extern int nioctl; extern int maxdim; extern long yystno; /* statement label */ extern char stmtbuf[]; /* input buffer */ extern char *commentbuf; /* comments buffer from scanner */ extern PTR_BLOB head_blob; extern PTR_BLOB cur_blob; extern PTR_TYPE vartype; /* variable type */ extern int end_group; extern char saveall; extern int privateall; extern int needkwd; extern int implkwd; extern int opt_kwd_hedr; /* added for FORTRAN 90 */ extern PTR_LLND first_unresolved_call; extern PTR_LLND last_unresolved_call; extern int data_stat; extern char yyquote; extern int warn_all; extern int statement_kind; /* kind of statement: 1 - HPF-DVM-directive, 0 - Fortran statement*/ int extend_flag = 0; static int do_name_err; static int ndim; /* number of dimension */ /*!!! hpf */ static int explicit_shape; /* 1 if shape specification is explicit */ /* static int varleng;*/ /* variable size */ static int lastwasbranch = NO; /* set if last stmt was a branch stmt */ static int thiswasbranch = NO; /* set if this stmt is a branch stmt */ static PTR_SYMB type_var = SMNULL; static PTR_LLND stat_alloc = LLNULL; /* set if ALLOCATE/DEALLOCATE stmt has STAT-clause*/ /* static int subscripts_status = 0; */ static int type_options,type_opt; /* The various options used to declare a name - RECURSIVE, POINTER, OPTIONAL etc. */ static PTR_BFND module_scope; static int position = IN_OUTSIDE; static int attr_ndim; /* number of dimensions in DIMENSION (array_spec) attribute declaration */ static PTR_LLND attr_dims; /* low level representation of array_spec in DIMENSION (array_spec) attribute declarartion. */ static int in_vec = NO; /* set if processing array constructor */ %} %union { int token; char charv; char *charp; PTR_BFND bf_node; PTR_LLND ll_node; PTR_SYMB symbol; PTR_TYPE data_type; PTR_HASH hash_entry; PTR_LABEL label; } /* * gram.head * * First part of the Fortran grammar * */ /* Specify precedences and associativities. */ %left COMMA %nonassoc COLON %right EQUAL %left DEFINED_OPERATOR %left BINARY_OP %left EQV NEQV %left OR XOR %left AND %left NOT %nonassoc LT GT LE GE EQ NE %left DSLASH %left PLUS MINUS %left ASTER SLASH %right DASTER %nonassoc UNARY_OP %start program %type addop stop att_type %type letter %type filename %type name opt_unit_name %type progname blokname args arg arglist call comblock namelist_group %type program stat spec exec iffable goto logif %type dcl implicit data common dimension external intrinsic attrib %type equivalence namelist type_dcl end_type static %type intent optional public private sequence allocatable pointer target %type implist impitem %type paramlist paramitem %type dim dims dimlist ubound funarglist funarg funargs opt_expr var %type labellist expr uexpr lhs simple_const lengspec substring %type complex_const vec triplet %type dospec use_name_list %type do_var %type