00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045 static char USMID[] = "\n@(#)5.0_pl/sources/p_ctl_flow.c 5.11 10/12/99 10:54:10\n";
00046
00047 # include "defines.h"
00048
00049 # include "host.m"
00050 # include "host.h"
00051 # include "target.m"
00052 # include "target.h"
00053
00054 # include "globals.m"
00055 # include "tokens.m"
00056 # include "sytb.m"
00057 # include "p_globals.m"
00058 # include "debug.m"
00059
00060 # include "globals.h"
00061 # include "tokens.h"
00062 # include "sytb.h"
00063 # include "p_globals.h"
00064
00065
00066
00067
00068
00069
00070 static boolean change_subscript (opnd_type *);
00071 static boolean loop_top_is_perfectly_nested (char *);
00072 static int match_blk (blk_cntxt_type, boolean);
00073 static boolean parse_label_list (int);
00074 static void process_blockable_dir (void);
00075 static void process_interchange_dir (void);
00076 static void check_mp_dir_nesting (void);
00077 static void gen_if_ir(int, int, int, int);
00078
00079
00080
00081
00082
00083
00084
00085
00086 static int last_unlbld_loop_line = 0;
00087 static int last_unlbld_loop_num;
00088
00089 boolean star_expected = FALSE;
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 void parse_allocate_stmt (void)
00109
00110 {
00111 boolean had_stat = FALSE;
00112 int ir_idx;
00113 int list1_idx;
00114 int list2_idx = 0;
00115 opnd_type opnd;
00116 boolean parsed_ok = TRUE;
00117 token_type stat_token;
00118 #ifdef KEY
00119 boolean first_trip = TRUE;
00120 #endif
00121
00122
00123 TRACE (Func_Entry, "parse_allocate_stmt", NULL);
00124
00125 if (LA_CH_VALUE != LPAREN) {
00126 parse_err_flush(Find_EOS, "(");
00127 goto EXIT;
00128 }
00129
00130 if (!CURR_BLK_NO_EXEC || !iss_blk_stk_err()) {
00131 curr_stmt_category = Executable_Stmt_Cat;
00132 }
00133
00134 NTR_IR_TBL(ir_idx);
00135 SH_STMT_TYPE(curr_stmt_sh_idx) = Allocate_Stmt;
00136 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
00137
00138 IR_OPR(ir_idx) = Allocate_Opr;
00139 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
00140 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(token);
00141 IR_LINE_NUM(ir_idx) = TOKEN_LINE(token);
00142 IR_FLD_L(ir_idx) = IL_Tbl_Idx;
00143 IR_LIST_CNT_L(ir_idx) = 0;
00144
00145 do {
00146 NEXT_LA_CH;
00147
00148 if (MATCHED_TOKEN_CLASS(Tok_Class_Id)) {
00149
00150 #ifdef KEY
00151
00152 if (first_trip == TRUE) {
00153 first_trip = FALSE;
00154 }
00155 else {
00156 #endif
00157 if (strcmp(TOKEN_STR(token),"STAT") == 0) {
00158 stat_token = token;
00159
00160 if (LA_CH_VALUE == EQUAL) {
00161 NEXT_LA_CH;
00162 had_stat = TRUE;
00163
00164 if (MATCHED_TOKEN_CLASS(Tok_Class_Id)) {
00165
00166
00167
00168 parsed_ok = parse_deref(&opnd, NULL_IDX) && parsed_ok;
00169 COPY_OPND(IR_OPND_R(ir_idx), opnd);
00170
00171 mark_attr_defined(&opnd);
00172 continue;
00173 }
00174 else {
00175
00176 parse_err_flush(Find_Comma_Rparen,
00177 "scalar integer STAT variable");
00178 continue;
00179 }
00180 }
00181 }
00182 #ifdef KEY
00183 }
00184 #endif
00185
00186 NTR_IR_LIST_TBL(list1_idx);
00187
00188 if (list2_idx) {
00189 IL_NEXT_LIST_IDX(list2_idx) = list1_idx;
00190 IL_PREV_LIST_IDX(list1_idx) = list2_idx;
00191 }
00192 else {
00193 IR_IDX_L(ir_idx) = list1_idx;
00194 }
00195 list2_idx = list1_idx;
00196
00197 (IR_LIST_CNT_L(ir_idx))++;
00198
00199
00200 if (had_stat) {
00201 PRINTMSG(TOKEN_LINE(stat_token),203, Error,
00202 TOKEN_COLUMN(stat_token), NULL);
00203 }
00204
00205 star_expected = TRUE;
00206 if (parse_deref(&opnd, NULL_IDX)) {
00207 parsed_ok = change_subscript(&opnd) && parsed_ok;
00208 }
00209 else {
00210 parsed_ok = FALSE;
00211 }
00212 star_expected = FALSE;
00213
00214 COPY_OPND(IL_OPND(list1_idx), opnd);
00215
00216 if (LA_CH_VALUE != COMMA && LA_CH_VALUE != RPAREN) {
00217
00218 parse_err_flush(Find_Comma_Rparen,", or )");
00219 }
00220
00221 if (LA_CH_VALUE == EOS) {
00222 goto EXIT;
00223 }
00224
00225 } else {
00226 parse_err_flush(Find_EOS, "allocation object or STAT = ");
00227 goto EXIT;
00228 }
00229 }
00230 while (LA_CH_VALUE == COMMA);
00231
00232 if (LA_CH_VALUE != RPAREN) {
00233 parse_err_flush(Find_EOS, ")");
00234 }
00235 else {
00236 NEXT_LA_CH;
00237 }
00238
00239 EXIT:
00240
00241 if (LA_CH_VALUE != EOS) {
00242 parse_err_flush(Find_EOS, EOS_STR);
00243 }
00244
00245 matched_specific_token(Tok_EOS, Tok_Class_Punct);
00246
00247 TRACE (Func_Exit, "parse_allocate_stmt", NULL);
00248
00249 return;
00250
00251 }
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275 void parse_assign_stmt(void)
00276
00277 {
00278 opnd_type asg_var_opnd;
00279 token_type asg_var_token;
00280 int attr_idx;
00281 int name_idx;
00282 int ir_idx;
00283
00284
00285 TRACE (Func_Entry, "parse_assign_stmt", NULL);
00286
00287 if ( ! CURR_BLK_NO_EXEC || ! iss_blk_stk_err() ) {
00288 curr_stmt_category = Executable_Stmt_Cat;
00289 }
00290
00291
00292
00293 PRINTMSG(stmt_start_line, 1568, Ansi, stmt_start_col, "ASSIGN");
00294
00295 NTR_IR_TBL(ir_idx);
00296 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
00297 IR_OPR(ir_idx) = Asg_Opr;
00298 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
00299 IR_LINE_NUM(ir_idx) = TOKEN_LINE(token);
00300 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(token);
00301
00302
00303
00304 if (MATCHED_TOKEN_CLASS(Tok_Class_Label)) {
00305
00306 if (TOKEN_ERR(token)) {
00307 parse_err_flush(Find_EOS, NULL);
00308 goto EXIT;
00309 }
00310
00311 attr_idx = srch_sym_tbl(TOKEN_STR(token), TOKEN_LEN(token), &name_idx);
00312
00313 if (attr_idx == NULL_IDX) {
00314 attr_idx = ntr_sym_tbl(&token, name_idx);
00315 AT_OBJ_CLASS(attr_idx) = Label;
00316 AT_REFERENCED(attr_idx) = Referenced;
00317 LN_DEF_LOC(name_idx) = TRUE;
00318 build_fwd_ref_entry(attr_idx, Assign_Ref);
00319 }
00320 else if (! AT_DCL_ERR(attr_idx) ) {
00321
00322 if (AT_DEFINED(attr_idx) ) {
00323
00324
00325
00326
00327 if (stmt_label_idx != NULL_IDX &&
00328 ATL_DEF_STMT_IDX(attr_idx) == curr_stmt_sh_idx) {
00329 ATL_EXECUTABLE(attr_idx) = TRUE;
00330 }
00331
00332 label_ref_semantics(attr_idx, Assign_Ref, NULL_IDX,
00333 TOKEN_LINE(token), TOKEN_COLUMN(token));
00334 }
00335 else {
00336 build_fwd_ref_entry(attr_idx, Assign_Ref);
00337 }
00338 }
00339 else {
00340 SH_ERR_FLG(curr_stmt_sh_idx) = TRUE;
00341 }
00342
00343 ATL_IN_ASSIGN(attr_idx) = TRUE;
00344 AT_REFERENCED(attr_idx) = Referenced;
00345
00346 IR_LINE_NUM_L(ir_idx) = TOKEN_LINE(token);
00347 IR_COL_NUM_L(ir_idx) = TOKEN_COLUMN(token);
00348 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
00349 IR_IDX_L(ir_idx) = attr_idx;
00350
00351 if (cif_flags & XREF_RECS) {
00352 cif_usage_rec(attr_idx, AT_Tbl_Idx,
00353 IR_LINE_NUM_L(ir_idx), IR_COL_NUM_L(ir_idx),
00354 CIF_Label_Referenced_In_ASSIGN);
00355 }
00356
00357 if (matched_specific_token(Tok_Kwd_To, Tok_Class_Keyword)) {
00358
00359 if (MATCHED_TOKEN_CLASS(Tok_Class_Id)) {
00360 asg_var_token = token;
00361
00362 if (parse_deref(&asg_var_opnd, NULL_IDX)) {
00363
00364 if (OPND_FLD(asg_var_opnd) == AT_Tbl_Idx) {
00365 COPY_OPND(IR_OPND_R(ir_idx), asg_var_opnd);
00366
00367 if (AT_OBJ_CLASS(OPND_IDX(asg_var_opnd)) == Data_Obj) {
00368 ATD_IN_ASSIGN(OPND_IDX(asg_var_opnd)) = TRUE;
00369 }
00370
00371 mark_attr_defined(&asg_var_opnd);
00372
00373 if (LA_CH_VALUE != EOS) {
00374 parse_err_flush(Find_EOS, EOS_STR);
00375 }
00376 }
00377 else {
00378 PRINTMSG(TOKEN_LINE(asg_var_token), 172, Error,
00379 TOKEN_COLUMN(asg_var_token));
00380 parse_err_flush(Find_EOS, NULL);
00381 SH_ERR_FLG(curr_stmt_sh_idx) = TRUE;
00382 }
00383 }
00384 else {
00385 parse_err_flush(Find_EOS, NULL);
00386 }
00387 }
00388 else {
00389 parse_err_flush(Find_EOS, "scalar-int-variable");
00390 }
00391 }
00392 else {
00393 parse_err_flush(Find_EOS, "TO");
00394 }
00395 }
00396 else {
00397 parse_err_flush(Find_EOS, "label");
00398 }
00399
00400 EXIT:
00401
00402 matched_specific_token(Tok_EOS, Tok_Class_Punct);
00403
00404 TRACE (Func_Exit, "parse_assign_stmt", NULL);
00405
00406 return;
00407
00408 }
00409 #ifdef KEY
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441 int switch_to_subroutine(int *host_name_idx, int *name_idx)
00442 {
00443
00444
00445
00446 token_type subr_name = token;
00447 strcat(TOKEN_STR(subr_name), INTRIN_SUBR_SUFFIX);
00448 TOKEN_LEN(subr_name) += ((sizeof INTRIN_SUBR_SUFFIX) - 1);
00449 int host_attr_idx = srch_host_sym_tbl(
00450 TOKEN_STR(subr_name), TOKEN_LEN(subr_name), host_name_idx, TRUE);
00451 if (host_attr_idx != NULL_IDX) {
00452 token = subr_name;
00453 srch_sym_tbl(TOKEN_STR(token), TOKEN_LEN(token), name_idx);
00454 }
00455 return host_attr_idx;
00456 }
00457 #endif
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475 void parse_call_stmt (void)
00476
00477 {
00478 boolean amb_ref = FALSE;
00479 int attr_idx;
00480 int call_idx;
00481 int col;
00482 int host_attr_idx;
00483 int host_name_idx;
00484 int line;
00485 int name_idx;
00486 opnd_type opnd;
00487 boolean parsed_ok = TRUE;
00488
00489
00490 TRACE (Func_Entry, "parse_call_stmt", NULL);
00491
00492 if (!CURR_BLK_NO_EXEC || !iss_blk_stk_err()) {
00493 curr_stmt_category = Executable_Stmt_Cat;
00494 }
00495
00496 if (cmd_line_flags.debug_lvl == Debug_Lvl_1) {
00497 gen_debug_lbl_stmt(curr_stmt_sh_idx, Ldbg_Stmt_Lbl, NULL_IDX);
00498 }
00499
00500 NTR_IR_TBL(call_idx);
00501 SH_IR_IDX(curr_stmt_sh_idx) = call_idx;
00502
00503 IR_OPR(call_idx) = Call_Opr;
00504 IR_TYPE_IDX(call_idx) = TYPELESS_DEFAULT_TYPE;
00505 IR_COL_NUM(call_idx) = TOKEN_COLUMN(token);
00506 IR_LINE_NUM(call_idx) = TOKEN_LINE(token);
00507
00508 if (MATCHED_TOKEN_CLASS(Tok_Class_Id)) {
00509 line = TOKEN_LINE(token);
00510 col = TOKEN_COLUMN(token);
00511
00512 attr_idx = srch_sym_tbl(TOKEN_STR(token),
00513 TOKEN_LEN(token),
00514 &name_idx);
00515 #ifdef KEY
00516 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
00517 strncasecmp(TOKEN_STR(token), "omp_",4) == 0){
00518 host_attr_idx = srch_host_sym_tbl(TOKEN_STR(token),
00519 TOKEN_LEN(token),
00520 &host_name_idx,
00521 TRUE);
00522 if (host_attr_idx)
00523 attr_idx = NULL_IDX;
00524 }
00525 #endif
00526
00527 #ifdef KEY
00528
00529
00530
00531
00532
00533
00534
00535 int explicit_intrinsic_decl = FALSE;
00536 if (AT_IS_INTRIN(attr_idx) &&
00537 AT_OBJ_CLASS(attr_idx) == Interface &&
00538 ATI_INTERFACE_CLASS(attr_idx) == Generic_Function_Interface) {
00539 explicit_intrinsic_decl = TRUE;
00540 attr_idx = NULL_IDX;
00541 }
00542 #endif
00543 if (attr_idx != NULL_IDX) {
00544 host_attr_idx = attr_idx;
00545
00546 if (! LN_DEF_LOC(name_idx)) {
00547 amb_ref = TRUE;
00548
00549 while (AT_ATTR_LINK(host_attr_idx) != NULL_IDX) {
00550 host_attr_idx = AT_ATTR_LINK(host_attr_idx);
00551 }
00552 }
00553 }
00554 else {
00555 amb_ref = TRUE;
00556
00557
00558
00559 host_attr_idx = srch_host_sym_tbl(TOKEN_STR(token),
00560 TOKEN_LEN(token),
00561 &host_name_idx,
00562 TRUE);
00563
00564
00565
00566 if (host_attr_idx != NULL_IDX) {
00567
00568 #ifdef KEY
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579 #else
00580 if (LA_CH_VALUE != LPAREN &&
00581 AT_IS_INTRIN(host_attr_idx) &&
00582 AT_OBJ_CLASS(host_attr_idx) == Interface &&
00583 (strcmp(AT_OBJ_NAME_PTR(host_attr_idx), "SYNCHRONIZE") != 0) &&
00584 (strcmp(AT_OBJ_NAME_PTR(host_attr_idx), "RANDOM_SEED") != 0)) {
00585 host_attr_idx = NULL_IDX;
00586 }
00587 #endif
00588
00589
00590
00591
00592
00593 if (AT_IS_INTRIN(host_attr_idx) &&
00594 AT_OBJ_CLASS(host_attr_idx) == Interface &&
00595 ATI_INTERFACE_CLASS(host_attr_idx) ==
00596 Generic_Function_Interface) {
00597 #ifdef KEY
00598 int switch_attr_idx = switch_to_subroutine(&host_name_idx,
00599 &name_idx);
00600 if (NULL_IDX == switch_attr_idx) {
00601
00602
00603
00604
00605
00606 if (explicit_intrinsic_decl) {
00607 if (fnd_semantic_err(Obj_Use_Extern_Subr,
00608 line,
00609 col,
00610 host_attr_idx,
00611 TRUE)) {
00612 parse_err_flush(Find_EOS, NULL);
00613 parsed_ok = FALSE;
00614 goto EXIT;
00615 }
00616 }
00617 else {
00618 PRINTMSG(line, 1675, Warning, col,
00619 AT_OBJ_NAME_PTR(host_attr_idx));
00620 host_attr_idx = NULL_IDX;
00621 }
00622 }
00623 else {
00624 host_attr_idx = switch_attr_idx;
00625 }
00626 #else
00627 host_attr_idx = NULL_IDX;
00628 #endif
00629 }
00630 }
00631
00632 if (host_attr_idx != NULL_IDX) {
00633 attr_idx = ntr_host_in_sym_tbl(&token,
00634 name_idx,
00635 host_attr_idx,
00636 host_name_idx,
00637 TRUE);
00638
00639 AT_ATTR_LINK(attr_idx) = host_attr_idx;
00640
00641 while (AT_ATTR_LINK(host_attr_idx) != NULL_IDX) {
00642 host_attr_idx = AT_ATTR_LINK(host_attr_idx);
00643 }
00644
00645 if (AT_IS_INTRIN(host_attr_idx) &&
00646 AT_OBJ_CLASS(host_attr_idx) == Interface) {
00647
00648 if (ATI_FIRST_SPECIFIC_IDX(host_attr_idx) == NULL_IDX) {
00649 complete_intrinsic_definition(host_attr_idx);
00650 }
00651
00652
00653
00654 COPY_ATTR_NTRY(attr_idx, host_attr_idx);
00655 AT_CIF_SYMBOL_ID(attr_idx) = 0;
00656 AT_ATTR_LINK(attr_idx) = NULL_IDX;
00657 host_attr_idx = NULL_IDX;
00658 AT_DEF_LINE(attr_idx) = TOKEN_LINE(token);
00659 AT_DEF_COLUMN(attr_idx) = TOKEN_COLUMN(token);
00660 attr_idx = srch_sym_tbl(TOKEN_STR(token),
00661 TOKEN_LEN(token),
00662 &name_idx);
00663 }
00664 }
00665 }
00666
00667 if (attr_idx == NULL_IDX) {
00668 attr_idx = ntr_sym_tbl(&token, name_idx);
00669 AT_OBJ_CLASS(attr_idx) = Pgm_Unit;
00670 ATP_PGM_UNIT(attr_idx) = Subroutine;
00671 ATP_SCP_IDX(attr_idx) = curr_scp_idx;
00672 MAKE_EXTERNAL_NAME(attr_idx,
00673 AT_NAME_IDX(attr_idx),
00674 AT_NAME_LEN(attr_idx));
00675 ATP_PROC(attr_idx) = Unknown_Proc;
00676 }
00677 else if (!amb_ref) {
00678
00679 if (AT_OBJ_CLASS(attr_idx) == Pgm_Unit &&
00680 !AT_NOT_VISIBLE(attr_idx) &&
00681 (ATP_PGM_UNIT(attr_idx) == Subroutine ||
00682 ATP_PGM_UNIT(attr_idx) == Pgm_Unknown)) {
00683 ATP_PGM_UNIT(attr_idx) = Subroutine;
00684 }
00685 else if (fnd_semantic_err(Obj_Use_Extern_Subr,
00686 line,
00687 col,
00688 attr_idx,
00689 TRUE)) {
00690 parse_err_flush(Find_EOS, NULL);
00691 parsed_ok = FALSE;
00692 goto EXIT;
00693 }
00694 else if (AT_OBJ_CLASS(attr_idx) == Data_Obj) {
00695 chg_data_obj_to_pgm_unit(attr_idx, Subroutine, Extern_Proc);
00696 }
00697 }
00698 else {
00699 if (AT_OBJ_CLASS(attr_idx) == Interface) {
00700
00701 }
00702 else if (AT_REFERENCED(attr_idx) == Not_Referenced &&
00703 AT_OBJ_CLASS(attr_idx) == Data_Obj) {
00704
00705
00706
00707 chg_data_obj_to_pgm_unit(attr_idx, Subroutine, Extern_Proc);
00708 }
00709 }
00710
00711 AT_REFERENCED(attr_idx) = Referenced;
00712 IR_FLD_L(call_idx) = AT_Tbl_Idx;
00713 IR_IDX_L(call_idx) = attr_idx;
00714 IR_LINE_NUM_L(call_idx) = line;
00715 IR_COL_NUM_L(call_idx) = col;
00716
00717 if (LA_CH_VALUE == LPAREN) {
00718 parsed_ok = parse_actual_arg_spec(&opnd, FALSE, attr_idx) &&
00719 parsed_ok;
00720 COPY_OPND(IR_OPND_R(call_idx), opnd);
00721 }
00722 else {
00723
00724 if (LA_CH_VALUE != EOS) {
00725 parse_err_flush(Find_EOS, "( or "EOS_STR);
00726 parsed_ok = FALSE;
00727 }
00728 else {
00729 IR_FLD_R(call_idx) = IL_Tbl_Idx;
00730 IR_IDX_R(call_idx) = NULL_IDX;
00731 IR_LIST_CNT_R(call_idx) = 0;
00732 }
00733 }
00734 }
00735 else {
00736 parse_err_flush(Find_EOS, "SUBROUTINE NAME");
00737 parsed_ok = FALSE;
00738 }
00739
00740 EXIT:
00741
00742 if (LA_CH_VALUE != EOS) {
00743 parse_err_flush(Find_EOS, EOS_STR);
00744 parsed_ok = FALSE;
00745 }
00746
00747 matched_specific_token(Tok_EOS, Tok_Class_Punct);
00748
00749 SH_ERR_FLG(curr_stmt_sh_idx) = ! parsed_ok;
00750
00751 TRACE (Func_Exit, "parse_call_stmt", NULL);
00752
00753 return;
00754
00755 }
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774 void parse_case_stmt (void)
00775
00776 {
00777 int blk_idx;
00778 int case_ir_idx;
00779 int case_lbl_idx;
00780 int cont_stmt_sh_idx;
00781 #ifdef KEY
00782 int expr_start_col = 0;
00783 int expr_start_line = 0;
00784 boolean fnd_colon = 0;
00785 #else
00786 int expr_start_col;
00787 int expr_start_line;
00788 boolean fnd_colon;
00789 #endif
00790 boolean fnd_default = FALSE;
00791 boolean fnd_name = FALSE;
00792 int ir_idx;
00793 boolean matched_blk = FALSE;
00794 int num_cases = 0;
00795 opnd_type opnd;
00796 int range_ir_idx;
00797 int save_curr_stmt_sh_idx;
00798
00799
00800 TRACE (Func_Entry, "parse_case_stmt", NULL);
00801
00802 check_for_vestigial_task_blks();
00803
00804
00805
00806
00807
00808
00809
00810 save_curr_stmt_sh_idx = curr_stmt_sh_idx;
00811
00812 if (SH_LABELED(curr_stmt_sh_idx)) {
00813 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
00814 }
00815
00816
00817
00818 if (cmd_line_flags.debug_lvl == Debug_Lvl_0 &&
00819 SH_IR_IDX(curr_stmt_sh_idx) != NULL_IDX &&
00820 IR_OPR(SH_IR_IDX(curr_stmt_sh_idx)) == Label_Opr) {
00821
00822 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
00823 }
00824
00825 gen_sh(Before, Continue_Stmt, stmt_start_line, stmt_start_col,
00826 FALSE, TRUE, TRUE);
00827
00828 cont_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
00829
00830 case_lbl_idx = gen_internal_lbl(stmt_start_line);
00831
00832 NTR_IR_TBL(ir_idx);
00833 SH_IR_IDX(cont_stmt_sh_idx) = ir_idx;
00834 IR_OPR(ir_idx) = Label_Opr;
00835
00836 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
00837 IR_LINE_NUM(ir_idx) = stmt_start_line;
00838 IR_COL_NUM(ir_idx) = stmt_start_col;
00839 IR_LINE_NUM_L(ir_idx) = stmt_start_line;
00840 IR_COL_NUM_L(ir_idx) = stmt_start_col;
00841 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
00842 IR_IDX_L(ir_idx) = case_lbl_idx;
00843
00844 AT_REFERENCED(case_lbl_idx) = Referenced;
00845 AT_DEFINED(case_lbl_idx) = TRUE;
00846 AT_DEF_LINE(case_lbl_idx) = stmt_start_line;
00847 ATL_DEF_STMT_IDX(case_lbl_idx) = cont_stmt_sh_idx;
00848
00849 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
00850
00851
00852
00853
00854
00855
00856 NTR_IR_TBL(case_ir_idx);
00857 SH_IR_IDX(curr_stmt_sh_idx) = case_ir_idx;
00858 IR_OPR(case_ir_idx) = Case_Opr;
00859
00860 IR_TYPE_IDX(case_ir_idx) = TYPELESS_DEFAULT_TYPE;
00861 IR_LINE_NUM(case_ir_idx) = stmt_start_line;
00862 IR_COL_NUM(case_ir_idx) = stmt_start_col;
00863 IR_FLD_R(case_ir_idx) = CN_Tbl_Idx;
00864 IR_IDX_R(case_ir_idx) = CN_INTEGER_ZERO_IDX;
00865 IR_LINE_NUM_R(case_ir_idx) = stmt_start_line;
00866 IR_COL_NUM_R(case_ir_idx) = stmt_start_col;
00867
00868 if (LA_CH_VALUE == LPAREN) {
00869
00870
00871
00872 ATL_CASE_LABEL(case_lbl_idx) = TRUE;
00873
00874
00875 do {
00876
00877
00878
00879
00880 NEXT_LA_CH;
00881
00882 opnd = null_opnd;
00883
00884 if (LA_CH_VALUE != COLON) {
00885 strcpy(parse_operand_insert, "operand or :");
00886
00887
00888
00889
00890 expr_start_line = LA_CH_LINE;
00891 expr_start_col = LA_CH_COLUMN;
00892
00893 if (! parse_expr(&opnd)) {
00894 parse_err_flush(Find_Rparen, NULL);
00895 break;
00896 }
00897
00898 fnd_colon = FALSE;
00899 }
00900
00901 if (LA_CH_VALUE == COLON) {
00902 fnd_colon = TRUE;
00903 NTR_IR_TBL(range_ir_idx);
00904
00905 IR_FLD_L(case_ir_idx) = IR_Tbl_Idx;
00906 IR_IDX_L(case_ir_idx) = range_ir_idx;
00907 IR_OPR(range_ir_idx) = Case_Range_Opr;
00908 IR_TYPE_IDX(range_ir_idx) = TYPELESS_DEFAULT_TYPE;
00909 IR_LINE_NUM(range_ir_idx) = LA_CH_LINE;
00910 IR_COL_NUM(range_ir_idx) = LA_CH_COLUMN;
00911
00912 if (OPND_FLD(opnd) != NO_Tbl_Idx) {
00913 COPY_OPND(IR_OPND_L(range_ir_idx), opnd);
00914 IR_LINE_NUM_L(range_ir_idx) = expr_start_line;
00915 IR_COL_NUM_L(range_ir_idx) = expr_start_col;
00916 }
00917
00918 NEXT_LA_CH;
00919
00920 if (LA_CH_VALUE != COMMA && LA_CH_VALUE != RPAREN) {
00921 strcpy(parse_operand_insert, "operand, comma, or )");
00922
00923 expr_start_line = LA_CH_LINE;
00924 expr_start_col = LA_CH_COLUMN;
00925
00926 if (parse_expr(&opnd)) {
00927 COPY_OPND(IR_OPND_R(range_ir_idx), opnd);
00928 IR_LINE_NUM_R(range_ir_idx) = expr_start_line;
00929 IR_COL_NUM_R(range_ir_idx) = expr_start_col;
00930 }
00931 else {
00932 parse_err_flush(Find_Rparen, NULL);
00933 }
00934 }
00935 else {
00936
00937 if (OPND_FLD(opnd) == NO_Tbl_Idx) {
00938 PRINTMSG(IR_LINE_NUM(range_ir_idx), 789, Error,
00939 IR_COL_NUM(range_ir_idx));
00940 continue;
00941 }
00942
00943 }
00944 }
00945 else {
00946 COPY_OPND(IR_OPND_L(case_ir_idx), opnd);
00947 IR_LINE_NUM_L(case_ir_idx) = expr_start_line;
00948 IR_COL_NUM_L(case_ir_idx) = expr_start_col;
00949 }
00950
00951 ++num_cases;
00952
00953
00954
00955
00956
00957
00958 if (CURR_BLK == Select_Blk) {
00959 SH_PARENT_BLK_IDX(curr_stmt_sh_idx) = CURR_BLK_FIRST_SH_IDX;
00960 }
00961 else if (CURR_BLK == Case_Blk &&
00962 BLK_TYPE(blk_stk_idx - 1) == Select_Blk) {
00963 SH_PARENT_BLK_IDX(curr_stmt_sh_idx) =
00964 BLK_FIRST_SH_IDX(blk_stk_idx - 1);
00965 }
00966
00967
00968
00969
00970
00971 if (LA_CH_VALUE == COMMA) {
00972 IR_IDX_R(case_ir_idx) = CN_INTEGER_ONE_IDX;
00973
00974 gen_sh(After, Case_Stmt, stmt_start_line, stmt_start_col, FALSE,
00975 FALSE, TRUE);
00976
00977 NTR_IR_TBL(case_ir_idx);
00978 SH_IR_IDX(curr_stmt_sh_idx) = case_ir_idx;
00979 IR_OPR(case_ir_idx) = Case_Opr;
00980
00981 IR_TYPE_IDX(case_ir_idx) = TYPELESS_DEFAULT_TYPE;
00982 IR_LINE_NUM(case_ir_idx) = stmt_start_line;
00983 IR_COL_NUM(case_ir_idx) = stmt_start_col;
00984 IR_FLD_R(case_ir_idx) = CN_Tbl_Idx;
00985 IR_IDX_R(case_ir_idx) = CN_INTEGER_ZERO_IDX;
00986 IR_LINE_NUM_R(case_ir_idx) = stmt_start_line;
00987 IR_COL_NUM_R(case_ir_idx) = stmt_start_col;
00988 }
00989
00990 } while (LA_CH_VALUE == COMMA);
00991
00992 if (LA_CH_VALUE == RPAREN) {
00993 NEXT_LA_CH;
00994 }
00995 else {
00996 parse_err_flush(Find_EOS,
00997 (fnd_colon) ? "comma or )" : "comma, :, or )");
00998 }
00999
01000 fnd_name = MATCHED_TOKEN_CLASS(Tok_Class_Id);
01001 }
01002 else if (matched_specific_token(Tok_Kwd_Default, Tok_Class_Keyword)) {
01003 fnd_name = MATCHED_TOKEN_CLASS(Tok_Class_Id);
01004 fnd_default = TRUE;
01005 }
01006 else {
01007 parse_err_flush(Find_EOS, "( or DEFAULT");
01008 }
01009
01010 if (LA_CH_VALUE != EOS) {
01011 parse_err_flush(Find_EOS, EOS_STR);
01012 }
01013
01014
01015 if (STMT_LEGAL_IN_BLK(Case_Stmt, CURR_BLK)) {
01016
01017 matched_blk = (fnd_name) ? (CURR_BLK_NAME != NULL_IDX &&
01018 (compare_names(TOKEN_ID(token).words,
01019 TOKEN_LEN(token),
01020 AT_OBJ_NAME_LONG(CURR_BLK_NAME),
01021 AT_NAME_LEN(CURR_BLK_NAME)) == 0)):
01022 TRUE;
01023 }
01024
01025 if (matched_blk) {
01026
01027 if ((cif_flags & XREF_RECS) && fnd_name && matched_blk) {
01028 cif_usage_rec(CURR_BLK_NAME, AT_Tbl_Idx,
01029 TOKEN_LINE(token), TOKEN_COLUMN(token),
01030 CIF_Construct_Name_Reference);
01031 }
01032 curr_stmt_category = Executable_Stmt_Cat;
01033 blk_idx = (CURR_BLK == Select_Blk) ?
01034 blk_stk_idx : blk_stk_idx - 1;
01035 }
01036 else {
01037 blk_idx = blk_match_err(Select_Blk, fnd_name, FALSE);
01038
01039 if (blk_idx == NULL_IDX) {
01040 goto EXIT;
01041 }
01042
01043 if (CURR_BLK == Case_Blk) {
01044 blk_idx = blk_stk_idx - 1;
01045 }
01046 else if (CURR_BLK == Select_Blk) {
01047 blk_idx = blk_stk_idx;
01048 }
01049 else {
01050 goto EXIT;
01051 }
01052 }
01053
01054 BLK_NUM_CASES(blk_idx) += num_cases;
01055
01056 if (fnd_default) {
01057
01058 if (BLK_FND_DEFAULT(blk_idx) && ! BLK_ERR(blk_idx)) {
01059
01060
01061
01062 PRINTMSG(stmt_start_line, 159, Error, stmt_start_col,
01063 BLK_DEF_LINE(blk_idx));
01064 }
01065 else {
01066 BLK_CASE_DEFAULT_LBL_LINE_NUM(blk_idx) = stmt_start_line;
01067 BLK_CASE_DEFAULT_LBL_COL_NUM(blk_idx) = stmt_start_col;
01068 BLK_CASE_DEFAULT_LBL_FLD(blk_idx) = AT_Tbl_Idx;
01069 BLK_CASE_DEFAULT_LBL_IDX(blk_idx) = case_lbl_idx;
01070 }
01071
01072 BLK_FND_DEFAULT(blk_idx) = TRUE;
01073 }
01074
01075 if (CURR_BLK == Case_Blk) {
01076
01077
01078
01079 CURR_BLK_DEF_LINE = stmt_start_line;
01080 CURR_BLK_DEF_COLUMN = stmt_start_col;
01081
01082
01083
01084
01085 save_curr_stmt_sh_idx = curr_stmt_sh_idx;
01086 curr_stmt_sh_idx = cont_stmt_sh_idx;
01087
01088 gen_sh(Before, Goto_Stmt, SH_GLB_LINE(SH_PREV_IDX(curr_stmt_sh_idx)),
01089 SH_COL_NUM(SH_PREV_IDX(curr_stmt_sh_idx)), FALSE, FALSE, TRUE);
01090
01091 curr_stmt_sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
01092
01093 NTR_IR_TBL(ir_idx);
01094 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
01095 IR_OPR(ir_idx) = Br_Uncond_Opr;
01096
01097 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
01098 IR_LINE_NUM(ir_idx) = SH_GLB_LINE(curr_stmt_sh_idx);
01099 IR_COL_NUM(ir_idx) = SH_COL_NUM(curr_stmt_sh_idx);
01100 IR_LINE_NUM_R(ir_idx) = IR_LINE_NUM(ir_idx);
01101 IR_COL_NUM_R(ir_idx) = IR_COL_NUM(ir_idx);
01102 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
01103 IR_IDX_R(ir_idx) = BLK_LABEL(blk_idx);
01104
01105 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
01106 }
01107 else {
01108 PUSH_BLK_STK(Case_Blk);
01109 CURR_BLK_ERR = BLK_ERR(blk_idx);
01110 CURR_BLK_NAME = BLK_NAME(blk_idx);
01111 }
01112
01113 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
01114 LINK_TO_PARENT_BLK;
01115
01116 if (cif_flags & MISC_RECS) {
01117 cif_stmt_type_rec(TRUE,
01118 (fnd_default) ? CIF_Case_Default_Stmt : CIF_Case_Stmt,
01119 statement_number);
01120 }
01121
01122 EXIT:
01123
01124 NEXT_LA_CH;
01125 strcpy(parse_operand_insert, "operand");
01126
01127 TRACE (Func_Exit, "parse_case_stmt", NULL);
01128
01129 return;
01130
01131 }
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141
01142
01143
01144
01145
01146
01147
01148
01149
01150 void parse_continue_stmt (void)
01151
01152 {
01153 TRACE (Func_Entry, "parse_continue_stmt", NULL);
01154
01155 if (LA_CH_VALUE != EOS) {
01156 parse_err_flush(Find_EOS, EOS_STR);
01157 }
01158
01159 if (!CURR_BLK_NO_EXEC || !iss_blk_stk_err()) {
01160 curr_stmt_category = Executable_Stmt_Cat;
01161 }
01162
01163 NEXT_LA_CH;
01164
01165 TRACE (Func_Exit, "parse_continue_stmt", NULL);
01166
01167 return;
01168
01169 }
01170
01171
01172
01173
01174
01175
01176
01177
01178
01179
01180
01181
01182
01183
01184
01185
01186
01187
01188
01189
01190 void parse_cycle_stmt (void)
01191
01192 {
01193 int blk_idx;
01194 boolean fnd_name = FALSE;
01195 int ir_idx;
01196
01197
01198 TRACE (Func_Entry, "parse_cycle_stmt", NULL);
01199
01200 if (LA_CH_VALUE != EOS) {
01201 fnd_name = MATCHED_TOKEN_CLASS(Tok_Class_Id);
01202
01203 if (fnd_name) {
01204
01205 if (LA_CH_VALUE != EOS) {
01206 parse_err_flush(Find_EOS, EOS_STR);
01207 }
01208
01209 }
01210 else {
01211 parse_err_flush(Find_EOS, "construct-name or EOS");
01212 goto EXIT;
01213 }
01214
01215 }
01216
01217 blk_idx = match_blk(Do_Blk, fnd_name);
01218
01219 if (blk_idx != NULL_IDX) {
01220
01221 if (! CURR_BLK_NO_EXEC || ! iss_blk_stk_err()) {
01222 curr_stmt_category = Executable_Stmt_Cat;
01223 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
01224 BLK_CYCLE_STMT(blk_idx) = TRUE;
01225
01226 NTR_IR_TBL(ir_idx);
01227 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
01228 IR_OPR(ir_idx) = Br_Uncond_Opr;
01229
01230 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
01231 IR_LINE_NUM(ir_idx) = stmt_start_line;
01232 IR_COL_NUM(ir_idx) = stmt_start_col;
01233 IR_LINE_NUM_R(ir_idx) = stmt_start_line;
01234 IR_COL_NUM_R(ir_idx) = stmt_start_col;
01235 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
01236 IR_IDX_R(ir_idx) = gen_loop_lbl_name(blk_idx, Cycle_Lbl);
01237
01238 if (fnd_name && (cif_flags & XREF_RECS)) {
01239 cif_usage_rec(BLK_NAME(blk_idx), AT_Tbl_Idx,
01240 TOKEN_LINE(token), TOKEN_COLUMN(token),
01241 CIF_Construct_Name_Reference);
01242 }
01243 }
01244
01245 }
01246 else {
01247 PRINTMSG(stmt_start_line, 262, Error, stmt_start_col, "CYCLE");
01248 }
01249
01250 EXIT:
01251
01252 NEXT_LA_CH;
01253
01254 TRACE (Func_Exit, "parse_cycle_stmt", NULL);
01255
01256 return;
01257
01258 }
01259
01260
01261
01262
01263
01264
01265
01266
01267
01268
01269
01270
01271
01272
01273
01274
01275
01276
01277 void parse_deallocate_stmt (void)
01278
01279 {
01280 boolean had_stat = FALSE;
01281 int ir_idx;
01282 int list1_idx;
01283 int list2_idx = 0;
01284 opnd_type opnd;
01285 boolean parsed_ok = TRUE;
01286 token_type stat_token;
01287
01288
01289 TRACE (Func_Entry, "parse_deallocate_stmt", NULL);
01290
01291 if (LA_CH_VALUE != LPAREN) {
01292 parse_err_flush(Find_EOS, "(");
01293 goto EXIT;
01294 }
01295
01296 if (!CURR_BLK_NO_EXEC || !iss_blk_stk_err()) {
01297 curr_stmt_category = Executable_Stmt_Cat;
01298 }
01299
01300 NTR_IR_TBL(ir_idx);
01301 SH_STMT_TYPE(curr_stmt_sh_idx) = Deallocate_Stmt;
01302 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
01303
01304 IR_OPR(ir_idx) = Deallocate_Opr;
01305 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
01306 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(token);
01307 IR_LINE_NUM(ir_idx) = TOKEN_LINE(token);
01308 IR_FLD_L(ir_idx) = IL_Tbl_Idx;
01309 IR_LIST_CNT_L(ir_idx) = 0;
01310
01311 do {
01312 NEXT_LA_CH;
01313
01314 if (MATCHED_TOKEN_CLASS(Tok_Class_Id)) {
01315
01316 if (strcmp(TOKEN_STR(token),"STAT") == 0) {
01317 stat_token = token;
01318
01319 if (LA_CH_VALUE == EQUAL) {
01320 NEXT_LA_CH;
01321 had_stat = TRUE;
01322
01323 if (MATCHED_TOKEN_CLASS(Tok_Class_Id)) {
01324
01325
01326
01327 parsed_ok = parse_deref(&opnd, NULL_IDX) && parsed_ok;
01328 COPY_OPND(IR_OPND_R(ir_idx), opnd);
01329
01330 mark_attr_defined(&opnd);
01331 continue;
01332 }
01333 else {
01334
01335 parse_err_flush(Find_Comma_Rparen,
01336 "scalar integer STAT variable");
01337 continue;
01338 }
01339 }
01340 }
01341
01342 NTR_IR_LIST_TBL(list1_idx);
01343
01344 if (list2_idx) {
01345 IL_NEXT_LIST_IDX(list2_idx) = list1_idx;
01346 IL_PREV_LIST_IDX(list1_idx) = list2_idx;
01347 }
01348 else {
01349 IR_IDX_L(ir_idx) = list1_idx;
01350 }
01351 list2_idx = list1_idx;
01352
01353 (IR_LIST_CNT_L(ir_idx))++;
01354
01355
01356 if (had_stat) {
01357 PRINTMSG(TOKEN_LINE(stat_token), 203, Error,
01358 TOKEN_COLUMN(stat_token), NULL);
01359 }
01360
01361 if (parse_deref(&opnd, NULL_IDX)) {
01362 parsed_ok = change_subscript(&opnd) && parsed_ok;
01363 }
01364 else {
01365 parsed_ok = FALSE;
01366 }
01367
01368 COPY_OPND(IL_OPND(list1_idx), opnd);
01369
01370 if (LA_CH_VALUE != COMMA && LA_CH_VALUE != RPAREN) {
01371
01372 parse_err_flush(Find_Comma_Rparen,", or )");
01373 }
01374
01375 if (LA_CH_VALUE == EOS) {
01376 goto EXIT;
01377 }
01378
01379 } else {
01380 parse_err_flush(Find_EOS, "allocation object or STAT = ");
01381 goto EXIT;
01382 }
01383 }
01384 while (LA_CH_VALUE == COMMA);
01385
01386 if (LA_CH_VALUE != RPAREN) {
01387 parse_err_flush(Find_EOS, ")");
01388 }
01389 else {
01390 NEXT_LA_CH;
01391 }
01392
01393 EXIT:
01394
01395 if (LA_CH_VALUE != EOS) {
01396 parse_err_flush(Find_EOS, EOS_STR);
01397 }
01398
01399 matched_specific_token(Tok_EOS, Tok_Class_Punct);
01400
01401 TRACE (Func_Exit, "parse_deallocate_stmt", NULL);
01402
01403 return;
01404
01405 }
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419
01420
01421
01422
01423
01424
01425
01426
01427
01428
01429
01430
01431
01432
01433
01434
01435
01436
01437
01438
01439
01440
01441
01442
01443
01444
01445
01446 void parse_do_stmt (void)
01447
01448 {
01449 int blk_idx;
01450 int cif_il_idx;
01451 boolean comma_found = FALSE;
01452 opnd_type do_variable;
01453 int expr_start_col;
01454 int expr_start_line;
01455 int idx;
01456 #ifdef KEY
01457 int il_idx = 0;
01458 int il_idx_2 = 0;
01459 #else
01460 int il_idx;
01461 int il_idx_2;
01462 #endif
01463 boolean label_found = FALSE;
01464 int last_il_idx;
01465 int loop_info_idx;
01466 int loop_control_il_idx;
01467 opnd_type loop_expr;
01468 int loop_labels_il_idx;
01469 int mp_nest_list_idx = NULL_IDX;
01470 #ifdef KEY
01471 int mp_prev_idx = 0;
01472 #else
01473 int mp_prev_idx;
01474 #endif
01475 int name_idx;
01476 opnd_type while_expr;
01477
01478
01479 TRACE (Func_Entry, "parse_do_stmt", NULL);
01480
01481 if (! CURR_BLK_NO_EXEC || ! iss_blk_stk_err()) {
01482
01483 if (cdir_switches.doall_sh_idx != NULL_IDX) {
01484 PUSH_BLK_STK (Doall_Blk);
01485 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01486 CURR_BLK_FIRST_SH_IDX = cdir_switches.doall_sh_idx;
01487 cdir_switches.doall_sh_idx = NULL_IDX;
01488 cdir_switches.doall_region = TRUE;
01489 }
01490 else if (cdir_switches.doacross_sh_idx != NULL_IDX) {
01491
01492 PUSH_BLK_STK (SGI_Doacross_Blk);
01493 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01494 CURR_BLK_FIRST_SH_IDX = cdir_switches.doacross_sh_idx;
01495 mp_nest_list_idx = IR_IDX_L(SH_IR_IDX(
01496 cdir_switches.doacross_sh_idx));
01497
01498 idx = 0;
01499
01500 while (idx < MP_DIR_NEST_IDX) {
01501 mp_nest_list_idx =
01502 IL_NEXT_LIST_IDX(mp_nest_list_idx);
01503 idx++;
01504 }
01505
01506 if (IL_FLD(mp_nest_list_idx) == NO_Tbl_Idx) {
01507 NTR_IR_LIST_TBL(idx);
01508 IL_FLD(mp_nest_list_idx) = IL_Tbl_Idx;
01509 IL_IDX(mp_nest_list_idx) = idx;
01510 IL_LIST_CNT(mp_nest_list_idx) = 1;
01511 mp_prev_idx = mp_nest_list_idx;
01512 mp_nest_list_idx = idx;
01513 }
01514 else {
01515 mp_nest_list_idx = NULL_IDX;
01516 }
01517
01518 cdir_switches.dir_nest_check_sh_idx = cdir_switches.doacross_sh_idx;
01519 cdir_switches.doacross_sh_idx = NULL_IDX;
01520 }
01521 else if (cdir_switches.paralleldo_sh_idx != NULL_IDX) {
01522
01523 PUSH_BLK_STK (SGI_Parallel_Do_Blk);
01524 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01525 CURR_BLK_FIRST_SH_IDX = cdir_switches.paralleldo_sh_idx;
01526 mp_nest_list_idx = IR_IDX_L(SH_IR_IDX(
01527 cdir_switches.paralleldo_sh_idx));
01528
01529 idx = 0;
01530
01531 while (idx < MP_DIR_NEST_IDX) {
01532 mp_nest_list_idx =
01533 IL_NEXT_LIST_IDX(mp_nest_list_idx);
01534 idx++;
01535 }
01536
01537 if (IL_FLD(mp_nest_list_idx) == NO_Tbl_Idx) {
01538 NTR_IR_LIST_TBL(idx);
01539 IL_FLD(mp_nest_list_idx) = IL_Tbl_Idx;
01540 IL_IDX(mp_nest_list_idx) = idx;
01541 IL_LIST_CNT(mp_nest_list_idx) = 1;
01542 mp_prev_idx = mp_nest_list_idx;
01543 mp_nest_list_idx = idx;
01544 }
01545 else {
01546 mp_nest_list_idx = NULL_IDX;
01547 }
01548
01549 cdir_switches.dir_nest_check_sh_idx = cdir_switches.paralleldo_sh_idx;
01550 cdir_switches.paralleldo_sh_idx = NULL_IDX;
01551 }
01552 else if (cdir_switches.pdo_sh_idx != NULL_IDX) {
01553
01554 PUSH_BLK_STK (SGI_Pdo_Blk);
01555 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01556 CURR_BLK_FIRST_SH_IDX = cdir_switches.pdo_sh_idx;
01557 mp_nest_list_idx = IR_IDX_L(SH_IR_IDX(
01558 cdir_switches.pdo_sh_idx));
01559
01560 idx = 0;
01561
01562 while (idx < MP_DIR_NEST_IDX) {
01563 mp_nest_list_idx =
01564 IL_NEXT_LIST_IDX(mp_nest_list_idx);
01565 idx++;
01566 }
01567
01568 if (IL_FLD(mp_nest_list_idx) == NO_Tbl_Idx) {
01569 NTR_IR_LIST_TBL(idx);
01570 IL_FLD(mp_nest_list_idx) = IL_Tbl_Idx;
01571 IL_IDX(mp_nest_list_idx) = idx;
01572 IL_LIST_CNT(mp_nest_list_idx) = 1;
01573 mp_prev_idx = mp_nest_list_idx;
01574 mp_nest_list_idx = idx;
01575 }
01576 else {
01577 mp_nest_list_idx = NULL_IDX;
01578 }
01579
01580 cdir_switches.dir_nest_check_sh_idx = cdir_switches.pdo_sh_idx;
01581 cdir_switches.pdo_sh_idx = NULL_IDX;
01582 }
01583 else if (cdir_switches.dopar_sh_idx != NULL_IDX) {
01584 PUSH_BLK_STK (Do_Parallel_Blk);
01585 CURR_BLK_FIRST_SH_IDX = cdir_switches.dopar_sh_idx;
01586 cdir_switches.dopar_sh_idx = NULL_IDX;
01587 }
01588 else if (cdir_switches.do_omp_sh_idx != NULL_IDX) {
01589 PUSH_BLK_STK (Open_Mp_Do_Blk);
01590 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01591 mp_nest_list_idx = IR_IDX_L(SH_IR_IDX(
01592 cdir_switches.do_omp_sh_idx));
01593
01594 idx = 0;
01595
01596 while (idx < OPEN_MP_NEST_IDX) {
01597 mp_nest_list_idx =
01598 IL_NEXT_LIST_IDX(mp_nest_list_idx);
01599 idx++;
01600 }
01601
01602 if (IL_FLD(mp_nest_list_idx) == NO_Tbl_Idx) {
01603 NTR_IR_LIST_TBL(idx);
01604 IL_FLD(mp_nest_list_idx) = IL_Tbl_Idx;
01605 IL_IDX(mp_nest_list_idx) = idx;
01606 IL_LIST_CNT(mp_nest_list_idx) = 1;
01607 mp_prev_idx = mp_nest_list_idx;
01608 mp_nest_list_idx = idx;
01609 }
01610 else {
01611 mp_nest_list_idx = NULL_IDX;
01612 }
01613
01614 CURR_BLK_FIRST_SH_IDX = cdir_switches.do_omp_sh_idx;
01615 cdir_switches.do_omp_sh_idx = NULL_IDX;
01616 }
01617 else if (cdir_switches.paralleldo_omp_sh_idx != NULL_IDX) {
01618 PUSH_BLK_STK (Open_Mp_Parallel_Do_Blk);
01619 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01620 mp_nest_list_idx = IR_IDX_L(SH_IR_IDX(
01621 cdir_switches.paralleldo_omp_sh_idx));
01622
01623 idx = 0;
01624
01625 while (idx < OPEN_MP_NEST_IDX) {
01626 mp_nest_list_idx =
01627 IL_NEXT_LIST_IDX(mp_nest_list_idx);
01628 idx++;
01629 }
01630
01631 if (IL_FLD(mp_nest_list_idx) == NO_Tbl_Idx) {
01632 NTR_IR_LIST_TBL(idx);
01633 IL_FLD(mp_nest_list_idx) = IL_Tbl_Idx;
01634 IL_IDX(mp_nest_list_idx) = idx;
01635 IL_LIST_CNT(mp_nest_list_idx) = 1;
01636 mp_prev_idx = mp_nest_list_idx;
01637 mp_nest_list_idx = idx;
01638 }
01639 else {
01640 mp_nest_list_idx = NULL_IDX;
01641 }
01642
01643 CURR_BLK_FIRST_SH_IDX = cdir_switches.paralleldo_omp_sh_idx;
01644 cdir_switches.paralleldo_omp_sh_idx = NULL_IDX;
01645 }
01646
01647 PUSH_BLK_STK (Do_Blk);
01648 curr_stmt_category = Executable_Stmt_Cat;
01649 }
01650 else {
01651
01652 if (cdir_switches.doall_sh_idx != NULL_IDX) {
01653 PUSH_BLK_STK (Doall_Blk);
01654 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01655 CURR_BLK_FIRST_SH_IDX = cdir_switches.doall_sh_idx;
01656 cdir_switches.doall_sh_idx = NULL_IDX;
01657 cdir_switches.doall_region = TRUE;
01658 }
01659 else if (cdir_switches.doacross_sh_idx != NULL_IDX) {
01660
01661 PUSH_BLK_STK (SGI_Doacross_Blk);
01662 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01663 CURR_BLK_FIRST_SH_IDX = cdir_switches.doacross_sh_idx;
01664 cdir_switches.dir_nest_check_sh_idx = cdir_switches.doacross_sh_idx;
01665 cdir_switches.doacross_sh_idx = NULL_IDX;
01666 }
01667 else if (cdir_switches.paralleldo_sh_idx != NULL_IDX) {
01668
01669 PUSH_BLK_STK (SGI_Parallel_Do_Blk);
01670 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01671 CURR_BLK_FIRST_SH_IDX = cdir_switches.paralleldo_sh_idx;
01672 cdir_switches.dir_nest_check_sh_idx = cdir_switches.paralleldo_sh_idx;
01673 cdir_switches.paralleldo_sh_idx = NULL_IDX;
01674 }
01675 else if (cdir_switches.pdo_sh_idx != NULL_IDX) {
01676
01677 PUSH_BLK_STK (SGI_Pdo_Blk);
01678 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01679 CURR_BLK_FIRST_SH_IDX = cdir_switches.pdo_sh_idx;
01680 cdir_switches.dir_nest_check_sh_idx = cdir_switches.pdo_sh_idx;
01681 cdir_switches.pdo_sh_idx = NULL_IDX;
01682 }
01683 else if (cdir_switches.dopar_sh_idx != NULL_IDX) {
01684 PUSH_BLK_STK (Do_Parallel_Blk);
01685 CURR_BLK_FIRST_SH_IDX = cdir_switches.dopar_sh_idx;
01686 cdir_switches.dopar_sh_idx = NULL_IDX;
01687 }
01688 else if (cdir_switches.do_omp_sh_idx != NULL_IDX) {
01689 PUSH_BLK_STK (Open_Mp_Do_Blk);
01690 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01691 CURR_BLK_FIRST_SH_IDX = cdir_switches.do_omp_sh_idx;
01692 cdir_switches.do_omp_sh_idx = NULL_IDX;
01693 }
01694 else if (cdir_switches.paralleldo_omp_sh_idx != NULL_IDX) {
01695 PUSH_BLK_STK (Open_Mp_Parallel_Do_Blk);
01696 BLK_IS_PARALLEL_REGION(blk_stk_idx) = TRUE;
01697 CURR_BLK_FIRST_SH_IDX = cdir_switches.paralleldo_omp_sh_idx;
01698 cdir_switches.paralleldo_omp_sh_idx = NULL_IDX;
01699 }
01700
01701 PUSH_BLK_STK (Do_Blk);
01702 CURR_BLK_ERR = TRUE;
01703 }
01704
01705 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
01706 LINK_TO_PARENT_BLK;
01707
01708
01709
01710
01711
01712
01713
01714
01715
01716
01717
01718
01719
01720 NTR_IR_TBL(loop_info_idx);
01721 SH_IR_IDX(curr_stmt_sh_idx) = loop_info_idx;
01722 IR_OPR(loop_info_idx) = Loop_Info_Opr;
01723
01724 IR_TYPE_IDX(loop_info_idx) = TYPELESS_DEFAULT_TYPE;
01725 IR_LINE_NUM(loop_info_idx) = stmt_start_line;
01726 IR_COL_NUM(loop_info_idx) = stmt_start_col;
01727
01728 NTR_IR_LIST_TBL(loop_control_il_idx);
01729 IR_LIST_CNT_R(loop_info_idx) = 1;
01730 IR_FLD_R(loop_info_idx) = IL_Tbl_Idx;
01731 IR_IDX_R(loop_info_idx) = loop_control_il_idx;
01732
01733 NTR_IR_LIST_TBL(loop_labels_il_idx);
01734 IL_NEXT_LIST_IDX(loop_control_il_idx) = loop_labels_il_idx;
01735 IL_PREV_LIST_IDX(loop_labels_il_idx) = loop_control_il_idx;
01736 ++IR_LIST_CNT_R(loop_info_idx);
01737
01738 if (cif_flags & MISC_RECS) {
01739 NTR_IR_LIST_TBL(cif_il_idx);
01740 IL_NEXT_LIST_IDX(loop_labels_il_idx) = cif_il_idx;
01741 IL_PREV_LIST_IDX(cif_il_idx) = loop_labels_il_idx;
01742 ++IR_LIST_CNT_R(loop_info_idx);
01743
01744
01745
01746
01747 NTR_IR_LIST_TBL(il_idx);
01748 NTR_IR_LIST_TBL(il_idx_2);
01749 IL_NEXT_LIST_IDX(il_idx) = il_idx_2;
01750 IL_PREV_LIST_IDX(il_idx_2) = il_idx;
01751
01752 IL_FLD(cif_il_idx) = IL_Tbl_Idx;
01753 IL_IDX(cif_il_idx) = il_idx;
01754 IL_LIST_CNT(cif_il_idx) = 2;
01755 }
01756
01757 if (stmt_construct_idx != NULL_IDX) {
01758 CURR_BLK_NAME = stmt_construct_idx;
01759 ATL_CLASS(stmt_construct_idx) = Lbl_Construct;
01760 ATL_DEF_STMT_IDX(stmt_construct_idx) = curr_stmt_sh_idx;
01761 SH_ERR_FLG(curr_stmt_sh_idx) = SH_ERR_FLG(curr_stmt_sh_idx) |
01762 AT_DCL_ERR(stmt_construct_idx);
01763
01764
01765
01766
01767
01768
01769 if (cif_flags & MISC_RECS) {
01770 IL_FLD(il_idx_2) = AT_Tbl_Idx;
01771 IL_IDX(il_idx_2) = stmt_construct_idx;
01772 IL_LINE_NUM(il_idx_2) = stmt_start_line;
01773 IL_COL_NUM(il_idx_2) = stmt_start_col;
01774 }
01775
01776 stmt_construct_idx = NULL_IDX;
01777 }
01778
01779 if (MATCHED_TOKEN_CLASS(Tok_Class_Label) && ! TOKEN_ERR(token)) {
01780
01781 CURR_BLK_LABEL = srch_sym_tbl(TOKEN_STR(token), TOKEN_LEN(token),
01782 &name_idx);
01783
01784 if (CURR_BLK_LABEL == NULL_IDX) {
01785 CURR_BLK_LABEL = ntr_sym_tbl(&token, name_idx);
01786 AT_OBJ_CLASS(CURR_BLK_LABEL) = Label;
01787 LN_DEF_LOC(name_idx) = TRUE;
01788
01789 if (cmd_line_flags.debug_lvl == Debug_Lvl_1) {
01790 ATL_DEBUG_CLASS(CURR_BLK_LABEL) = Ldbg_User_Lbl;
01791 }
01792 }
01793 else if (AT_DEFINED(CURR_BLK_LABEL)) {
01794 PRINTMSG(TOKEN_LINE(token), 248, Error, TOKEN_COLUMN(token));
01795 parse_err_flush(Find_EOS, NULL);
01796 goto EXIT;
01797 }
01798
01799 AT_REFERENCED(CURR_BLK_LABEL) = Referenced;
01800 label_found = TRUE;
01801
01802 build_fwd_ref_entry(CURR_BLK_LABEL, Do_Ref);
01803
01804 blk_idx = blk_stk_idx - 1;
01805
01806 while (BLK_IS_PARALLEL_REGION(blk_idx) ||
01807 BLK_TYPE(blk_idx) == Do_Parallel_Blk ||
01808 BLK_TYPE(blk_idx) == Wait_Blk ||
01809 BLK_TYPE(blk_idx) == SGI_Region_Blk ||
01810 BLK_TYPE(blk_idx) == Open_Mp_Section_Blk) {
01811 blk_idx--;
01812 }
01813
01814 if (BLK_TYPE(blk_idx) == Do_Blk &&
01815 BLK_LABEL(blk_idx) == CURR_BLK_LABEL) {
01816
01817 if (BLK_LOOP_NUM(blk_idx) == MAX_BLK_LOOP_NUM) {
01818 PRINTMSG(stmt_start_line, 1324, Internal, stmt_start_col,
01819 MAX_BLK_LOOP_NUM);
01820 }
01821 else {
01822 BLK_LOOP_NUM(blk_stk_idx) = BLK_LOOP_NUM(blk_idx) + 1;
01823 }
01824 }
01825 else {
01826 BLK_LOOP_NUM(blk_stk_idx) = 1;
01827 }
01828
01829 if (cif_flags & XREF_RECS) {
01830 cif_usage_rec(CURR_BLK_LABEL, AT_Tbl_Idx,
01831 TOKEN_LINE(token), TOKEN_COLUMN(token),
01832 CIF_Do_Loop_Label);
01833 }
01834
01835
01836
01837
01838
01839 if (cif_flags & MISC_RECS) {
01840 IL_FLD(il_idx) = AT_Tbl_Idx;
01841 IL_IDX(il_idx) = CURR_BLK_LABEL;
01842 IL_LINE_NUM(il_idx) = stmt_start_line;
01843 IL_COL_NUM(il_idx) = stmt_start_col;
01844 }
01845 }
01846 else {
01847
01848 if (last_unlbld_loop_line == stmt_start_line) {
01849
01850 if (last_unlbld_loop_num == MAX_BLK_LOOP_NUM) {
01851 PRINTMSG(stmt_start_line, 1324, Internal, stmt_start_col,
01852 MAX_BLK_LOOP_NUM);
01853 }
01854 else {
01855 BLK_LOOP_NUM(blk_stk_idx) = ++last_unlbld_loop_num;
01856 }
01857 }
01858 else {
01859 last_unlbld_loop_line = stmt_start_line;
01860 last_unlbld_loop_num = 1;
01861 BLK_LOOP_NUM(blk_stk_idx) = 1;
01862 }
01863 }
01864
01865 if (LA_CH_VALUE == COMMA) {
01866 NEXT_LA_CH;
01867 comma_found = TRUE;
01868 }
01869
01870
01871 if (matched_specific_token(Tok_Kwd_While, Tok_Class_Keyword)) {
01872
01873
01874
01875
01876
01877 if (LA_CH_VALUE == LPAREN) {
01878 NEXT_LA_CH;
01879 SH_STMT_TYPE(curr_stmt_sh_idx) = Do_While_Stmt;
01880 stmt_type = Do_While_Stmt;
01881 BLK_DO_TYPE(blk_stk_idx) = While_Loop;
01882
01883 expr_start_line = LA_CH_LINE;
01884 expr_start_col = LA_CH_COLUMN;
01885
01886 if (parse_expr(&while_expr)) {
01887
01888 if (LA_CH_VALUE == RPAREN) {
01889 NEXT_LA_CH;
01890
01891 if (LA_CH_VALUE == EOS) {
01892
01893 NTR_IR_LIST_TBL(il_idx);
01894 IL_LIST_CNT(loop_control_il_idx) = 1;
01895 IL_FLD(loop_control_il_idx) = IL_Tbl_Idx;
01896 IL_IDX(loop_control_il_idx) = il_idx;
01897 COPY_OPND(IL_OPND(il_idx), while_expr);
01898 IL_LINE_NUM(il_idx) = expr_start_line;
01899 IL_COL_NUM(il_idx) = expr_start_col;
01900
01901
01902
01903
01904 BLK_SKIP_LBL_IDX(blk_stk_idx) =
01905 gen_loop_lbl_name(blk_stk_idx, Skip_Lbl);
01906
01907 if (BLK_SKIP_LBL_IDX(blk_stk_idx) == NULL_IDX) {
01908 goto EXIT;
01909 }
01910
01911 # ifndef _HIGH_LEVEL_DO_LOOP_FORM
01912
01913 NTR_IR_LIST_TBL(il_idx);
01914 IL_LIST_CNT(loop_labels_il_idx) = 1;
01915 IL_FLD(loop_labels_il_idx) = IL_Tbl_Idx;
01916 IL_IDX(loop_labels_il_idx) = il_idx;
01917
01918 IL_LINE_NUM(il_idx) = stmt_start_line;
01919 IL_COL_NUM(il_idx) = stmt_start_col;
01920 IL_FLD(il_idx) = AT_Tbl_Idx;
01921 IL_IDX(il_idx) = BLK_SKIP_LBL_IDX(blk_stk_idx);
01922
01923
01924
01925
01926
01927
01928 NTR_IR_LIST_TBL(il_idx);
01929 IL_NEXT_LIST_IDX(il_idx) = IL_IDX(loop_labels_il_idx);
01930 IL_PREV_LIST_IDX(IL_IDX(loop_labels_il_idx)) = il_idx;
01931
01932 ++IL_LIST_CNT(loop_labels_il_idx);
01933 IL_IDX(loop_labels_il_idx) = il_idx;
01934
01935 IL_LINE_NUM(il_idx) = stmt_start_line;
01936 IL_COL_NUM(il_idx) = stmt_start_col;
01937 IL_FLD(il_idx) = AT_Tbl_Idx;
01938 IL_IDX(il_idx) = gen_loop_lbl_name(blk_stk_idx, Top_Lbl);
01939
01940 AT_DEFINED(IL_IDX(il_idx)) = TRUE;
01941
01942 # endif
01943
01944 if (cif_flags & MISC_RECS) {
01945 cif_stmt_type_rec(TRUE,
01946 (CURR_BLK_LABEL == NULL_IDX) ?
01947 CIF_Do_Unlabeled_While_Stmt :
01948 CIF_Do_Labeled_While_Stmt,
01949 statement_number);
01950 }
01951 }
01952 else {
01953 parse_err_flush(Find_EOS, EOS_STR);
01954 }
01955 }
01956 else {
01957 parse_err_flush(Find_EOS, ")");
01958 }
01959 }
01960 else {
01961 parse_err_flush(Find_EOS, NULL);
01962 }
01963 }
01964 else if (LA_CH_CLASS == Ch_Class_Letter ||
01965 LA_CH_CLASS == Ch_Class_Digit ||
01966 LA_CH_VALUE == USCORE ||
01967 LA_CH_VALUE == DOLLAR ||
01968 #ifdef KEY
01969
01970 LA_CH_VALUE == EQUAL ||
01971 #endif
01972 LA_CH_VALUE == AT_SIGN) {
01973 reset_lex(TOKEN_BUF_IDX(token), TOKEN_STMT_NUM(token));
01974 goto CHECK_FOR_VARIABLE;
01975 }
01976 else {
01977 parse_err_flush(Find_EOS, "( or =");
01978 }
01979
01980 goto EXIT;
01981 }
01982
01983
01984 CHECK_FOR_VARIABLE:
01985
01986 if (MATCHED_TOKEN_CLASS(Tok_Class_Id)) {
01987
01988
01989
01990
01991
01992 SH_STMT_TYPE(curr_stmt_sh_idx) = Do_Iterative_Stmt;
01993 stmt_type = Do_Iterative_Stmt;
01994 BLK_DO_TYPE(blk_stk_idx) = Iterative_Loop;
01995
01996 expr_start_line = TOKEN_LINE(token);
01997 expr_start_col = TOKEN_COLUMN(token);
01998
01999 if (parse_deref(&do_variable, NULL_IDX)) {
02000
02001 if (mp_nest_list_idx != NULL_IDX) {
02002 COPY_OPND(IL_OPND(mp_nest_list_idx), do_variable);
02003 }
02004
02005 COPY_OPND(BLK_DO_VAR_OPND(blk_stk_idx), do_variable);
02006 BLK_DO_VAR_LINE_NUM(blk_stk_idx) = expr_start_line;
02007 BLK_DO_VAR_COL_NUM(blk_stk_idx) = expr_start_col;
02008
02009 NTR_IR_LIST_TBL(last_il_idx);
02010 IL_LIST_CNT(loop_control_il_idx) = 1;
02011 IL_FLD(loop_control_il_idx) = IL_Tbl_Idx;
02012 IL_IDX(loop_control_il_idx) = last_il_idx;
02013 COPY_OPND(IL_OPND(last_il_idx), BLK_DO_VAR_OPND(blk_stk_idx));
02014
02015 if (BLK_DO_VAR_FLD(blk_stk_idx) == AT_Tbl_Idx) {
02016
02017
02018
02019
02020
02021
02022
02023 if (AT_OBJ_CLASS(OPND_IDX(do_variable)) == Data_Obj &&
02024 ATD_CLASS(OPND_IDX(do_variable)) == Function_Result) {
02025 AT_DEFINED(ATD_FUNC_IDX(OPND_IDX(do_variable))) = TRUE;
02026 }
02027
02028
02029 blk_idx = blk_stk_idx - 1;
02030
02031 while (BLK_TYPE(blk_idx) > Module_Proc_Blk) {
02032
02033 if (BLK_TYPE(blk_idx) == Do_Blk) {
02034
02035 if ((BLK_DO_VAR_FLD(blk_idx) ==
02036 BLK_DO_VAR_FLD(blk_stk_idx)) &&
02037 (BLK_DO_VAR_IDX(blk_idx) ==
02038 BLK_DO_VAR_IDX(blk_stk_idx)) &&
02039 ! BLK_ERR(blk_idx)) {
02040 PRINTMSG(TOKEN_LINE(token), 517, Error,
02041 TOKEN_COLUMN(token));
02042 break;
02043 }
02044 }
02045
02046 --blk_idx;
02047 }
02048 }
02049
02050 # if defined(CDIR_INTERCHANGE)
02051 process_interchange_dir();
02052 # endif
02053
02054 # if defined(CDIR_BLOCKABLE)
02055 process_blockable_dir();
02056 # endif
02057
02058 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
02059 check_mp_dir_nesting();
02060 # endif
02061
02062 }
02063 else {
02064 parse_err_flush(Find_EOS, NULL);
02065 goto EXIT;
02066 }
02067
02068 if (LA_CH_VALUE == EQUAL) {
02069 NEXT_LA_CH;
02070 }
02071 else {
02072 parse_err_flush(Find_EOS, "=");
02073 goto EXIT;
02074 }
02075
02076
02077
02078
02079
02080 expr_start_line = LA_CH_LINE;
02081 expr_start_col = LA_CH_COLUMN;
02082
02083 if (parse_expr(&loop_expr)) {
02084
02085
02086
02087
02088
02089
02090 if (! SH_ERR_FLG(curr_stmt_sh_idx)) {
02091 NTR_IR_LIST_TBL(il_idx);
02092 IL_NEXT_LIST_IDX(last_il_idx) = il_idx;
02093 IL_PREV_LIST_IDX(il_idx) = last_il_idx;
02094 COPY_OPND(IL_OPND(il_idx), loop_expr);
02095 IL_LINE_NUM(il_idx) = expr_start_line;
02096 IL_COL_NUM(il_idx) = expr_start_col;
02097 last_il_idx = il_idx;
02098 ++IL_LIST_CNT(loop_control_il_idx);
02099 }
02100 else {
02101 parse_err_flush(Find_EOS, NULL);
02102 goto EXIT;
02103 }
02104 }
02105 else {
02106 parse_err_flush(Find_EOS, NULL);
02107 goto EXIT;
02108 }
02109
02110 if (LA_CH_VALUE == COMMA) {
02111 NEXT_LA_CH;
02112 }
02113 else {
02114 parse_err_flush(Find_EOS, ",");
02115 goto EXIT;
02116 }
02117
02118
02119
02120
02121
02122 expr_start_line = LA_CH_LINE;
02123 expr_start_col = LA_CH_COLUMN;
02124
02125 if (parse_expr(&loop_expr)) {
02126
02127
02128
02129
02130
02131
02132
02133 if (! SH_ERR_FLG(curr_stmt_sh_idx)) {
02134 NTR_IR_LIST_TBL(il_idx);
02135 IL_NEXT_LIST_IDX(last_il_idx) = il_idx;
02136 IL_PREV_LIST_IDX(il_idx) = last_il_idx;
02137 COPY_OPND(IL_OPND(il_idx), loop_expr);
02138 IL_LINE_NUM(il_idx) = expr_start_line;
02139 IL_COL_NUM(il_idx) = expr_start_col;
02140 last_il_idx = il_idx;
02141 ++IL_LIST_CNT(loop_control_il_idx);
02142 }
02143 else {
02144 parse_err_flush(Find_EOS, NULL);
02145 goto EXIT;
02146 }
02147 }
02148 else {
02149 parse_err_flush(Find_EOS, NULL);
02150 goto EXIT;
02151 }
02152
02153
02154
02155
02156
02157 if (LA_CH_VALUE == COMMA) {
02158 NEXT_LA_CH;
02159 expr_start_line = LA_CH_LINE;
02160 expr_start_col = LA_CH_COLUMN;
02161
02162 if (parse_expr(&loop_expr)) {
02163
02164 if (LA_CH_VALUE == EOS) {
02165
02166
02167
02168
02169
02170
02171
02172 if (! SH_ERR_FLG(curr_stmt_sh_idx)) {
02173 NTR_IR_LIST_TBL(il_idx);
02174 IL_NEXT_LIST_IDX(last_il_idx) = il_idx;
02175 IL_PREV_LIST_IDX(il_idx) = last_il_idx;
02176 COPY_OPND(IL_OPND(il_idx), loop_expr);
02177 IL_LINE_NUM(il_idx) = expr_start_line;
02178 IL_COL_NUM(il_idx) = expr_start_col;
02179 ++IL_LIST_CNT(loop_control_il_idx);
02180 }
02181 else {
02182 parse_err_flush(Find_EOS, NULL);
02183 }
02184 }
02185 else {
02186 parse_err_flush(Find_EOS, EOS_STR);
02187 }
02188 }
02189 else {
02190 parse_err_flush(Find_EOS, NULL);
02191 }
02192 }
02193 else if (LA_CH_VALUE == EOS) {
02194 NTR_IR_LIST_TBL(il_idx);
02195 IL_NEXT_LIST_IDX(last_il_idx) = il_idx;
02196 IL_PREV_LIST_IDX(il_idx) = last_il_idx;
02197 IL_LINE_NUM(il_idx) = expr_start_line;
02198 IL_COL_NUM(il_idx) = expr_start_col;
02199 IL_FLD(il_idx) = CN_Tbl_Idx;
02200 IL_IDX(il_idx) = CN_INTEGER_ONE_IDX;
02201 ++IL_LIST_CNT(loop_control_il_idx);
02202 }
02203 else {
02204 parse_err_flush(Find_EOS, ", or EOS");
02205 }
02206
02207
02208
02209
02210
02211
02212
02213
02214
02215
02216
02217 # ifndef _HIGH_LEVEL_DO_LOOP_FORM
02218
02219 NTR_IR_LIST_TBL(il_idx);
02220 IL_LIST_CNT(loop_labels_il_idx) = 1;
02221 IL_FLD(loop_labels_il_idx) = IL_Tbl_Idx;
02222 IL_IDX(loop_labels_il_idx) = il_idx;
02223
02224 # endif
02225
02226 BLK_SKIP_LBL_IDX(blk_stk_idx) = gen_loop_lbl_name(blk_stk_idx, Skip_Lbl);
02227
02228 if (BLK_SKIP_LBL_IDX(blk_stk_idx) != NULL_IDX) {
02229
02230 # ifndef _HIGH_LEVEL_DO_LOOP_FORM
02231
02232 IL_FLD(il_idx) = AT_Tbl_Idx;
02233 IL_IDX(il_idx) = BLK_SKIP_LBL_IDX(blk_stk_idx);
02234 IL_LINE_NUM(il_idx) = expr_start_line;
02235 IL_COL_NUM(il_idx) = expr_start_col;
02236
02237 # endif
02238
02239 }
02240 else {
02241 goto EXIT;
02242 }
02243
02244
02245 # ifndef _HIGH_LEVEL_DO_LOOP_FORM
02246
02247
02248
02249
02250
02251 NTR_IR_LIST_TBL(il_idx);
02252 ++IL_LIST_CNT(loop_labels_il_idx);
02253 IL_NEXT_LIST_IDX(il_idx) = IL_IDX(loop_labels_il_idx);
02254 IL_PREV_LIST_IDX(IL_IDX(loop_labels_il_idx)) = il_idx;
02255 IL_IDX(loop_labels_il_idx) = il_idx;
02256
02257 BLK_TOP_LBL_IDX(blk_stk_idx) = gen_loop_lbl_name(blk_stk_idx, Top_Lbl);
02258
02259 IL_LINE_NUM(il_idx) = stmt_start_line;
02260 IL_COL_NUM(il_idx) = stmt_start_col;
02261 IL_FLD(il_idx) = AT_Tbl_Idx;
02262 IL_IDX(il_idx) = BLK_TOP_LBL_IDX(blk_stk_idx);
02263
02264 # endif
02265
02266 if (cif_flags & MISC_RECS) {
02267 cif_stmt_type_rec(TRUE,
02268 (CURR_BLK_LABEL == NULL_IDX) ?
02269 CIF_Do_Unlabeled_Iterative_Stmt :
02270 CIF_Do_Labeled_Iterative_Stmt,
02271 statement_number);
02272 }
02273
02274 goto EXIT;
02275 }
02276
02277
02278
02279
02280
02281
02282
02283 if (LA_CH_VALUE == EOS) {
02284
02285 if (comma_found) {
02286 parse_err_flush(Find_EOS, "do-variable or WHILE");
02287 }
02288 else {
02289 SH_STMT_TYPE(curr_stmt_sh_idx) = Do_Infinite_Stmt;
02290 stmt_type = Do_Infinite_Stmt;
02291 BLK_DO_TYPE(blk_stk_idx) = Infinite_Loop;
02292
02293
02294
02295 NTR_IR_LIST_TBL(il_idx);
02296 IL_LIST_CNT(loop_labels_il_idx) = 1;
02297 IL_FLD(loop_labels_il_idx) = IL_Tbl_Idx;
02298 IL_IDX(loop_labels_il_idx) = il_idx;
02299
02300 # ifndef _ACSET
02301
02302 IL_LINE_NUM(il_idx) = stmt_start_line;
02303 IL_COL_NUM(il_idx) = stmt_start_col;
02304 IL_FLD(il_idx) = AT_Tbl_Idx;
02305 IL_IDX(il_idx) = gen_loop_lbl_name(blk_stk_idx, Top_Lbl);
02306
02307 # endif
02308
02309 if (cif_flags & MISC_RECS) {
02310 cif_stmt_type_rec(TRUE,
02311 (CURR_BLK_LABEL == NULL_IDX) ?
02312 CIF_Do_Unlabeled_Infinite_Stmt :
02313 CIF_Do_Labeled_Infinite_Stmt,
02314 statement_number);
02315 }
02316 }
02317 }
02318 else {
02319
02320 if (comma_found) {
02321 parse_err_flush(Find_EOS, "do-variable or WHILE");
02322 }
02323 else if (label_found) {
02324 PRINTMSG(LA_CH_LINE, 513, Error, LA_CH_COLUMN, LA_CH_VALUE);
02325 parse_err_flush(Find_EOS, NULL);
02326 }
02327 else {
02328 PRINTMSG(LA_CH_LINE, 515, Error, LA_CH_COLUMN, LA_CH_VALUE);
02329 parse_err_flush(Find_EOS, NULL);
02330 }
02331 }
02332
02333 EXIT:
02334
02335 if (mp_nest_list_idx != NULL_IDX &&
02336 IL_FLD(mp_nest_list_idx) == NO_Tbl_Idx) {
02337
02338
02339 FREE_IR_LIST_NODE(mp_nest_list_idx);
02340 IL_OPND(mp_prev_idx) = null_opnd;
02341 }
02342
02343 NEXT_LA_CH;
02344
02345
02346
02347 cdir_switches.shortloop = FALSE;
02348 cdir_switches.shortloop128 = FALSE;
02349
02350 TRACE (Func_Exit, "parse_do_stmt", NULL);
02351
02352 return;
02353
02354 }
02355
02356
02357
02358
02359
02360
02361
02362
02363
02364
02365
02366
02367
02368
02369
02370
02371
02372
02373
02374
02375
02376
02377
02378
02379
02380
02381 void parse_else_stmt (void)
02382
02383 {
02384 int blk_idx;
02385 blk_cntxt_type blk_type = If_Else_Blk;
02386 opnd_type cond_expr;
02387
02388 # if 0
02389 int cont_lbl_idx;
02390 int end_lbl_idx;
02391 # endif
02392
02393 blk_cntxt_type err_blk;
02394 #ifdef KEY
02395 int expr_start_line = 0;
02396 int expr_start_col = 0;
02397 #else
02398 int expr_start_line;
02399 int expr_start_col;
02400 #endif
02401 boolean found_name = FALSE;
02402 int il_idx_1;
02403 int il_idx_2;
02404 int ir_idx;
02405 boolean matched_blk = FALSE;
02406 #ifdef KEY
02407 int name_idx = 0;
02408 boolean prev_clause_in_err;
02409 int sh_idx = 0;
02410 #else
02411 int name_idx;
02412 boolean prev_clause_in_err;
02413 int sh_idx;
02414 #endif
02415
02416
02417 TRACE (Func_Entry, "parse_else_stmt", NULL);
02418
02419 check_for_vestigial_task_blks();
02420
02421
02422
02423
02424
02425 if (LA_CH_VALUE == EOS) {
02426 matched_blk = STMT_LEGAL_IN_BLK(Else_Stmt, CURR_BLK);
02427
02428 if (cif_flags & MISC_RECS) {
02429 cif_stmt_type_rec(TRUE, CIF_Else_Stmt, statement_number);
02430 }
02431 }
02432
02433 else if (MATCHED_TOKEN_CLASS(Tok_Class_Keyword)) {
02434
02435
02436
02437
02438
02439 if (TOKEN_VALUE(token) == Tok_Kwd_If && LA_CH_VALUE == LPAREN) {
02440
02441
02442
02443
02444
02445 blk_type = If_Else_If_Blk;
02446 stmt_type = Else_If_Stmt;
02447 SH_STMT_TYPE(curr_stmt_sh_idx) = Else_If_Stmt;
02448
02449 NEXT_LA_CH;
02450
02451 expr_start_line = LA_CH_LINE;
02452 expr_start_col = LA_CH_COLUMN;
02453
02454 if (parse_expr(&cond_expr)) {
02455
02456 if (LA_CH_VALUE == RPAREN) {
02457 NEXT_LA_CH;
02458
02459 if (matched_specific_token(Tok_Kwd_Then, Tok_Class_Keyword)) {
02460
02461 if (LA_CH_VALUE != EOS) {
02462
02463 if ( (found_name = MATCHED_TOKEN_CLASS(Tok_Class_Id)) ) {
02464
02465 if (LA_CH_VALUE != EOS) {
02466 parse_err_flush(Find_EOS, EOS_STR);
02467 }
02468 }
02469 else {
02470 parse_err_flush(Find_EOS, "if-construct-name");
02471 }
02472 }
02473 }
02474 else {
02475 parse_err_flush(Find_EOS, "THEN");
02476 }
02477 }
02478 else {
02479 parse_err_flush(Find_EOS, ")");
02480 }
02481 }
02482 else {
02483 parse_err_flush(Find_EOS, NULL);
02484 }
02485
02486 if (SH_ERR_FLG(curr_stmt_sh_idx)) {
02487 goto EXIT;
02488 }
02489
02490 if (cif_flags & MISC_RECS) {
02491 cif_stmt_type_rec(TRUE, CIF_Else_If_Stmt, statement_number);
02492 }
02493
02494 if (STMT_LEGAL_IN_BLK(Else_If_Stmt, CURR_BLK)) {
02495 matched_blk = (found_name) ? (CURR_BLK_NAME != NULL_IDX &&
02496 (compare_names(TOKEN_ID(token).words,
02497 TOKEN_LEN(token),
02498 AT_OBJ_NAME_LONG(CURR_BLK_NAME),
02499 AT_NAME_LEN(CURR_BLK_NAME)) == 0)):
02500 TRUE;
02501 }
02502 }
02503 else if (TOKEN_VALUE(token) == Tok_Kwd_Where && LA_CH_VALUE == LPAREN) {
02504
02505
02506
02507
02508 blk_type = Where_Else_Mask_Blk;
02509 stmt_type = Else_Where_Mask_Stmt;
02510 SH_STMT_TYPE(curr_stmt_sh_idx) = Else_Where_Mask_Stmt;
02511
02512 NTR_IR_TBL(ir_idx);
02513 IR_OPR(ir_idx) = Else_Where_Mask_Opr;
02514 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
02515 IR_LINE_NUM(ir_idx) = TOKEN_LINE(token);
02516 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(token);
02517 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
02518
02519 NEXT_LA_CH;
02520
02521 expr_start_line = LA_CH_LINE;
02522 expr_start_col = LA_CH_COLUMN;
02523
02524 if (parse_expr(&cond_expr)) {
02525
02526 COPY_OPND(IR_OPND_L(ir_idx), cond_expr);
02527
02528 if (LA_CH_VALUE == RPAREN) {
02529 NEXT_LA_CH;
02530
02531 if (LA_CH_VALUE != EOS) {
02532
02533 if ( (found_name = MATCHED_TOKEN_CLASS(Tok_Class_Id)) ) {
02534
02535 if (LA_CH_VALUE != EOS) {
02536 parse_err_flush(Find_EOS, EOS_STR);
02537 }
02538 }
02539 else {
02540 parse_err_flush(Find_EOS, "where-construct-name");
02541 }
02542 }
02543 }
02544 else {
02545 parse_err_flush(Find_EOS, ")");
02546 }
02547 }
02548 else {
02549 parse_err_flush(Find_EOS, NULL);
02550 }
02551
02552 if (SH_ERR_FLG(curr_stmt_sh_idx)) {
02553 goto EXIT;
02554 }
02555
02556 if (cif_flags & MISC_RECS) {
02557 cif_stmt_type_rec(TRUE, CIF_Elsewhere_Stmt, statement_number);
02558 }
02559
02560 if (STMT_LEGAL_IN_BLK(Else_Where_Mask_Stmt, CURR_BLK)) {
02561 SH_PARENT_BLK_IDX(curr_stmt_sh_idx) = CURR_BLK_FIRST_SH_IDX;
02562
02563 matched_blk = (found_name) ? (CURR_BLK_NAME != NULL_IDX &&
02564 (compare_names(TOKEN_ID(token).words,
02565 TOKEN_LEN(token),
02566 AT_OBJ_NAME_LONG(CURR_BLK_NAME),
02567 AT_NAME_LEN(CURR_BLK_NAME)) == 0)):
02568 TRUE;
02569 }
02570 }
02571 else if (TOKEN_VALUE(token) == Tok_Kwd_Where &&
02572 (CURR_BLK == Where_Then_Blk ||
02573 CURR_BLK == Where_Else_Mask_Blk)) {
02574
02575
02576
02577
02578
02579 stmt_type = Else_Where_Stmt;
02580 SH_STMT_TYPE(curr_stmt_sh_idx) = Else_Where_Stmt;
02581 blk_type = Where_Else_Blk;
02582 SH_PARENT_BLK_IDX(curr_stmt_sh_idx) = CURR_BLK_FIRST_SH_IDX;
02583
02584 NTR_IR_TBL(ir_idx);
02585 IR_OPR(ir_idx) = Else_Where_Opr;
02586 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
02587 IR_LINE_NUM(ir_idx) = TOKEN_LINE(token);
02588 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(token);
02589 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
02590
02591
02592 if (LA_CH_VALUE != EOS) {
02593
02594 if ( (found_name = MATCHED_TOKEN_CLASS(Tok_Class_Id)) ) {
02595
02596 if (LA_CH_VALUE != EOS) {
02597 parse_err_flush(Find_EOS, EOS_STR);
02598 }
02599 }
02600 else {
02601 parse_err_flush(Find_EOS, "where-construct-name");
02602 }
02603 }
02604
02605 matched_blk = (found_name) ? (CURR_BLK_NAME != NULL_IDX &&
02606 (compare_names(TOKEN_ID(token).words,
02607 TOKEN_LEN(token),
02608 AT_OBJ_NAME_LONG(CURR_BLK_NAME),
02609 AT_NAME_LEN(CURR_BLK_NAME)) == 0)):
02610 TRUE;
02611
02612 if (cif_flags & MISC_RECS) {
02613 cif_stmt_type_rec(TRUE, CIF_Elsewhere_Stmt, statement_number);
02614 }
02615 }
02616 else if (TOKEN_VALUE(token) == Tok_Kwd_Where && LA_CH_VALUE == EOS) {
02617
02618 if (STMT_LEGAL_IN_BLK(Else_Stmt, CURR_BLK) &&
02619 (CURR_BLK_NAME != NULL_IDX &&
02620 (compare_names(TOKEN_ID(token).words,
02621 TOKEN_LEN(token),
02622 AT_OBJ_NAME_LONG(CURR_BLK_NAME),
02623 AT_NAME_LEN(CURR_BLK_NAME)) == 0)) ) {
02624
02625
02626
02627
02628
02629 matched_blk = TRUE;
02630 found_name = TRUE;
02631
02632 if (cif_flags & MISC_RECS) {
02633 cif_stmt_type_rec(TRUE, CIF_Else_Stmt, statement_number);
02634 }
02635 }
02636 else if (match_blk(Where_Then_Blk, FALSE) >=
02637 match_blk(If_Blk, FALSE)) {
02638
02639
02640
02641
02642
02643
02644
02645
02646 stmt_type = Else_Where_Stmt;
02647 SH_STMT_TYPE(curr_stmt_sh_idx) = Else_Where_Stmt;
02648 blk_type = Where_Else_Blk;
02649
02650 if (cif_flags & MISC_RECS) {
02651 cif_stmt_type_rec(TRUE, CIF_Elsewhere_Stmt, statement_number);
02652 }
02653 }
02654 else {
02655
02656
02657
02658
02659 found_name = TRUE;
02660
02661 if (cif_flags & MISC_RECS) {
02662 cif_stmt_type_rec(TRUE, CIF_Else_Stmt, statement_number);
02663 }
02664 }
02665 }
02666 else {
02667
02668
02669
02670
02671
02672 found_name = TRUE;
02673
02674 if (TOKEN_VALUE(token) != Tok_Id) {
02675 reset_lex(TOKEN_BUF_IDX(token), TOKEN_STMT_NUM(token));
02676 MATCHED_TOKEN_CLASS(Tok_Class_Id);
02677 }
02678
02679 if (CURR_BLK == If_Then_Blk || CURR_BLK == If_Else_If_Blk) {
02680 matched_blk = CURR_BLK_NAME != NULL_IDX &&
02681 (compare_names(TOKEN_ID(token).words,
02682 TOKEN_LEN(token),
02683 AT_OBJ_NAME_LONG(CURR_BLK_NAME),
02684 AT_NAME_LEN(CURR_BLK_NAME)) == 0);
02685 }
02686
02687 if (cif_flags & MISC_RECS) {
02688 cif_stmt_type_rec(TRUE, CIF_Else_Stmt, statement_number);
02689 }
02690
02691 if (LA_CH_VALUE != EOS) {
02692 parse_err_flush(Find_EOS, EOS_STR);
02693 }
02694 }
02695 }
02696 else {
02697 parse_err_flush(Find_EOS, "IF, WHERE, a construct name or EOS");
02698 }
02699
02700
02701
02702
02703
02704
02705
02706
02707 if (matched_blk) {
02708 curr_stmt_category = Executable_Stmt_Cat;
02709
02710 if ((cif_flags & XREF_RECS) && found_name) {
02711 cif_usage_rec(CURR_BLK_NAME, AT_Tbl_Idx,
02712 TOKEN_LINE(token), TOKEN_COLUMN(token),
02713 CIF_Construct_Name_Reference);
02714 }
02715
02716 if (blk_type != Where_Else_Blk &&
02717 blk_type != Where_Else_Mask_Blk &&
02718 ! SH_ERR_FLG(curr_stmt_sh_idx)) {
02719
02720
02721
02722
02723
02724
02725
02726
02727
02728
02729
02730
02731
02732
02733
02734 # ifdef _DEBUG
02735 if (BLK_TYPE(blk_stk_idx - 1) != If_Blk) {
02736 PRINTMSG(stmt_start_line, 160, Internal, 0, blk_stk_idx);
02737 }
02738 # endif
02739
02740 #if 0
02741 if (CURR_BLK == If_Then_Blk) {
02742 cont_lbl_idx = BLK_LABEL(blk_stk_idx - 1);
02743 end_lbl_idx = gen_internal_lbl(stmt_start_line);
02744 BLK_LABEL(blk_stk_idx - 1) = end_lbl_idx;
02745 }
02746 else {
02747 cont_lbl_idx = CURR_BLK_LABEL;
02748 end_lbl_idx = BLK_LABEL(blk_stk_idx - 1);
02749 }
02750 #endif
02751
02752 }
02753
02754 prev_clause_in_err = SH_ERR_FLG(CURR_BLK_FIRST_SH_IDX);
02755
02756 if (blk_type != Where_Else_Blk &&
02757 blk_type != Where_Else_Mask_Blk) {
02758 blk_idx = blk_stk_idx;
02759
02760 if (CURR_BLK == If_Then_Blk) {
02761 --blk_idx;
02762 }
02763
02764 sh_idx = BLK_FIRST_SH_IDX(blk_idx);
02765 }
02766
02767 if (blk_type == Where_Else_Blk ||
02768 blk_type == Where_Else_Mask_Blk) {
02769 name_idx = CURR_BLK_NAME;
02770 }
02771
02772 POP_BLK_STK;
02773 PUSH_BLK_STK(blk_type);
02774 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
02775
02776 if (blk_type == Where_Else_Blk ||
02777 blk_type == Where_Else_Mask_Blk) {
02778 CURR_BLK_NAME = name_idx;
02779 CURR_BLK_NO_EXEC = TRUE;
02780 }
02781 else {
02782 CURR_BLK_NAME = BLK_NAME(blk_stk_idx - 1);
02783 LINK_TO_PARENT_BLK;
02784
02785 if (SH_ERR_FLG(SH_PARENT_BLK_IDX(curr_stmt_sh_idx)) ||
02786 prev_clause_in_err) {
02787 SH_ERR_FLG(curr_stmt_sh_idx) = TRUE;
02788 }
02789
02790
02791
02792
02793
02794
02795
02796
02797
02798
02799
02800
02801
02802
02803 if (! SH_ERR_FLG(curr_stmt_sh_idx)) {
02804 NTR_IR_TBL(ir_idx);
02805 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
02806 IR_TYPE_IDX(ir_idx) = LOGICAL_DEFAULT_TYPE;
02807 IR_LINE_NUM(ir_idx) = expr_start_line;
02808 IR_COL_NUM(ir_idx) = expr_start_col;
02809
02810 if (blk_type == If_Else_If_Blk) {
02811 IR_OPR(ir_idx) = Br_True_Opr;
02812 COPY_OPND(IR_OPND_L(ir_idx), cond_expr);
02813 NTR_IR_LIST_TBL(il_idx_1);
02814 IR_LIST_CNT_R(ir_idx) = 1;
02815 IR_FLD_R(ir_idx) = IL_Tbl_Idx;
02816 IR_IDX_R(ir_idx) = il_idx_1;
02817 NTR_IR_LIST_TBL(il_idx_2);
02818 IR_LIST_CNT_R(ir_idx) = 2;
02819 IL_NEXT_LIST_IDX(il_idx_1) = il_idx_2;
02820 IL_PREV_LIST_IDX(il_idx_2) = il_idx_1;
02821 IL_LINE_NUM(il_idx_2) = stmt_start_line;
02822 IL_COL_NUM(il_idx_2) = stmt_start_col;
02823 IL_FLD(il_idx_2) = SH_Tbl_Idx;
02824 IL_IDX(il_idx_2) = sh_idx;
02825 }
02826 else {
02827 IR_OPR(ir_idx) = Else_Opr;
02828 IR_LINE_NUM(ir_idx) = stmt_start_line;
02829 IR_COL_NUM(ir_idx) = stmt_start_col;
02830 IR_FLD_L(ir_idx) = SH_Tbl_Idx;
02831 IR_IDX_L(ir_idx) = sh_idx;
02832 }
02833 #if 0
02834 CURR_BLK_LABEL = gen_internal_lbl(stmt_start_line);
02835 IR_LINE_NUM_R(ir_idx) = stmt_start_line;
02836 IR_COL_NUM_R(ir_idx) = stmt_start_col;
02837 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
02838 IR_IDX_R(ir_idx) = CURR_BLK_LABEL;
02839 #endif
02840
02841
02842 #if 0
02843
02844
02845
02846
02847 gen_sh(Before, Goto_Stmt,
02848 SH_GLB_LINE(SH_PREV_IDX(curr_stmt_sh_idx)),
02849 SH_COL_NUM(SH_PREV_IDX(curr_stmt_sh_idx)),
02850 FALSE, FALSE, TRUE);
02851
02852 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
02853 NTR_IR_TBL(ir_idx);
02854 SH_IR_IDX(sh_idx) = ir_idx;
02855 IR_OPR(ir_idx) = Br_Uncond_Opr;
02856
02857 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
02858 IR_LINE_NUM(ir_idx) = SH_GLB_LINE(SH_PREV_IDX(sh_idx));
02859 IR_COL_NUM(ir_idx) = SH_COL_NUM(SH_PREV_IDX(sh_idx));
02860
02861 IR_LINE_NUM_R(ir_idx) = SH_GLB_LINE(SH_PREV_IDX(sh_idx));
02862 IR_COL_NUM_R(ir_idx) = SH_COL_NUM(SH_PREV_IDX(sh_idx));
02863 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
02864 IR_IDX_R(ir_idx) = end_lbl_idx;
02865
02866 gen_sh(Before, Continue_Stmt, stmt_start_line, stmt_start_col,
02867 FALSE, TRUE, TRUE);
02868
02869 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
02870 NTR_IR_TBL(ir_idx);
02871 SH_IR_IDX(sh_idx) = ir_idx;
02872 IR_OPR(ir_idx) = Label_Opr;
02873
02874 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
02875 IR_LINE_NUM(ir_idx) = stmt_start_line;
02876 IR_COL_NUM(ir_idx) = stmt_start_col;
02877 IR_LINE_NUM_L(ir_idx) = stmt_start_line;
02878 IR_COL_NUM_L(ir_idx) = stmt_start_col;
02879 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
02880 IR_IDX_L(ir_idx) = cont_lbl_idx;
02881 AT_DEFINED(cont_lbl_idx) = TRUE;
02882 AT_DEF_LINE(cont_lbl_idx) = stmt_start_line;
02883 AT_DEF_COLUMN(cont_lbl_idx) = stmt_start_col;
02884 AT_REFERENCED(cont_lbl_idx) = Referenced;
02885 ATL_DEF_STMT_IDX(cont_lbl_idx) = sh_idx;
02886 #endif
02887 }
02888 }
02889 }
02890 else {
02891 err_blk = (blk_type == Where_Else_Blk ||
02892 blk_type == Where_Else_Mask_Blk) ? Where_Then_Blk : If_Blk;
02893 blk_idx = blk_match_err(err_blk, found_name, FALSE);
02894
02895
02896
02897 if (blk_idx != NULL_IDX) {
02898 if (blk_type == Where_Else_Blk ||
02899 blk_type == Where_Else_Mask_Blk) {
02900 name_idx = CURR_BLK_NAME;
02901 }
02902
02903 POP_BLK_STK;
02904 PUSH_BLK_STK(blk_type);
02905 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
02906
02907 if (blk_type == Where_Else_Blk ||
02908 blk_type == Where_Else_Mask_Blk) {
02909 CURR_BLK_NAME = name_idx;
02910 CURR_BLK_NO_EXEC = TRUE;
02911 }
02912 else {
02913 CURR_BLK_NAME = BLK_NAME(blk_stk_idx - 1);
02914 LINK_TO_PARENT_BLK;
02915 SH_ERR_FLG(curr_stmt_sh_idx) = TRUE;
02916 }
02917
02918 # if 0
02919 if (cif_flags & XREF_RECS) {
02920 cif_usage_rec(CURR_BLK_NAME, AT_Tbl_Idx,
02921 TOKEN_LINE(token), TOKEN_COLUMN(token),
02922 CIF_Construct_Name_Reference);
02923 }
02924 # endif
02925 }
02926 }
02927
02928 EXIT:
02929
02930 NEXT_LA_CH;
02931
02932 TRACE (Func_Exit, "parse_else_stmt", NULL);
02933
02934 return;
02935
02936 }
02937
02938
02939
02940
02941
02942
02943
02944
02945
02946
02947
02948
02949
02950
02951
02952
02953
02954
02955
02956
02957 void parse_exit_stmt (void)
02958
02959 {
02960 int blk_idx;
02961 boolean fnd_name = FALSE;
02962 int ir_idx;
02963
02964
02965 TRACE (Func_Entry, "parse_exit_stmt", NULL);
02966
02967 if (LA_CH_VALUE != EOS) {
02968 fnd_name = MATCHED_TOKEN_CLASS(Tok_Class_Id);
02969
02970 if (fnd_name) {
02971
02972 if (LA_CH_VALUE != EOS) {
02973 parse_err_flush(Find_EOS, EOS_STR);
02974 }
02975
02976 }
02977 else {
02978 parse_err_flush(Find_EOS, "construct-name or EOS");
02979 goto EXIT;
02980 }
02981
02982 }
02983
02984 blk_idx = match_blk(Do_Blk, fnd_name);
02985
02986 if (blk_idx != NULL_IDX) {
02987
02988 if (! CURR_BLK_NO_EXEC || ! iss_blk_stk_err()) {
02989 curr_stmt_category = Executable_Stmt_Cat;
02990 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
02991 BLK_EXIT_STMT(blk_idx) = TRUE;
02992
02993 NTR_IR_TBL(ir_idx);
02994 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
02995 IR_OPR(ir_idx) = Br_Uncond_Opr;
02996
02997 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
02998 IR_LINE_NUM(ir_idx) = stmt_start_line;
02999 IR_COL_NUM(ir_idx) = stmt_start_col;
03000 IR_LINE_NUM_R(ir_idx) = stmt_start_line;
03001 IR_COL_NUM_R(ir_idx) = stmt_start_col;
03002 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
03003 IR_IDX_R(ir_idx) = gen_loop_lbl_name(blk_idx, Exit_Lbl);
03004
03005 if (fnd_name && (cif_flags & XREF_RECS)) {
03006 cif_usage_rec(BLK_NAME(blk_idx), AT_Tbl_Idx,
03007 TOKEN_LINE(token), TOKEN_COLUMN(token),
03008 CIF_Construct_Name_Reference);
03009 }
03010 }
03011
03012 }
03013 else {
03014 PRINTMSG(stmt_start_line, 262, Error, stmt_start_col, "EXIT");
03015 }
03016
03017 EXIT:
03018
03019 NEXT_LA_CH;
03020
03021 TRACE (Func_Exit, "parse_exit_stmt", NULL);
03022
03023 return;
03024
03025 }
03026
03027
03028
03029
03030
03031
03032
03033
03034
03035
03036
03037
03038
03039
03040
03041
03042
03043
03044 void parse_forall (void)
03045
03046 {
03047 opnd_type an_opnd;
03048 #ifdef KEY
03049 int blk_stk_start = 0;
03050 #else
03051 int blk_stk_start;
03052 #endif
03053 int expr_start_line;
03054 int expr_start_col;
03055 int forall_ir_idx;
03056 int forall_sh_idx;
03057 boolean found_colon;
03058 boolean found_comma;
03059 int i;
03060 int il_idx;
03061 int index_name_il_idx;
03062 int mask_il_idx;
03063 int stride_il_idx;
03064 int subscript1_il_idx;
03065 int subscript2_il_idx;
03066 int triplet_spec_il_idx;
03067
03068
03069 TRACE (Func_Entry, "parse_forall", NULL);
03070
03071
03072
03073
03074
03075
03076
03077
03078
03079
03080
03081
03082
03083 NTR_IR_TBL(forall_ir_idx);
03084 SH_IR_IDX(curr_stmt_sh_idx) = forall_ir_idx;
03085 IR_OPR(forall_ir_idx) = Forall_Opr;
03086 IR_TYPE_IDX(forall_ir_idx) = TYPELESS_DEFAULT_TYPE;
03087 IR_LINE_NUM(forall_ir_idx) = stmt_start_line;
03088 IR_COL_NUM(forall_ir_idx) = stmt_start_col;
03089
03090
03091
03092
03093
03094
03095
03096
03097
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107
03108
03109 if (LA_CH_VALUE == LPAREN) {
03110 NEXT_LA_CH;
03111
03112 if (MATCHED_TOKEN_CLASS(Tok_Class_Id)) {
03113 expr_start_line = TOKEN_LINE(token);
03114 expr_start_col = TOKEN_COLUMN(token);
03115
03116 if (parse_deref(&an_opnd, NULL_IDX)) {
03117 NTR_IR_LIST_TBL(triplet_spec_il_idx);
03118 IR_LIST_CNT_R(forall_ir_idx) = 1;
03119 IR_FLD_R(forall_ir_idx) = IL_Tbl_Idx;
03120 IR_IDX_R(forall_ir_idx) = triplet_spec_il_idx;
03121
03122 NTR_IR_LIST_TBL(index_name_il_idx);
03123 IL_FLD(triplet_spec_il_idx) = IL_Tbl_Idx;
03124 IL_IDX(triplet_spec_il_idx) = index_name_il_idx;
03125 IL_LIST_CNT(triplet_spec_il_idx) = 1;
03126
03127 COPY_OPND(IL_OPND(index_name_il_idx), an_opnd);
03128 }
03129 else {
03130 parse_err_flush(Find_EOS, NULL);
03131 goto EXIT;
03132 }
03133 }
03134 else {
03135 parse_err_flush(Find_EOS, "index-name");
03136 goto EXIT;
03137 }
03138 }
03139 else {
03140 parse_err_flush(Find_EOS, "(");
03141 goto EXIT;
03142 }
03143
03144 NEXT_TRIPLET_SPEC:
03145
03146 if (LA_CH_VALUE == EQUAL) {
03147 NEXT_LA_CH;
03148 }
03149 else {
03150 parse_err_flush(Find_EOS, "=");
03151 goto EXIT;
03152 }
03153
03154
03155
03156
03157
03158
03159
03160
03161
03162
03163 expr_start_line = LA_CH_LINE;
03164 expr_start_col = LA_CH_COLUMN;
03165
03166
03167 if (parse_expr(&an_opnd)) {
03168
03169
03170
03171
03172
03173
03174 if (! SH_ERR_FLG(curr_stmt_sh_idx)) {
03175 NTR_IR_LIST_TBL(subscript1_il_idx);
03176 IL_NEXT_LIST_IDX(index_name_il_idx) = subscript1_il_idx;
03177 IL_PREV_LIST_IDX(subscript1_il_idx) = index_name_il_idx;
03178 COPY_OPND(IL_OPND(subscript1_il_idx), an_opnd);
03179 IL_LINE_NUM(subscript1_il_idx) = expr_start_line;
03180 IL_COL_NUM(subscript1_il_idx) = expr_start_col;
03181 ++IL_LIST_CNT(triplet_spec_il_idx);
03182 }
03183 else {
03184 parse_err_flush(Find_EOS, NULL);
03185 goto EXIT;
03186 }
03187 }
03188 else {
03189 parse_err_flush(Find_EOS, NULL);
03190 goto EXIT;
03191 }
03192
03193
03194 if (LA_CH_VALUE == COLON) {
03195 NEXT_LA_CH;
03196 }
03197 else {
03198 parse_err_flush(Find_EOS, ":");
03199 goto EXIT;
03200 }
03201
03202
03203
03204
03205
03206
03207 expr_start_line = LA_CH_LINE;
03208 expr_start_col = LA_CH_COLUMN;
03209
03210 if (parse_expr(&an_opnd)) {
03211
03212 if (! SH_ERR_FLG(curr_stmt_sh_idx)) {
03213 NTR_IR_LIST_TBL(subscript2_il_idx);
03214 IL_NEXT_LIST_IDX(subscript1_il_idx) = subscript2_il_idx;
03215 IL_PREV_LIST_IDX(subscript2_il_idx) = subscript1_il_idx;
03216 COPY_OPND(IL_OPND(subscript2_il_idx), an_opnd);
03217 IL_LINE_NUM(subscript2_il_idx) = expr_start_line;
03218 IL_COL_NUM(subscript2_il_idx) = expr_start_col;
03219 ++IL_LIST_CNT(triplet_spec_il_idx);
03220 }
03221 else {
03222 parse_err_flush(Find_EOS, NULL);
03223 goto EXIT;
03224 }
03225 }
03226 else {
03227 parse_err_flush(Find_EOS, NULL);
03228 goto EXIT;
03229 }
03230
03231
03232
03233
03234
03235
03236
03237
03238
03239 found_colon = FALSE;
03240 found_comma = FALSE;
03241
03242
03243 NTR_IR_LIST_TBL(stride_il_idx);
03244 IL_NEXT_LIST_IDX(subscript2_il_idx) = stride_il_idx;
03245 IL_PREV_LIST_IDX(stride_il_idx) = subscript2_il_idx;
03246 ++IL_LIST_CNT(triplet_spec_il_idx);
03247
03248 if (LA_CH_VALUE == COLON) {
03249 NEXT_LA_CH;
03250 found_colon = TRUE;
03251
03252 expr_start_line = LA_CH_LINE;
03253 expr_start_col = LA_CH_COLUMN;
03254
03255 if (parse_expr(&an_opnd)) {
03256
03257 if (! SH_ERR_FLG(curr_stmt_sh_idx)) {
03258 COPY_OPND(IL_OPND(stride_il_idx), an_opnd);
03259 IL_LINE_NUM(stride_il_idx) = expr_start_line;
03260 IL_COL_NUM(stride_il_idx) = expr_start_col;
03261 }
03262 else {
03263 parse_err_flush(Find_EOS, NULL);
03264 goto EXIT;
03265 }
03266 }
03267 else {
03268 parse_err_flush(Find_EOS, NULL);
03269 goto EXIT;
03270 }
03271 }
03272 else {
03273 IL_LINE_NUM(stride_il_idx) = LA_CH_LINE;
03274 IL_COL_NUM(stride_il_idx) = LA_CH_COLUMN;
03275 IL_FLD(stride_il_idx) = CN_Tbl_Idx;
03276 IL_IDX(stride_il_idx) = CN_INTEGER_ONE_IDX;
03277 }
03278
03279
03280
03281
03282
03283
03284
03285
03286
03287 if (LA_CH_VALUE == COMMA) {
03288 NEXT_LA_CH;
03289 found_colon = TRUE;
03290 found_comma = TRUE;
03291
03292 expr_start_line = LA_CH_LINE;
03293 expr_start_col = LA_CH_COLUMN;
03294
03295
03296
03297
03298
03299
03300
03301 if (MATCHED_TOKEN_CLASS(Tok_Class_Opnd)) {
03302 reset_lex(TOKEN_BUF_IDX(token), TOKEN_STMT_NUM(token));
03303 }
03304 else if (MATCHED_TOKEN_CLASS(Tok_Class_Op)) {
03305 reset_lex(TOKEN_BUF_IDX(token), TOKEN_STMT_NUM(token));
03306 }
03307 #ifdef KEY
03308 else if (LA_CH_VALUE == LPAREN) {
03309 reset_lex(TOKEN_BUF_IDX(token), TOKEN_STMT_NUM(token));
03310 }
03311 #endif
03312 else {
03313 parse_err_flush(Find_EOS, "index-name or mask expression");
03314 goto EXIT;
03315 }
03316
03317 if (parse_expr(&an_opnd)) {
03318
03319 if (! SH_ERR_FLG(curr_stmt_sh_idx)) {
03320
03321 if (LA_CH_VALUE == EQUAL) {
03322 il_idx = triplet_spec_il_idx;
03323 NTR_IR_LIST_TBL(triplet_spec_il_idx);
03324 ++IR_LIST_CNT_R(forall_ir_idx);
03325 IL_NEXT_LIST_IDX(il_idx) = triplet_spec_il_idx;
03326 IL_PREV_LIST_IDX(triplet_spec_il_idx) = il_idx;
03327
03328 NTR_IR_LIST_TBL(index_name_il_idx);
03329 IL_FLD(triplet_spec_il_idx) = IL_Tbl_Idx;
03330 IL_IDX(triplet_spec_il_idx) = index_name_il_idx;
03331 IL_LIST_CNT(triplet_spec_il_idx) = 1;
03332
03333 COPY_OPND(IL_OPND(index_name_il_idx), an_opnd);
03334
03335 goto NEXT_TRIPLET_SPEC;
03336 }
03337 else {
03338 NTR_IR_LIST_TBL(mask_il_idx);
03339 ++IR_LIST_CNT_R(forall_ir_idx);
03340 IL_NEXT_LIST_IDX(triplet_spec_il_idx) = mask_il_idx;
03341 IL_PREV_LIST_IDX(mask_il_idx) = triplet_spec_il_idx;
03342
03343 COPY_OPND(IL_OPND(mask_il_idx), an_opnd);
03344 IL_LINE_NUM(mask_il_idx) = expr_start_line;
03345 IL_COL_NUM(mask_il_idx) = expr_start_col;
03346 }
03347 }
03348 else {
03349 parse_err_flush(Find_EOS, NULL);
03350 goto EXIT;
03351 }
03352 }
03353 else {
03354 parse_err_flush(Find_EOS, NULL);
03355 goto EXIT;
03356 }
03357 }
03358
03359
03360 if (LA_CH_VALUE == RPAREN) {
03361 NEXT_LA_CH;
03362 }
03363 else {
03364
03365 if (! found_colon) {
03366 parse_err_flush(Find_EOS, "colon, comma, or right parenthesis");
03367 }
03368 else if (! found_comma) {
03369 parse_err_flush(Find_EOS, "comma or )");
03370 }
03371 else if (OPND_FLD(an_opnd) == AT_Tbl_Idx) {
03372 parse_err_flush(Find_EOS, "= or )");
03373 }
03374 else {
03375 parse_err_flush(Find_EOS, ")");
03376 }
03377
03378 goto EXIT;
03379 }
03380
03381 forall_sh_idx = curr_stmt_sh_idx;
03382
03383 if (LA_CH_VALUE == EOS) {
03384 NEXT_LA_CH;
03385
03386
03387
03388
03389
03390
03391
03392 if (! CURR_BLK_NO_EXEC || CURR_BLK == Forall_Blk) {
03393 PUSH_BLK_STK(Forall_Blk);
03394 }
03395 else {
03396 iss_blk_stk_err();
03397 PUSH_BLK_STK(Forall_Blk);
03398 CURR_BLK_ERR = TRUE;
03399 }
03400
03401 if (stmt_construct_idx != NULL_IDX) {
03402 CURR_BLK_NAME = stmt_construct_idx;
03403 ATL_CLASS(stmt_construct_idx) = Lbl_Construct;
03404 ATL_DEF_STMT_IDX(stmt_construct_idx) = curr_stmt_sh_idx;
03405 SH_ERR_FLG(curr_stmt_sh_idx) =
03406 SH_ERR_FLG(curr_stmt_sh_idx) || AT_DCL_ERR(stmt_construct_idx);
03407 stmt_construct_idx = NULL_IDX;
03408 }
03409
03410 curr_stmt_category = Executable_Stmt_Cat;
03411 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
03412 CURR_BLK_NO_EXEC = TRUE;
03413 blk_stk_start = blk_stk_idx - 1;
03414 }
03415 else {
03416
03417
03418
03419
03420
03421
03422
03423 stmt_type = Forall_Stmt;
03424 SH_STMT_TYPE(curr_stmt_sh_idx) = Forall_Stmt;
03425
03426 if (! CURR_BLK_NO_EXEC || CURR_BLK == Forall_Blk) {
03427 curr_stmt_category = Executable_Stmt_Cat;
03428 }
03429 else {
03430 iss_blk_stk_err();
03431 parse_err_flush(Find_EOS, NULL);
03432 goto EXIT;
03433 }
03434
03435
03436 if (MATCHED_TOKEN_CLASS(Tok_Class_Keyword)) {
03437 gen_sh(After, Null_Stmt, 0, 0, FALSE, FALSE, FALSE);
03438
03439 determine_stmt_type();
03440
03441 if (stmt_type == Assignment_Stmt) {
03442
03443
03444
03445
03446
03447
03448 INCREMENT_STATEMENT_NUMBER;
03449 in_action_stmt_of_if_where_or_forall = TRUE;
03450
03451 (*stmt_parsers[Assignment_Stmt])();
03452
03453 in_action_stmt_of_if_where_or_forall = FALSE;
03454
03455 if (SH_ERR_FLG(curr_stmt_sh_idx)) {
03456 SH_ERR_FLG(forall_sh_idx) = TRUE;
03457 goto EXIT;
03458 }
03459
03460 blk_stk_start = blk_stk_idx;
03461
03462
03463
03464 gen_sh(After, End_Forall_Stmt, SH_GLB_LINE(forall_sh_idx),
03465 SH_COL_NUM(forall_sh_idx), FALSE, FALSE, FALSE);
03466
03467 SH_PARENT_BLK_IDX(curr_stmt_sh_idx) = forall_sh_idx;
03468 IR_FLD_L(SH_IR_IDX(forall_sh_idx)) = SH_Tbl_Idx;
03469 IR_IDX_L(SH_IR_IDX(forall_sh_idx)) = curr_stmt_sh_idx;
03470 IR_LINE_NUM_L(SH_IR_IDX(forall_sh_idx)) =
03471 SH_GLB_LINE(forall_sh_idx);
03472 IR_COL_NUM_L(SH_IR_IDX(forall_sh_idx)) =
03473 SH_COL_NUM(forall_sh_idx);
03474
03475 }
03476 else {
03477 PRINTMSG(stmt_start_line, 365, Error, stmt_start_col);
03478 parse_err_flush(Find_EOS, NULL);
03479 NEXT_LA_CH;
03480 SH_ERR_FLG(forall_sh_idx) = TRUE;
03481 }
03482 }
03483 else {
03484 parse_err_flush(Find_EOS, "identifier or EOS");
03485 goto EXIT;
03486 }
03487 }
03488
03489
03490
03491
03492
03493
03494 for (i = blk_stk_start; i > 0; --i) {
03495
03496 if (BLK_TYPE(i) == Forall_Blk) {
03497 SH_PARENT_BLK_IDX(forall_sh_idx) = BLK_FIRST_SH_IDX(i);
03498 break;
03499 }
03500 }
03501
03502 EXIT:
03503
03504 if (LA_CH_VALUE == EOS) {
03505 NEXT_LA_CH;
03506 }
03507
03508 TRACE (Func_Exit, "parse_forall", NULL);
03509
03510 return;
03511
03512 }
03513
03514
03515
03516
03517
03518
03519
03520
03521
03522
03523
03524
03525
03526
03527
03528
03529
03530
03531
03532
03533
03534
03535
03536 void parse_goto_stmt(void)
03537
03538 {
03539 int attr_idx;
03540 int col;
03541 boolean comma_found = FALSE;
03542 int host_attr_idx;
03543 int host_name_idx;
03544 int ir_idx;
03545 boolean label_list_found = FALSE;
03546 int lbl_attr_idx;
03547 int line;
03548 int name_idx;
03549 opnd_type opnd;
03550
03551
03552 TRACE (Func_Entry, "parse_goto_stmt", NULL);
03553
03554
03555
03556
03557
03558
03559 line = TOKEN_LINE(token);
03560 col = TOKEN_COLUMN(token);
03561
03562 if (matched_specific_token(Tok_Kwd_To, Tok_Class_Keyword)) {
03563 if ( ! CURR_BLK_NO_EXEC || ! iss_blk_stk_err() ) {
03564 curr_stmt_category = Executable_Stmt_Cat;
03565 }
03566 }
03567 else {
03568 parse_err_flush(Find_EOS, "TO");
03569 goto EXIT;
03570 }
03571
03572
03573
03574
03575 NTR_IR_TBL(ir_idx);
03576 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
03577 IR_LINE_NUM(ir_idx) = line;
03578 IR_COL_NUM(ir_idx) = col;
03579
03580
03581
03582
03583
03584
03585 if (LA_CH_CLASS == Ch_Class_Digit) {
03586
03587 MATCHED_TOKEN_CLASS(Tok_Class_Label);
03588
03589 if ( ! TOKEN_ERR(token)) {
03590
03591 if (LA_CH_VALUE == EOS) {
03592
03593
03594
03595
03596 lbl_attr_idx = check_label_ref();
03597
03598 IR_OPR(ir_idx) = Br_Uncond_Opr;
03599
03600 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
03601 IR_LINE_NUM(ir_idx) = TOKEN_LINE(token);
03602 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(token);
03603 IR_LINE_NUM_R(ir_idx) = TOKEN_LINE(token);
03604 IR_COL_NUM_R(ir_idx) = TOKEN_COLUMN(token);
03605 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
03606 IR_IDX_R(ir_idx) = lbl_attr_idx;
03607 AT_REFERENCED(lbl_attr_idx) = Referenced;
03608
03609 if (cif_flags & MISC_RECS) {
03610 cif_stmt_type_rec(TRUE,
03611 CIF_Go_To_Unconditional_Stmt,
03612 statement_number);
03613 }
03614 }
03615 else {
03616
03617
03618
03619 parse_err_flush(Find_EOS, EOS_STR);
03620 }
03621 }
03622 else {
03623
03624
03625
03626
03627 parse_err_flush(Find_EOS, NULL);
03628 }
03629
03630 goto EXIT;
03631 }
03632
03633
03634
03635
03636
03637
03638 if (LA_CH_VALUE == LPAREN) {
03639
03640 IR_OPR(ir_idx) = Br_Index_Opr;
03641
03642 IR_TYPE_IDX(ir_idx) = INTEGER_DEFAULT_TYPE;
03643
03644
03645
03646
03647 if (parse_label_list(ir_idx)) {
03648 #ifdef KEY
03649 PRINTMSG(stmt_start_line, 1568, Ansi, stmt_start_col, "computed GOTO");
03650 #endif
03651
03652
03653
03654
03655 if (LA_CH_VALUE == COMMA) {
03656 NEXT_LA_CH;
03657 }
03658
03659
03660
03661
03662 if (parse_expr(&opnd)) {
03663
03664 COPY_OPND(IR_OPND_L(ir_idx), opnd);
03665
03666 if (LA_CH_VALUE != EOS) {
03667
03668
03669
03670 parse_err_flush(Find_EOS, EOS_STR);
03671 }
03672 }
03673 else {
03674 parse_err_flush(Find_EOS, NULL);
03675 }
03676 }
03677
03678 if (cif_flags & MISC_RECS) {
03679 cif_stmt_type_rec(TRUE, CIF_Go_To_Computed_Stmt, statement_number);
03680 }
03681
03682 goto EXIT;
03683 }
03684
03685
03686
03687
03688
03689
03690 if ( ! MATCHED_TOKEN_CLASS(Tok_Class_Id) ) {
03691 PRINTMSG(LA_CH_LINE, 339, Error, LA_CH_COLUMN,
03692 (LA_CH_CLASS == Ch_Class_EOS) ? "EOS" : &LA_CH_VALUE);
03693 parse_err_flush(Find_EOS, NULL);
03694 goto EXIT;
03695 }
03696
03697 IR_OPR(ir_idx) = Br_Asg_Opr;
03698
03699 IR_TYPE_IDX(ir_idx) = INTEGER_DEFAULT_TYPE;
03700
03701
03702
03703
03704
03705
03706 attr_idx = srch_sym_tbl(TOKEN_STR(token), TOKEN_LEN(token), &name_idx);
03707
03708 if (attr_idx == NULL_IDX) {
03709 host_attr_idx =
03710 srch_host_sym_tbl(TOKEN_STR(token),
03711 TOKEN_LEN(token),
03712 &host_name_idx,
03713 TRUE);
03714
03715 if (host_attr_idx == NULL_IDX) {
03716 attr_idx = ntr_sym_tbl(&token, name_idx);
03717 SET_IMPL_TYPE(attr_idx);
03718 }
03719 else {
03720 attr_idx = ntr_host_in_sym_tbl(&token, name_idx,
03721 host_attr_idx, host_name_idx,
03722 TRUE);
03723 }
03724 }
03725
03726 if (AT_DCL_ERR(attr_idx)) {
03727 parse_err_flush(Find_EOS, NULL);
03728 SH_ERR_FLG(curr_stmt_sh_idx) = TRUE;
03729 goto EXIT;
03730 }
03731
03732 AT_REFERENCED(attr_idx) = Referenced;
03733
03734 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
03735 IR_IDX_L(ir_idx) = attr_idx;
03736 IR_LINE_NUM_L(ir_idx) = TOKEN_LINE(token);
03737 IR_COL_NUM_L(ir_idx) = TOKEN_COLUMN(token);
03738
03739
03740
03741 if (LA_CH_VALUE == COMMA) {
03742 comma_found = TRUE;
03743 NEXT_LA_CH;
03744 }
03745
03746
03747
03748
03749 if (LA_CH_VALUE == LPAREN) {
03750 label_list_found = TRUE;
03751
03752 if ( ! parse_label_list(ir_idx) ) {
03753 goto EXIT;
03754 }
03755 }
03756 else {
03757 if (comma_found) {
03758 parse_err_flush(Find_EOS, "(");
03759 goto EXIT;
03760 }
03761 }
03762
03763
03764
03765
03766
03767
03768
03769
03770
03771 if (LA_CH_VALUE == EOS) {
03772 PRINTMSG(stmt_start_line, 1568, Ansi, stmt_start_col, "assign GOTO");
03773 }
03774 else {
03775
03776 if (label_list_found) {
03777 parse_err_flush(Find_EOS, EOS_STR);
03778 }
03779 else {
03780 parse_err_flush(Find_EOS, ", or ( or EOS");
03781 }
03782
03783 }
03784
03785 if (cif_flags & MISC_RECS) {
03786 cif_stmt_type_rec(TRUE, CIF_Go_To_Assigned_Stmt, statement_number);
03787 }
03788
03789 EXIT:
03790
03791 NEXT_LA_CH;
03792
03793 TRACE (Func_Exit, "parse_goto_stmt", NULL);
03794
03795 return;
03796
03797 }
03798
03799
03800
03801
03802
03803
03804
03805
03806
03807
03808
03809
03810
03811
03812
03813
03814
03815
03816
03817
03818
03819
03820
03821
03822
03823
03824
03825
03826
03827 void parse_if_stmt (void)
03828
03829 {
03830 opnd_type cond_expr;
03831 int expr_start_line;
03832 int expr_start_col;
03833 int if_stmt_sh_idx;
03834 int ir_idx;
03835 int lbl_attr_idx;
03836 int neg_il_idx;
03837 int pos_il_idx;
03838 int save_if_stmt_start_line;
03839 int save_if_stmt_start_col;
03840 int sh_idx;
03841 boolean stmt_parsers_called;
03842 int zero_il_idx;
03843
03844
03845 TRACE (Func_Entry, "parse_if_stmt", NULL);
03846
03847
03848
03849
03850
03851 if (LA_CH_VALUE == LPAREN) {
03852 NEXT_LA_CH;
03853
03854 expr_start_line = LA_CH_LINE;
03855 expr_start_col = LA_CH_COLUMN;
03856
03857 parse_expr(&cond_expr);
03858
03859 if (LA_CH_VALUE != RPAREN) {
03860
03861 if ( ! parse_err_flush(Find_Rparen, ")") ) {
03862 parse_err_flush(Find_EOS, NULL);
03863 goto EXIT;
03864 }
03865 }
03866 }
03867 else {
03868 parse_err_flush(Find_EOS, "(");
03869 goto EXIT;
03870 }
03871
03872 NEXT_LA_CH;
03873
03874
03875
03876
03877
03878
03879 if (MATCHED_TOKEN_CLASS(Tok_Class_Keyword)) {
03880
03881 if (TOKEN_VALUE(token) == Tok_Kwd_Then) {
03882
03883 if (LA_CH_VALUE != EOS) {
03884
03885
03886
03887 if (LA_CH_VALUE == USCORE || LA_CH_CLASS == Ch_Class_Letter ||
03888 LA_CH_CLASS == Ch_Class_Digit) {
03889 reset_lex(TOKEN_BUF_IDX(token), TOKEN_STMT_NUM(token));
03890 MATCHED_TOKEN_CLASS(Tok_Class_Id);
03891 goto PARSE_LOGICAL_IF;
03892 }
03893 else if (LA_CH_VALUE == LPAREN || LA_CH_VALUE == PERCENT ||
03894 LA_CH_VALUE == EQUAL) {
03895 goto PARSE_LOGICAL_IF;
03896 }
03897 else {
03898
03899
03900
03901
03902
03903 parse_err_flush(Find_EOS, EOS_STR);
03904 }
03905 }
03906
03907
03908
03909
03910
03911 if (if_stmt_lbl_idx == NULL_IDX) {
03912
03913
03914
03915
03916 if ( ! CURR_BLK_NO_EXEC || ! iss_blk_stk_err() ) {
03917 curr_stmt_category = Executable_Stmt_Cat;
03918 PUSH_BLK_STK (If_Blk);
03919 }
03920 else {
03921 PUSH_BLK_STK (If_Blk);
03922 CURR_BLK_ERR = TRUE;
03923 }
03924
03925 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
03926 LINK_TO_PARENT_BLK;
03927
03928 if (stmt_construct_idx != NULL_IDX) {
03929 CURR_BLK_NAME = stmt_construct_idx;
03930 ATL_CLASS(stmt_construct_idx) = Lbl_Construct;
03931 ATL_DEF_STMT_IDX(stmt_construct_idx) = curr_stmt_sh_idx;
03932 SH_ERR_FLG(curr_stmt_sh_idx) =
03933 SH_ERR_FLG(curr_stmt_sh_idx) | AT_DCL_ERR(stmt_construct_idx);
03934 stmt_construct_idx = NULL_IDX;
03935 }
03936
03937
03938
03939
03940
03941
03942 if ( ! SH_ERR_FLG(curr_stmt_sh_idx) ) {
03943 NTR_IR_TBL(ir_idx);
03944 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
03945 IR_OPR(ir_idx) = Br_True_Opr;
03946 IR_TYPE_IDX(ir_idx) = LOGICAL_DEFAULT_TYPE;
03947 IR_LINE_NUM(ir_idx) = expr_start_line;
03948 IR_COL_NUM(ir_idx) = expr_start_col;
03949 COPY_OPND(IR_OPND_L(ir_idx), cond_expr);
03950 #if 0
03951 CURR_BLK_LABEL = gen_internal_lbl(stmt_start_line);
03952 IR_LINE_NUM_R(ir_idx) = expr_start_line;
03953 IR_COL_NUM_R(ir_idx) = expr_start_col;
03954 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
03955 IR_IDX_R(ir_idx) = CURR_BLK_LABEL;
03956 #endif
03957 }
03958
03959
03960
03961
03962
03963 gen_sh(After, Then_Stmt, TOKEN_LINE(token), TOKEN_COLUMN(token),
03964 SH_ERR_FLG(curr_stmt_sh_idx), FALSE, FALSE);
03965
03966 PUSH_BLK_STK(If_Then_Blk);
03967 blk_stk[blk_stk_idx] = blk_stk[blk_stk_idx - 1];
03968 CURR_BLK = If_Then_Blk;
03969 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
03970 LINK_TO_PARENT_BLK;
03971
03972 if (cif_flags & MISC_RECS) {
03973 cif_stmt_type_rec(TRUE, CIF_If_Construct, statement_number);
03974 }
03975 }
03976 else {
03977
03978
03979
03980
03981 PRINTMSG(stmt_start_line, 365, Error, stmt_start_col);
03982 }
03983
03984 goto EXIT;
03985
03986 }
03987
03988
03989
03990
03991
03992
03993
03994
03995 PARSE_LOGICAL_IF:
03996
03997 stmt_type = If_Stmt;
03998 SH_STMT_TYPE(curr_stmt_sh_idx) = If_Stmt;
03999 if_stmt_sh_idx = curr_stmt_sh_idx;
04000 save_if_stmt_start_line = stmt_start_line;
04001 save_if_stmt_start_col = stmt_start_col;
04002
04003 if ( ! CURR_BLK_NO_EXEC || ! iss_blk_stk_err() ) {
04004 curr_stmt_category = Executable_Stmt_Cat;
04005 }
04006
04007 if (if_stmt_lbl_idx == NULL_IDX) {
04008 if_stmt_lbl_idx = gen_internal_lbl(stmt_start_line);
04009 }
04010 else {
04011 PRINTMSG(stmt_start_line, 365, Error, stmt_start_col);
04012 parse_err_flush(Find_EOS, NULL);
04013 NEXT_LA_CH;
04014 goto EXIT;
04015 }
04016
04017 if (cif_flags & MISC_RECS) {
04018 cif_stmt_type_rec(TRUE, CIF_If_Logical_Stmt, statement_number);
04019 }
04020
04021
04022
04023
04024
04025
04026
04027
04028
04029
04030 if ( ! SH_ERR_FLG(curr_stmt_sh_idx) ) {
04031 NTR_IR_TBL(ir_idx);
04032 SH_IR_IDX(if_stmt_sh_idx) = ir_idx;
04033 IR_OPR(ir_idx) = Br_True_Opr;
04034 IR_TYPE_IDX(ir_idx) = LOGICAL_DEFAULT_TYPE;
04035 IR_LINE_NUM(ir_idx) = expr_start_line;
04036 IR_COL_NUM(ir_idx) = expr_start_col;
04037
04038 COPY_OPND(IR_OPND_L(ir_idx), cond_expr);
04039 IR_LINE_NUM_R(ir_idx) = expr_start_line;
04040 IR_COL_NUM_R(ir_idx) = expr_start_col;
04041 IR_FLD_R(ir_idx) = AT_Tbl_Idx;
04042 IR_IDX_R(ir_idx) = if_stmt_lbl_idx;
04043 AT_REFERENCED(if_stmt_lbl_idx) = Referenced;
04044 }
04045
04046
04047
04048
04049
04050
04051 gen_sh(After, Null_Stmt, 0, 0, FALSE, FALSE, FALSE);
04052
04053 SH_ACTION_STMT(curr_stmt_sh_idx) = TRUE;
04054 stmt_parsers_called = FALSE;
04055
04056 determine_stmt_type();
04057
04058 if (stmt_type == Where_Cstrct_Stmt ||
04059 stmt_type == End_Stmt ||
04060 stmt_type == Forall_Cstrct_Stmt) {
04061
04062
04063
04064
04065
04066
04067
04068
04069
04070
04071
04072
04073
04074
04075
04076 INCREMENT_STATEMENT_NUMBER;
04077 stmt_parsers_called = TRUE;
04078 in_action_stmt_of_if_where_or_forall = TRUE;
04079
04080 (*stmt_parsers[stmt_type])();
04081
04082 in_action_stmt_of_if_where_or_forall = FALSE;
04083 }
04084
04085 switch (stmt_type) {
04086 case Allocatable_Stmt:
04087 case Automatic_Stmt:
04088 #ifdef KEY
04089 case Bind_Stmt:
04090 #endif
04091 case Common_Stmt:
04092 case Contains_Stmt:
04093 case Cpnt_Decl_Stmt:
04094 case Data_Stmt:
04095 case Derived_Type_Stmt:
04096 case Dimension_Stmt:
04097 case Directive_Stmt:
04098 case Equivalence_Stmt:
04099 case External_Stmt:
04100 case Format_Stmt:
04101 case Implicit_Stmt:
04102 case Implicit_None_Stmt:
04103 #ifdef KEY
04104 case Import_Stmt:
04105 #endif
04106 #ifdef KEY
04107 case Enum_Stmt:
04108 case Enumerator_Stmt:
04109 #endif
04110 case Intent_Stmt:
04111 case Interface_Stmt:
04112 case Intrinsic_Stmt:
04113 case Module_Proc_Stmt:
04114 case Namelist_Stmt:
04115 case Optional_Stmt:
04116 case Parameter_Stmt:
04117 case Pointer_Stmt:
04118 case Private_Stmt:
04119 case Public_Stmt:
04120 case Save_Stmt:
04121 case Sequence_Stmt:
04122 case Stmt_Func_Stmt:
04123 case Target_Stmt:
04124 case Task_Common_Stmt:
04125 case Type_Decl_Stmt:
04126 case Use_Stmt:
04127 case Volatile_Stmt:
04128 case Blockdata_Stmt:
04129 case Elemental_Stmt:
04130 case Function_Stmt:
04131 case Module_Stmt:
04132 case Program_Stmt:
04133 case Pure_Stmt:
04134 case Recursive_Stmt:
04135 case Subroutine_Stmt:
04136 #ifdef KEY
04137 case Value_Stmt:
04138 #endif
04139
04140 PRINTMSG(stmt_start_line, 365, Error, stmt_start_col);
04141 parse_err_flush(Find_EOS, NULL);
04142 NEXT_LA_CH;
04143 SH_ERR_FLG(if_stmt_sh_idx) = TRUE;
04144 stmt_type = If_Stmt;
04145 break;
04146
04147 case Where_Cstrct_Stmt:
04148 case Forall_Cstrct_Stmt:
04149
04150
04151
04152
04153
04154 if (CURR_BLK == Where_Then_Blk) {
04155 POP_BLK_STK;
04156 }
04157
04158 sh_idx = curr_stmt_sh_idx;
04159
04160 while (SH_STMT_TYPE(sh_idx) != If_Stmt) {
04161 SH_ERR_FLG(sh_idx) = TRUE;
04162 sh_idx = SH_PREV_IDX(sh_idx);
04163 }
04164
04165
04166
04167 case Case_Stmt:
04168 case Do_Iterative_Stmt:
04169 case Do_While_Stmt:
04170 case Do_Infinite_Stmt:
04171 case Else_Stmt:
04172 case Entry_Stmt:
04173 case Select_Stmt:
04174
04175 PRINTMSG(stmt_start_line, 365, Error, stmt_start_col);
04176
04177 if (stmt_type != Where_Cstrct_Stmt) {
04178 parse_err_flush(Find_EOS, NULL);
04179 NEXT_LA_CH;
04180 }
04181
04182 SH_ERR_FLG(if_stmt_sh_idx) = TRUE;
04183 stmt_type = If_Stmt;
04184 goto EXIT;
04185
04186 case Allocate_Stmt:
04187 case Arith_If_Stmt:
04188 case Assign_Stmt:
04189 case Assignment_Stmt:
04190 case Backspace_Stmt:
04191 case Buffer_Stmt:
04192 case Call_Stmt:
04193 case Close_Stmt:
04194 case Continue_Stmt:
04195 case Cycle_Stmt:
04196 case Deallocate_Stmt:
04197 case Decode_Stmt:
04198 case Else_If_Stmt:
04199 case Else_Where_Stmt:
04200 case Encode_Stmt:
04201 case Exit_Stmt:
04202 case Goto_Stmt:
04203 case If_Cstrct_Stmt:
04204 case If_Stmt:
04205 case Inquire_Stmt:
04206 case Nullify_Stmt:
04207 case Open_Stmt:
04208 case Outmoded_If_Stmt:
04209 case Pause_Stmt:
04210 case Print_Stmt:
04211 case Read_Stmt:
04212 case Return_Stmt:
04213 case Rewind_Stmt:
04214 case Stop_Stmt:
04215 case Then_Stmt:
04216 case Write_Stmt:
04217 case Endfile_Stmt:
04218 case Where_Stmt:
04219 case Forall_Stmt:
04220
04221
04222 if (!stmt_parsers_called) {
04223
04224
04225
04226
04227 INCREMENT_STATEMENT_NUMBER;
04228 in_action_stmt_of_if_where_or_forall = TRUE;
04229
04230 (*stmt_parsers[stmt_type])();
04231
04232 in_action_stmt_of_if_where_or_forall = FALSE;
04233 }
04234
04235
04236
04237
04238
04239
04240
04241
04242 gen_if_ir(if_stmt_lbl_idx,
04243 if_stmt_sh_idx,
04244 save_if_stmt_start_line,
04245 save_if_stmt_start_col);
04246
04247 stmt_type = If_Stmt;
04248 break;
04249
04250 case End_Stmt:
04251 case End_Blockdata_Stmt:
04252 case End_Do_Stmt:
04253 case End_Function_Stmt:
04254 case End_If_Stmt:
04255 case End_Interface_Stmt:
04256 #ifdef KEY
04257 case End_Enum_Stmt:
04258 #endif
04259 case End_Module_Stmt:
04260 case End_Program_Stmt:
04261 case End_Select_Stmt:
04262 case End_Subroutine_Stmt:
04263 case End_Type_Stmt:
04264 case End_Where_Stmt:
04265 case End_Forall_Stmt:
04266
04267 PRINTMSG(stmt_start_line, 365, Error, stmt_start_col);
04268 SH_ERR_FLG(if_stmt_sh_idx) = TRUE;
04269 stmt_type = If_Stmt;
04270 break;
04271
04272 case Null_Stmt:
04273 case Type_Init_Stmt:
04274 case Label_Def:
04275 case Construct_Def:
04276 case Automatic_Base_Calc_Stmt:
04277 case Automatic_Base_Size_Stmt:
04278 case End_Parallel_Stmt:
04279 case End_Do_Parallel_Stmt:
04280 case End_Parallel_Case_Stmt:
04281 case Parallel_Case_Stmt:
04282 case End_Guard_Stmt:
04283 case Statement_Num_Stmt:
04284 case SGI_Section_Stmt:
04285 case SGI_End_Psection_Stmt:
04286 case SGI_End_Pdo_Stmt:
04287 case SGI_End_Parallel_Stmt:
04288 case SGI_End_Critical_Section_Stmt:
04289 case SGI_End_Single_Process_Stmt:
04290 case SGI_Region_End_Stmt:
04291 case Open_MP_Section_Stmt:
04292 case Open_MP_End_Parallel_Stmt:
04293 case Open_MP_End_Do_Stmt:
04294 case Open_MP_End_Parallel_Sections_Stmt:
04295 case Open_MP_End_Sections_Stmt:
04296 case Open_MP_End_Section_Stmt:
04297 case Open_MP_End_Single_Stmt:
04298 case Open_MP_End_Parallel_Do_Stmt:
04299 case Open_MP_End_Master_Stmt:
04300 case Open_MP_End_Critical_Stmt:
04301 case Open_MP_End_Ordered_Stmt:
04302
04303 # if defined(_DEBUG)
04304
04305
04306
04307
04308
04309
04310
04311
04312
04313
04314 PRINTMSG(stmt_start_line, 366, Internal, stmt_start_col);
04315 # endif
04316 break;
04317
04318 }
04319
04320 goto EXIT;
04321
04322 }
04323
04324
04325
04326
04327
04328
04329
04330
04331 if (LA_CH_CLASS == Ch_Class_Digit) {
04332
04333 if ( ! CURR_BLK_NO_EXEC || ! iss_blk_stk_err() ) {
04334 curr_stmt_category = Executable_Stmt_Cat;
04335 }
04336
04337 stmt_type = Arith_If_Stmt;
04338 SH_STMT_TYPE(curr_stmt_sh_idx) = Arith_If_Stmt;
04339
04340
04341
04342
04343 NTR_IR_TBL(ir_idx);
04344 IR_OPR(ir_idx) = Br_Aif_Opr;
04345
04346 IR_TYPE_IDX(ir_idx) = INTEGER_DEFAULT_TYPE;
04347 IR_LINE_NUM(ir_idx) = expr_start_line;
04348 IR_COL_NUM(ir_idx) = expr_start_col;
04349 COPY_OPND(IR_OPND_L(ir_idx), cond_expr);
04350
04351 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
04352
04353
04354
04355
04356
04357 MATCHED_TOKEN_CLASS(Tok_Class_Label);
04358
04359 if (TOKEN_ERR(token)) {
04360 parse_err_flush(Find_EOS, NULL);
04361 goto EXIT;
04362 }
04363
04364
04365
04366
04367 lbl_attr_idx = check_label_ref();
04368
04369 NTR_IR_LIST_TBL(neg_il_idx);
04370 IL_LINE_NUM(neg_il_idx) = TOKEN_LINE(token);
04371 IL_COL_NUM(neg_il_idx) = TOKEN_COLUMN(token);
04372 IL_FLD(neg_il_idx) = AT_Tbl_Idx;
04373 IL_IDX(neg_il_idx) = lbl_attr_idx;
04374 AT_REFERENCED(lbl_attr_idx) = Referenced;
04375
04376 IR_FLD_R(ir_idx) = IL_Tbl_Idx;
04377 IR_IDX_R(ir_idx) = neg_il_idx;
04378 ++IR_LIST_CNT_R(ir_idx);
04379
04380 if (LA_CH_VALUE == COMMA) {
04381 NEXT_LA_CH;
04382
04383 if (MATCHED_TOKEN_CLASS(Tok_Class_Label)) {
04384
04385 if (TOKEN_ERR(token)) {
04386 parse_err_flush(Find_EOS, NULL);
04387 goto EXIT;
04388 }
04389
04390 lbl_attr_idx = check_label_ref();
04391
04392 NTR_IR_LIST_TBL(zero_il_idx);
04393 IL_LINE_NUM(zero_il_idx) = TOKEN_LINE(token);
04394 IL_COL_NUM(zero_il_idx) = TOKEN_COLUMN(token);
04395 IL_FLD(zero_il_idx) = AT_Tbl_Idx;
04396 IL_IDX(zero_il_idx) = lbl_attr_idx;
04397 AT_REFERENCED(lbl_attr_idx) = Referenced;
04398
04399 IL_NEXT_LIST_IDX(zero_il_idx) = neg_il_idx;
04400 IL_PREV_LIST_IDX(neg_il_idx) = zero_il_idx;
04401
04402 IR_IDX_R(ir_idx) = zero_il_idx;
04403 ++IR_LIST_CNT_R(ir_idx);
04404
04405 if (LA_CH_VALUE == COMMA) {
04406 NEXT_LA_CH;
04407
04408 if (MATCHED_TOKEN_CLASS(Tok_Class_Label)) {
04409
04410 if (TOKEN_ERR(token)) {
04411 parse_err_flush(Find_EOS, NULL);
04412 goto EXIT;
04413 }
04414
04415 lbl_attr_idx = check_label_ref();
04416
04417 NTR_IR_LIST_TBL(pos_il_idx);
04418 IL_LINE_NUM(pos_il_idx) = TOKEN_LINE(token);
04419 IL_COL_NUM(pos_il_idx) = TOKEN_COLUMN(token);
04420 IL_FLD(pos_il_idx) = AT_Tbl_Idx;
04421 IL_IDX(pos_il_idx) = lbl_attr_idx;
04422 AT_REFERENCED(lbl_attr_idx) = Referenced;
04423
04424 IL_NEXT_LIST_IDX(zero_il_idx) = pos_il_idx;
04425 IL_PREV_LIST_IDX(pos_il_idx) = zero_il_idx;
04426 IL_NEXT_LIST_IDX(pos_il_idx) = neg_il_idx;
04427 IL_PREV_LIST_IDX(neg_il_idx) = pos_il_idx;
04428
04429 ++IR_LIST_CNT_R(ir_idx);
04430
04431 if (LA_CH_VALUE == EOS) {
04432
04433
04434
04435
04436
04437 #ifdef KEY
04438 PRINTMSG(stmt_start_line, 112, Ansi, stmt_start_col);
04439 #else
04440 PRINTMSG(stmt_start_line, 112, Comment, stmt_start_col);
04441 #endif
04442
04443 if (cif_flags & MISC_RECS) {
04444 cif_stmt_type_rec(TRUE,
04445 CIF_If_Arithmetic_Stmt,
04446 statement_number);
04447 }
04448 }
04449 else {
04450 parse_err_flush(Find_EOS, EOS_STR);
04451 }
04452 }
04453 else {
04454 parse_err_flush(Find_EOS, "label");
04455 }
04456 }
04457 else {
04458
04459 if (LA_CH_VALUE == EOS) {
04460
04461
04462
04463
04464
04465
04466 stmt_type = Outmoded_If_Stmt;
04467 SH_STMT_TYPE(curr_stmt_sh_idx) = Outmoded_If_Stmt;
04468
04469 PRINTMSG(stmt_start_line, 406, Ansi, stmt_start_col);
04470
04471 if (cif_flags & MISC_RECS) {
04472 gen_sh(Before, Statement_Num_Stmt, statement_number, 0,
04473 FALSE, FALSE, TRUE);
04474 }
04475 }
04476 else {
04477 parse_err_flush(Find_EOS, ", or EOS");
04478 }
04479 }
04480 }
04481 else {
04482 parse_err_flush(Find_EOS, "label");
04483 }
04484 }
04485 else {
04486 parse_err_flush(Find_EOS, ",");
04487 }
04488 }
04489 else {
04490
04491
04492
04493 PRINTMSG(LA_CH_LINE, 377, Error, LA_CH_COLUMN);
04494 parse_err_flush(Find_EOS, NULL);
04495 }
04496
04497 EXIT:
04498
04499 if (stmt_type == If_Stmt) {
04500 if_stmt_lbl_idx = NULL_IDX;
04501 }
04502 else {
04503
04504 if (stmt_type == If_Cstrct_Stmt && SH_ERR_FLG(curr_stmt_sh_idx) &&
04505 stmt_label_idx != NULL_IDX) {
04506 AT_DCL_ERR(stmt_label_idx) = TRUE;
04507 }
04508
04509 NEXT_LA_CH;
04510 }
04511
04512 TRACE (Func_Exit, "parse_if_stmt", NULL);
04513
04514 return;
04515
04516 }
04517
04518
04519
04520
04521
04522
04523
04524
04525
04526
04527
04528
04529
04530
04531
04532
04533
04534
04535 void parse_nullify_stmt (void)
04536
04537 {
04538 int ir_idx;
04539 int list1_idx;
04540 int list2_idx = NULL_IDX;
04541 int num_items = 0;
04542 opnd_type opnd;
04543 boolean parsed_ok = TRUE;
04544
04545 TRACE (Func_Entry, "parse_nullify_stmt", NULL);
04546
04547 if (LA_CH_VALUE != LPAREN) {
04548 parse_err_flush(Find_EOS, "(");
04549 goto EXIT;
04550 }
04551
04552
04553 if (!CURR_BLK_NO_EXEC || !iss_blk_stk_err()) {
04554 curr_stmt_category = Executable_Stmt_Cat;
04555 }
04556
04557 NTR_IR_TBL(ir_idx);
04558 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
04559 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(token);
04560 IR_LINE_NUM(ir_idx) = TOKEN_LINE(token);
04561 IR_OPR(ir_idx) = Nullify_Opr;
04562 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
04563 IR_FLD_L(ir_idx) = IL_Tbl_Idx;
04564
04565 do {
04566 NEXT_LA_CH;
04567 num_items++;
04568
04569 NTR_IR_LIST_TBL(list1_idx);
04570
04571 if (list2_idx) {
04572 IL_NEXT_LIST_IDX(list2_idx) = list1_idx;
04573 IL_PREV_LIST_IDX(list1_idx) = list2_idx;
04574 }
04575 else {
04576 IR_IDX_L(ir_idx) = list1_idx;
04577 }
04578 list2_idx = list1_idx;
04579
04580 if (MATCHED_TOKEN_CLASS(Tok_Class_Id)) {
04581 parsed_ok = parse_deref(&opnd, NULL_IDX) && parsed_ok;
04582 COPY_OPND(IL_OPND(list1_idx), opnd);
04583
04584 mark_attr_defined(&opnd);
04585 }
04586 else {
04587 parsed_ok = FALSE;
04588 parse_err_flush(Find_Comma_Rparen, "IDENTIFIER");
04589 }
04590 }
04591 while (LA_CH_VALUE == COMMA);
04592
04593 IR_LIST_CNT_L(ir_idx) = num_items;
04594
04595 if (LA_CH_VALUE != RPAREN) {
04596 parse_err_flush(Find_EOS, ")");
04597 }
04598 else {
04599 NEXT_LA_CH;
04600 }
04601
04602 EXIT:
04603
04604 if (LA_CH_VALUE != EOS) {
04605 parse_err_flush(Find_EOS, EOS_STR);
04606 }
04607
04608 matched_specific_token(Tok_EOS, Tok_Class_Punct);
04609
04610 TRACE (Func_Exit, "parse_nullify_stmt", NULL);
04611
04612 return;
04613
04614 }
04615
04616
04617
04618
04619
04620
04621
04622
04623
04624
04625
04626
04627
04628
04629
04630
04631
04632
04633
04634
04635 void parse_return_stmt (void)
04636
04637 {
04638 int ir_idx;
04639 opnd_type opnd;
04640
04641
04642 TRACE (Func_Entry, "parse_return_stmt", NULL);
04643
04644
04645
04646 if (CURR_BLK_NO_EXEC ||
04647 (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Function &&
04648 ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) != Subroutine)) {
04649 iss_blk_stk_err();
04650 }
04651
04652 if (cmd_line_flags.debug_lvl == Debug_Lvl_1) {
04653 gen_debug_lbl_stmt(curr_stmt_sh_idx, Ldbg_Start_Epilogue, NULL_IDX);
04654 }
04655
04656 curr_stmt_category = Executable_Stmt_Cat;
04657
04658 NTR_IR_TBL(ir_idx);
04659 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
04660
04661 IR_OPR(ir_idx) = Return_Opr;
04662 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
04663 IR_LINE_NUM(ir_idx) = LA_CH_LINE;
04664 IR_COL_NUM(ir_idx) = LA_CH_COLUMN;
04665
04666 if (LA_CH_VALUE != EOS) {
04667
04668
04669
04670 PRINTMSG(IR_LINE_NUM(ir_idx), 371,
04671 #ifdef KEY
04672 Ansi,
04673 #else
04674 Comment,
04675 #endif
04676 IR_COL_NUM(ir_idx));
04677
04678
04679
04680 if (ATP_PGM_UNIT(SCP_ATTR_IDX(curr_scp_idx)) == Function) {
04681 PRINTMSG(IR_LINE_NUM(ir_idx), 370, Error, IR_COL_NUM(ir_idx));
04682 }
04683
04684
04685
04686
04687 if (parse_expr(&opnd)) {
04688
04689 COPY_OPND(IR_OPND_L(ir_idx), opnd);
04690
04691 if (LA_CH_VALUE != EOS) {
04692
04693
04694
04695 parse_err_flush(Find_EOS, EOS_STR);
04696 }
04697 }
04698 }
04699
04700 NEXT_LA_CH;
04701
04702 TRACE (Func_Exit, "parse_return_stmt", NULL);
04703
04704 return;
04705
04706 }
04707
04708
04709
04710
04711
04712
04713
04714
04715
04716
04717
04718
04719
04720
04721
04722
04723
04724
04725 void parse_select_stmt (void)
04726
04727 {
04728 opnd_type expr_opnd;
04729 int first_select_ir_idx;
04730 int second_select_ir_idx;
04731
04732
04733 TRACE (Func_Entry, "parse_select_stmt", NULL);
04734
04735 if (matched_specific_token(Tok_Kwd_Case, Tok_Class_Keyword) &&
04736 LA_CH_VALUE == LPAREN) {
04737 NEXT_LA_CH;
04738 }
04739 else if (TOKEN_VALUE(token) == Tok_Kwd_Case) {
04740 parse_err_flush(Find_EOS, "(");
04741 goto EXIT;
04742 }
04743 else {
04744 parse_err_flush(Find_EOS, "CASE");
04745 goto EXIT;
04746 }
04747
04748 if (CURR_BLK_NO_EXEC && iss_blk_stk_err()) {
04749 PUSH_BLK_STK (Select_Blk);
04750 CURR_BLK_ERR = TRUE;
04751 }
04752 else {
04753 PUSH_BLK_STK (Select_Blk);
04754 curr_stmt_category = Executable_Stmt_Cat;
04755 }
04756
04757 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
04758 CURR_BLK_NO_EXEC = TRUE;
04759 BLK_CASE_DEFAULT_LBL_FLD(blk_stk_idx) = NO_Tbl_Idx;
04760 LINK_TO_PARENT_BLK;
04761
04762 if (stmt_construct_idx != NULL_IDX) {
04763 CURR_BLK_NAME = stmt_construct_idx;
04764 ATL_CLASS(stmt_construct_idx) = Lbl_Construct;
04765 ATL_DEF_STMT_IDX(stmt_construct_idx) = curr_stmt_sh_idx;
04766 SH_ERR_FLG(curr_stmt_sh_idx) =
04767 SH_ERR_FLG(curr_stmt_sh_idx) || AT_DCL_ERR(stmt_construct_idx);
04768 stmt_construct_idx = NULL_IDX;
04769 }
04770
04771
04772
04773
04774
04775
04776
04777
04778
04779
04780
04781 NTR_IR_TBL(first_select_ir_idx);
04782 SH_IR_IDX(curr_stmt_sh_idx) = first_select_ir_idx;
04783 IR_OPR(first_select_ir_idx) = Select_Opr;
04784
04785 IR_TYPE_IDX(first_select_ir_idx) = TYPELESS_DEFAULT_TYPE;
04786
04787 if (parse_expr(&expr_opnd)) {
04788 NTR_IR_TBL(second_select_ir_idx);
04789 IR_OPR(second_select_ir_idx) = Select_Opr;
04790
04791 IR_TYPE_IDX(second_select_ir_idx) = TYPELESS_DEFAULT_TYPE;
04792 IR_LINE_NUM(second_select_ir_idx) = stmt_start_line;
04793 IR_COL_NUM(second_select_ir_idx) = stmt_start_col;
04794 COPY_OPND(IR_OPND_L(second_select_ir_idx), expr_opnd);
04795
04796 IR_FLD_L(first_select_ir_idx) = IR_Tbl_Idx;
04797 IR_IDX_L(first_select_ir_idx) = second_select_ir_idx;
04798
04799 CURR_BLK_LABEL = gen_internal_lbl(stmt_start_line);
04800 AT_REFERENCED(CURR_BLK_LABEL) = Referenced;
04801 }
04802
04803 if (LA_CH_VALUE == RPAREN) {
04804 NEXT_LA_CH;
04805 }
04806 else {
04807 parse_err_flush(Find_EOS, ")");
04808 }
04809
04810 if (LA_CH_VALUE != EOS) {
04811 parse_err_flush(Find_EOS, EOS_STR);
04812 }
04813
04814 CURR_BLK_ERR = SH_ERR_FLG(curr_stmt_sh_idx);
04815
04816 EXIT:
04817
04818 NEXT_LA_CH;
04819
04820 TRACE (Func_Exit, "parse_select_stmt", NULL);
04821
04822 return;
04823
04824 }
04825
04826
04827
04828
04829
04830
04831
04832
04833
04834
04835
04836
04837
04838
04839
04840
04841
04842
04843
04844
04845
04846
04847
04848
04849
04850
04851
04852
04853
04854
04855
04856
04857
04858 void parse_stop_pause_stmt (void)
04859
04860 {
04861 opnd_type opnd;
04862 int ir_idx;
04863
04864
04865 TRACE (Func_Entry, "parse_stop_pause_stmt", NULL);
04866
04867 if (cmd_line_flags.debug_lvl == Debug_Lvl_1) {
04868 gen_debug_lbl_stmt(curr_stmt_sh_idx, Ldbg_Exit_Point, NULL_IDX);
04869 }
04870
04871 if (!CURR_BLK_NO_EXEC || !iss_blk_stk_err()) {
04872 curr_stmt_category = Executable_Stmt_Cat;
04873 }
04874
04875 if (ATP_PURE(SCP_ATTR_IDX(curr_scp_idx)) ||
04876 ATP_ELEMENTAL(SCP_ATTR_IDX(curr_scp_idx))) {
04877 PRINTMSG(TOKEN_LINE(token), 1262, Error,
04878 TOKEN_COLUMN(token),
04879 stmt_type_str[stmt_type],
04880 ATP_PURE(SCP_ATTR_IDX(curr_scp_idx)) ? "pure" : "elemental",
04881 AT_OBJ_NAME_PTR(SCP_ATTR_IDX(curr_scp_idx)));
04882 }
04883
04884 NTR_IR_TBL(ir_idx);
04885 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
04886 IR_LINE_NUM(ir_idx) = LA_CH_LINE;
04887 IR_COL_NUM(ir_idx) = LA_CH_COLUMN;
04888
04889 if (stmt_type == Stop_Stmt) {
04890 IR_OPR(ir_idx) = Stop_Opr;
04891 }
04892 else {
04893 IR_OPR(ir_idx) = Pause_Opr;
04894
04895
04896
04897 PRINTMSG(TOKEN_LINE(token), 1568, Ansi, TOKEN_COLUMN(token), "PAUSE");
04898 }
04899
04900 if (LA_CH_VALUE != EOS) {
04901
04902 if (LA_CH_CLASS == Ch_Class_Digit) {
04903 matched_specific_token(Tok_Const_Int, Tok_Class_Int_Spec);
04904
04905 if (LA_CH_VALUE != EOS) {
04906
04907 parse_err_flush(Find_EOS, EOS_STR);
04908 }
04909 else {
04910 IR_FLD_L(ir_idx) = CN_Tbl_Idx;
04911 IR_IDX_L(ir_idx) = TOKEN_CONST_TBL_IDX(token);
04912 IR_COL_NUM_L(ir_idx) = TOKEN_COLUMN(token);
04913 IR_LINE_NUM_L(ir_idx) = TOKEN_LINE(token);
04914 }
04915 }
04916
04917
04918
04919 else if (parse_expr(&opnd)) {
04920
04921 COPY_OPND(IR_OPND_L(ir_idx), opnd);
04922
04923 if (LA_CH_VALUE != EOS) {
04924
04925 parse_err_flush(Find_EOS, EOS_STR);
04926 }
04927 }
04928 }
04929
04930
04931
04932 if (stmt_type == Stop_Stmt &&
04933 ! cdir_switches.parallel_region &&
04934 ! cdir_switches.doall_region &&
04935 ! cdir_switches.guard) {
04936
04937 gen_sh(After, Return_Stmt, stmt_start_line, stmt_start_col,
04938 SH_ERR_FLG(curr_stmt_sh_idx), FALSE, TRUE);
04939
04940 NTR_IR_TBL(ir_idx);
04941 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
04942 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
04943
04944 IR_OPR(ir_idx) = Return_Opr;
04945 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
04946 IR_LINE_NUM(ir_idx) = stmt_start_line;
04947 IR_COL_NUM(ir_idx) = stmt_start_col;
04948 }
04949
04950
04951 NEXT_LA_CH;
04952
04953 TRACE (Func_Exit, "parse_stop_pause_stmt", NULL);
04954
04955 return;
04956
04957 }
04958
04959
04960
04961
04962
04963
04964
04965
04966
04967
04968
04969
04970
04971
04972
04973
04974
04975
04976 void parse_where_stmt (void)
04977
04978 {
04979 int col;
04980 int ir_idx;
04981 int line;
04982 opnd_type opnd;
04983 int save_curr_stmt_sh_idx;
04984
04985
04986 TRACE (Func_Entry, "parse_where_stmt", NULL);
04987
04988 if (LA_CH_VALUE != LPAREN) {
04989 parse_err_flush(Find_EOS, "(");
04990 goto EXIT;
04991 }
04992
04993 NTR_IR_TBL(ir_idx);
04994 IR_OPR(ir_idx) = Where_Opr;
04995 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
04996 IR_LINE_NUM(ir_idx) = TOKEN_LINE(token);
04997 IR_COL_NUM(ir_idx) = TOKEN_COLUMN(token);
04998
04999 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
05000
05001 if (CURR_BLK == Where_Then_Blk ||
05002 CURR_BLK == Where_Else_Blk ||
05003 CURR_BLK == Where_Else_Mask_Blk) {
05004
05005 SH_PARENT_BLK_IDX(curr_stmt_sh_idx) = CURR_BLK_FIRST_SH_IDX;
05006 }
05007
05008
05009
05010
05011
05012 NEXT_LA_CH;
05013
05014 parse_expr(&opnd);
05015
05016 if (LA_CH_VALUE != RPAREN) {
05017 if (! parse_err_flush(Find_Rparen, ")")) {
05018 goto EXIT;
05019 }
05020 }
05021
05022
05023 NEXT_LA_CH;
05024
05025 COPY_OPND(IR_OPND_L(ir_idx), opnd);
05026
05027 if (LA_CH_VALUE != EOS) {
05028
05029
05030 stmt_type = Where_Stmt;
05031 SH_STMT_TYPE(curr_stmt_sh_idx) = Where_Stmt;
05032
05033 if (cif_flags & MISC_RECS) {
05034 cif_stmt_type_rec(TRUE, CIF_Where_Stmt, statement_number);
05035 }
05036
05037 if (CURR_BLK_NO_EXEC &&
05038 CURR_BLK != Forall_Blk &&
05039 CURR_BLK != Where_Then_Blk &&
05040 CURR_BLK != Where_Else_Blk &&
05041 CURR_BLK != Where_Else_Mask_Blk) {
05042 iss_blk_stk_err();
05043 parse_err_flush(Find_EOS, NULL);
05044 goto EXIT;
05045 }
05046
05047
05048
05049
05050
05051
05052
05053
05054 INCREMENT_STATEMENT_NUMBER;
05055
05056 gen_sh(After, Statement_Num_Stmt, stmt_start_line, stmt_start_col,
05057 FALSE, FALSE, TRUE);
05058 SH_PARENT_BLK_IDX(curr_stmt_sh_idx) = statement_number;
05059 curr_stmt_category = Executable_Stmt_Cat;
05060 save_curr_stmt_sh_idx = curr_stmt_sh_idx;
05061 line = LA_CH_LINE;
05062 col = LA_CH_COLUMN;
05063 in_action_stmt_of_if_where_or_forall = TRUE;
05064
05065 if (MATCHED_TOKEN_CLASS(Tok_Class_Keyword)) {
05066 curr_stmt_sh_idx = ntr_sh_tbl();
05067
05068 determine_stmt_type();
05069
05070 if (stmt_type == Assignment_Stmt) {
05071
05072 (*stmt_parsers[Assignment_Stmt])();
05073
05074 IR_FLD_R(ir_idx) = IR_Tbl_Idx;
05075 IR_IDX_R(ir_idx) = SH_IR_IDX(curr_stmt_sh_idx);
05076
05077 FREE_SH_NODE(curr_stmt_sh_idx);
05078 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
05079 in_action_stmt_of_if_where_or_forall = FALSE;
05080
05081 goto NO_EOS;
05082 }
05083 else {
05084
05085 FREE_SH_NODE(curr_stmt_sh_idx);
05086 curr_stmt_sh_idx = save_curr_stmt_sh_idx;
05087
05088 PRINTMSG(line, 102, Error, col);
05089 parse_err_flush(Find_EOS, NULL);
05090 in_action_stmt_of_if_where_or_forall = FALSE;
05091 goto EXIT;
05092 }
05093 }
05094 else {
05095 PRINTMSG(line, 102, Error, col);
05096 parse_err_flush(Find_EOS, NULL);
05097 in_action_stmt_of_if_where_or_forall = FALSE;
05098 goto EXIT;
05099 }
05100 }
05101 else {
05102
05103
05104 IR_OPR(ir_idx) = Where_Cnstrct_Opr;
05105
05106 if (cif_flags & MISC_RECS) {
05107 cif_stmt_type_rec(TRUE, CIF_Where_Construct, statement_number);
05108 }
05109
05110 if (! CURR_BLK_NO_EXEC ||
05111 CURR_BLK == Forall_Blk ||
05112 CURR_BLK == Where_Then_Blk ||
05113 CURR_BLK == Where_Else_Blk ||
05114 CURR_BLK == Where_Else_Mask_Blk) {
05115 PUSH_BLK_STK (Where_Then_Blk);
05116 }
05117 else {
05118 iss_blk_stk_err();
05119 PUSH_BLK_STK (Where_Then_Blk);
05120 CURR_BLK_ERR = TRUE;
05121 }
05122
05123 if (stmt_construct_idx != NULL_IDX) {
05124 CURR_BLK_NAME = stmt_construct_idx;
05125 ATL_CLASS(stmt_construct_idx) = Lbl_Construct;
05126 ATL_DEF_STMT_IDX(stmt_construct_idx) = curr_stmt_sh_idx;
05127 SH_ERR_FLG(curr_stmt_sh_idx) =
05128 SH_ERR_FLG(curr_stmt_sh_idx) || AT_DCL_ERR(stmt_construct_idx);
05129 stmt_construct_idx = NULL_IDX;
05130 }
05131
05132 curr_stmt_category = Executable_Stmt_Cat;
05133 CURR_BLK_NO_EXEC = TRUE;
05134 CURR_BLK_FIRST_SH_IDX = curr_stmt_sh_idx;
05135 }
05136
05137 EXIT:
05138
05139 NEXT_LA_CH;
05140
05141 NO_EOS:
05142
05143 TRACE (Func_Exit, "parse_where_stmt", NULL);
05144
05145 return;
05146
05147 }
05148
05149
05150
05151
05152
05153
05154
05155
05156
05157
05158
05159
05160
05161
05162
05163
05164
05165
05166
05167
05168
05169
05170
05171 static int match_blk(blk_cntxt_type the_blk,
05172 boolean fnd_name)
05173
05174 {
05175 int blk_idx;
05176
05177
05178 TRACE (Func_Entry, "match_blk", NULL);
05179
05180 for (blk_idx = blk_stk_idx; blk_idx > NULL_IDX; blk_idx--) {
05181
05182 if (BLK_TYPE(blk_idx) == the_blk) {
05183
05184 if (!fnd_name ||
05185 (BLK_NAME(blk_idx) != NULL_IDX &&
05186 (compare_names(TOKEN_ID(token).words,
05187 TOKEN_LEN(token),
05188 AT_OBJ_NAME_LONG(BLK_NAME(blk_idx)),
05189 AT_NAME_LEN(BLK_NAME(blk_idx))) == 0))){
05190 break;
05191 }
05192 }
05193 }
05194
05195 if (blk_idx == NULL_IDX) {
05196 CLEAR_TBL_NTRY(blk_stk, NULL_IDX);
05197 }
05198
05199 TRACE (Func_Exit, "match_blk", NULL);
05200
05201 return(blk_idx);
05202
05203 }
05204
05205
05206
05207
05208
05209
05210
05211
05212
05213
05214
05215
05216
05217
05218
05219
05220
05221
05222
05223
05224
05225 static boolean parse_label_list(int ir_idx)
05226
05227 {
05228 int lbl_attr_idx;
05229 int list_tail = NULL_IDX;
05230 int new_lbl;
05231 boolean parsed_correctly = TRUE;
05232
05233
05234 TRACE (Func_Entry, "parse_label_list", NULL);
05235
05236
05237
05238 NEXT_LA_CH;
05239
05240
05241
05242
05243
05244
05245
05246 while (LA_CH_VALUE != EOS) {
05247
05248 if (MATCHED_TOKEN_CLASS(Tok_Class_Label)) {
05249
05250 if ( ! TOKEN_ERR(token)) {
05251 lbl_attr_idx = check_label_ref();
05252
05253 NTR_IR_LIST_TBL(new_lbl);
05254
05255 if (list_tail != NULL_IDX) {
05256 IL_NEXT_LIST_IDX(list_tail) = new_lbl;
05257 IL_PREV_LIST_IDX(new_lbl) = list_tail;
05258 list_tail = new_lbl;
05259 }
05260 else {
05261 IR_FLD_R(ir_idx) = IL_Tbl_Idx;
05262 IR_IDX_R(ir_idx) = new_lbl;
05263 list_tail = new_lbl;
05264 }
05265
05266 IL_LINE_NUM(new_lbl) = TOKEN_LINE(token);
05267 IL_COL_NUM(new_lbl) = TOKEN_COLUMN(token);
05268 IL_FLD(new_lbl) = AT_Tbl_Idx;
05269 IL_IDX(new_lbl) = lbl_attr_idx;
05270 AT_REFERENCED(lbl_attr_idx) = Referenced;
05271
05272 IR_LIST_CNT_R(ir_idx)++;
05273 }
05274
05275 if (LA_CH_VALUE == COMMA) {
05276 NEXT_LA_CH;
05277 }
05278 else if (LA_CH_VALUE == RPAREN) {
05279 NEXT_LA_CH;
05280 goto EXIT;
05281 }
05282 else {
05283 parse_err_flush(Find_EOS, ", or )");
05284 parsed_correctly = FALSE;
05285 goto EXIT;
05286 }
05287
05288 }
05289 else {
05290 parse_err_flush(Find_EOS, "statement label");
05291 parsed_correctly = FALSE;
05292 goto EXIT;
05293 }
05294
05295 }
05296
05297 parse_err_flush(Find_EOS, "statement label");
05298 parsed_correctly = FALSE;
05299
05300 EXIT:
05301
05302 TRACE (Func_Exit, "parse_label_list", NULL);
05303
05304 return(parsed_correctly);
05305
05306 }
05307
05308
05309
05310
05311
05312
05313
05314
05315
05316
05317
05318
05319
05320
05321
05322
05323
05324
05325
05326
05327 static boolean change_subscript(opnd_type *top_opnd)
05328
05329 {
05330 boolean allocate;
05331 int column;
05332 int ir_idx;
05333 int ir2_idx;
05334 int line;
05335 int list_idx;
05336 int list2_idx;
05337 int msg_num;
05338 boolean ok = TRUE;
05339
05340
05341 TRACE (Func_Entry, "change_subscript", NULL);
05342
05343 if (stmt_type == Deallocate_Stmt) {
05344 allocate = FALSE;
05345 msg_num = 428;
05346 }
05347 else {
05348 allocate = TRUE;
05349 msg_num = 201;
05350 }
05351
05352 if (OPND_FLD((*top_opnd)) == CN_Tbl_Idx) {
05353
05354
05355
05356 find_opnd_line_and_column(top_opnd, &line, &column);
05357
05358 PRINTMSG(line, msg_num, Error, column);
05359 ok = FALSE;
05360 }
05361 else if (OPND_FLD((*top_opnd)) == AT_Tbl_Idx) {
05362 NTR_IR_TBL(ir_idx);
05363 IR_OPR(ir_idx) = (allocate ? Alloc_Obj_Opr : Dealloc_Obj_Opr);
05364 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
05365 IR_LINE_NUM(ir_idx) = OPND_LINE_NUM((*top_opnd));
05366 IR_COL_NUM(ir_idx) = OPND_COL_NUM((*top_opnd));
05367
05368 COPY_OPND(IR_OPND_L(ir_idx), (*top_opnd));
05369
05370 OPND_FLD((*top_opnd)) = IR_Tbl_Idx;
05371 OPND_IDX((*top_opnd)) = ir_idx;
05372 }
05373 else if (OPND_FLD((*top_opnd)) == IR_Tbl_Idx) {
05374 ir_idx = OPND_IDX((*top_opnd));
05375
05376 switch (IR_OPR(ir_idx)) {
05377
05378 case Subscript_Opr :
05379
05380 if (allocate) {
05381 IR_OPR(ir_idx) = Alloc_Obj_Opr;
05382
05383 list_idx = IR_IDX_R(ir_idx);
05384
05385 while (list_idx != NULL_IDX) {
05386
05387 if (IL_FLD(list_idx) == IR_Tbl_Idx &&
05388 IR_OPR(IL_IDX(list_idx)) == Triplet_Opr) {
05389
05390 ir_idx = IL_IDX(list_idx);
05391 IL_FLD(list_idx) = IL_Tbl_Idx;
05392 IL_LIST_CNT(list_idx) = 2;
05393 IL_IDX(list_idx) = IR_IDX_L(ir_idx);
05394
05395 list2_idx = IL_IDX(list_idx);
05396 list2_idx = IL_NEXT_LIST_IDX(list2_idx);
05397
05398 if (IL_FLD(IR_IDX_L(ir_idx)) == NO_Tbl_Idx) {
05399
05400 ok = FALSE;
05401 PRINTMSG(IR_LINE_NUM(ir_idx), 1558, Error,
05402 IR_COL_NUM(ir_idx),
05403 "lower bound");
05404 }
05405 else if (IL_FLD(list2_idx) == NO_Tbl_Idx &&
05406 ! IL_PE_SUBSCRIPT(list_idx)) {
05407
05408 ok = FALSE;
05409 PRINTMSG(IR_LINE_NUM(ir_idx), 1558, Error,
05410 IR_COL_NUM(ir_idx),
05411 "upper bound");
05412 }
05413 else if (IL_FLD(IL_NEXT_LIST_IDX(list2_idx))
05414 != NO_Tbl_Idx) {
05415
05416 ok = FALSE;
05417 find_opnd_line_and_column((opnd_type *)&IL_OPND(
05418 IL_NEXT_LIST_IDX(list2_idx)),
05419 &line,
05420 &column);
05421 PRINTMSG(line, 401, Error, column);
05422 }
05423
05424 FREE_IR_NODE(ir_idx);
05425
05426 IL_NEXT_LIST_IDX(list2_idx) = NULL_IDX;
05427
05428 }
05429
05430 list_idx = IL_NEXT_LIST_IDX(list_idx);
05431 }
05432 }
05433 else {
05434
05435 PRINTMSG(IR_LINE_NUM(ir_idx), 430, Error,
05436 IR_COL_NUM(ir_idx));
05437 ok = FALSE;
05438 }
05439 break;
05440
05441 case Struct_Opr :
05442
05443
05444 NTR_IR_TBL(ir2_idx);
05445 IR_OPR(ir2_idx) = (allocate ? Alloc_Obj_Opr :
05446 Dealloc_Obj_Opr);
05447 IR_TYPE_IDX(ir2_idx) = TYPELESS_DEFAULT_TYPE;
05448 IR_LINE_NUM(ir2_idx) = IR_LINE_NUM_R(ir_idx);
05449 IR_COL_NUM(ir2_idx) = IR_COL_NUM_R(ir_idx);
05450
05451 COPY_OPND(IR_OPND_L(ir2_idx), (*top_opnd));
05452
05453 OPND_FLD((*top_opnd)) = IR_Tbl_Idx;
05454 OPND_IDX((*top_opnd)) = ir2_idx;
05455
05456 break;
05457
05458 case Substring_Opr :
05459
05460 PRINTMSG(IR_LINE_NUM(ir_idx), 405, Error, IR_COL_NUM(ir_idx));
05461 ok = FALSE;
05462 break;
05463
05464 default :
05465 PRINTMSG(IR_LINE_NUM(ir_idx), msg_num, Error, IR_COL_NUM(ir_idx));
05466 ok = FALSE;
05467 break;
05468 }
05469 }
05470 else {
05471 find_opnd_line_and_column(top_opnd, &line, &column);
05472 PRINTMSG(line, 626, Internal, column,
05473 "CN_Tbl_Idx, AT_Tbl_Idx, or IR_Tbl_Idx",
05474 "change_subscript");
05475 }
05476
05477 TRACE (Func_Exit, "change_subscript", NULL);
05478
05479 return(ok);
05480
05481 }
05482
05483
05484
05485
05486
05487
05488
05489
05490
05491
05492
05493
05494
05495
05496
05497
05498
05499
05500
05501
05502
05503
05504 int gen_loop_lbl_name(int blk_idx,
05505 lbl_pos_type lbl_pos)
05506
05507 {
05508 int attr_idx;
05509 char lbl_name[MAX_ID_LEN];
05510 char lbl_pos_name[4][8] = { "top", "cycle", "exit", "bot" };
05511 token_type lbl_token;
05512 int name_idx;
05513 char num_buf[8];
05514
05515
05516 TRACE (Func_Entry, "gen_loop_lbl_name", NULL);
05517
05518 if (BLK_LABEL(blk_idx) != NULL_IDX) {
05519 strcpy(lbl_name, AT_OBJ_NAME_PTR(BLK_LABEL(blk_idx)));
05520 }
05521 else {
05522 sprintf(num_buf, "%d", BLK_DEF_LINE(blk_idx));
05523 strcpy(lbl_name, num_buf);
05524 strcat(lbl_name, "u");
05525 }
05526
05527 strcat(lbl_name, lbl_pos_name[lbl_pos]);
05528 sprintf(num_buf, "%d", BLK_LOOP_NUM(blk_idx));
05529 strcat(lbl_name, num_buf);
05530
05531 BACK:
05532
05533 CREATE_ID(TOKEN_ID(lbl_token), lbl_name, strlen(lbl_name));
05534 TOKEN_LEN(lbl_token) = strlen(lbl_name);
05535
05536 attr_idx = srch_sym_tbl(TOKEN_STR(lbl_token), TOKEN_LEN(lbl_token),
05537 &name_idx);
05538
05539 if (attr_idx == NULL_IDX) {
05540 attr_idx = ntr_sym_tbl(&lbl_token, name_idx);
05541 AT_OBJ_CLASS(attr_idx) = Label;
05542 ATL_CLASS(attr_idx) = Lbl_Internal;
05543 ATL_EXECUTABLE(attr_idx) = TRUE;
05544
05545 if (lbl_pos == Top_Lbl &&
05546 (stmt_type == Do_Iterative_Stmt || stmt_type == Do_While_Stmt)) {
05547 ATL_TOP_OF_LOOP(attr_idx) = TRUE;
05548 }
05549
05550 if (cmd_line_flags.debug_lvl == Debug_Lvl_1) {
05551 ATL_DEBUG_CLASS(attr_idx) = Ldbg_Loop_Lbl;
05552 }
05553 }
05554 else if (lbl_pos == Top_Lbl || lbl_pos == Skip_Lbl) {
05555
05556 sprintf(num_buf, "%d", BLK_FIRST_SH_IDX(blk_idx));
05557 strcat(lbl_name, num_buf);
05558 goto BACK;
05559 }
05560
05561 TRACE (Func_Exit, "gen_loop_lbl_name", NULL);
05562
05563 return(attr_idx);
05564
05565 }
05566
05567
05568
05569
05570
05571
05572
05573
05574
05575
05576
05577
05578
05579
05580
05581
05582
05583
05584
05585 static void process_blockable_dir(void)
05586
05587 {
05588 int blk_idx;
05589 int dir_il_idx;
05590 int i;
05591 int il_idx;
05592 int il_idx_2;
05593 int ir_idx;
05594
05595
05596 TRACE (Func_Entry, "process_blockable_dir", NULL);
05597
05598
05599
05600
05601
05602
05603 if (cdir_switches.blockable_sh_idx != NULL_IDX) {
05604 BLK_BLOCKABLE_DIR_SH_IDX(blk_stk_idx) = cdir_switches.blockable_sh_idx;
05605 ir_idx =
05606 SH_IR_IDX(cdir_switches.blockable_sh_idx);
05607 BLK_BLOCKABLE_NUM_LCVS(blk_stk_idx) = IR_LIST_CNT_L(ir_idx);
05608 cdir_switches.blockable_sh_idx = NULL_IDX;
05609 dir_il_idx = IR_IDX_L(ir_idx);
05610
05611 for (i = 1; i <= IR_LIST_CNT_L(ir_idx); ++i) {
05612
05613 if (IL_IDX(dir_il_idx) == OPND_IDX(BLK_DO_VAR_OPND(blk_stk_idx))) {
05614 break;
05615 }
05616 else {
05617 dir_il_idx = IL_NEXT_LIST_IDX(dir_il_idx);
05618 }
05619 }
05620
05621 if (i <= IR_LIST_CNT_L(ir_idx)) {
05622 NTR_IR_LIST_TBL(il_idx);
05623 IR_FLD_R(ir_idx) = IL_Tbl_Idx;
05624 IR_IDX_R(ir_idx) = il_idx;
05625 IR_LIST_CNT_R(ir_idx) = 1;
05626
05627 IL_LINE_NUM(il_idx) = TOKEN_LINE(token);
05628 IL_COL_NUM(il_idx) = TOKEN_COLUMN(token);
05629 IL_FLD(il_idx) = CN_Tbl_Idx;
05630 IL_IDX(il_idx) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, i);
05631 }
05632 else {
05633 PRINTMSG(TOKEN_LINE(token), 1379, Error, TOKEN_COLUMN(token),
05634 "BLOCKABLE");
05635 SH_ERR_FLG(BLK_BLOCKABLE_DIR_SH_IDX(blk_stk_idx)) = TRUE;
05636 BLK_BLOCKABLE_DIR_SH_IDX(blk_stk_idx) = NULL_IDX;
05637 BLK_BLOCKABLE_NUM_LCVS(blk_stk_idx) = 0;
05638 }
05639 }
05640 else {
05641
05642
05643
05644
05645
05646 for (blk_idx = blk_stk_idx - 1; blk_idx > 1; --blk_idx) {
05647
05648 if (BLK_TYPE(blk_idx) == Do_Blk &&
05649 SH_STMT_TYPE(BLK_FIRST_SH_IDX(blk_idx)) == Do_Iterative_Stmt) {
05650 break;
05651 }
05652 }
05653
05654 if (blk_idx > 1 && BLK_BLOCKABLE_NUM_LCVS(blk_idx) > 1) {
05655
05656
05657
05658
05659
05660
05661 if (BLK_BLOCKABLE_NUM_LCVS(blk_stk_idx - 1) > 1) {
05662 BLK_BLOCKABLE_NUM_LCVS(blk_stk_idx) =
05663 BLK_BLOCKABLE_NUM_LCVS(blk_stk_idx - 1) - 1;
05664
05665 blk_idx = blk_stk_idx - 1;
05666
05667 while (BLK_BLOCKABLE_DIR_SH_IDX(blk_idx) == NULL_IDX) {
05668 --blk_idx;
05669 }
05670
05671 ir_idx = SH_IR_IDX(BLK_BLOCKABLE_DIR_SH_IDX(blk_idx));
05672 dir_il_idx = IR_IDX_L(ir_idx);
05673
05674 for (i = 1; i <= IR_LIST_CNT_L(ir_idx); ++i) {
05675
05676 if (IL_IDX(dir_il_idx) ==
05677 OPND_IDX(BLK_DO_VAR_OPND(blk_stk_idx))) {
05678 break;
05679 }
05680 else {
05681 dir_il_idx = IL_NEXT_LIST_IDX(dir_il_idx);
05682 }
05683 }
05684
05685 if (i <= IR_LIST_CNT_L(ir_idx)) {
05686
05687
05688
05689
05690
05691 il_idx = IR_IDX_R(ir_idx);
05692
05693 while (IL_NEXT_LIST_IDX(il_idx) != NULL_IDX) {
05694 il_idx = IL_NEXT_LIST_IDX(il_idx);
05695 }
05696
05697 NTR_IR_LIST_TBL(il_idx_2);
05698 IL_NEXT_LIST_IDX(il_idx) = il_idx_2;
05699 IL_PREV_LIST_IDX(il_idx_2) = il_idx;
05700 ++IR_LIST_CNT_R(ir_idx);
05701 IL_LINE_NUM(il_idx_2) = TOKEN_LINE(token);
05702 IL_COL_NUM(il_idx_2) = TOKEN_COLUMN(token);
05703 IL_FLD(il_idx_2) = CN_Tbl_Idx;
05704 IL_IDX(il_idx_2) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, i);
05705 }
05706 else {
05707 PRINTMSG(TOKEN_LINE(token), 1379, Error, TOKEN_COLUMN(token),
05708 "BLOCKABLE");
05709 BLK_BLOCKABLE_NUM_LCVS(blk_stk_idx) = 0;
05710
05711 blk_idx = blk_stk_idx - 1;
05712
05713 for (blk_idx = blk_stk_idx; blk_idx > 1; --blk_idx) {
05714 BLK_BLOCKABLE_NUM_LCVS(blk_idx) = 0;
05715
05716 if (BLK_BLOCKABLE_DIR_SH_IDX(blk_idx) != NULL_IDX) {
05717 SH_ERR_FLG(BLK_BLOCKABLE_DIR_SH_IDX(blk_idx)) = TRUE;
05718 BLK_BLOCKABLE_DIR_SH_IDX(blk_idx) = NULL_IDX;
05719 }
05720 }
05721 }
05722 }
05723 }
05724 }
05725
05726 TRACE (Func_Exit, "process_blockable_dir", NULL);
05727
05728 return;
05729
05730 }
05731
05732
05733
05734
05735
05736
05737
05738
05739
05740
05741
05742
05743
05744
05745
05746
05747
05748
05749
05750
05751 static void process_interchange_dir(void)
05752
05753 {
05754 int blk_idx;
05755 int dir_il_idx;
05756 int i;
05757 int il_idx;
05758 int il_idx_2;
05759 int ir_idx;
05760 int sh_idx;
05761
05762
05763 TRACE (Func_Entry, "process_interchange_dir", NULL);
05764
05765
05766
05767
05768
05769
05770 if (cdir_switches.interchange_sh_idx != NULL_IDX) {
05771 sh_idx = SH_PREV_IDX(BLK_FIRST_SH_IDX(blk_stk_idx));
05772
05773 while (SH_COMPILER_GEN(sh_idx) ||
05774 (SH_STMT_TYPE(sh_idx) == Directive_Stmt &&
05775 IR_OPR(SH_IR_IDX(sh_idx)) != Interchange_Dir_Opr)) {
05776 sh_idx = SH_PREV_IDX(sh_idx);
05777 }
05778
05779 if (sh_idx != cdir_switches.interchange_sh_idx) {
05780
05781
05782
05783 PRINTMSG(SH_GLB_LINE(sh_idx), 1381, Error, 0, "INTERCHANGE");
05784 SH_ERR_FLG(cdir_switches.interchange_sh_idx) = TRUE;
05785 cdir_switches.interchange_sh_idx = NULL_IDX;
05786 }
05787 else {
05788 BLK_INTERCHANGE_DIR_SH_IDX(blk_stk_idx) =
05789 cdir_switches.interchange_sh_idx;
05790 ir_idx = SH_IR_IDX(cdir_switches.interchange_sh_idx);
05791 BLK_INTERCHANGE_NUM_LCVS(blk_stk_idx) = IR_LIST_CNT_L(ir_idx);
05792 cdir_switches.interchange_sh_idx = NULL_IDX;
05793 dir_il_idx = IR_IDX_L(ir_idx);
05794
05795 for (i = 1; i <= IR_LIST_CNT_L(ir_idx); ++i) {
05796
05797 if (IL_IDX(dir_il_idx) == OPND_IDX(BLK_DO_VAR_OPND(blk_stk_idx))) {
05798 break;
05799 }
05800 else {
05801 dir_il_idx = IL_NEXT_LIST_IDX(dir_il_idx);
05802 }
05803 }
05804
05805 if (i <= IR_LIST_CNT_L(ir_idx)) {
05806
05807
05808
05809 NTR_IR_LIST_TBL(il_idx);
05810 IR_FLD_R(ir_idx) = IL_Tbl_Idx;
05811 IR_IDX_R(ir_idx) = il_idx;
05812 IR_LIST_CNT_R(ir_idx) = 1;
05813
05814 IL_LINE_NUM(il_idx) = TOKEN_LINE(token);
05815 IL_COL_NUM(il_idx) = TOKEN_COLUMN(token);
05816 IL_FLD(il_idx) = CN_Tbl_Idx;
05817 IL_IDX(il_idx) = C_INT_TO_CN( CG_INTEGER_DEFAULT_TYPE, i);
05818 }
05819 else {
05820
05821
05822
05823 PRINTMSG(TOKEN_LINE(token), 1379, Error, TOKEN_COLUMN(token),
05824 "INTERCHANGE");
05825 SH_ERR_FLG(BLK_INTERCHANGE_DIR_SH_IDX(blk_stk_idx)) = TRUE;
05826 BLK_INTERCHANGE_DIR_SH_IDX(blk_stk_idx) = NULL_IDX;
05827 BLK_INTERCHANGE_NUM_LCVS(blk_stk_idx) = 0;
05828 }
05829 }
05830 }
05831 else {
05832
05833
05834
05835
05836
05837 for (blk_idx = blk_stk_idx - 1; blk_idx > 1; --blk_idx) {
05838
05839 if (BLK_TYPE(blk_idx) == Do_Blk &&
05840 SH_STMT_TYPE(BLK_FIRST_SH_IDX(blk_idx)) == Do_Iterative_Stmt) {
05841 break;
05842 }
05843 }
05844
05845 if (blk_idx > 1 && BLK_INTERCHANGE_NUM_LCVS(blk_idx) > 1) {
05846
05847 if (loop_top_is_perfectly_nested("INTERCHANGE")) {
05848
05849
05850
05851
05852
05853
05854
05855 if (BLK_INTERCHANGE_NUM_LCVS(blk_stk_idx - 1) > 1) {
05856 BLK_INTERCHANGE_NUM_LCVS(blk_stk_idx) =
05857 BLK_INTERCHANGE_NUM_LCVS(blk_stk_idx - 1) - 1;
05858
05859 blk_idx = blk_stk_idx - 1;
05860
05861 while (BLK_INTERCHANGE_DIR_SH_IDX(blk_idx) == NULL_IDX) {
05862 --blk_idx;
05863 }
05864
05865 ir_idx = SH_IR_IDX(BLK_INTERCHANGE_DIR_SH_IDX(blk_idx));
05866 dir_il_idx = IR_IDX_L(ir_idx);
05867
05868 for (i = 1; i <= IR_LIST_CNT_L(ir_idx); ++i) {
05869
05870 if (IL_IDX(dir_il_idx) ==
05871 OPND_IDX(BLK_DO_VAR_OPND(blk_stk_idx))) {
05872 break;
05873 }
05874 else {
05875 dir_il_idx = IL_NEXT_LIST_IDX(dir_il_idx);
05876 }
05877 }
05878
05879 if (i <= IR_LIST_CNT_L(ir_idx)) {
05880
05881
05882
05883
05884
05885 il_idx = IR_IDX_R(ir_idx);
05886
05887 while (IL_NEXT_LIST_IDX(il_idx) != NULL_IDX) {
05888 il_idx = IL_NEXT_LIST_IDX(il_idx);
05889 }
05890
05891 NTR_IR_LIST_TBL(il_idx_2);
05892 IL_NEXT_LIST_IDX(il_idx) = il_idx_2;
05893 IL_PREV_LIST_IDX(il_idx_2) = il_idx;
05894 ++IR_LIST_CNT_R(ir_idx);
05895 IL_LINE_NUM(il_idx_2) = TOKEN_LINE(token);
05896 IL_COL_NUM(il_idx_2) = TOKEN_COLUMN(token);
05897 IL_FLD(il_idx_2) = CN_Tbl_Idx;
05898 IL_IDX(il_idx_2) = C_INT_TO_CN(CG_INTEGER_DEFAULT_TYPE, i);
05899 }
05900 else {
05901 PRINTMSG(TOKEN_LINE(token), 1379, Error, TOKEN_COLUMN(token),
05902 "INTERCHANGE");
05903 BLK_INTERCHANGE_NUM_LCVS(blk_stk_idx) = 0;
05904
05905 blk_idx = blk_stk_idx - 1;
05906
05907 for (blk_idx = blk_stk_idx; blk_idx > 1; --blk_idx) {
05908 BLK_INTERCHANGE_NUM_LCVS(blk_idx) = 0;
05909 BLK_HAS_NESTED_LOOP(blk_idx) = FALSE;
05910
05911 if (BLK_INTERCHANGE_DIR_SH_IDX(blk_idx) != NULL_IDX) {
05912 SH_ERR_FLG(BLK_INTERCHANGE_DIR_SH_IDX(blk_idx)) = TRUE;
05913 BLK_INTERCHANGE_DIR_SH_IDX(blk_idx) =
05914 NULL_IDX;
05915 }
05916 }
05917 }
05918 }
05919 }
05920 }
05921 }
05922
05923 TRACE (Func_Exit, "process_interchange_dir", NULL);
05924
05925 return;
05926
05927 }
05928
05929 # if (defined(_TARGET_OS_IRIX) || defined(_TARGET_OS_LINUX) || defined(_TARGET_OS_DARWIN))
05930
05931
05932
05933
05934
05935
05936
05937
05938
05939
05940
05941
05942
05943
05944
05945
05946
05947
05948 static void check_mp_dir_nesting(void)
05949
05950 {
05951 int blk_idx;
05952 int col;
05953 int dir_list_idx;
05954 int i;
05955 int line;
05956 int list_idx;
05957 int ir_idx;
05958 char str[80];
05959
05960
05961 TRACE (Func_Entry, "check_mp_dir_nesting", NULL);
05962
05963
05964
05965
05966
05967
05968 if (cdir_switches.dir_nest_check_sh_idx != NULL_IDX) {
05969 BLK_DIR_NEST_CHECK_SH_IDX(blk_stk_idx) =
05970 cdir_switches.dir_nest_check_sh_idx;
05971 ir_idx = SH_IR_IDX(cdir_switches.dir_nest_check_sh_idx);
05972
05973 list_idx = IR_IDX_L(ir_idx);
05974
05975 for (i = 0; i < MP_DIR_NEST_IDX; i++) {
05976 list_idx = IL_NEXT_LIST_IDX(list_idx);
05977 }
05978
05979 # ifdef _DEBUG
05980 if (list_idx == NULL_IDX ||
05981 IL_FLD(list_idx) != IL_Tbl_Idx) {
05982 PRINTMSG(SH_GLB_LINE(cdir_switches.dir_nest_check_sh_idx),
05983 626, Internal,
05984 SH_COL_NUM(cdir_switches.dir_nest_check_sh_idx),
05985 "IL_Tbl_Idx", "check_mp_dir_nesting");
05986 }
05987 # endif
05988
05989 BLK_DIR_NEST_CHECK_NUM_LCVS(blk_stk_idx) = IL_LIST_CNT(list_idx);
05990 cdir_switches.dir_nest_check_sh_idx = NULL_IDX;
05991 dir_list_idx = IL_IDX(list_idx);
05992
05993
05994
05995 if (IL_IDX(dir_list_idx) != OPND_IDX(BLK_DO_VAR_OPND(blk_stk_idx))) {
05996
05997 find_opnd_line_and_column(&IL_OPND(dir_list_idx), &line, &col);
05998
05999 PRINTMSG(line, 1416, Error, col);
06000 SH_ERR_FLG(BLK_DIR_NEST_CHECK_SH_IDX(blk_stk_idx)) = TRUE;
06001 BLK_DIR_NEST_CHECK_SH_IDX(blk_stk_idx) = NULL_IDX;
06002 BLK_DIR_NEST_CHECK_NUM_LCVS(blk_stk_idx) = 0;
06003 }
06004 }
06005 else {
06006
06007 for (blk_idx = blk_stk_idx - 1; blk_idx > 1; --blk_idx) {
06008
06009 if (BLK_TYPE(blk_idx) == Do_Blk &&
06010 SH_STMT_TYPE(BLK_FIRST_SH_IDX(blk_idx)) == Do_Iterative_Stmt) {
06011 break;
06012 }
06013 }
06014
06015 if (blk_idx > 1 && BLK_DIR_NEST_CHECK_NUM_LCVS(blk_idx) > 1) {
06016
06017 blk_idx = blk_stk_idx - 1;
06018
06019 while (blk_idx > 1 &&
06020 BLK_DIR_NEST_CHECK_SH_IDX(blk_idx) == NULL_IDX) {
06021 --blk_idx;
06022 }
06023
06024 if (BLK_DIR_NEST_CHECK_SH_IDX(blk_idx) != NULL_IDX) {
06025 switch (IR_OPR(SH_IR_IDX(BLK_DIR_NEST_CHECK_SH_IDX(blk_idx)))) {
06026 case Pdo_Par_Opr:
06027 strcpy(str, "PDO");
06028 break;
06029
06030 case Parallel_Do_Par_Opr:
06031 strcpy(str, "PARALLEL DO");
06032 break;
06033
06034 case Doacross_Dollar_Opr:
06035 strcpy(str, "DOACROSS");
06036 break;
06037
06038 default:
06039 strcpy(str, "DO");
06040 break;
06041 }
06042 }
06043 else {
06044 strcpy(str, "DO");
06045 }
06046
06047 if (loop_top_is_perfectly_nested(str)) {
06048
06049
06050
06051
06052
06053
06054 if (BLK_DIR_NEST_CHECK_NUM_LCVS(blk_stk_idx - 1) > 1) {
06055 BLK_DIR_NEST_CHECK_NUM_LCVS(blk_stk_idx) =
06056 BLK_DIR_NEST_CHECK_NUM_LCVS(blk_stk_idx - 1) - 1;
06057
06058 blk_idx = blk_stk_idx - 1;
06059
06060 while (blk_idx > 1 &&
06061 BLK_DIR_NEST_CHECK_SH_IDX(blk_idx) == NULL_IDX) {
06062 --blk_idx;
06063 }
06064
06065 # ifdef _DEBUG
06066 if (blk_idx <= 1 ||
06067 BLK_DIR_NEST_CHECK_SH_IDX(blk_idx) == NULL_IDX) {
06068 PRINTMSG(SH_GLB_LINE(cdir_switches.dir_nest_check_sh_idx),
06069 626, Internal,
06070 SH_COL_NUM(cdir_switches.dir_nest_check_sh_idx),
06071 "BLK_DIR_NEST_CHECK_SH_IDX", "check_mp_dir_nesting");
06072 }
06073 # endif
06074
06075 ir_idx = SH_IR_IDX(BLK_DIR_NEST_CHECK_SH_IDX(blk_idx));
06076
06077
06078
06079 list_idx = IR_IDX_L(ir_idx);
06080
06081 for (i = 0; i < MP_DIR_NEST_IDX; i++) {
06082 list_idx = IL_NEXT_LIST_IDX(list_idx);
06083 }
06084
06085 # ifdef _DEBUG
06086 if (list_idx == NULL_IDX ||
06087 IL_FLD(list_idx) != IL_Tbl_Idx) {
06088 PRINTMSG(SH_GLB_LINE(cdir_switches.dir_nest_check_sh_idx),
06089 626, Internal,
06090 SH_COL_NUM(cdir_switches.dir_nest_check_sh_idx),
06091 "IL_Tbl_Idx", "check_mp_dir_nesting");
06092 }
06093 # endif
06094
06095 dir_list_idx = IL_IDX(list_idx);
06096
06097 for (i = 1;
06098 i < ((IL_LIST_CNT(list_idx) -
06099 BLK_DIR_NEST_CHECK_NUM_LCVS(blk_stk_idx)) + 1);
06100 i++) {
06101
06102 dir_list_idx = IL_NEXT_LIST_IDX(dir_list_idx);
06103 }
06104
06105 if (IL_IDX(dir_list_idx) !=
06106 OPND_IDX(BLK_DO_VAR_OPND(blk_stk_idx))) {
06107
06108 find_opnd_line_and_column(&IL_OPND(dir_list_idx),&line,&col);
06109
06110 PRINTMSG(line, 1416, Error, col);
06111 BLK_DIR_NEST_CHECK_NUM_LCVS(blk_stk_idx) = 0;
06112 blk_idx = blk_stk_idx - 1;
06113
06114 for (blk_idx = blk_stk_idx; blk_idx > 1; --blk_idx) {
06115 BLK_DIR_NEST_CHECK_NUM_LCVS(blk_idx) = 0;
06116 BLK_HAS_NESTED_LOOP(blk_idx) = FALSE;
06117
06118 if (BLK_DIR_NEST_CHECK_SH_IDX(blk_idx) != NULL_IDX) {
06119 SH_ERR_FLG(BLK_DIR_NEST_CHECK_SH_IDX(blk_idx)) = TRUE;
06120 BLK_DIR_NEST_CHECK_SH_IDX(blk_idx) =
06121 NULL_IDX;
06122 }
06123 }
06124 }
06125 }
06126 }
06127 }
06128 }
06129
06130 TRACE (Func_Exit, "check_mp_dir_nesting", NULL);
06131
06132 return;
06133
06134 }
06135
06136 # endif
06137
06138
06139
06140
06141
06142
06143
06144
06145
06146
06147
06148
06149
06150
06151
06152
06153
06154
06155
06156
06157
06158 static boolean loop_top_is_perfectly_nested(char *str)
06159
06160 {
06161 int blk_idx;
06162 boolean perfectly_nested = FALSE;
06163 int sh_idx;
06164
06165
06166 TRACE (Func_Entry, "loop_top_is_perfectly_nested", NULL);
06167
06168 blk_idx = blk_stk_idx - 1;
06169
06170 if (BLK_TYPE(blk_idx) == Do_Blk &&
06171 SH_STMT_TYPE(BLK_FIRST_SH_IDX(blk_idx)) == Do_Iterative_Stmt) {
06172 sh_idx = SH_PREV_IDX(curr_stmt_sh_idx);
06173
06174 while (SH_COMPILER_GEN(sh_idx)) {
06175 sh_idx = SH_PREV_IDX(sh_idx);
06176 }
06177
06178 if (SH_STMT_TYPE(sh_idx) == Do_Iterative_Stmt) {
06179 BLK_HAS_NESTED_LOOP(blk_idx) = TRUE;
06180 perfectly_nested = TRUE;
06181 }
06182 }
06183 else {
06184 sh_idx = BLK_FIRST_SH_IDX(blk_idx);
06185 }
06186
06187 if (! perfectly_nested) {
06188 PRINTMSG(SH_GLB_LINE(sh_idx), 1380, Error, SH_COL_NUM(sh_idx), str);
06189
06190 for (blk_idx = blk_stk_idx; blk_idx > 1; --blk_idx) {
06191
06192 if (BLK_TYPE(blk_idx) == Do_Blk) {
06193 BLK_INTERCHANGE_NUM_LCVS(blk_idx) = 0;
06194 BLK_DIR_NEST_CHECK_NUM_LCVS(blk_idx) = 0;
06195 BLK_HAS_NESTED_LOOP(blk_idx) = 0;
06196
06197 if (BLK_DIR_NEST_CHECK_SH_IDX(blk_idx) != NULL_IDX) {
06198 SH_ERR_FLG(BLK_DIR_NEST_CHECK_SH_IDX(blk_idx)) = TRUE;
06199 BLK_DIR_NEST_CHECK_SH_IDX(blk_idx) = NULL_IDX;
06200 }
06201
06202 if (BLK_INTERCHANGE_DIR_SH_IDX(blk_idx) != NULL_IDX) {
06203 SH_ERR_FLG(BLK_INTERCHANGE_DIR_SH_IDX(blk_idx)) = TRUE;
06204 BLK_INTERCHANGE_DIR_SH_IDX(blk_idx) = NULL_IDX;
06205 break;
06206 }
06207 }
06208 }
06209 }
06210
06211 TRACE (Func_Exit, "loop_top_is_perfectly_nested", NULL);
06212
06213 return(perfectly_nested);
06214
06215 }
06216
06217
06218
06219
06220
06221
06222
06223
06224
06225
06226
06227
06228
06229
06230
06231
06232
06233
06234 static void gen_if_ir(int if_stmt_lbl_idx,
06235 int if_stmt_sh_idx,
06236 int save_if_stmt_start_line,
06237 int save_if_stmt_start_col)
06238
06239 {
06240 int ir_idx;
06241
06242
06243 TRACE (Func_Entry, "gen_if_ir", NULL);
06244
06245 if (!SH_ERR_FLG(curr_stmt_sh_idx) && !SH_ERR_FLG(if_stmt_sh_idx)) {
06246
06247 # if defined(_HIGH_LEVEL_IF_FORM)
06248
06249
06250
06251
06252
06253
06254
06255
06256 gen_sh(After, End_If_Stmt, stmt_start_line, stmt_start_col,
06257 FALSE,
06258 FALSE,
06259 TRUE);
06260 SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;
06261
06262 NTR_IR_TBL(ir_idx);
06263 IR_OPR(ir_idx) = Endif_Opr;
06264 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
06265 IR_LINE_NUM(ir_idx) = stmt_start_line;
06266 IR_COL_NUM(ir_idx) = stmt_start_col;
06267 IR_FLD_L(ir_idx) = SH_Tbl_Idx;
06268 IR_IDX_L(ir_idx) = if_stmt_sh_idx;
06269 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
06270 # else
06271 stmt_start_line = save_if_stmt_start_line;
06272 stmt_start_col = save_if_stmt_start_col;
06273
06274 gen_sh(After, Continue_Stmt, stmt_start_line, stmt_start_col,
06275 FALSE, TRUE, TRUE);
06276
06277 NTR_IR_TBL(ir_idx);
06278 SH_IR_IDX(curr_stmt_sh_idx) = ir_idx;
06279 IR_OPR(ir_idx) = Label_Opr;
06280
06281
06282
06283 IR_TYPE_IDX(ir_idx) = TYPELESS_DEFAULT_TYPE;
06284 IR_LINE_NUM(ir_idx) = stmt_start_line;
06285 IR_COL_NUM(ir_idx) = stmt_start_col;
06286 IR_FLD_L(ir_idx) = AT_Tbl_Idx;
06287 IR_IDX_L(ir_idx) = if_stmt_lbl_idx;
06288 IR_LINE_NUM_L(ir_idx) = stmt_start_line;
06289 IR_COL_NUM_L(ir_idx) = stmt_start_col;
06290 AT_DEFINED(if_stmt_lbl_idx) = TRUE;
06291 ATL_DEF_STMT_IDX(if_stmt_lbl_idx) = curr_stmt_sh_idx;
06292
06293 # endif
06294 }
06295 else if (SH_ERR_FLG(curr_stmt_sh_idx)) {
06296 SH_ERR_FLG(if_stmt_sh_idx) = TRUE;
06297 }
06298 TRACE (Func_Exit, "gen_if_ir", NULL);
06299
06300 return;
06301 }