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 static char USMID[] = "\n@(#)5.0_pl/sources/p_driver.c 5.13 10/20/99 16:13:01\n";
00038
00039 # include "defines.h"
00040
00041 # include "host.m"
00042 # include "host.h"
00043 # include "target.m"
00044 # include "target.h"
00045
00046 # include "globals.m"
00047 # include "tokens.m"
00048 # include "sytb.m"
00049 # include "p_globals.m"
00050 # include "debug.m"
00051
00052 # include "globals.h"
00053 # include "tokens.h"
00054 # include "sytb.h"
00055 # include "p_globals.h"
00056 # include "p_driver.h"
00057 # include "fmath.h"
00058
00059
00060
00061
00062
00063
00064 void init_parse_prog_unit(void);
00065 static void check_for_dup_derived_type_lbl(void);
00066 static void ck_lbl_construct_name(void);
00067 static void enter_intrinsic_info (void);
00068 static void init_const_tbl(void);
00069 static void set_integer_default_type(void);
00070 static void stmt_level_semantics(void);
00071
00072 # if defined(_EXPRESSION_EVAL)
00073 static void parse_expr_for_evaluator(void);
00074 # endif
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093 void complete_intrinsic_definition(int generic_attr)
00094
00095 {
00096 int al_idx;
00097 int arg_attr_idx;
00098 int arg_idx;
00099 int attr_idx;
00100 int intrin_tbl_idx;
00101 int j;
00102 id_str_type name;
00103 int np_idx;
00104 int result_attr;
00105 int sn_idx;
00106 int tmp_len;
00107 id_str_type tmp_nam;
00108 int dp_specific_args;
00109 int dp_specific_rslt;
00110
00111
00112 TRACE (Func_Entry, "complete_intrinsic_definition", NULL);
00113
00114 # if defined(_DEBUG)
00115
00116 if ((ATI_FIRST_SPECIFIC_IDX(generic_attr) == NULL_IDX &&
00117 ATI_NUM_SPECIFICS(generic_attr) > 0)||
00118 (ATI_FIRST_SPECIFIC_IDX(generic_attr) != NULL_IDX &&
00119 ATI_NUM_SPECIFICS(generic_attr) == 0)) {
00120 PRINTMSG(stmt_start_line, 626, Internal, 0,
00121 "correct intrinsic", "complete_intrinsic_definition");
00122 }
00123 # endif
00124
00125 intrin_tbl_idx = ATI_INTRIN_TBL_IDX(generic_attr);
00126 j = intrin_tbl_idx + 1;
00127
00128 while ((! intrin_tbl[j].generic) &&
00129 (intrin_tbl[j].name_len > 0)) {
00130
00131 if (cmd_line_flags.s_pointer8) {
00132 if ((strcmp("_MALLOC_I4_I4", (char *)&intrin_tbl[j].id_str) == 0) ||
00133 (strcmp("_MALLOC_I4_I8", (char *)&intrin_tbl[j].id_str) == 0)) {
00134 j = j + 1;
00135
00136 while (intrin_tbl[j].intrin_enum == 0 &&
00137 intrin_tbl[j].external == 0) {
00138 j = j + 1;
00139 }
00140 }
00141 }
00142
00143 if (INTEGER_DEFAULT_TYPE == Integer_8 ||
00144 LOGICAL_DEFAULT_TYPE == Logical_8) {
00145 if ((strcmp("_SIZE_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00146 (strcmp("_SCAN_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00147 (strcmp("_SIZEOF_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00148 (strcmp("_LBOUND0_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00149 (strcmp("_SYSTEM_CLOCK_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00150 (strcmp("_ASSOCIATED_4", (char *)&intrin_tbl[j].id_str) == 0) ||
00151 (strcmp("_SELECTED_REAL_KIND_4",
00152 (char *)&intrin_tbl[j].id_str) == 0) ||
00153 (strcmp("_FP_CLASS_I4_H",
00154 (char *)&intrin_tbl[j].id_str) == 0) ||
00155 (strcmp("_FP_CLASS_I4_R",
00156 (char *)&intrin_tbl[j].id_str) == 0) ||
00157 (strcmp("_FP_CLASS_I4_D",
00158 (char *)&intrin_tbl[j].id_str) == 0) ||
00159 (strcmp("_UBOUND0_4", (char *)&intrin_tbl[j].id_str) == 0)) {
00160 j = j + 1;
00161
00162 while (intrin_tbl[j].intrin_enum == 0 &&
00163 intrin_tbl[j].external == 0) {
00164 j = j + 1;
00165 }
00166 }
00167 }
00168
00169 dp_specific_args = 0;
00170 dp_specific_rslt = 0;
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187 if (intrin_tbl[intrin_tbl_idx].n_specifics == 1 &&
00188 # if defined(_QUAD_PRECISION)
00189 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'D' ||
00190 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'I' &&
00191 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'D') ||
00192 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'C' &&
00193 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'D'))) {
00194 # else
00195
00196
00197
00198
00199
00200 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'D' ||
00201 intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'Q' ||
00202 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'I' &&
00203 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'D') ||
00204 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'I' &&
00205 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'Q') ||
00206 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'C' &&
00207 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'D') ||
00208 (intrin_tbl[intrin_tbl_idx].id_str.string[0] == 'C' &&
00209 intrin_tbl[intrin_tbl_idx].id_str.string[1] == 'Q'))) {
00210 # endif
00211
00212 if ((intrin_tbl[j].data_type == Real_8 ||
00213 intrin_tbl[j].data_type == Real_16) &&
00214 (1<<intrin_tbl[j].data_type) == intrin_tbl[j+1].data_type) {
00215 dp_specific_args = (1<<DOUBLE_DEFAULT_TYPE);
00216 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00217 }
00218 else if (intrin_tbl[j].data_type == Integer_4) {
00219 dp_specific_args = (1<<DOUBLE_DEFAULT_TYPE);
00220 dp_specific_rslt = INTEGER_DEFAULT_TYPE;
00221 }
00222 else if ((intrin_tbl[j].data_type == Complex_8 ||
00223 intrin_tbl[j].data_type == Complex_16) &&
00224 (1<<intrin_tbl[j].data_type) == intrin_tbl[j+1].data_type) {
00225 dp_specific_args = (1<<DOUBLE_COMPLEX_DEFAULT_TYPE);
00226 dp_specific_rslt = DOUBLE_COMPLEX_DEFAULT_TYPE;
00227 }
00228
00229 if (strcmp("CDABS", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00230 dp_specific_args = (1<<DOUBLE_COMPLEX_DEFAULT_TYPE);
00231 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00232 }
00233
00234 if (strcmp("DIMAG", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00235 dp_specific_args = (1<<DOUBLE_COMPLEX_DEFAULT_TYPE);
00236 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00237 }
00238
00239 if (strcmp("DREAL", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00240 dp_specific_args = intrin_tbl[j+1].data_type;
00241 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00242 }
00243
00244 # ifndef _QUAD_PRECISION
00245 if (strcmp("CQABS", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00246 dp_specific_args = (1<<DOUBLE_COMPLEX_DEFAULT_TYPE);
00247 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00248 }
00249
00250 if (strcmp("QIMAG", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00251 dp_specific_args = (1<<DOUBLE_COMPLEX_DEFAULT_TYPE);
00252 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00253 }
00254
00255 if (strcmp("QREAL", (char *)&intrin_tbl[intrin_tbl_idx].id_str) == 0) {
00256 dp_specific_args = intrin_tbl[j+1].data_type;
00257 dp_specific_rslt = DOUBLE_DEFAULT_TYPE;
00258 }
00259 # endif
00260
00261 }
00262
00263 tmp_len = intrin_tbl[j].name_len;
00264 strcpy(&tmp_nam.string[0], &intrin_tbl[j].id_str.string[0]);
00265
00266 CREATE_ID(name,
00267 tmp_nam.string,
00268 tmp_len);
00269
00270 NTR_NAME_POOL(&(name.words[0]), intrin_tbl[j].name_len, np_idx);
00271
00272 NTR_ATTR_TBL(attr_idx);
00273 COPY_COMMON_ATTR_INFO(generic_attr, attr_idx, Pgm_Unit);
00274 AT_NAME_LEN(attr_idx) = intrin_tbl[j].name_len;
00275 AT_NAME_IDX(attr_idx) = np_idx;
00276
00277 NTR_INTERFACE_IN_SN_TBL(sn_idx,
00278 attr_idx,
00279 generic_attr,
00280 stmt_start_line,
00281 stmt_start_col);
00282
00283 AT_OBJ_CLASS(attr_idx) = Pgm_Unit;
00284 AT_ELEMENTAL_INTRIN(attr_idx) = intrin_tbl[j].elemental;
00285 ATP_ELEMENTAL(attr_idx) = intrin_tbl[j].elemental &&
00286 !(intrin_tbl[j].non_ansi);
00287 ATP_PURE(attr_idx) = ATP_ELEMENTAL(attr_idx);
00288 ATP_PROC(attr_idx) = Intrin_Proc;
00289 AT_IS_INTRIN(attr_idx) = TRUE;
00290 ATP_EXPL_ITRFC(attr_idx) = TRUE;
00291 MAKE_EXTERNAL_NAME(attr_idx,
00292 AT_NAME_IDX(attr_idx),
00293 AT_NAME_LEN(attr_idx));
00294 ATP_IN_INTERFACE_BLK(attr_idx) = TRUE;
00295 ATP_EXTERNAL_INTRIN(attr_idx) = intrin_tbl[j].external;
00296 ATP_NON_ANSI_INTRIN(attr_idx) = intrin_tbl[j].non_ansi;
00297 ATP_INTRIN_ENUM(attr_idx) = intrin_tbl[j].intrin_enum;
00298
00299 if (intrin_tbl[j].function) {
00300 NTR_ATTR_TBL(result_attr);
00301 COPY_COMMON_ATTR_INFO(attr_idx, result_attr, Data_Obj);
00302 ATD_CLASS(result_attr) = Function_Result;
00303 ATP_RSLT_IDX(attr_idx) = result_attr;
00304 ATD_FUNC_IDX(result_attr) = attr_idx;
00305 ATD_TYPE_IDX(result_attr) = intrin_tbl[j].data_type;
00306
00307 if (dp_specific_rslt != 0)
00308 ATD_TYPE_IDX(result_attr) = dp_specific_rslt;
00309
00310 if ((strcmp("KIND", (char *)&intrin_tbl[j].id_str) == 0) ||
00311 (strcmp("_LBOUND", (char *)&intrin_tbl[j].id_str) == 0) ||
00312 (strcmp("_UBOUND", (char *)&intrin_tbl[j].id_str) == 0)) {
00313 ATD_TYPE_IDX(result_attr) = INTEGER_DEFAULT_TYPE;
00314 }
00315
00316 ATD_ARRAY_IDX(result_attr) = intrin_tbl[j].n_specifics;
00317 ATD_IM_A_DOPE(result_attr) = intrin_tbl[j].dope;
00318 ATP_PGM_UNIT(attr_idx) = Function;
00319 ATP_NOSIDE_EFFECTS(attr_idx) = TRUE;
00320 ATP_PURE(attr_idx) = TRUE;
00321 }
00322 else {
00323 ATP_PGM_UNIT(attr_idx) = Subroutine;
00324 }
00325
00326 ATP_SCP_IDX(attr_idx) = curr_scp_idx;
00327
00328 j = j + 1;
00329
00330 while ((intrin_tbl[j].intrin_enum == 0) &&
00331 (intrin_tbl[j].name_len > 0) &&
00332 (!intrin_tbl[j].external) &&
00333 (!intrin_tbl[j].generic)) {
00334 CREATE_ID(name,
00335 intrin_tbl[j].id_str.string,
00336 intrin_tbl[j].name_len);
00337
00338 NTR_NAME_POOL(&(name.words[0]),
00339 intrin_tbl[j].name_len,
00340 np_idx);
00341
00342 NTR_ATTR_TBL(arg_attr_idx);
00343 AT_DEF_LINE(arg_attr_idx) = stmt_start_line;
00344 AT_DEF_COLUMN(arg_attr_idx) = stmt_start_col;
00345 AT_NAME_LEN(arg_attr_idx) = intrin_tbl[j].name_len;
00346 AT_NAME_IDX(arg_attr_idx) = np_idx;
00347
00348 NTR_SN_TBL(arg_idx);
00349 SN_ATTR_IDX(arg_idx) = arg_attr_idx;
00350 SN_NAME_LEN(arg_idx) = intrin_tbl[j].name_len;
00351 SN_NAME_IDX(arg_idx) = np_idx;
00352
00353 if (ATP_FIRST_IDX(attr_idx) == NULL_IDX) {
00354 ATP_FIRST_IDX(attr_idx) = arg_idx;
00355 }
00356
00357 ATP_NUM_DARGS(attr_idx) += 1;
00358
00359 if (intrin_tbl[j].function) {
00360 AT_OBJ_CLASS(arg_attr_idx) = Pgm_Unit;
00361 AT_NAME_LEN(arg_attr_idx) = intrin_tbl[j].name_len;
00362 AT_NAME_IDX(arg_attr_idx) = np_idx;
00363 ATP_PROC(arg_attr_idx) = Dummy_Proc;
00364 ATP_EXT_NAME_LEN(arg_attr_idx) = intrin_tbl[j].name_len;
00365 ATP_EXT_NAME_IDX(arg_attr_idx) = np_idx;
00366 }
00367 else {
00368 AT_OBJ_CLASS(arg_attr_idx) = Data_Obj;
00369 ATD_CLASS(arg_attr_idx) = Dummy_Argument;
00370 ATD_INTRIN_DARG(arg_attr_idx) = TRUE;
00371 ATD_INTRIN_DARG_TYPE(arg_attr_idx) = intrin_tbl[j].data_type;
00372 if (dp_specific_args != 0)
00373 ATD_INTRIN_DARG_TYPE(arg_attr_idx) = dp_specific_args;
00374 ATD_IM_A_DOPE(arg_attr_idx) = intrin_tbl[j].dope;
00375 ATD_ARRAY_IDX(arg_attr_idx) = intrin_tbl[j].n_specifics;
00376 }
00377
00378 AT_IS_DARG(arg_attr_idx) = TRUE;
00379 AT_OPTIONAL(arg_attr_idx) = intrin_tbl[j].optional;
00380 j = j + 1;
00381 }
00382
00383 if (!cmd_line_flags.s_pointer8) {
00384 if ((strcmp("_MALLOC_I8_I4", (char *)&intrin_tbl[j].id_str) == 0) ||
00385 (strcmp("_MALLOC_I8_I8", (char *)&intrin_tbl[j].id_str) == 0)) {
00386 j = j + 1;
00387
00388 while ((intrin_tbl[j].intrin_enum == 0) &&
00389 (! intrin_tbl[j].generic)) {
00390 j = j + 1;
00391 }
00392 }
00393 }
00394
00395 if (INTEGER_DEFAULT_TYPE == Integer_4 ||
00396 LOGICAL_DEFAULT_TYPE == Logical_4) {
00397 if ((strcmp("_SIZE_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00398 (strcmp("_SCAN_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00399 (strcmp("_SIZEOF_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00400 (strcmp("_LBOUND0_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00401 (strcmp("_SYSTEM_CLOCK_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00402 (strcmp("_ASSOCIATED_8", (char *)&intrin_tbl[j].id_str) == 0) ||
00403 (strcmp("_SELECTED_REAL_KIND_8",
00404 (char *)&intrin_tbl[j].id_str) == 0) ||
00405 (strcmp("_FP_CLASS_I8_H",
00406 (char *)&intrin_tbl[j].id_str) == 0) ||
00407 (strcmp("_FP_CLASS_I8_R",
00408 (char *)&intrin_tbl[j].id_str) == 0) ||
00409 (strcmp("_FP_CLASS_I8_D",
00410 (char *)&intrin_tbl[j].id_str) == 0) ||
00411 (strcmp("_UBOUND0_8", (char *)&intrin_tbl[j].id_str) == 0)) {
00412 j = j + 1;
00413
00414 while ((intrin_tbl[j].intrin_enum == 0) &&
00415 (! intrin_tbl[j].generic)) {
00416 j = j + 1;
00417 }
00418 }
00419 }
00420 }
00421
00422
00423
00424
00425 al_idx = expanded_intrinsic_list;
00426
00427 while (al_idx != NULL_IDX) {
00428
00429 if (generic_attr == AL_ATTR_IDX(al_idx)) {
00430 break;
00431 }
00432 al_idx = AL_NEXT_IDX(al_idx);
00433 }
00434
00435 if (al_idx == NULL_IDX) {
00436 NTR_ATTR_LIST_TBL(al_idx);
00437 AL_ATTR_IDX(al_idx) = generic_attr;
00438 AL_NEXT_IDX(al_idx) = expanded_intrinsic_list;
00439 expanded_intrinsic_list = al_idx;
00440 }
00441
00442 TRACE (Func_Exit, "complete_intrinsic_definition", NULL);
00443
00444 return;
00445
00446 }
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464 static void enter_intrinsic_info (void)
00465
00466 {
00467 int attr_idx;
00468 int name_idx = 2;
00469 token_type tmp_token;
00470 int i;
00471
00472 TRACE (Func_Entry, "enter_intrinsic_info", NULL);
00473
00474 i = 1;
00475 tmp_token = initial_token;
00476 TOKEN_COLUMN(tmp_token) = 1;
00477 TOKEN_LINE(tmp_token) = 1;
00478 TOKEN_VALUE(tmp_token) = Tok_Id;
00479
00480 while (i < MAX_INTRIN_TBL_SIZE) {
00481 if (intrin_tbl[i].generic) {
00482
00483 CREATE_ID(TOKEN_ID(tmp_token),
00484 intrin_tbl[i].id_str.string,
00485 intrin_tbl[i].name_len);
00486
00487 TOKEN_LEN(tmp_token) = intrin_tbl[i].name_len;
00488
00489 attr_idx = ntr_sym_tbl(&tmp_token, name_idx);
00490
00491 AT_OBJ_CLASS(attr_idx) = Interface;
00492 AT_IS_INTRIN(attr_idx) = TRUE;
00493 ATI_INTRIN_PASSABLE(attr_idx) = intrin_tbl[i].passable;
00494 ATI_GENERIC_INTRINSIC(attr_idx) = intrin_tbl[i].dope;
00495 AT_ELEMENTAL_INTRIN(attr_idx) = intrin_tbl[i].elemental;
00496
00497 if (intrin_tbl[i].function) {
00498 ATI_INTERFACE_CLASS(attr_idx) = Generic_Function_Interface;
00499 }
00500 else {
00501 ATI_INTERFACE_CLASS(attr_idx) = Generic_Subroutine_Interface;
00502 }
00503
00504 ATI_INTRIN_TBL_IDX(attr_idx) = i;
00505 name_idx = name_idx + 1;
00506 }
00507
00508 i = i + 1;
00509 }
00510
00511 expanded_intrinsic_list = NULL_IDX;
00512
00513 TRACE (Func_Exit, "enter_intrinsic_info", NULL);
00514
00515 return;
00516
00517 }
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540 void parse_prog_unit (void)
00541
00542 {
00543 int defer_msg = 0;
00544 int name_idx;
00545 int need_ez_debug_label = FALSE;
00546 int prev_stmt_start_line;
00547 int save_blk_stk_idx;
00548 int sh_idx;
00549
00550 # if defined(GENERATE_WHIRL)
00551 int ir_idx;
00552 # endif
00553
00554
00555 TRACE (PU_Start, NULL, NULL);
00556
00557 TRACE (Func_Entry, "parse_prog_unit", NULL);
00558
00559 if (first_time_tbl_alloc) {
00560 first_time_tbl_alloc = FALSE;
00561
00562 }
00563 else {
00564 init_parse_prog_unit();
00565 }
00566
00567 prev_stmt_start_line = stmt_start_line;
00568 pgm_unit_start_line = stmt_start_line;
00569
00570 # if defined(_EXPRESSION_EVAL)
00571
00572 if (cmd_line_flags.expression_eval_expr) {
00573 parse_expr_for_evaluator();
00574 }
00575
00576 # endif
00577
00578 while (!EOPU_encountered) {
00579
00580 TRACE_NEW_STMT(NULL);
00581
00582 stmt_type = Null_Stmt;
00583
00584 if (need_new_sh) {
00585 sh_idx = curr_stmt_sh_idx;
00586 curr_stmt_sh_idx = ntr_sh_tbl();
00587 SH_NEXT_IDX(sh_idx) = curr_stmt_sh_idx;
00588 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
00589 }
00590 else {
00591
00592
00593 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
00594 CLEAR_TBL_NTRY(sh_tbl, curr_stmt_sh_idx);
00595 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
00596 }
00597
00598 ck_lbl_construct_name();
00599
00600 if (MATCHED_TOKEN_CLASS(Tok_Class_Keyword)) {
00601 determine_stmt_type();
00602
00603 if (curr_stmt_category == Init_Stmt_Cat &&
00604 cdir_switches.implicit_use_idx != NULL_IDX) {
00605
00606
00607
00608 switch (stmt_type) {
00609 case Blockdata_Stmt:
00610 case Elemental_Stmt:
00611 case Function_Stmt:
00612 case Module_Stmt:
00613 case Program_Stmt:
00614 case Pure_Stmt:
00615 case Recursive_Stmt:
00616 case Subroutine_Stmt:
00617
00618
00619
00620
00621 case Directive_Stmt:
00622
00623
00624
00625
00626
00627 break;
00628
00629 case Type_Decl_Stmt:
00630
00631 if ((TOKEN_VALUE(token) == Tok_Kwd_Type &&
00632 LA_CH_VALUE != LPAREN) ||
00633 stmt_has_double_colon()) {
00634
00635
00636
00637
00638 implicit_use_semantics();
00639 }
00640
00641
00642
00643 break;
00644
00645 default:
00646 implicit_use_semantics();
00647 break;
00648 }
00649 }
00650
00651 if (stmt_type != Use_Stmt &&
00652 SCP_USED_MODULE_LIST(curr_scp_idx) != NULL_IDX) {
00653 use_stmt_semantics();
00654 }
00655
00656 if (need_ez_debug_label) {
00657 gen_debug_lbl_stmt(curr_stmt_sh_idx, Ldbg_Stmt_Lbl, NULL_IDX);
00658 need_ez_debug_label = FALSE;
00659 }
00660
00661 if (cmd_line_flags.debug_lvl == Debug_Lvl_0) {
00662
00663
00664
00665 if (prev_stmt_start_line != stmt_start_line) {
00666
00667
00668
00669 switch (stmt_type) {
00670 case Allocate_Stmt:
00671 case Arith_If_Stmt:
00672 case Assign_Stmt:
00673 case Assignment_Stmt:
00674 case Backspace_Stmt:
00675 case Buffer_Stmt:
00676 case Call_Stmt:
00677 case Case_Stmt:
00678 case Close_Stmt:
00679 case Continue_Stmt:
00680 case Cycle_Stmt:
00681 case Deallocate_Stmt:
00682 case Decode_Stmt:
00683 case Do_Iterative_Stmt:
00684 case Do_While_Stmt:
00685 case Do_Infinite_Stmt:
00686 case Else_Where_Stmt:
00687 case Encode_Stmt:
00688 case Endfile_Stmt:
00689 case Entry_Stmt:
00690 case Exit_Stmt:
00691 case Goto_Stmt:
00692 case If_Cstrct_Stmt:
00693 case If_Stmt:
00694 case Inquire_Stmt:
00695 case Nullify_Stmt:
00696 case Open_Stmt:
00697 case Outmoded_If_Stmt:
00698 case Pause_Stmt:
00699 case Print_Stmt:
00700 case Read_Stmt:
00701 case Return_Stmt:
00702 case Rewind_Stmt:
00703 case Select_Stmt:
00704 case Stop_Stmt:
00705 case Then_Stmt:
00706 case Where_Cstrct_Stmt:
00707 case Where_Stmt:
00708 case Write_Stmt:
00709 gen_debug_lbl_stmt(curr_stmt_sh_idx,
00710 Ldbg_Stmt_Lbl,
00711 NULL_IDX);
00712 break;
00713
00714 }
00715 }
00716 prev_stmt_start_line = stmt_start_line;
00717 }
00718
00719 if (stmt_label_idx != NULL_IDX) {
00720 gen_attr_and_IR_for_lbl(TRUE);
00721 }
00722
00723 (*stmt_parsers[stmt_type])();
00724
00725 stmt_level_semantics();
00726
00727 if (cdir_switches.implicit_use_idx != NULL_IDX) {
00728
00729
00730
00731
00732 implicit_use_semantics();
00733 }
00734
00735 if (cmd_line_flags.debug_lvl == Debug_Lvl_1) {
00736
00737
00738
00739
00740 switch (stmt_type) {
00741 case If_Cstrct_Stmt:
00742 case Else_Stmt:
00743 case Else_If_Stmt:
00744 case Else_Where_Stmt:
00745 case Case_Stmt:
00746 case Where_Cstrct_Stmt:
00747 need_ez_debug_label = TRUE;
00748 break;
00749 }
00750 }
00751 }
00752 else {
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766 stmt_start_line = LA_CH_LINE;
00767 stmt_start_col = LA_CH_COLUMN;
00768 SH_GLB_LINE(curr_stmt_sh_idx) = stmt_start_line;
00769 SH_COL_NUM(curr_stmt_sh_idx) = stmt_start_col;
00770 SH_STMT_TYPE(curr_stmt_sh_idx) = stmt_type;
00771
00772 if (SCP_ATTR_IDX(curr_scp_idx) == glb_tbl_idx[Main_Attr_Idx] &&
00773 !AT_DEFINED(glb_tbl_idx[Main_Attr_Idx]) &&
00774 !AT_DCL_ERR(glb_tbl_idx[Main_Attr_Idx])) {
00775
00776 if (curr_stmt_category == Init_Stmt_Cat) {
00777 curr_stmt_category = Use_Stmt_Cat;
00778 }
00779
00780 token = main_token;
00781 TOKEN_LINE(token) = stmt_start_line;
00782 TOKEN_COLUMN(token) = stmt_start_col;
00783 save_blk_stk_idx = blk_stk_idx;
00784 blk_stk_idx = BLK_HEAD_IDX;
00785 defer_msg = 1;
00786
00787 start_new_prog_unit(Program, Program_Blk, TRUE, FALSE, &defer_msg);
00788
00789 CURR_BLK_NAME = NULL_IDX;
00790 blk_stk_idx = save_blk_stk_idx;
00791 }
00792
00793 if (cif_need_unit_rec &&
00794 stmt_type != Directive_Stmt &&
00795 stmt_type != End_Parallel_Stmt &&
00796 stmt_type != End_Do_Parallel_Stmt &&
00797 stmt_type != End_Parallel_Case_Stmt &&
00798 stmt_type != Parallel_Case_Stmt &&
00799 stmt_type != End_Guard_Stmt &&
00800 stmt_type != Open_MP_Section_Stmt &&
00801 stmt_type != Open_MP_End_Parallel_Stmt &&
00802 stmt_type != Open_MP_End_Do_Stmt &&
00803 stmt_type != Open_MP_End_Parallel_Sections_Stmt &&
00804 stmt_type != Open_MP_End_Sections_Stmt &&
00805 stmt_type != Open_MP_End_Section_Stmt &&
00806 stmt_type != Open_MP_End_Single_Stmt &&
00807 stmt_type != Open_MP_End_Parallel_Do_Stmt &&
00808 stmt_type != Open_MP_End_Master_Stmt &&
00809 stmt_type != Open_MP_End_Critical_Stmt &&
00810 stmt_type != Open_MP_End_Ordered_Stmt &&
00811 stmt_type != Open_MP_End_Parallel_Workshare_Stmt &&
00812 stmt_type != Open_MP_End_Workshare_Stmt &&
00813 stmt_type != SGI_Section_Stmt &&
00814 stmt_type != SGI_End_Psection_Stmt &&
00815 stmt_type != SGI_End_Pdo_Stmt &&
00816 stmt_type != SGI_End_Parallel_Stmt &&
00817 stmt_type != SGI_End_Critical_Section_Stmt &&
00818 stmt_type != SGI_End_Single_Process_Stmt &&
00819 stmt_type != SGI_Region_End_Stmt) {
00820
00821 cif_unit_rec();
00822
00823 if (cif_flags) {
00824 cif_begin_scope_rec();
00825
00826 if (cif_flags & XREF_RECS) {
00827 cif_usage_rec(glb_tbl_idx[Main_Attr_Idx],
00828 AT_Tbl_Idx,
00829 stmt_start_line,
00830 stmt_start_col,
00831 CIF_Symbol_Declaration);
00832 }
00833 }
00834 }
00835
00836 if ((stmt_label_idx | stmt_construct_idx) == NULL_IDX) {
00837
00838 if (LA_CH_CLASS == Ch_Class_Digit && ! label_ok) {
00839 PRINTMSG (LA_CH_LINE, 407, Error, LA_CH_COLUMN);
00840 }
00841 else {
00842
00843
00844
00845
00846 PRINTMSG (LA_CH_LINE, 100, Error, LA_CH_COLUMN);
00847 }
00848 }
00849 else {
00850
00851
00852
00853
00854 if (stmt_label_idx != NULL_IDX) {
00855 PRINTMSG (LA_CH_LINE, 6, Error, LA_CH_COLUMN);
00856
00857
00858
00859
00860
00861 if (CURR_BLK != Derived_Type_Blk) {
00862 stmt_label_idx = srch_sym_tbl(TOKEN_STR(label_token),
00863 TOKEN_LEN(label_token),
00864 &name_idx);
00865
00866 if (stmt_label_idx != NULL_IDX &&
00867 ! AT_DEFINED(stmt_label_idx) &&
00868 ATL_FWD_REF_IDX(stmt_label_idx) != NULL_IDX) {
00869 AT_DCL_ERR(stmt_label_idx) = TRUE;
00870 resolve_fwd_lbl_refs();
00871 }
00872 }
00873 }
00874
00875
00876
00877
00878 if (stmt_construct_idx != NULL_IDX) {
00879 PRINTMSG (LA_CH_LINE, 6, Error, LA_CH_COLUMN);
00880 AT_DCL_ERR(stmt_construct_idx) = TRUE;
00881 }
00882 }
00883 parse_err_flush(Find_EOS, NULL);
00884 NEXT_LA_CH;
00885
00886 if (defer_msg > 1 && LA_CH_CLASS != Ch_Class_EOF) {
00887 PRINTMSG (AT_DEF_LINE(SCP_ATTR_IDX(curr_scp_idx)), defer_msg,
00888
00889 # if defined(_ERROR_DUPLICATE_GLOBALS)
00890 Error,
00891 # else
00892 Warning,
00893 # endif
00894 AT_DEF_COLUMN(SCP_ATTR_IDX(curr_scp_idx)));
00895 }
00896
00897 }
00898
00899 # if defined(GENERATE_WHIRL)
00900 if (stmt_type != Directive_Stmt) {
00901 directives_are_global = FALSE;
00902 }
00903
00904 if (stmt_type != Directive_Stmt &&
00905 stmt_type != End_Parallel_Stmt &&
00906 stmt_type != End_Do_Parallel_Stmt &&
00907 stmt_type != End_Parallel_Case_Stmt &&
00908 stmt_type != Parallel_Case_Stmt &&
00909 stmt_type != End_Guard_Stmt &&
00910 stmt_type != Open_MP_Section_Stmt &&
00911 stmt_type != Open_MP_End_Parallel_Stmt &&
00912 stmt_type != Open_MP_End_Do_Stmt &&
00913 stmt_type != Open_MP_End_Parallel_Sections_Stmt &&
00914 stmt_type != Open_MP_End_Sections_Stmt &&
00915 stmt_type != Open_MP_End_Section_Stmt &&
00916 stmt_type != Open_MP_End_Single_Stmt &&
00917 stmt_type != Open_MP_End_Parallel_Do_Stmt &&
00918 stmt_type != Open_MP_End_Master_Stmt &&
00919 stmt_type != Open_MP_End_Critical_Stmt &&
00920 stmt_type != Open_MP_End_Ordered_Stmt &&
00921 stmt_type != Open_MP_End_Parallel_Workshare_Stmt &&
00922 stmt_type != Open_MP_End_Workshare_Stmt &&
00923 stmt_type != SGI_Section_Stmt &&
00924 stmt_type != SGI_End_Psection_Stmt &&
00925 stmt_type != SGI_End_Pdo_Stmt &&
00926 stmt_type != SGI_End_Parallel_Stmt &&
00927 stmt_type != SGI_End_Critical_Section_Stmt &&
00928 stmt_type != SGI_End_Single_Process_Stmt &&
00929 stmt_type != SGI_Region_End_Stmt &&
00930 cdir_switches.inline_here_sgi) {
00931
00932
00933
00934 need_new_sh = TRUE;
00935
00936 if (SH_IR_IDX(curr_stmt_sh_idx)) {
00937
00938
00939 SH_NEXT_IDX(curr_stmt_sh_idx) = ntr_sh_tbl();
00940 SH_PREV_IDX(SH_NEXT_IDX(curr_stmt_sh_idx)) = curr_stmt_sh_idx;
00941 curr_stmt_sh_idx = SH_NEXT_IDX(curr_stmt_sh_idx);
00942 SH_STMT_TYPE(curr_stmt_sh_idx) = Directive_Stmt;
00943 }
00944
00945 SH_GLB_LINE(curr_stmt_sh_idx)= stmt_start_line;
00946 SH_COL_NUM(curr_stmt_sh_idx) = stmt_start_col;
00947
00948 NTR_IR_TBL(ir_idx);
00949 IR_OPR(ir_idx) = End_Inline_Here_Star_Opr;
00950
00951
00952
00953 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
00954 IR_LINE_NUM(ir_idx) = stmt_start_line;
00955 IR_COL_NUM(ir_idx) = stmt_start_col;
00956
00957 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
00958 cdir_switches.inline_here_sgi = FALSE;
00959 }
00960 # endif
00961
00962 if (LA_CH_CLASS == Ch_Class_EOF) {
00963 EOPU_encountered = TRUE;
00964 }
00965 }
00966
00967 # if defined(_EXPRESSION_EVAL)
00968
00969
00970
00971
00972 if (cmd_line_flags.expression_eval_stmt ||
00973 cmd_line_flags.expression_eval_expr) {
00974
00975 stmt_type = End_Stmt;
00976
00977 if (need_new_sh) {
00978 sh_idx = curr_stmt_sh_idx;
00979 curr_stmt_sh_idx = ntr_sh_tbl();
00980 SH_NEXT_IDX(sh_idx) = curr_stmt_sh_idx;
00981 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
00982 }
00983 else {
00984
00985
00986 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
00987 CLEAR_TBL_NTRY(sh_tbl, curr_stmt_sh_idx);
00988 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
00989 }
00990
00991 expression_eval_end();
00992 }
00993
00994 # endif
00995
00996 if (blk_stk_idx != NULL_IDX) {
00997
00998 if (SCP_ATTR_IDX(curr_scp_idx) == glb_tbl_idx[Main_Attr_Idx] &&
00999 stmt_start_line == AT_DEF_LINE(glb_tbl_idx[Main_Attr_Idx]) &&
01000 !SCP_IN_ERR(curr_scp_idx) &&
01001 LA_CH_CLASS == Ch_Class_EOF) {
01002
01003
01004
01005 SCP_IN_ERR(curr_scp_idx) = TRUE;
01006 AT_DCL_ERR(SCP_ATTR_IDX(curr_scp_idx)) = TRUE;
01007 PRINTMSG (stmt_start_line, 1581, Error, stmt_start_col);
01008 }
01009
01010
01011
01012
01013 clearing_blk_stk = TRUE;
01014
01015 if (need_new_sh) {
01016 sh_idx = curr_stmt_sh_idx;
01017 curr_stmt_sh_idx = ntr_sh_tbl();
01018 SH_NEXT_IDX(sh_idx) = curr_stmt_sh_idx;
01019 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
01020 }
01021 else {
01022 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
01023 CLEAR_TBL_NTRY(sh_tbl, curr_stmt_sh_idx);
01024 SH_PREV_IDX(curr_stmt_sh_idx) = sh_idx;
01025 need_new_sh = TRUE;
01026 }
01027
01028 SH_ERR_FLG(curr_stmt_sh_idx) = TRUE;
01029
01030 pop_and_err_blk_stk(NULL_IDX, TRUE);
01031
01032 clearing_blk_stk = FALSE;
01033 }
01034
01035
01036
01037 TBL_FREE(blk_stk);
01038
01039 TRACE (Func_Exit, "parse_prog_unit", NULL);
01040
01041 return;
01042
01043 }
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062 void init_parse_prog_unit()
01063
01064 {
01065 int i;
01066 int idx;
01067 id_str_type name;
01068 int name_idx;
01069 token_type npes_token;
01070 int npes_attr;
01071 int save_stmt_start_line;
01072 long *type_tbl_base;
01073 long *static_type_tbl_base;
01074
01075
01076 TRACE (Func_Entry, "init_parse_prog_unit", NULL);
01077
01078 save_stmt_start_line = stmt_start_line;
01079 stmt_start_line = 1;
01080
01081
01082
01083
01084
01085 set_integer_default_type();
01086
01087
01088 if (on_off_flags.recognize_minus_zero) {
01089 for (i = 0; i < MAX_INTRIN_MAP_SIZE; i++) {
01090 if ((strcmp("SIGN", (char *)&intrin_map[i].id_str) == 0) ||
01091 (strcmp("DSIGN", (char *)&intrin_map[i].id_str) == 0)) {
01092 intrin_map[i].mapped_4.string[8] = '_';
01093 intrin_map[i].mapped_8.string[8] = '_';
01094 }
01095 }
01096 }
01097
01098
01099
01100
01101
01102
01103
01104
01105
01106
01107
01108 CHECK_INITIAL_ALLOC (blk_stk, NULL_IDX);
01109
01110 CHECK_INITIAL_ALLOC (attr_list_tbl, NULL_IDX);
01111 CHECK_INITIAL_ALLOC (attr_tbl, NULL_IDX);
01112 CHECK_INITIAL_ALLOC (attr_aux_tbl, NULL_IDX);
01113 CHECK_INITIAL_ALLOC (bounds_tbl, BD_LAST_USED_IDX);
01114 CHECK_INITIAL_ALLOC (const_tbl, NULL_IDX);
01115 CHECK_INITIAL_ALLOC (const_pool, NULL_IDX);
01116 CHECK_INITIAL_ALLOC (sec_name_tbl, NULL_IDX);
01117 CHECK_INITIAL_ALLOC (stor_blk_tbl, NULL_IDX);
01118 CHECK_INITIAL_ALLOC (loc_name_tbl, NULL_IDX);
01119 CHECK_INITIAL_ALLOC (hidden_name_tbl,NULL_IDX);
01120 CHECK_INITIAL_ALLOC (name_pool, NP_LAST_USED_IDX);
01121 CHECK_INITIAL_ALLOC (scp_tbl, NULL_IDX);
01122 CHECK_INITIAL_ALLOC (type_tbl, TYP_LAST_USED_IDX);
01123 CHECK_INITIAL_ALLOC (equiv_tbl, NULL_IDX);
01124
01125 CHECK_INITIAL_ALLOC (ir_tbl, NULL_IDX);
01126 CHECK_INITIAL_ALLOC (sh_tbl, NULL_IDX);
01127 CHECK_INITIAL_ALLOC (ir_list_tbl, NULL_IDX);
01128
01129
01130
01131
01132
01133 CLEAR_TBL_NTRY(attr_list_tbl, NULL_IDX);
01134 CLEAR_TBL_NTRY(ir_tbl, NULL_IDX);
01135 CLEAR_TBL_NTRY(ir_list_tbl, NULL_IDX);
01136 CLEAR_TBL_NTRY(sh_tbl, NULL_IDX);
01137 CLEAR_TBL_NTRY(bounds_tbl, NULL_IDX);
01138
01139
01140
01141
01142 for (idx = 0; idx < Num_Glb_Tbl_Idxs; idx++) {
01143 glb_tbl_idx[idx] = 0;
01144 }
01145
01146 init_target_opnd = null_opnd;
01147
01148 type_tbl_base = (long *) type_tbl;
01149 static_type_tbl_base = (long *) type_init_tbl;
01150
01151 for (idx = 0; idx < ((Num_Linear_Types+2) * NUM_TYP_WDS); idx++) {
01152 type_tbl_base[idx] = static_type_tbl_base[idx];
01153 }
01154
01155
01156
01157
01158 type_tbl[NULL_IDX] = type_tbl[INTEGER_DEFAULT_TYPE];
01159
01160
01161
01162
01163
01164
01165
01166
01167
01168
01169 name_pool[0].name_long = 0;
01170 name_pool[1].name_long = 0;
01171 name_pool[2].name_long = LARGE_WORD_FOR_TBL_SRCH;
01172
01173 curr_scp_idx = INTRINSIC_SCP_IDX;
01174
01175 CLEAR_TBL_NTRY(scp_tbl, INTRINSIC_SCP_IDX);
01176
01177 init_name_and_stor_tbls(INTRINSIC_SCP_IDX, FALSE);
01178
01179 enter_intrinsic_info();
01180
01181 SCP_FIRST_CHILD_IDX(INTRINSIC_SCP_IDX) = 1;
01182 SCP_NUM_CHILDREN(INTRINSIC_SCP_IDX) = 1;
01183
01184 NTR_SCP_TBL(curr_scp_idx);
01185
01186 SCP_PARENT_IDX(curr_scp_idx) = 0;
01187
01188
01189
01190
01191 init_name_and_stor_tbls(curr_scp_idx, TRUE);
01192
01193
01194
01195
01196
01197
01198
01199 NTR_ATTR_TBL(glb_tbl_idx[Main_Attr_Idx]);
01200 AT_NAME_LEN(glb_tbl_idx[Main_Attr_Idx]) = 5;
01201 AT_NAME_IDX(glb_tbl_idx[Main_Attr_Idx]) = name_pool_idx + 1;
01202 AT_DEF_LINE(glb_tbl_idx[Main_Attr_Idx]) = curr_glb_line;
01203 AT_DEF_COLUMN(glb_tbl_idx[Main_Attr_Idx]) = 1;
01204 AT_OBJ_CLASS(glb_tbl_idx[Main_Attr_Idx]) = Pgm_Unit;
01205 ATP_EXT_NAME_LEN(glb_tbl_idx[Main_Attr_Idx]) = 5;
01206 ATP_EXT_NAME_IDX(glb_tbl_idx[Main_Attr_Idx]) = name_pool_idx + 1;
01207 ATP_PGM_UNIT(glb_tbl_idx[Main_Attr_Idx]) = Program;
01208 ATP_SCP_IDX(glb_tbl_idx[Main_Attr_Idx]) = curr_scp_idx;
01209 ATP_EXPL_ITRFC(glb_tbl_idx[Main_Attr_Idx]) = TRUE;
01210
01211 CREATE_ID(name, UNNAMED_PROGRAM_NAME, UNNAMED_PROGRAM_NAME_LEN);
01212 NTR_NAME_POOL(&(name.words[0]), UNNAMED_PROGRAM_NAME_LEN, idx);
01213
01214 SCP_ATTR_IDX(curr_scp_idx) = glb_tbl_idx[Main_Attr_Idx];
01215
01216 PUSH_BLK_STK(Program_Blk);
01217 SCP_IMPL_NONE(curr_scp_idx) = FALSE;
01218 SCP_PARENT_NONE(curr_scp_idx) = FALSE;
01219
01220 for (idx = 0; idx < MAX_IMPL_CHS; idx++) {
01221 IM_TYPE_IDX(curr_scp_idx, idx) = REAL_DEFAULT_TYPE;
01222 IM_SET(curr_scp_idx, idx) = FALSE;
01223 }
01224
01225 for (idx = IMPL_IDX('I'); idx <= IMPL_IDX('N'); idx++) {
01226 IM_TYPE_IDX(curr_scp_idx, idx) = INTEGER_DEFAULT_TYPE;
01227 }
01228
01229 init_const_tbl();
01230
01231
01232
01233 CREATE_ID(TOKEN_ID(npes_token), "N$PES", 5);
01234
01235 TOKEN_COLUMN(npes_token) = 1;
01236 TOKEN_LEN(npes_token) = 5;
01237 TOKEN_LINE(npes_token) = curr_glb_line;
01238 npes_attr = srch_sym_tbl(TOKEN_STR(npes_token),
01239 TOKEN_LEN(npes_token),
01240 &name_idx);
01241 npes_attr = ntr_sym_tbl(&npes_token,name_idx);
01242 LN_DEF_LOC(name_idx) = TRUE;
01243 AT_OBJ_CLASS(npes_attr) = Data_Obj;
01244 AT_COMPILER_GEND(npes_attr) = TRUE;
01245 AT_SEMANTICS_DONE(npes_attr) = TRUE;
01246 ATD_SYMBOLIC_CONSTANT(npes_attr) = TRUE;
01247 ATD_TYPE_IDX(npes_attr) = CG_INTEGER_DEFAULT_TYPE;
01248
01249
01250
01251
01252
01253
01254 if (cmd_line_flags.MPP_num_pes == 0) {
01255 ATD_CLASS(npes_attr) = Variable;
01256 }
01257 else {
01258 ATD_CLASS(npes_attr) = Constant;
01259 AT_DEFINED(npes_attr) = TRUE;
01260 ATD_FLD(npes_attr) = CN_Tbl_Idx;
01261 ATD_CONST_IDX(npes_attr) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
01262 cmd_line_flags.MPP_num_pes);
01263 }
01264
01265 const_safevl_idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE,
01266 target_safevl);
01267
01268
01269
01270 TYP_IDX(Character_1) = CN_INTEGER_ONE_IDX;
01271 TYP_FLD(Character_1) = CN_Tbl_Idx;
01272 TYP_IDX(Character_2) = CN_INTEGER_ONE_IDX;
01273 TYP_FLD(Character_1) = CN_Tbl_Idx;
01274 TYP_IDX(Character_4) = CN_INTEGER_ONE_IDX;
01275 TYP_FLD(Character_4) = CN_Tbl_Idx;
01276
01277
01278
01279
01280
01281 # ifdef _TARGET_OS_SOLARIS
01282
01283 if (TYP_LINEAR(INTEGER_DEFAULT_TYPE) == Integer_8) {
01284 storage_bit_size_tbl[CRI_Ptr_8] = 64;
01285 }
01286
01287 # endif
01288
01289
01290
01291
01292 for (idx = BD_DEFERRED_1_IDX; idx <= BD_DEFERRED_7_IDX; idx++) {
01293 CLEAR_TBL_NTRY(bounds_tbl, idx);
01294 BD_ARRAY_CLASS(idx) = Deferred_Shape;
01295 BD_RANK(idx) = idx;
01296 BD_USED_NTRY(idx) = TRUE;
01297 BD_NTRY_SIZE(idx) = 1;
01298 BD_GLOBAL_IDX(idx) = idx;
01299 }
01300
01301 PRINT_INTRIN;
01302
01303 EOPU_encountered = FALSE;
01304 curr_stmt_category = Init_Stmt_Cat;
01305 curr_internal_lbl = 0;
01306 curr_debug_lbl = 0;
01307 if_stmt_lbl_idx = NULL_IDX;
01308
01309 cif_prog_unit_init();
01310
01311 curr_stmt_sh_idx = ntr_sh_tbl();
01312 SH_STMT_TYPE(curr_stmt_sh_idx) = Null_Stmt;
01313 SCP_FIRST_SH_IDX(curr_scp_idx) = curr_stmt_sh_idx;
01314 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
01315 need_new_sh = FALSE;
01316
01317
01318
01319 init_directive (1);
01320 stmt_start_line = save_stmt_start_line;
01321
01322 TRACE (Func_Exit, "init_parse_prog_unit", NULL);
01323
01324 return;
01325
01326 }
01327
01328
01329
01330
01331
01332
01333
01334
01335
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348 static void ck_lbl_construct_name(void)
01349
01350 {
01351 int ir_idx;
01352 int name_idx;
01353 int sh_idx;
01354
01355
01356 TRACE (Func_Entry, "ck_lbl_construct_name", NULL);
01357
01358 stmt_label_idx = NULL_IDX;
01359 stmt_construct_idx = NULL_IDX;
01360
01361
01362
01363
01364
01365 if (label_ok &&
01366 MATCHED_TOKEN_CLASS(Tok_Class_Label) &&
01367 ! TOKEN_ERR(token)) {
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381 label_token = token;
01382 stmt_label_idx = -911;
01383 }
01384
01385 if (MATCHED_TOKEN_CLASS(Tok_Class_Construct_Def)) {
01386
01387
01388
01389 stmt_construct_idx = srch_sym_tbl(TOKEN_STR(token),
01390 TOKEN_LEN(token),
01391 &name_idx);
01392
01393 if (stmt_construct_idx == NULL_IDX ||
01394 AT_OBJ_CLASS(stmt_construct_idx) != Label) {
01395
01396 if (stmt_construct_idx == NULL_IDX) {
01397 stmt_construct_idx = ntr_sym_tbl(&token, name_idx);
01398 }
01399 else {
01400 fnd_semantic_err(Obj_Construct,
01401 TOKEN_LINE(token),
01402 TOKEN_COLUMN(token),
01403 stmt_construct_idx,
01404 TRUE);
01405 CREATE_ERR_ATTR(stmt_construct_idx, TOKEN_LINE(token),
01406 TOKEN_COLUMN(token), Label);
01407 }
01408
01409 LN_DEF_LOC(name_idx) = TRUE;
01410 AT_OBJ_CLASS(stmt_construct_idx) = Label;
01411 AT_DEFINED(stmt_construct_idx) = TRUE;
01412 AT_DEF_LINE(stmt_construct_idx) = TOKEN_LINE(token);
01413 ATL_DEBUG_CLASS(stmt_construct_idx) = Ldbg_Construct_Name;
01414
01415 gen_sh(Before, Construct_Def, TOKEN_LINE(token), TOKEN_COLUMN(token),
01416 FALSE, FALSE, FALSE);
01417
01418 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
01419
01420 if (SCP_FIRST_SH_IDX(curr_scp_idx) == curr_stmt_sh_idx) {
01421 SCP_FIRST_SH_IDX(curr_scp_idx) = sh_idx;
01422 }
01423
01424 NTR_IR_TBL(ir_idx);
01425 SH_IR_IDX(sh_idx) = ir_idx;
01426 IR_OPR(ir_idx) = Label_Opr;
01427 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
01428 IR_LINE_NUM(ir_idx) = TOKEN_LINE(token);
01429 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(token);
01430 IR_LINE_NUM_L(ir_idx) = TOKEN_LINE(token);
01431 IR_COL_NUM_L(ir_idx) = TOKEN_COLUMN(token);
01432 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
01433 IR_IDX_L(ir_idx) = stmt_construct_idx;
01434 IR_FLD_R(ir_idx) = SH_Tbl_Idx;
01435 IR_IDX_R(ir_idx) = curr_stmt_sh_idx;
01436
01437 if (cif_flags & XREF_RECS) {
01438 cif_usage_rec(stmt_construct_idx, AT_Tbl_Idx,
01439 TOKEN_LINE(token), TOKEN_COLUMN(token),
01440 CIF_Symbol_Declaration);
01441 }
01442
01443 }
01444 else {
01445 AT_DCL_ERR(stmt_construct_idx) = TRUE;
01446 PRINTMSG(TOKEN_LINE(token), 171, Error, TOKEN_COLUMN(token),
01447 AT_OBJ_NAME_PTR(stmt_construct_idx),
01448 AT_DEF_LINE(stmt_construct_idx));
01449 }
01450 }
01451
01452 TRACE (Func_Exit, "ck_lbl_construct_name", NULL);
01453
01454 return;
01455
01456 }
01457
01458
01459
01460
01461
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481 void gen_attr_and_IR_for_lbl(boolean check_stmt_type)
01482
01483 {
01484 int ir_idx;
01485 int name_idx;
01486 int sh_idx;
01487
01488
01489 TRACE (Func_Entry, "gen_attr_and_IR_for_lbl", NULL);
01490
01491 if (check_stmt_type &&
01492 (stmt_type == Type_Decl_Stmt ||
01493 stmt_type == Function_Stmt ||
01494 stmt_type == Recursive_Stmt ||
01495 stmt_type == Subroutine_Stmt ||
01496 stmt_type == Pure_Stmt ||
01497 stmt_type == Elemental_Stmt ||
01498 stmt_type == End_Stmt)) {
01499 goto EXIT;
01500 }
01501
01502 stmt_label_idx = srch_sym_tbl(TOKEN_STR(label_token),
01503 TOKEN_LEN(label_token),
01504 &name_idx);
01505
01506 if (stmt_label_idx == NULL_IDX) {
01507 stmt_label_idx = ntr_sym_tbl(&label_token, name_idx);
01508 AT_OBJ_CLASS(stmt_label_idx) = Label;
01509 ATL_DEBUG_CLASS(stmt_label_idx) = Ldbg_User_Lbl;
01510
01511 if (! check_stmt_type) {
01512 ATL_CLASS(stmt_label_idx) = Lbl_User;
01513 }
01514
01515 LN_DEF_LOC(name_idx) = TRUE;
01516 }
01517
01518 if (AT_DEFINED(stmt_label_idx)) {
01519 PRINTMSG(TOKEN_LINE(label_token), 146, Error,
01520 TOKEN_COLUMN(label_token),
01521 AT_OBJ_NAME_PTR(stmt_label_idx),
01522 AT_DEF_LINE(stmt_label_idx));
01523 }
01524 else {
01525
01526
01527
01528
01529 if (ATL_FWD_REF_IDX(stmt_label_idx) == NULL_IDX) {
01530 AT_DEFINED(stmt_label_idx) = TRUE;
01531 ATL_DEF_STMT_IDX(stmt_label_idx) = curr_stmt_sh_idx;
01532 }
01533
01534 if (! cdir_switches.vector) {
01535 ATL_NOVECTOR(stmt_label_idx) = TRUE;
01536 }
01537
01538 AT_DEF_LINE(stmt_label_idx) = TOKEN_LINE(label_token);
01539 SH_LABELED(curr_stmt_sh_idx) = TRUE;
01540
01541 gen_sh(Before, Label_Def,
01542 TOKEN_LINE(label_token), TOKEN_COLUMN(label_token),
01543 FALSE, FALSE, FALSE);
01544
01545 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
01546
01547 if (SCP_FIRST_SH_IDX(curr_scp_idx) == curr_stmt_sh_idx) {
01548 SCP_FIRST_SH_IDX(curr_scp_idx) = sh_idx;
01549 }
01550
01551 NTR_IR_TBL(ir_idx);
01552 SH_IR_IDX(sh_idx) = ir_idx;
01553 IR_OPR(ir_idx) = Label_Opr;
01554 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
01555 IR_LINE_NUM(ir_idx) = TOKEN_LINE(label_token);
01556 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(label_token);
01557 IR_LINE_NUM_L(ir_idx) = TOKEN_LINE(label_token);
01558 IR_COL_NUM_L(ir_idx) = TOKEN_COLUMN(label_token);
01559 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
01560 IR_IDX_L(ir_idx) = stmt_label_idx;
01561 IR_FLD_R(ir_idx) = SH_Tbl_Idx;
01562 IR_IDX_R(ir_idx) = curr_stmt_sh_idx;
01563
01564 if (cif_flags & XREF_RECS) {
01565 cif_usage_rec(stmt_label_idx, AT_Tbl_Idx,
01566 TOKEN_LINE(label_token), TOKEN_COLUMN(label_token),
01567 CIF_Symbol_Declaration);
01568 }
01569
01570 }
01571
01572 EXIT:
01573
01574 TRACE (Func_Exit, "gen_attr_and_IR_for_lbl", NULL);
01575
01576 return;
01577
01578 }
01579
01580
01581
01582
01583
01584
01585
01586
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597
01598
01599
01600 void determine_stmt_type(void)
01601
01602 {
01603 int buf_idx;
01604 int stmt_num;
01605
01606 TRACE (Func_Entry, "determine_stmt_type", NULL);
01607 stmt_start_line = TOKEN_LINE(token);
01608 stmt_start_col = TOKEN_COLUMN(token);
01609 buf_idx = TOKEN_BUF_IDX(token);
01610 stmt_num = TOKEN_STMT_NUM(token);
01611 stmt_type = token_to_stmt_type [TOKEN_VALUE(token)];
01612
01613 SH_GLB_LINE(curr_stmt_sh_idx) = stmt_start_line;
01614 SH_COL_NUM(curr_stmt_sh_idx) = stmt_start_col;
01615
01616 if (stmt_type == Format_Stmt &&
01617 stmt_label_idx &&
01618 LA_CH_VALUE == LPAREN) {
01619
01620
01621
01622
01623 }
01624 else if (stmt_type != Assignment_Stmt &&
01625 stmt_type != Directive_Stmt &&
01626 stmt_type != End_Parallel_Stmt &&
01627 stmt_type != End_Do_Parallel_Stmt &&
01628 stmt_type != End_Parallel_Case_Stmt &&
01629 stmt_type != Parallel_Case_Stmt &&
01630 stmt_type != End_Guard_Stmt &&
01631 stmt_type != Open_MP_Section_Stmt &&
01632 stmt_type != Open_MP_End_Parallel_Stmt &&
01633 stmt_type != Open_MP_End_Do_Stmt &&
01634 stmt_type != Open_MP_End_Parallel_Sections_Stmt &&
01635 stmt_type != Open_MP_End_Sections_Stmt &&
01636 stmt_type != Open_MP_End_Section_Stmt &&
01637 stmt_type != Open_MP_End_Single_Stmt &&
01638 stmt_type != Open_MP_End_Parallel_Do_Stmt &&
01639 stmt_type != Open_MP_End_Master_Stmt &&
01640 stmt_type != Open_MP_End_Critical_Stmt &&
01641 stmt_type != Open_MP_End_Ordered_Stmt &&
01642 stmt_type != Open_MP_End_Parallel_Workshare_Stmt &&
01643 stmt_type != Open_MP_End_Workshare_Stmt &&
01644 stmt_type != SGI_Section_Stmt &&
01645 stmt_type != SGI_End_Psection_Stmt &&
01646 stmt_type != SGI_End_Pdo_Stmt &&
01647 stmt_type != SGI_End_Parallel_Stmt &&
01648 stmt_type != SGI_End_Critical_Section_Stmt &&
01649 stmt_type != SGI_End_Single_Process_Stmt &&
01650 stmt_type != SGI_Region_End_Stmt) {
01651
01652 if (TOKEN_VALUE(token) == Tok_Kwd_Double && ! set_stmt_type_known()) {
01653
01654
01655
01656
01657 reset_lex (buf_idx, stmt_num);
01658 MATCHED_TOKEN_CLASS (Tok_Class_DO);
01659 stmt_type = Do_Iterative_Stmt;
01660 }
01661
01662 if (stmt_type == Do_Iterative_Stmt) {
01663
01664 if (! set_stmt_type_known() ) {
01665
01666 if (! stmt_is_DO_stmt () ) {
01667 stmt_type = Assignment_Stmt;
01668 }
01669 }
01670 }
01671 else if (stmt_type == Data_Stmt) {
01672
01673 if ( ! stmt_is_DATA_stmt () ) {
01674 stmt_type = Assignment_Stmt;
01675 }
01676 }
01677 else if (! set_stmt_type_known() ) {
01678 stmt_type = Assignment_Stmt;
01679 }
01680 }
01681
01682 if (stmt_type == Assignment_Stmt) {
01683
01684 if (TOKEN_VALUE(token) != Tok_Id) {
01685
01686
01687
01688
01689
01690
01691
01692 reset_lex (buf_idx, stmt_num);
01693 MATCHED_TOKEN_CLASS(Tok_Class_Id);
01694 }
01695 }
01696
01697
01698
01699 SH_STMT_TYPE(curr_stmt_sh_idx) = stmt_type;
01700
01701
01702
01703
01704
01705
01706 need_new_sh = TRUE;
01707
01708
01709
01710
01711
01712
01713
01714
01715 if (cif_flags & MISC_RECS) {
01716 cif_stmt_type_rec(FALSE, CIF_Not_Exact, statement_number);
01717 }
01718
01719 TRACE (Func_Exit, "determine_stmt_type", NULL);
01720
01721 return;
01722
01723 }
01724
01725
01726
01727
01728
01729
01730
01731
01732
01733
01734
01735
01736
01737
01738
01739
01740
01741
01742
01743 boolean iss_blk_stk_err(void)
01744
01745 {
01746 int blk_idx;
01747 int err_msg;
01748 boolean iss_msg;
01749
01750
01751 TRACE (Func_Entry, "iss_blk_stk_err", NULL);
01752
01753
01754
01755
01756
01757 if (if_stmt_lbl_idx != NULL_IDX) {
01758 iss_msg = FALSE;
01759 goto EXIT;
01760 }
01761
01762 err_msg = 5;
01763 iss_msg = TRUE;
01764
01765 if (STMT_CANT_BE_IN_BLK(stmt_type, CURR_BLK)) {
01766
01767 for (blk_idx = blk_stk_idx;
01768
01769
01770
01771
01772 blk_idx > NULL_IDX &&
01773 BLK_ERR(blk_idx) == TRUE &&
01774 STMT_CANT_BE_IN_BLK(stmt_type, BLK_TYPE(blk_idx));
01775
01776 blk_idx--);
01777
01778 if (blk_idx > NULL_IDX) {
01779 err_msg = (STMT_CANT_BE_IN_BLK(stmt_type, BLK_TYPE(blk_idx))) ?
01780 blk_err_msgs[BLK_TYPE(blk_idx)] : FALSE;
01781 }
01782 }
01783
01784 switch (stmt_type) {
01785
01786 case Blockdata_Stmt:
01787 case Module_Stmt:
01788 case Program_Stmt:
01789
01790 pop_and_err_blk_stk(NULL_IDX, TRUE);
01791 init_parse_prog_unit();
01792 err_msg = 0;
01793 iss_msg = FALSE;
01794 break;
01795
01796 case Function_Stmt:
01797 case Subroutine_Stmt:
01798 for (blk_idx = blk_stk_idx;
01799 (blk_idx > NULL_IDX &&
01800 BLK_TYPE(blk_idx) != Interface_Blk &&
01801 BLK_TYPE(blk_idx) != Contains_Blk);
01802 blk_idx--);
01803
01804
01805
01806
01807 pop_and_err_blk_stk(blk_idx, TRUE);
01808
01809 if (blk_idx == NULL_IDX) {
01810
01811
01812 if (cif_flags & BASIC_RECS) {
01813 cif_send_sytb();
01814 }
01815 init_parse_prog_unit();
01816 }
01817
01818 err_msg = 0;
01819 iss_msg = FALSE;
01820 break;
01821
01822 case Return_Stmt:
01823 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Function &&
01824 ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Subroutine) {
01825
01826 switch (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx))) {
01827 case Module:
01828 err_msg = 19;
01829 break;
01830
01831 case Blockdata:
01832 err_msg = 15;
01833 break;
01834
01835 case Program:
01836 err_msg = 16;
01837 break;
01838 # ifdef _DEBUG
01839 default:
01840 PRINTMSG(stmt_start_line, 179, Internal,
01841 stmt_start_col, "iss_blk_stk_err");
01842 break;
01843 # endif
01844 }
01845 }
01846 break;
01847
01848 case Private_Stmt:
01849 case Public_Stmt:
01850
01851 if (STMT_LEGAL_IN_BLK(stmt_type, CURR_BLK)) {
01852
01853 if (STMT_CANT_BE_IN_BLK(stmt_type, BLK_TYPE(BLK_HEAD_IDX))) {
01854 err_msg = blk_err_msgs[BLK_TYPE(BLK_HEAD_IDX)];
01855 iss_msg = TRUE;
01856 }
01857 }
01858 break;
01859
01860 default:
01861 break;
01862
01863 }
01864
01865 if (iss_msg && err_msg != 0) {
01866 PRINTMSG(stmt_start_line, err_msg, Error, stmt_start_col,
01867 stmt_type_str[stmt_type]);
01868
01869 if (err_msg != 5) {
01870 SCP_IN_ERR(curr_scp_idx) = TRUE;
01871 }
01872 }
01873
01874 EXIT:
01875
01876 TRACE (Func_Exit, "iss_blk_stk_err", NULL);
01877
01878 return(iss_msg);
01879
01880 }
01881
01882
01883
01884
01885
01886
01887
01888
01889
01890
01891
01892
01893
01894
01895
01896
01897
01898
01899 void parse_bad_stmt(void)
01900
01901 {
01902 TRACE (Func_Entry, "parse_bad_stmt", NULL);
01903
01904 PRINTMSG(TOKEN_LINE(token), 141, Internal, TOKEN_COLUMN(token));
01905
01906 TRACE (Func_Exit, "parse_bad_stmt", NULL);
01907
01908 return;
01909
01910 }
01911
01912
01913
01914
01915
01916
01917
01918
01919
01920
01921
01922
01923
01924
01925
01926
01927
01928
01929 static void check_for_dup_derived_type_lbl(void)
01930 {
01931 int al_idx;
01932 int lbl_list_idx;
01933 int np_idx;
01934
01935
01936 TRACE (Func_Entry, "check_for_dup_derived_type_lbl", NULL);
01937
01938 if (CURR_BLK_NAME == NULL_IDX || AT_DCL_ERR(CURR_BLK_NAME) || CURR_BLK_ERR) {
01939
01940
01941
01942 stmt_label_idx = NULL_IDX;
01943 return;
01944 }
01945
01946 lbl_list_idx = (stmt_type == End_Type_Stmt) ?
01947 ATT_LABEL_LIST_IDX(BLK_NAME(blk_stk_idx + 1)) :
01948 ATT_LABEL_LIST_IDX(CURR_BLK_NAME);
01949
01950 while (lbl_list_idx != NULL_IDX &&
01951 ! EQUAL_STRS(TOKEN_STR(label_token),
01952 AT_OBJ_NAME_PTR(AL_ATTR_IDX(lbl_list_idx)))) {
01953 lbl_list_idx = AL_NEXT_IDX(lbl_list_idx);
01954 }
01955
01956 if (lbl_list_idx == NULL_IDX) {
01957 NTR_ATTR_TBL(stmt_label_idx);
01958 AT_DEF_COLUMN(stmt_label_idx) = TOKEN_COLUMN(label_token);
01959 AT_DEF_LINE(stmt_label_idx) = TOKEN_LINE(label_token);
01960
01961 NTR_NAME_POOL(TOKEN_ID(label_token).words,
01962 TOKEN_LEN(label_token),
01963 np_idx);
01964
01965 AT_NAME_IDX(stmt_label_idx) = np_idx;
01966 AT_NAME_LEN(stmt_label_idx) = TOKEN_LEN(label_token);
01967 AT_OBJ_CLASS(stmt_label_idx) = Label;
01968 AT_DEFINED(stmt_label_idx) = TRUE;
01969 ATL_CLASS(stmt_label_idx) = Lbl_User;
01970 ATL_DEF_STMT_IDX(stmt_label_idx) = curr_stmt_sh_idx;
01971 ATL_DEBUG_CLASS(stmt_label_idx) = Ldbg_User_Lbl;
01972
01973 NTR_ATTR_LIST_TBL(al_idx);
01974 AL_ATTR_IDX(al_idx) = stmt_label_idx;
01975 AL_NEXT_IDX(al_idx) = ATT_LABEL_LIST_IDX(CURR_BLK_NAME);
01976 ATT_LABEL_LIST_IDX(CURR_BLK_NAME) = al_idx;
01977
01978 if (cif_flags & INFO_RECS) {
01979 cif_label_rec(stmt_label_idx);
01980 }
01981
01982 if (cif_flags & XREF_RECS) {
01983 cif_usage_rec(stmt_label_idx,
01984 AT_Tbl_Idx,
01985 AT_DEF_LINE(stmt_label_idx),
01986 AT_DEF_COLUMN(stmt_label_idx),
01987 CIF_Symbol_Declaration);
01988 }
01989 }
01990 else {
01991 PRINTMSG(TOKEN_LINE(label_token), 146, Error,
01992 TOKEN_COLUMN(label_token),
01993 TOKEN_STR(label_token),
01994 AT_DEF_LINE(AL_ATTR_IDX(lbl_list_idx)));
01995 stmt_label_idx = AL_ATTR_IDX(lbl_list_idx);
01996 }
01997
01998 TRACE (Func_Exit, "check_for_dup_derived_type_lbl", NULL);
01999
02000 return;
02001
02002 }
02003
02004
02005
02006
02007
02008
02009
02010
02011
02012
02013
02014
02015
02016
02017
02018
02019
02020
02021
02022 extern void init_type(void)
02023
02024 {
02025 linear_type_type dp_linear_type;
02026
02027 TRACE (Func_Entry, "init_type", NULL);
02028
02029 set_integer_default_type();
02030
02031
02032
02033 dp_linear_type = half_linear_type[Fortran_Double];
02034
02035 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type =
02036 (cmd_line_flags.s_doubleprecision16) ? Real_16 :
02037 init_default_linear_type[Fortran_Double];
02038
02039 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.linear_type =
02040 (cmd_line_flags.s_doublecomplex16) ? Complex_16:
02041 init_default_linear_type[Fortran_Double_Complex];
02042
02043 LOGICAL_DEFAULT_TYPE = (cmd_line_flags.s_logical8) ? Logical_8 :
02044 init_default_linear_type[Fortran_Logical];
02045 REAL_DEFAULT_TYPE = (cmd_line_flags.s_real8) ? Real_8 :
02046 init_default_linear_type[Fortran_Real];
02047 COMPLEX_DEFAULT_TYPE = (cmd_line_flags.s_complex8) ? Complex_8 :
02048 init_default_linear_type[Fortran_Complex];
02049
02050 CHARACTER_DEFAULT_TYPE = init_default_linear_type[Fortran_Character];
02051
02052 # if defined(_ACCEPT_CMD_s_32)
02053
02054 if (cmd_line_flags.s_default32) {
02055 CHARACTER_DEFAULT_TYPE = half_linear_type[Fortran_Character];
02056 COMPLEX_DEFAULT_TYPE = half_linear_type[Fortran_Complex];
02057 LOGICAL_DEFAULT_TYPE = half_linear_type[Fortran_Logical];
02058 REAL_DEFAULT_TYPE = half_linear_type[Fortran_Real];
02059
02060 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type =
02061 half_linear_type[Fortran_Double];
02062
02063 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.linear_type =
02064 half_linear_type[Fortran_Double_Complex];
02065
02066
02067 # ifdef _TARGET_OS_MAX
02068 dp_linear_type = half_linear_type[Fortran_Real];
02069 # endif
02070
02071 }
02072
02073 # endif
02074
02075
02076 # if defined(_TARGET32) || defined(_WHIRL_HOST64_TARGET64) || (defined(_HOST32) && defined(_TARGET64))
02077
02078 if (cmd_line_flags.s_default64) {
02079 CHARACTER_DEFAULT_TYPE = double_linear_type[Fortran_Character];
02080 COMPLEX_DEFAULT_TYPE = double_linear_type[Fortran_Complex];
02081 LOGICAL_DEFAULT_TYPE = double_linear_type[Fortran_Logical];
02082 REAL_DEFAULT_TYPE = double_linear_type[Fortran_Real];
02083
02084 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type =
02085 double_linear_type[Fortran_Double];
02086
02087 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.linear_type =
02088 double_linear_type[Fortran_Double_Complex];
02089 }
02090 else if (cmd_line_flags.s_float64) {
02091 CHARACTER_DEFAULT_TYPE = init_default_linear_type[Fortran_Character];
02092 LOGICAL_DEFAULT_TYPE = init_default_linear_type[Fortran_Logical];
02093 REAL_DEFAULT_TYPE = double_linear_type[Fortran_Real];
02094 COMPLEX_DEFAULT_TYPE = double_linear_type[Fortran_Complex];
02095
02096 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type =
02097 double_linear_type[Fortran_Double];
02098
02099 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.linear_type =
02100 double_linear_type[Fortran_Double_Complex];
02101 }
02102
02103 # endif
02104
02105 if (!on_off_flags.enable_double_precision) {
02106 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.linear_type = dp_linear_type;
02107
02108 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.linear_type =
02109 COMPLEX_DEFAULT_TYPE;
02110
02111 type_init_tbl[DOUBLE_PRECISION_TYPE_IDX].fld.dp_hit_me = TRUE;
02112 type_init_tbl[DOUBLE_COMPLEX_TYPE_IDX].fld.dp_hit_me = TRUE;
02113 }
02114
02115
02116 # if defined(GENERATE_WHIRL)
02117
02118 if (cmd_line_flags.s_pointer8) {
02119 storage_bit_size_tbl[CRI_Ptr_8] = 64;
02120 storage_bit_size_tbl[CRI_Ch_Ptr_8] = 128;
02121 storage_bit_size_tbl[CRI_Parcel_Ptr_8] = 64;
02122 }
02123
02124 # endif
02125
02126
02127 TRACE (Func_Exit, "init_type", NULL);
02128
02129 return;
02130
02131 }
02132
02133
02134
02135
02136
02137
02138
02139
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151 static void set_integer_default_type(void)
02152
02153 {
02154 TRACE (Func_Entry, "set_integer_default_type", NULL);
02155
02156
02157
02158
02159 if (cmd_line_flags.integer_32) {
02160 INTEGER_DEFAULT_TYPE = Integer_4;
02161 }
02162 else {
02163 # if defined(_TARGET32) || defined(_WHIRL_HOST64_TARGET64) || (defined(_HOST32) && defined(_TARGET64))
02164 INTEGER_DEFAULT_TYPE = Integer_4;
02165 # else
02166 INTEGER_DEFAULT_TYPE = Integer_8;
02167 # endif
02168 }
02169
02170 if (cmd_line_flags.s_integer8) {
02171 INTEGER_DEFAULT_TYPE = Integer_8;
02172 }
02173
02174
02175 # if defined(_ACCEPT_CMD_s_32)
02176 if (cmd_line_flags.s_default32) {
02177 INTEGER_DEFAULT_TYPE = half_linear_type[Fortran_Integer];
02178 }
02179 # endif
02180
02181 # if defined(_TARGET32)
02182 if (cmd_line_flags.s_default64) {
02183 INTEGER_DEFAULT_TYPE = double_linear_type[Fortran_Integer];
02184 }
02185 # endif
02186
02187 TRACE (Func_Exit, "set_integer_default_type", NULL);
02188
02189 return;
02190
02191 }
02192
02193
02194
02195
02196
02197
02198
02199
02200
02201
02202
02203
02204
02205
02206
02207
02208
02209
02210
02211 static void init_const_tbl(void)
02212 {
02213 int idx;
02214
02215
02216 TRACE (Func_Entry, "init_const_tbl", NULL);
02217
02218
02219
02220
02221
02222 for (idx = 0; idx < Num_Linear_Types; idx++) {
02223 cn_root_idx[idx] = 0;
02224 }
02225
02226
02227
02228
02229
02230
02231
02232
02233
02234
02235
02236
02237
02238 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, 0);
02239
02240 # ifdef _DEBUG
02241 if (idx != CN_INTEGER_ZERO_IDX) {
02242 PRINTMSG(1, 626, Internal, 0,
02243 "CN_INTEGER_ZERO_IDX = 1", "init_const_tbl");
02244 }
02245 # endif
02246
02247 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, 1);
02248
02249 # ifdef _DEBUG
02250 if (idx != CN_INTEGER_ONE_IDX) {
02251 PRINTMSG(1, 626, Internal, 0,
02252 "CN_INTEGER_ONE_IDX = 2", "init_const_tbl");
02253 }
02254 # endif
02255
02256 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, 2);
02257
02258 # ifdef _DEBUG
02259 if (idx != CN_INTEGER_TWO_IDX) {
02260 PRINTMSG(1, 626, Internal, 0,
02261 "CN_INTEGER_TWO_IDX = 3", "init_const_tbl");
02262 }
02263 # endif
02264
02265 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, 3);
02266
02267 # ifdef _DEBUG
02268 if (idx != CN_INTEGER_THREE_IDX) {
02269 PRINTMSG(1, 626, Internal, 0,
02270 "CN_INTEGER_THREE_IDX = 4", "init_const_tbl");
02271 }
02272 # endif
02273
02274 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, -1);
02275
02276 # ifdef _DEBUG
02277 if (idx != CN_INTEGER_NEG_ONE_IDX) {
02278 PRINTMSG(1, 626, Internal, 0,
02279 "CN_INTEGER_NEG_ONE_IDX = 5", "init_const_tbl");
02280 }
02281 # endif
02282
02283 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, TARGET_BITS_PER_WORD);
02284
02285 # ifdef _DEBUG
02286 if (idx != CN_INTEGER_BITS_PER_WORD_IDX) {
02287 PRINTMSG(1, 626, Internal, 0,
02288 "CN_INTEGER_BITS_PER_WORD_IDX = 6", "init_const_tbl");
02289 }
02290 # endif
02291
02292 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, CHAR_BIT);
02293
02294 # ifdef _DEBUG
02295 if (idx != CN_INTEGER_CHAR_BIT_IDX) {
02296 PRINTMSG(1, 626, Internal, 0,
02297 "CN_INTEGER_CHAR_BIT_IDX = 7", "init_const_tbl");
02298 }
02299 # endif
02300 idx = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, INT_MIN);
02301
02302 # ifdef _DEBUG
02303 if (idx != CN_INTEGER_MIN_IDX) {
02304 PRINTMSG(1, 626, Internal, 0,
02305 "CN_INTEGER_MIN_IDX = 8", "init_const_tbl");
02306 }
02307 # endif
02308
02309
02310
02311
02312
02313 for (idx = 0; idx < 18; ++idx) {
02314 ieee_const_tbl_idx[idx] = NULL_IDX;
02315 }
02316
02317 TRACE (Func_Exit, "init_const_tbl", NULL);
02318
02319 return;
02320
02321 }
02322
02323
02324
02325
02326
02327
02328
02329
02330
02331
02332
02333
02334
02335
02336
02337
02338
02339
02340 void implicit_use_semantics(void)
02341 {
02342 int attr_idx;
02343 int fp_idx;
02344 int list_idx;
02345 int name_idx;
02346 token_type name_token;
02347
02348
02349 TRACE (Func_Entry, "implicit_use_semantics", NULL);
02350
02351 fp_idx = cdir_switches.implicit_use_idx;
02352 cdir_switches.implicit_use_idx = NULL_IDX;
02353
02354 while (fp_idx != NULL_IDX) {
02355 CREATE_ID(TOKEN_ID(name_token),(FP_NAME_PTR(fp_idx)),FP_NAME_LEN(fp_idx));
02356
02357 TOKEN_COLUMN(name_token) = 1;
02358 TOKEN_LEN(name_token) = FP_NAME_LEN(fp_idx);
02359 TOKEN_LINE(name_token) = stmt_start_line;
02360
02361 attr_idx = srch_sym_tbl(TOKEN_STR(name_token),
02362 TOKEN_LEN(name_token),
02363 &name_idx);
02364
02365 if (attr_idx != NULL_IDX) {
02366
02367 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
02368 ATP_PGM_UNIT(attr_idx) == Module) {
02369
02370
02371
02372
02373 list_idx = SCP_USED_MODULE_LIST(curr_scp_idx);
02374
02375 while (list_idx != NULL_IDX) {
02376
02377 if (AL_ATTR_IDX(list_idx) == attr_idx) {
02378 break;
02379 }
02380 list_idx = AL_NEXT_IDX(list_idx);
02381 }
02382
02383 if (list_idx == NULL_IDX) {
02384
02385
02386
02387
02388
02389
02390
02391
02392 NTR_ATTR_LIST_TBL(list_idx);
02393 AL_ATTR_IDX(list_idx) = attr_idx;
02394 AL_PREV_MODULE_IDX(SCP_USED_MODULE_LIST(curr_scp_idx))= list_idx;
02395 AL_NEXT_IDX(list_idx) = SCP_USED_MODULE_LIST(curr_scp_idx);
02396 SCP_USED_MODULE_LIST(curr_scp_idx) = list_idx;
02397 AT_USE_ASSOCIATED(attr_idx) = TRUE;
02398 AT_MODULE_IDX(attr_idx) = attr_idx;
02399 }
02400 }
02401 else {
02402 PRINTMSG(TOKEN_LINE(name_token), 1496, Error,
02403 TOKEN_COLUMN(name_token),
02404 AT_OBJ_NAME_PTR(attr_idx));
02405 }
02406 }
02407 else {
02408 attr_idx = ntr_sym_tbl(&name_token, name_idx);
02409 AT_OBJ_CLASS(attr_idx) = Pgm_Unit;
02410 ATP_PGM_UNIT(attr_idx) = Module;
02411 ATP_SCP_IDX(attr_idx) = curr_scp_idx;
02412 ATP_IMPLICIT_USE_MODULE(attr_idx) = TRUE;
02413 MAKE_EXTERNAL_NAME(attr_idx,
02414 AT_NAME_IDX(attr_idx),
02415 AT_NAME_LEN(attr_idx));
02416 NTR_ATTR_LIST_TBL(list_idx);
02417 AL_ATTR_IDX(list_idx) = attr_idx;
02418 AL_PREV_MODULE_IDX(SCP_USED_MODULE_LIST(curr_scp_idx)) = list_idx;
02419 AL_NEXT_IDX(list_idx) = SCP_USED_MODULE_LIST(curr_scp_idx);
02420 SCP_USED_MODULE_LIST(curr_scp_idx)= list_idx;
02421 AT_USE_ASSOCIATED(attr_idx) = TRUE;
02422 AT_MODULE_IDX(attr_idx) = attr_idx;
02423 LN_DEF_LOC(name_idx) = TRUE;
02424 }
02425
02426 if (AT_ORIG_NAME_IDX(attr_idx) == NULL_IDX) {
02427 AT_ORIG_NAME_IDX(attr_idx) = AT_NAME_IDX(attr_idx);
02428 AT_ORIG_NAME_LEN(attr_idx) = AT_NAME_LEN(attr_idx);
02429 }
02430
02431 fp_idx = FP_NEXT_FILE_IDX(fp_idx);
02432 }
02433
02434 TRACE (Func_Exit, "implicit_use_semantics", NULL);
02435
02436 return;
02437
02438 }
02439
02440
02441
02442
02443
02444
02445
02446
02447
02448
02449
02450
02451
02452
02453
02454
02455
02456
02457 static void stmt_level_semantics(void)
02458 {
02459 int blk_idx;
02460 int defer_msg;
02461 int save_blk_stk_idx;
02462 boolean stmt_is_directive;
02463
02464
02465 TRACE (Func_Entry, "stmt_level_semantics", NULL);
02466
02467 switch (stmt_type) {
02468 case Directive_Stmt:
02469 case End_Parallel_Stmt:
02470 case End_Do_Parallel_Stmt:
02471 case End_Parallel_Case_Stmt:
02472 case Parallel_Case_Stmt:
02473 case End_Guard_Stmt:
02474 case Open_MP_Section_Stmt:
02475 case Open_MP_End_Parallel_Stmt:
02476 case Open_MP_End_Do_Stmt:
02477 case Open_MP_End_Parallel_Sections_Stmt:
02478 case Open_MP_End_Sections_Stmt:
02479 case Open_MP_End_Section_Stmt:
02480 case Open_MP_End_Single_Stmt:
02481 case Open_MP_End_Parallel_Do_Stmt:
02482 case Open_MP_End_Master_Stmt:
02483 case Open_MP_End_Critical_Stmt:
02484 case Open_MP_End_Ordered_Stmt:
02485 case Open_MP_End_Parallel_Workshare_Stmt:
02486 case Open_MP_End_Workshare_Stmt:
02487 case SGI_Section_Stmt:
02488 case SGI_End_Psection_Stmt:
02489 case SGI_End_Pdo_Stmt:
02490 case SGI_End_Parallel_Stmt:
02491 case SGI_End_Critical_Section_Stmt:
02492 case SGI_End_Single_Process_Stmt:
02493 case SGI_Region_End_Stmt:
02494
02495
02496
02497
02498
02499 if (LA_CH_CLASS == Ch_Class_EOF) {
02500 stmt_is_directive = FALSE;
02501 defer_msg = 1;
02502 }
02503 else {
02504 stmt_is_directive = TRUE;
02505 defer_msg = 0;
02506 }
02507
02508 break;
02509
02510 default:
02511 stmt_is_directive = FALSE;
02512 defer_msg = 0;
02513 break;
02514 }
02515
02516
02517
02518
02519
02520
02521
02522
02523
02524
02525
02526
02527 if (SCP_ATTR_IDX(curr_scp_idx) == glb_tbl_idx[Main_Attr_Idx] &&
02528 !AT_DEFINED(glb_tbl_idx[Main_Attr_Idx]) &&
02529 !AT_DCL_ERR(glb_tbl_idx[Main_Attr_Idx]) &&
02530 (!stmt_is_directive || LA_CH_CLASS == Ch_Class_EOF)) {
02531
02532 if (curr_stmt_category == Init_Stmt_Cat && !stmt_is_directive) {
02533 curr_stmt_category = Use_Stmt_Cat;
02534 }
02535
02536 token = main_token;
02537 TOKEN_LINE(token) = stmt_start_line;
02538 TOKEN_COLUMN(token) = stmt_start_col;
02539 save_blk_stk_idx = blk_stk_idx;
02540 blk_stk_idx = BLK_HEAD_IDX;
02541
02542 start_new_prog_unit(Program, Program_Blk, TRUE, FALSE, &defer_msg);
02543
02544 CURR_BLK_NAME = NULL_IDX;
02545 blk_stk_idx = save_blk_stk_idx;
02546 }
02547
02548
02549
02550
02551
02552
02553
02554 if (cif_need_unit_rec && !stmt_is_directive) {
02555
02556
02557
02558
02559
02560 if (blk_stk_idx == 0) {
02561 cif_pgm_unit_error_recovery = TRUE;
02562 }
02563
02564 if (cif_pgm_unit_error_recovery) {
02565
02566
02567
02568
02569 if (cif_flags == 0) {
02570 cif_pgm_unit_error_recovery = FALSE;
02571 }
02572
02573 blk_stk_idx = 1;
02574 cif_unit_rec();
02575 blk_stk_idx = 0;
02576 }
02577 else {
02578 cif_unit_rec();
02579 }
02580
02581 if (cif_flags != 0) {
02582
02583 if (cif_pgm_unit_error_recovery) {
02584
02585
02586
02587
02588 blk_stk_idx = 1;
02589 cif_begin_scope_rec();
02590 blk_stk_idx = 0;
02591 cif_copy_temp_to_actual_CIF();
02592 cif_pgm_unit_error_recovery = FALSE;
02593 }
02594 else if (BLK_CIF_SCOPE_ID(blk_stk_idx) == 0) {
02595 cif_begin_scope_rec();
02596 }
02597 else if (CURR_BLK == Do_Blk) {
02598
02599
02600
02601 save_blk_stk_idx = blk_stk_idx;
02602 --blk_stk_idx;
02603 cif_begin_scope_rec();
02604 blk_stk_idx = save_blk_stk_idx;
02605 }
02606 }
02607 }
02608
02609
02610
02611
02612
02613
02614 if (stmt_label_idx != NULL_IDX) {
02615
02616 switch(stmt_type) {
02617 case Allocate_Stmt:
02618 case Arith_If_Stmt:
02619 case Assign_Stmt:
02620 case Assignment_Stmt:
02621 case Backspace_Stmt:
02622 case Buffer_Stmt:
02623 case Call_Stmt:
02624 case Case_Stmt:
02625 case Close_Stmt:
02626 case Continue_Stmt:
02627 case Cycle_Stmt:
02628 case Deallocate_Stmt:
02629 case Decode_Stmt:
02630 case Do_Iterative_Stmt:
02631 case Do_While_Stmt:
02632 case Do_Infinite_Stmt:
02633 case Else_Stmt:
02634 case Else_If_Stmt:
02635 case Else_Where_Stmt:
02636 case Encode_Stmt:
02637 case Endfile_Stmt:
02638 case Entry_Stmt:
02639 case Exit_Stmt:
02640 case Forall_Cstrct_Stmt:
02641 case Forall_Stmt:
02642 case Goto_Stmt:
02643 case If_Cstrct_Stmt:
02644 case If_Stmt:
02645 case Inquire_Stmt:
02646 case Nullify_Stmt:
02647 case Open_Stmt:
02648 case Outmoded_If_Stmt:
02649 case Pause_Stmt:
02650 case Print_Stmt:
02651 case Read_Stmt:
02652 case Return_Stmt:
02653 case Rewind_Stmt:
02654 case Select_Stmt:
02655 case Stop_Stmt:
02656 case Then_Stmt:
02657 case Where_Cstrct_Stmt:
02658 case Where_Stmt:
02659 case Write_Stmt:
02660
02661 ATL_EXECUTABLE(stmt_label_idx) = TRUE;
02662 ATL_CLASS(stmt_label_idx) = Lbl_User;
02663 ATL_DEBUG_CLASS(stmt_label_idx) = Ldbg_User_Lbl;
02664
02665
02666
02667
02668 blk_idx = blk_stk_idx;
02669
02670 while (blk_idx > 0) {
02671
02672 if (BLK_IS_PARALLEL_REGION(blk_idx)) {
02673 ATL_CMIC_BLK_STMT_IDX(stmt_label_idx) =
02674 BLK_FIRST_SH_IDX(blk_idx);
02675 break;
02676 }
02677 blk_idx--;
02678 }
02679
02680
02681
02682
02683
02684
02685
02686
02687
02688
02689
02690
02691
02692
02693
02694
02695 switch (stmt_type) {
02696 case If_Cstrct_Stmt:
02697
02698 if (!AT_DCL_ERR(stmt_label_idx) ) {
02699 blk_idx = blk_stk_idx - 2;
02700
02701 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
02702 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
02703 BLK_TYPE(blk_idx) == Wait_Blk ||
02704 BLK_TYPE(blk_idx) == SGI_Region_Blk) {
02705 blk_idx--;
02706 }
02707
02708 if (BLK_TYPE(blk_idx) > Interface_Body_Blk) {
02709 ATL_BLK_STMT_IDX(stmt_label_idx) =
02710 BLK_FIRST_SH_IDX(blk_idx);
02711 }
02712 }
02713 break;
02714
02715 case Do_Iterative_Stmt:
02716 case Do_While_Stmt:
02717 case Do_Infinite_Stmt:
02718 case Select_Stmt:
02719 case Where_Cstrct_Stmt:
02720 case Forall_Cstrct_Stmt:
02721 blk_idx = blk_stk_idx - 1;
02722
02723 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
02724 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
02725 BLK_TYPE(blk_idx) == Wait_Blk ||
02726 BLK_TYPE(blk_idx) == SGI_Region_Blk) {
02727 blk_idx--;
02728 }
02729
02730 if (BLK_TYPE(blk_idx) > Interface_Body_Blk) {
02731 ATL_BLK_STMT_IDX(stmt_label_idx)=BLK_FIRST_SH_IDX(blk_idx);
02732 }
02733 break;
02734
02735 default:
02736 blk_idx = blk_stk_idx;
02737
02738 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
02739 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
02740 BLK_TYPE(blk_idx) == Wait_Blk ||
02741 BLK_TYPE(blk_idx) == SGI_Region_Blk) {
02742 blk_idx--;
02743 }
02744
02745 if (BLK_TYPE(blk_idx) > Interface_Body_Blk) {
02746 ATL_BLK_STMT_IDX(stmt_label_idx)=BLK_FIRST_SH_IDX(blk_idx);
02747 }
02748 break;
02749
02750 }
02751
02752 end_labeled_do();
02753 break;
02754
02755 case Elemental_Stmt:
02756 case Function_Stmt:
02757 case Pure_Stmt:
02758 case Recursive_Stmt:
02759 case Subroutine_Stmt:
02760 gen_attr_and_IR_for_lbl(FALSE);
02761 break;
02762
02763 case Null_Stmt:
02764 case Allocatable_Stmt:
02765 case Automatic_Stmt:
02766 case Common_Stmt:
02767 case Contains_Stmt:
02768 case Cpnt_Decl_Stmt:
02769 case Data_Stmt:
02770 case Derived_Type_Stmt:
02771 case Dimension_Stmt:
02772 case Directive_Stmt:
02773 case Equivalence_Stmt:
02774 case External_Stmt:
02775 case Format_Stmt:
02776 case Implicit_Stmt:
02777 case Implicit_None_Stmt:
02778 case Intent_Stmt:
02779 case Interface_Stmt:
02780 case Intrinsic_Stmt:
02781 case Module_Proc_Stmt:
02782 case Namelist_Stmt:
02783 case Optional_Stmt:
02784 case Parameter_Stmt:
02785 case Pointer_Stmt:
02786 case Private_Stmt:
02787 case Public_Stmt:
02788 case Save_Stmt:
02789 case Sequence_Stmt:
02790 case Stmt_Func_Stmt:
02791 case Target_Stmt:
02792 case Task_Common_Stmt:
02793 case Type_Decl_Stmt:
02794 case Use_Stmt:
02795 case Volatile_Stmt:
02796
02797
02798
02799
02800
02801 if (stmt_type != Data_Stmt) {
02802 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
02803 }
02804
02805
02806
02807
02808
02809
02810
02811
02812
02813 if (CURR_BLK == Derived_Type_Blk) {
02814 check_for_dup_derived_type_lbl();
02815 }
02816 else if (stmt_type == Type_Decl_Stmt) {
02817 gen_attr_and_IR_for_lbl(FALSE);
02818 }
02819
02820
02821
02822
02823 end_labeled_do();
02824 break;
02825
02826 case Blockdata_Stmt:
02827 case Module_Stmt:
02828 case Program_Stmt:
02829 case End_Blockdata_Stmt:
02830 case End_Do_Stmt:
02831 case End_Function_Stmt:
02832 case End_If_Stmt:
02833 case End_Interface_Stmt:
02834 case End_Module_Stmt:
02835 case End_Program_Stmt:
02836 case End_Select_Stmt:
02837 case End_Stmt:
02838 case End_Subroutine_Stmt:
02839 case End_Type_Stmt:
02840 case End_Where_Stmt:
02841 case End_Forall_Stmt:
02842 case Type_Init_Stmt:
02843 case Label_Def:
02844 case Construct_Def:
02845 case Automatic_Base_Calc_Stmt:
02846 case Automatic_Base_Size_Stmt:
02847 case End_Parallel_Stmt:
02848 case End_Do_Parallel_Stmt:
02849 case End_Parallel_Case_Stmt:
02850 case Parallel_Case_Stmt:
02851 case End_Guard_Stmt:
02852 case Statement_Num_Stmt:
02853 case SGI_Section_Stmt:
02854 case SGI_End_Psection_Stmt:
02855 case SGI_End_Pdo_Stmt:
02856 case SGI_End_Parallel_Stmt:
02857 case SGI_End_Critical_Section_Stmt:
02858 case SGI_End_Single_Process_Stmt:
02859 case SGI_Region_End_Stmt:
02860 case Open_MP_Section_Stmt:
02861 case Open_MP_End_Parallel_Stmt:
02862 case Open_MP_End_Do_Stmt:
02863 case Open_MP_End_Parallel_Sections_Stmt:
02864 case Open_MP_End_Sections_Stmt:
02865 case Open_MP_End_Section_Stmt:
02866 case Open_MP_End_Single_Stmt:
02867 case Open_MP_End_Parallel_Do_Stmt:
02868 case Open_MP_End_Master_Stmt:
02869 case Open_MP_End_Critical_Stmt:
02870 case Open_MP_End_Ordered_Stmt:
02871 case Open_MP_End_Parallel_Workshare_Stmt:
02872 case Open_MP_End_Workshare_Stmt:
02873
02874
02875
02876
02877 blk_idx = blk_stk_idx + 1;
02878
02879 while (blk_idx > 0) {
02880
02881 if (BLK_IS_PARALLEL_REGION(blk_idx)) {
02882 ATL_CMIC_BLK_STMT_IDX(stmt_label_idx) =
02883 BLK_FIRST_SH_IDX(blk_idx);
02884 break;
02885 }
02886 blk_idx--;
02887 }
02888
02889
02890
02891
02892
02893
02894
02895
02896
02897 switch (stmt_type) {
02898 case End_Do_Stmt:
02899 ATL_EXECUTABLE(stmt_label_idx) = TRUE;
02900 ATL_CLASS(stmt_label_idx) = Lbl_User;
02901 ATL_DEBUG_CLASS(stmt_label_idx) = Ldbg_User_Lbl;
02902
02903 blk_idx = blk_stk_idx + 1;
02904
02905 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
02906 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
02907 BLK_TYPE(blk_idx) == Wait_Blk ||
02908 BLK_TYPE(blk_idx) == SGI_Region_Blk) {
02909
02910 blk_idx++;
02911 }
02912
02913 ATL_BLK_STMT_IDX(stmt_label_idx) = BLK_FIRST_SH_IDX(blk_idx);
02914 break;
02915
02916 case End_If_Stmt:
02917 case End_Select_Stmt:
02918 case End_Where_Stmt:
02919 ATL_EXECUTABLE(stmt_label_idx) = TRUE;
02920 ATL_CLASS(stmt_label_idx) = Lbl_User;
02921 ATL_DEBUG_CLASS(stmt_label_idx) = Ldbg_User_Lbl;
02922
02923 blk_idx = blk_stk_idx + 1;
02924
02925 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
02926 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
02927 BLK_TYPE(blk_idx) == Wait_Blk ||
02928 BLK_TYPE(blk_idx) == SGI_Region_Blk) {
02929
02930 blk_idx++;
02931 }
02932
02933 ATL_BLK_STMT_IDX(stmt_label_idx) = BLK_FIRST_SH_IDX(blk_idx);
02934
02935 end_labeled_do();
02936 break;
02937
02938 case End_Type_Stmt:
02939 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
02940 check_for_dup_derived_type_lbl();
02941 break;
02942
02943 case End_Interface_Stmt:
02944 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
02945 break;
02946
02947 default:
02948 break;
02949 }
02950 break;
02951 }
02952
02953
02954
02955
02956 if (stmt_label_idx != NULL_IDX &&
02957 !AT_DEFINED(stmt_label_idx) &&
02958 ATL_FWD_REF_IDX(stmt_label_idx) != NULL_IDX ) {
02959 resolve_fwd_lbl_refs();
02960 }
02961 }
02962 else {
02963
02964
02965
02966
02967
02968 switch (stmt_type) {
02969 case Allocatable_Stmt:
02970 case Automatic_Stmt:
02971 case Common_Stmt:
02972 case Contains_Stmt:
02973 case Cpnt_Decl_Stmt:
02974 case Derived_Type_Stmt:
02975 case Dimension_Stmt:
02976 case Equivalence_Stmt:
02977 case External_Stmt:
02978 case Format_Stmt:
02979 case Implicit_Stmt:
02980 case Implicit_None_Stmt:
02981 case Intent_Stmt:
02982 case Interface_Stmt:
02983 case Intrinsic_Stmt:
02984 case Module_Proc_Stmt:
02985 case Namelist_Stmt:
02986 case Optional_Stmt:
02987 case Parameter_Stmt:
02988 case Pointer_Stmt:
02989 case Private_Stmt:
02990 case Public_Stmt:
02991 case Save_Stmt:
02992 case Sequence_Stmt:
02993 case Stmt_Func_Stmt:
02994 case Target_Stmt:
02995 case Task_Common_Stmt:
02996 case Type_Decl_Stmt:
02997 case End_Interface_Stmt:
02998 case End_Type_Stmt:
02999 case Volatile_Stmt:
03000 need_new_sh = FALSE;
03001 break;
03002
03003 default:
03004 break;
03005 }
03006 }
03007
03008 if (stmt_construct_idx != NULL_IDX) {
03009
03010
03011
03012
03013
03014 PRINTMSG(stmt_start_line, 7, Error, stmt_start_col,
03015 stmt_type_str[stmt_type]);
03016 }
03017
03018 TRACE (Func_Exit, "stmt_level_semantics", NULL);
03019
03020 return;
03021
03022 }
03023
03024 # if defined(_EXPRESSION_EVAL)
03025
03026
03027
03028
03029
03030
03031
03032
03033
03034
03035
03036
03037
03038
03039
03040
03041
03042
03043 static void parse_expr_for_evaluator(void)
03044 {
03045 int attr_idx;
03046 int ir_idx;
03047 opnd_type opnd;
03048 int sh_idx;
03049
03050
03051 TRACE (Func_Entry, "parse_expr_for_evaluator", NULL);
03052
03053 stmt_type = Assignment_Stmt;
03054 sh_idx = curr_stmt_sh_idx;
03055 curr_stmt_sh_idx = ntr_sh_tbl();
03056 SH_NEXT_IDX(sh_idx) = curr_stmt_sh_idx;
03057 SH_PREV_IDX(curr_stmt_sh_idx)= sh_idx;
03058
03059 if (parse_expr(&opnd)) {
03060
03061 # if 0
03062
03063
03064 GEN_COMPILER_TMP_ASG(ir_idx,
03065 attr_idx,
03066 TRUE,
03067 OPND_LINE_NUM(opnd),
03068 OPND_COL_NUM(opnd),
03069 INTEGER_DEFAULT_TYPE,
03070 Priv);
03071
03072 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
03073 COPY_OPND(IR_OPND_R(ir_idx),opnd);
03074 # endif
03075 stmt_level_semantics();
03076 }
03077 else {
03078 }
03079
03080 NEXT_LA_CH;
03081
03082 TRACE (Func_Exit, "parse_expr_for_evaluator", NULL);
03083
03084 return;
03085
03086 }
03087 # endif