void end_forall_semantics (void) { int ir_idx; int list_idx; int sh_idx; TRACE (Func_Entry, "end_forall_semantics", NULL); sh_idx = SH_PARENT_BLK_IDX(curr_stmt_sh_idx); if (SH_ERR_FLG(curr_stmt_sh_idx) || SH_ERR_FLG(sh_idx)) { goto EXIT; } # ifdef _DEBUG if (sh_idx == NULL_IDX) { PRINTMSG(SH_GLB_LINE(curr_stmt_sh_idx), 626, Internal, SH_COL_NUM(curr_stmt_sh_idx), "SH_PARENT_BLK_IDX", "end_forall_semantics"); } # endif ir_idx = SH_IR_IDX(sh_idx); # ifdef _DEBUG if (IR_OPR(ir_idx) != Forall_Opr) { PRINTMSG(SH_GLB_LINE(curr_stmt_sh_idx), 626, Internal, SH_COL_NUM(curr_stmt_sh_idx), "Forall_Opr", "end_forall_semantics"); } # endif list_idx = IR_IDX_R(ir_idx); while (list_idx && IL_FLD(list_idx) == IL_Tbl_Idx) { AT_ATTR_LINK(IL_IDX(IL_IDX(list_idx))) = NULL_IDX; AT_IGNORE_ATTR_LINK(IL_IDX(IL_IDX(list_idx))) = FALSE; list_idx = IL_NEXT_LIST_IDX(list_idx); } EXIT: active_forall_sh_idx = SH_PARENT_BLK_IDX(active_forall_sh_idx); if (active_forall_sh_idx == NULL_IDX) { within_forall_construct = FALSE; } TRACE (Func_Exit, "end_forall_semantics", NULL); return; } /* end_forall_semantics */
void end_where_semantics (void) { int sh_idx; TRACE (Func_Entry, "end_where_semantics", NULL); where_ir_idx = NULL_IDX; if (where_dealloc_stmt_idx) { SH_NEXT_IDX(where_dealloc_stmt_idx) = SH_NEXT_IDX(curr_stmt_sh_idx); SH_PREV_IDX(where_dealloc_stmt_idx) = curr_stmt_sh_idx; SH_PREV_IDX(SH_NEXT_IDX(curr_stmt_sh_idx)) = where_dealloc_stmt_idx; SH_NEXT_IDX(curr_stmt_sh_idx) = where_dealloc_stmt_idx; where_dealloc_stmt_idx = NULL_IDX; } sh_idx = SH_PARENT_BLK_IDX(curr_stmt_sh_idx); while (sh_idx != NULL_IDX && SH_STMT_TYPE(sh_idx) != Where_Cstrct_Stmt) { sh_idx = SH_PARENT_BLK_IDX(sh_idx); } if (sh_idx != NULL_IDX && (SH_PARENT_BLK_IDX(sh_idx) == NULL_IDX || (SH_STMT_TYPE(SH_PARENT_BLK_IDX(sh_idx)) != Where_Cstrct_Stmt && SH_STMT_TYPE(SH_PARENT_BLK_IDX(sh_idx)) != Else_Where_Stmt && SH_STMT_TYPE(SH_PARENT_BLK_IDX(sh_idx)) != Else_Where_Mask_Stmt))) { alloc_block_start_idx = NULL_IDX; alloc_block_end_idx = NULL_IDX; } if (sh_idx != NULL_IDX && SH_PARENT_BLK_IDX(sh_idx) != NULL_IDX) { sh_idx = SH_PARENT_BLK_IDX(sh_idx); if (SH_STMT_TYPE(sh_idx) == Where_Cstrct_Stmt || SH_STMT_TYPE(sh_idx) == Else_Where_Stmt || SH_STMT_TYPE(sh_idx) == Else_Where_Mask_Stmt) { if (IR_FLD_L(SH_IR_IDX(sh_idx)) == IL_Tbl_Idx) { where_ir_idx = IL_IDX(IR_IDX_L(SH_IR_IDX(sh_idx))); } } else if (SH_STMT_TYPE(sh_idx) == Forall_Cstrct_Stmt) { active_forall_sh_idx = sh_idx; } # ifdef _DEBUG else { PRINTMSG(SH_GLB_LINE(sh_idx), 626, Internal, SH_COL_NUM(sh_idx), "Forall_Opr", "end_where_semantics"); } # endif } TRACE (Func_Exit, "end_where_semantics", NULL); return; } /* end_where_semantics */
int main (int argc, char *argv[]) # endif { int column_num; long field_len; int line_num; char *msg_name; int save_statement_number = 0; # if (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX)) double end_time; double start_time; /* char time[20]; */ double total_cpu_time; struct rusage ru; # else # if !defined(_HOST_OS_UNICOS) long end_clock; # endif float end_time; float start_time; float total_cpu_time; # endif # if defined(_HOST_OS_UNICOS) && defined(_DEBUG) lowmem_check(); # endif # if defined(_TARGET32) && defined(_DEBUG) setbuf(stdout, NULL); setbuf(stderr, NULL); # endif # if defined(_HOST_OS_UNICOS) /* Lots of start up - ignore first call. See the comment block that */ /* precedes procedure cif_summary_rec in fecif.c for a discussion of the */ /* timing methods used by the different platforms. */ SECOND(&start_time); /* M_LOWFIT will eventually be in malloc.h. */ /* When it is remove this definition. */ # define M_LOWFIT 0107 /* Use lowest-fit algorithm for allocation. */ mallopt(M_LOWFIT, 1); # elif defined(_HOST_OS_MAX) /* Use clock() on MPP's (in particular T3E's) because at the time this */ /* change was made, neither SECOND() nor SECONDR() worked on T3E's. */ /* LRR 4 Mar 1997 */ clock(); start_time = 0; /* M_LOWFIT will eventually be in malloc.h. */ /* When it is remove this definition. */ # define M_LOWFIT 0107 /* Use lowest-fit algorithm for allocation. */ mallopt(M_LOWFIT, 1); # elif defined(_HOST_OS_SOLARIS) /* clock() is only semi-useful on a Sun because it rolls over in just over */ /* 2147 seconds (about 36 minutes). So on a Sun, we use clock() and */ /* time() both. If elapsed time <= 2147 seconds, the accounting info will */ /* show milliseconds (from clock()), else it will show seconds (because */ /* that is the accuracy of time()). This resolution should be good enough */ /* for a compilation exceeding 36 minutes. */ start_time = (float) time(NULL); clock(); # elif (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX)) getrusage (RUSAGE_SELF, &ru); start_time = (double) ru.ru_utime.tv_sec + (double) ru.ru_utime.tv_usec * 1e-6 + (double) ru.ru_stime.tv_sec + (double) ru.ru_stime.tv_usec * 1e-6; # else start_time = 0; # endif comp_phase = Pass1_Parsing; stmt_start_line = 1; /* Set in case mem problems */ init_compiler(argc, argv); /* init and process cmd line */ if (on_off_flags.preprocess_only) { goto PREPROCESS_ONLY_SKIP; } stmt_start_line = 0; while (LA_CH_CLASS != Ch_Class_EOF) { comp_phase = Pass1_Parsing; num_prog_unit_errors = 0; /* Accum errs for pgm unit */ OUTPUT_PASS_HEADER(Syntax_Pass); if (save_statement_number != 0) { statement_number = save_statement_number; } parse_prog_unit(); save_statement_number = statement_number; if (LA_CH_CLASS == Ch_Class_EOF) { issue_deferred_msgs(); } /* get current field length and save largest value */ field_len = (long) sbrk(0); # if defined(_HOST_OS_MAX) field_len &= (1 << 32) - 1; # endif if (field_len > max_field_len) { /* Max set in init_compiler */ max_field_len = field_len; /* Track max usage */ } PRINT_IR_TBL; /* If -u ir and DEBUG compiler, print ir. */ OUTPUT_PASS_HEADER(Semantics_Pass); semantics_pass_driver(); /* PASS 2 */ if (SCP_IN_ERR(curr_scp_idx)) { some_scp_in_err = TRUE; } PRINT_ALL_SYM_TBLS; /* If debug print -u options */ PRINT_FORTRAN_OUT; /* Print ir in a fortran format */ line_num = SH_GLB_LINE(SCP_LAST_SH_IDX(curr_scp_idx)); column_num = SH_COL_NUM(SCP_LAST_SH_IDX(curr_scp_idx)); if (num_prog_unit_errors == 0) { if (opt_flags.inline_lvl > Inline_Lvl_0) { comp_phase = Inlining; inline_processing(SCP_FIRST_SH_IDX(curr_scp_idx)); PRINT_IR_TBL3; } } insert_global_directives = TRUE; comp_phase = Pdg_Conversion; if (dump_flags.preinline) { /* Do not do a full compile */ if (ATP_PGM_UNIT(SCP_ATTR_IDX(MAIN_SCP_IDX)) == Module || ATP_PGM_UNIT(SCP_ATTR_IDX(MAIN_SCP_IDX)) == Function || ATP_PGM_UNIT(SCP_ATTR_IDX(MAIN_SCP_IDX)) == Subroutine) { curr_scp_idx = MAIN_SCP_IDX; #ifdef KEY /* Bug 3477 */ if (create_mod_info_file()) { /* Creates a name for the file. */ create_mod_info_tbl(); /* Creates the table. */ output_mod_info_file(); /* Writes the table. */ } #else create_mod_info_file(); /* Creates a name for the file. */ create_mod_info_tbl(); /* Creates the table. */ output_mod_info_file(); /* Writes the table. */ #endif /* KEY Bug 3477 */ free_tables(); /* Frees the tables. */ } } else { #ifdef KEY /* Bug 3477 */ int do_output_file = FALSE; #endif /* KEY Bug 3477 */ if (ATP_PGM_UNIT(SCP_ATTR_IDX(MAIN_SCP_IDX)) == Module) { #ifdef KEY /* Bug 3477 */ do_output_file = create_mod_info_file(); /* Creates a name for the file. */ #else create_mod_info_file(); /* Creates a name for the file. */ #endif /* KEY Bug 3477 */ } if (num_prog_unit_errors == 0 && (binary_output || assembly_output)) { cvrt_to_pdg(compiler_gen_date); } else if (ATP_PGM_UNIT(SCP_ATTR_IDX(MAIN_SCP_IDX)) == Module) { if (!SCP_IN_ERR(MAIN_SCP_IDX)) { curr_scp_idx = MAIN_SCP_IDX; #ifdef KEY /* Bug 3477 */ if (do_output_file) { create_mod_info_tbl(); /* Creates the table. */ output_mod_info_file(); /* Writes the table. */ } #else create_mod_info_tbl(); /* Creates the table. */ output_mod_info_file(); /* Writes the table. */ #endif /* KEY Bug 3477 */ } free_tables(); /* Frees the tables. */ } else { free_tables(); /* Frees the tables. */ } } /* ALERT - At this point, the symbol tables are invalid. */ /* Spit out the End Unit for the current program unit. The End Unit */ /* is needed if the Compiler Information File (CIF) is being produced */ /* and for the buffered message file. */ stmt_start_line = line_num; stmt_start_col = column_num; if (scp_tbl == NULL_IDX) { /* Table has been freed. */ cif_end_unit_rec(program_unit_name); } else { cif_end_unit_rec(AT_OBJ_NAME_PTR(SCP_ATTR_IDX(curr_scp_idx))); } } /* while */ clean_up_module_files(); # ifdef _NAME_SUBSTITUTION_INLINING if (!dump_flags.preinline) # endif terminate_PDGCS(); PRINT_GL_TBL; /* Prints to debug_file ifdef _DEBUG and -u gl */ PRINT_GN_TBL; /* Prints to debug_file ifdef _DEBUG and -u gn */ PREPROCESS_ONLY_SKIP: # if defined(_HOST_OS_UNICOS) SECOND(&end_time); # elif defined(_HOST_OS_MAX) end_clock = clock(); end_time = 0; # elif defined(_HOST_OS_SOLARIS) end_time = (float) time(NULL); end_clock = clock(); # elif (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX)) getrusage(RUSAGE_SELF, &ru); end_time = (double) ru.ru_utime.tv_sec + (double) ru.ru_utime.tv_usec * 1e-6 + (double) ru.ru_stime.tv_sec + (double) ru.ru_stime.tv_usec * 1e-6; # else end_time = 0; # endif total_cpu_time = end_time - start_time; if (cif_need_unit_rec && cif_first_pgm_unit) { /* Catastrophic errors, like a free source form program was compiled */ /* in fixed source form mode, so no Unit record was output. Output */ /* enough records to keep libcif tools happy. This routine needs to be */ /* called whether or not a CIF is being written because the buffered */ /* message file also must have the correct format. */ cif_fake_a_unit(); } /* CAUTION: The following code assumes that non-Cray platforms measure */ /* memory usage in terms of bytes and that there are 4 bytes per word. */ cif_summary_rec(release_level, compiler_gen_date, compiler_gen_time, total_cpu_time, # if defined(_HOST_OS_UNICOS) (long) 0, (some_scp_in_err) ? -3 : max_field_len); # elif defined(_HOST_OS_MAX) end_clock, (some_scp_in_err) ? -3 : max_field_len); # elif (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX)) (long) 0, (some_scp_in_err) ? -3 : max_field_len/4); # else /* defined(_HOST_OS_SOLARIS) */ end_clock, (some_scp_in_err) ? -3 : max_field_len/4); # endif /* Output compilation summary info if the -V option was specified on the */ /* command line. Also, issue the summary information if any messages were */ /* actually issued. */ if (cmd_line_flags.verify_option || num_errors > 0 || num_warnings > 0 || num_cautions > 0 || num_notes > 0 || num_comments > 0 || num_ansi > 0 || (num_optz_msgs > 0 && opt_flags.msgs)) { print_buffered_messages(); print_id_line(); /* Output the summary lines. The compilation time is in seconds. */ /* CAUTION: The following non-Cray code assumes a 32-bit word. */ # if defined(_HOST_OS_UNICOS) PRINTMSG (0, 104, Log_Summary, 0, (double) total_cpu_time); msg_name = "cf90"; # elif defined(_HOST_OS_MAX) PRINTMSG (0, 104, Log_Summary, 0, (double) end_clock/1000000.0); msg_name = "cf90"; # elif defined(_HOST_OS_LINUX) msg_name = PSC_NAME_PREFIX "f95"; # elif (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX)) /* IRIX cannot handle the int to float change necessary to get the */ /* time printed correctly, so we'll convert it to a character string */ /* and use a different message. */ /* */ /* LRR 4/28/97 In an email message from Rich Shapiro to me, he stated */ /* he did not want this line in the summary lines. */ /* sprintf(time, "%-1.2f", (double) total_cpu_time); PRINTMSG (0, 1310, Log_Summary, 0, time); */ msg_name = "cf90"; # elif defined(_HOST_OS_SOLARIS) PRINTMSG (0, 104, Log_Summary, 0, (total_cpu_time <= 2147.0) ? (float) end_clock/1000000.0 : (float) total_cpu_time); msg_name = "cf90"; # endif /* Maximum field length (maximum amount of memory used) in words */ /* (decimal). */ /* CAUTION: Non-Cray platforms are assumed to measure memory usage in */ /* bytes and we assume 4 bytes per word. */ # if defined(_HOST_OS_UNICOS) PRINTMSG (0, 105, Log_Summary, 0, max_field_len); # elif ! (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX)) /* LRR 4/28/97 In an email message from Rich Shapiro to me, he stated */ /* he did not want this line in the summary lines. */ PRINTMSG (0, 105, Log_Summary, 0, max_field_len/4); # endif /* Number of source lines compiled. */ # if (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX)) && !defined(_TARGET_SV2) PRINTMSG (0, 1401, Log_Summary, 0, --curr_glb_line); # else PRINTMSG (0, 106, Log_Summary, 0, --curr_glb_line); # endif /* Number of messages issued. */ # if (defined(_HOST_OS_IRIX) || defined(_HOST_OS_LINUX)) && !defined(_TARGET_SV2) PRINTMSG (0, 1403, Log_Summary, 0, num_errors, num_warnings, (opt_flags.msgs == 0) ? (num_cautions + num_notes + num_comments) : (num_cautions + num_notes + num_comments + num_optz_msgs), num_ansi); # else PRINTMSG (0, 107, Log_Summary, 0, num_errors, num_warnings, (opt_flags.msgs == 0) ? (num_cautions + num_notes + num_comments) : (num_cautions + num_notes + num_comments + num_optz_msgs), num_ansi); /* Code: in words; data: in words. */ /* LRR 4/28/97 In an email message from Rich Shapiro to me, he stated */ /* he did not want this line in the summary lines. */ # if !defined(_TARGET_SV2) /* Prints blank for sv2 right now. */ PRINTMSG (0, 108, Log_Summary, 0, code_size, data_size); # endif # endif if (num_errors > 0 || num_warnings > 0 || num_cautions > 0 || num_notes > 0 || num_comments > 0 || num_ansi > 0 || (num_optz_msgs > 0 && opt_flags.msgs)) { PRINTMSG (0, 1636, Log_Summary, 0, msg_name, msg_name); } } /* End of summary printing. */ # ifdef _DEBUG /* Get memory usage reports for these global tables. */ final_src_input(); MEM_REPORT(file_path_tbl); MEM_REPORT(global_attr_tbl); MEM_REPORT(global_bounds_tbl); MEM_REPORT(global_line_tbl); MEM_REPORT(global_name_tbl); MEM_REPORT(global_type_tbl); MEM_REPORT(str_pool); # endif exit_compiler ((num_errors == 0) ? RC_OKAY : RC_USER_ERROR); } /* main */