From e0082a72651ae718c46e4f3510bba4a116148fc7 Mon Sep 17 00:00:00 2001 From: Zdenek Dvorak Date: Thu, 23 May 2002 21:23:51 +0200 Subject: bb-reorder.c (make_reorder_chain, [...]): Use FOR_EACH_BB macros to iterate over basic block chain. * bb-reorder.c (make_reorder_chain, make_reorder_chain_1): Use FOR_EACH_BB macros to iterate over basic block chain. * cfg.c (clear_edges, clear_bb_flags, dump_flow_info, alloc_aux_for_blocks, clear_aux_for_blocks, alloc_aux_for_edges): Likewise. * cfganal.c (set_edge_can_fallthru_flag, flow_call_edges_add, find_unreachable_blocks, create_edge_list, verify_edge_list, remove_fake_edges, add_noreturn_fake_exit_edges, flow_preorder_transversal_compute, flow_dfs_compute_reverse_execute): Likewise. * cfgbuild.c (make_edges, find_basic_blocks, find_many_sub_basic_blocks, find_sub_basic_blocks): Likewise. * cfgcleanup.c (try_optimize_cfg, delete_unreachable_blocks): Likewise. * cfglayout.c (record_effective_endpoints, cleanup_unconditional_jumps): Likewise. * cfgloop.c (flow_loops_cfg_dump, flow_loops_find): Likewise. * cfgrtl.c (compute_bb_for_insn, tidy_fallthru_edges, commit_edge_insertions, commit_edge_insertions_watch_calls, print_rtl_with_bb, verify_flow_info, purge_all_dead_edges): Likewise. * combine.c (combine_instructions, reg_dead_at_p): Likewise. * conflict.c (conflict_graph_compute): Likewise. * df.c (df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_analyse_1, df_modified_p, df_refs_unlink, df_dump): Likewise. * dominance.c (calc_dfs_tree, calculate_dominance_info): Likewise. * final.c (compute_alignments): Likewise. * flow.c (update_life_info, update_life_info_in_dirty_blocks, delete_noop_moves, calculate_global_regs_live, allocate_bb_life_data, count_or_remove_death_notes): Likewise. * gcse.c (oprs_unchanged_p, record_last_reg_set_info, compute_hash_table, compute_kill_rd, compute_rd, compute_ae_kill, classic_gcse, compute_transp, cprop, compute_pre_data, compute_transpout, invalidate_nonnull_info, delete_null_pointer_checks_1, delete_null_pointer_checks, compute_code_hoist_vbeinout, hoist_code, compute_ld_motion_mems, compute_store_table, build_store_vectors, store_motion): Likewise. * global.c (global_conflicts, mark_elimination): Likewise. * graph.c (print_rtl_graph_with_bb): Likewise. * haifa-sched.c (sched_init): Likewise. * ifcvt.c (if_convert): Likewise. * lcm.c (compute_antinout_edge, compute_laterin, compute_insert_delete, compute_available, compute_nearerout, compute_rev_insert_delete, optimize_mode_switching): Likewise. * local-alloc.c (local_alloc, update_equiv_regs): Likewise. * predict.c (estimate_probability, note_prediction_to_br_prob, propagate_freq, counts_to_freqs, expensive_function_p, estimate_bb_frequencies): Likewise. * profile.c (instrument_edges, get_exec_counts, compute_branch_probabilities, compute_checksum, branch_prob, find_spanning_tree): Likewise. * recog.c (split_all_insns, peephole2_optimize): Likewise. * reg-stack.c (reg_to_stack, convert_regs_entry, convert_regs): Likewise. * regclass.c (scan_one_insn, regclass): Likewise. * regmove.c (mark_flags_life_zones, regmove_optimize, record_stack_memrefs): Likewise. * regrename.c (regrename_optimize, copyprop_hardreg_forward): Likewise. * reload1.c (reload, reload_combine, fixup_abnormal_edges): Likewise. * resource.c (find_basic_block): Likewise. * sched-ebb.c (schedule_ebbs): Likewise. * sched-rgn.c (is_cfg_nonregular, build_control_flow, find_single_block_region, find_rgns, schedule_insns) * sibcall.c (optimize_sibling_and_tail_recursive_call) * ssa-ccp.c (optimize_unexecutable_edges, ssa_ccp_df_delete_unreachable_insns): Likewise. * ssa-dce.c (ssa_eliminate_dead_code): Likewise. * ssa.c (find_evaluations, compute_dominance_frontiers_1, rename_block, convert_to_ssa, compute_conservative_reg_partition, compute_coalesced_reg_partition, rename_equivalent_regs, convert_from_ssa): Likewise. * config/ia64/ia64.c (emit_predicate_relation_info, process_epilogue, process_for_unwind_directive): Likewise. * df.c (FOR_ALL_BBS): Removed. * gcse.c (struct null_pointer_info): Type of current_block field changed. (struct reg_avail_info): Type of last_bb field changed. * config/ia64/ia64.c (block_num): Removed. (need_copy_state): Type changed. (last_block): New. From-SVN: r53804 --- gcc/haifa-sched.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'gcc/haifa-sched.c') diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 6b3e316..147dd7d 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -2303,7 +2303,8 @@ void sched_init (dump_file) FILE *dump_file; { - int luid, b; + int luid; + basic_block b; rtx insn; int i; @@ -2356,8 +2357,8 @@ sched_init (dump_file) h_i_d[0].luid = 0; luid = 1; - for (b = 0; b < n_basic_blocks; b++) - for (insn = BLOCK_HEAD (b);; insn = NEXT_INSN (insn)) + FOR_EACH_BB (b) + for (insn = b->head;; insn = NEXT_INSN (insn)) { INSN_LUID (insn) = luid; @@ -2369,7 +2370,7 @@ sched_init (dump_file) if (GET_CODE (insn) != NOTE) ++luid; - if (insn == BLOCK_END (b)) + if (insn == b->end) break; } @@ -2391,22 +2392,22 @@ sched_init (dump_file) predecessor has been scheduled, it is impossible to accurately determine the correct line number for the first insn of the block. */ - for (b = 0; b < n_basic_blocks; b++) + FOR_EACH_BB (b) { - for (line = BLOCK_HEAD (b); line; line = PREV_INSN (line)) + for (line = b->head; line; line = PREV_INSN (line)) if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0) { - line_note_head[b] = line; + line_note_head[b->index] = line; break; } /* Do a forward search as well, since we won't get to see the first notes in a basic block. */ - for (line = BLOCK_HEAD (b); line; line = NEXT_INSN (line)) + for (line = b->head; line; line = NEXT_INSN (line)) { if (INSN_P (line)) break; if (GET_CODE (line) == NOTE && NOTE_LINE_NUMBER (line) > 0) - line_note_head[b] = line; + line_note_head[b->index] = line; } } } @@ -2420,22 +2421,22 @@ sched_init (dump_file) /* ??? Add a NOTE after the last insn of the last basic block. It is not known why this is done. */ - insn = BLOCK_END (n_basic_blocks - 1); + insn = EXIT_BLOCK_PTR->prev_bb->end; if (NEXT_INSN (insn) == 0 || (GET_CODE (insn) != NOTE && GET_CODE (insn) != CODE_LABEL /* Don't emit a NOTE if it would end up before a BARRIER. */ && GET_CODE (NEXT_INSN (insn)) != BARRIER)) { - emit_note_after (NOTE_INSN_DELETED, BLOCK_END (n_basic_blocks - 1)); + emit_note_after (NOTE_INSN_DELETED, EXIT_BLOCK_PTR->prev_bb->end); /* Make insn to appear outside BB. */ - BLOCK_END (n_basic_blocks - 1) = PREV_INSN (BLOCK_END (n_basic_blocks - 1)); + EXIT_BLOCK_PTR->prev_bb->end = PREV_INSN (EXIT_BLOCK_PTR->prev_bb->end); } /* Compute INSN_REG_WEIGHT for all blocks. We must do this before removing death notes. */ - for (b = n_basic_blocks - 1; b >= 0; b--) - find_insn_reg_weight (b); + FOR_EACH_BB_REVERSE (b) + find_insn_reg_weight (b->index); } /* Free global data used during insn scheduling. */ -- cgit v1.1