diff options
author | Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> | 2002-05-23 21:23:51 +0200 |
---|---|---|
committer | Zdenek Dvorak <rakdver@gcc.gnu.org> | 2002-05-23 19:23:51 +0000 |
commit | e0082a72651ae718c46e4f3510bba4a116148fc7 (patch) | |
tree | d9ef360c452a150ca3f25a23e593846ce26b64f0 /gcc/cfgrtl.c | |
parent | 17645b154d8a32a6fad15296e1030d06f5a0456b (diff) | |
download | gcc-e0082a72651ae718c46e4f3510bba4a116148fc7.tar.gz |
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
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r-- | gcc/cfgrtl.c | 65 |
1 files changed, 26 insertions, 39 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 781b26adf33..226e301b1b4 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -448,16 +448,15 @@ void compute_bb_for_insn (max) int max; { - int i; + basic_block bb; if (basic_block_for_insn) VARRAY_FREE (basic_block_for_insn); VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn"); - for (i = 0; i < n_basic_blocks; ++i) + FOR_EACH_BB (bb) { - basic_block bb = BASIC_BLOCK (i); rtx end = bb->end; rtx insn; @@ -1168,14 +1167,17 @@ tidy_fallthru_edge (e, b, c) void tidy_fallthru_edges () { - int i; + basic_block b, c; + + if (ENTRY_BLOCK_PTR->next_bb == EXIT_BLOCK_PTR) + return; - for (i = 1; i < n_basic_blocks; i++) + FOR_BB_BETWEEN (b, ENTRY_BLOCK_PTR->next_bb, EXIT_BLOCK_PTR->prev_bb, next_bb) { - basic_block c = BASIC_BLOCK (i); - basic_block b = c->prev_bb; edge s; + c = b->next_bb; + /* We care about simple conditional or unconditional jumps with a single successor. @@ -1476,16 +1478,13 @@ commit_one_edge_insertion (e, watch_calls) void commit_edge_insertions () { - int i; basic_block bb; #ifdef ENABLE_CHECKING verify_flow_info (); #endif - i = -1; - bb = ENTRY_BLOCK_PTR; - while (1) + FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb) { edge e, next; @@ -1495,10 +1494,6 @@ commit_edge_insertions () if (e->insns) commit_one_edge_insertion (e, false); } - - if (++i >= n_basic_blocks) - break; - bb = BASIC_BLOCK (i); } } @@ -1508,16 +1503,13 @@ commit_edge_insertions () void commit_edge_insertions_watch_calls () { - int i; basic_block bb; #ifdef ENABLE_CHECKING verify_flow_info (); #endif - i = -1; - bb = ENTRY_BLOCK_PTR; - while (1) + FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb) { edge e, next; @@ -1527,10 +1519,6 @@ commit_edge_insertions_watch_calls () if (e->insns) commit_one_edge_insertion (e, true); } - - if (++i >= n_basic_blocks) - break; - bb = BASIC_BLOCK (i); } } @@ -1601,7 +1589,6 @@ print_rtl_with_bb (outf, rtx_first) fprintf (outf, "(nil)\n"); else { - int i; enum bb_state { NOT_IN_BB, IN_ONE_BB, IN_MULTIPLE_BB }; int max_uid = get_max_uid (); basic_block *start @@ -1611,9 +1598,10 @@ print_rtl_with_bb (outf, rtx_first) enum bb_state *in_bb_p = (enum bb_state *) xcalloc (max_uid, sizeof (enum bb_state)); - for (i = n_basic_blocks - 1; i >= 0; i--) + basic_block bb; + + FOR_EACH_BB_REVERSE (bb) { - basic_block bb = BASIC_BLOCK (i); rtx x; start[INSN_UID (bb->head)] = bb; @@ -1634,7 +1622,6 @@ print_rtl_with_bb (outf, rtx_first) for (tmp_rtx = rtx_first; NULL != tmp_rtx; tmp_rtx = NEXT_INSN (tmp_rtx)) { int did_output; - basic_block bb; if ((bb = start[INSN_UID (tmp_rtx)]) != NULL) { @@ -1721,7 +1708,7 @@ verify_flow_info () basic_block *bb_info, *last_visited; size_t *edge_checksum; rtx x; - int i, last_bb_num_seen, num_bb_notes, err = 0; + int i, num_bb_notes, err = 0; basic_block bb, last_bb_seen; bb_info = (basic_block *) xcalloc (max_uid, sizeof (basic_block)); @@ -1765,9 +1752,8 @@ verify_flow_info () last_bb_seen = bb; } - for (i = n_basic_blocks - 1; i >= 0; i--) + FOR_EACH_BB_REVERSE (bb) { - basic_block bb = BASIC_BLOCK (i); rtx head = bb->head; rtx end = bb->end; @@ -1813,9 +1799,8 @@ verify_flow_info () } /* Now check the basic blocks (boundaries etc.) */ - for (i = n_basic_blocks - 1; i >= 0; i--) + FOR_EACH_BB_REVERSE (bb) { - basic_block bb = BASIC_BLOCK (i); int n_fallthru = 0, n_eh = 0, n_call = 0, n_abnormal = 0, n_branch = 0; edge e; rtx note; @@ -2087,8 +2072,9 @@ verify_flow_info () err = 1; } - last_bb_num_seen = -1; num_bb_notes = 0; + last_bb_seen = ENTRY_BLOCK_PTR; + for (x = rtx_first; x; x = NEXT_INSN (x)) { if (NOTE_INSN_BASIC_BLOCK_P (x)) @@ -2096,10 +2082,10 @@ verify_flow_info () basic_block bb = NOTE_BASIC_BLOCK (x); num_bb_notes++; - if (bb->index != last_bb_num_seen + 1) + if (bb != last_bb_seen->next_bb) internal_error ("basic blocks not numbered consecutively"); - last_bb_num_seen = bb->index; + last_bb_seen = bb; } if (!bb_info[INSN_UID (x)]) @@ -2325,8 +2311,9 @@ bool purge_all_dead_edges (update_life_p) int update_life_p; { - int i, purged = false; + int purged = false; sbitmap blocks = 0; + basic_block bb; if (update_life_p) { @@ -2334,13 +2321,13 @@ purge_all_dead_edges (update_life_p) sbitmap_zero (blocks); } - for (i = 0; i < n_basic_blocks; i++) + FOR_EACH_BB (bb) { - bool purged_here = purge_dead_edges (BASIC_BLOCK (i)); + bool purged_here = purge_dead_edges (bb); purged |= purged_here; if (purged_here && update_life_p) - SET_BIT (blocks, i); + SET_BIT (blocks, bb->index); } if (update_life_p && purged) |