aboutsummaryrefslogtreecommitdiff
path: root/gcc/ssa.c
diff options
context:
space:
mode:
authorZdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>2002-05-23 21:23:51 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2002-05-23 19:23:51 +0000
commite0082a72651ae718c46e4f3510bba4a116148fc7 (patch)
treed9ef360c452a150ca3f25a23e593846ce26b64f0 /gcc/ssa.c
parent17645b154d8a32a6fad15296e1030d06f5a0456b (diff)
downloadgcc-e0082a72651ae718c46e4f3510bba4a116148fc7.zip
gcc-e0082a72651ae718c46e4f3510bba4a116148fc7.tar.gz
gcc-e0082a72651ae718c46e4f3510bba4a116148fc7.tar.bz2
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/ssa.c')
-rw-r--r--gcc/ssa.c82
1 files changed, 40 insertions, 42 deletions
diff --git a/gcc/ssa.c b/gcc/ssa.c
index 686339c..9fada95 100644
--- a/gcc/ssa.c
+++ b/gcc/ssa.c
@@ -470,18 +470,18 @@ find_evaluations (evals, nregs)
sbitmap *evals;
int nregs;
{
- int bb;
+ basic_block bb;
sbitmap_vector_zero (evals, nregs);
fe_evals = evals;
- for (bb = n_basic_blocks; --bb >= 0; )
+ FOR_EACH_BB_REVERSE (bb)
{
rtx p, last;
- fe_current_bb = bb;
- p = BLOCK_HEAD (bb);
- last = BLOCK_END (bb);
+ fe_current_bb = bb->index;
+ p = bb->head;
+ last = bb->end;
while (1)
{
if (INSN_P (p))
@@ -520,7 +520,7 @@ compute_dominance_frontiers_1 (frontiers, idom, bb, done)
{
basic_block b = BASIC_BLOCK (bb);
edge e;
- int c;
+ basic_block c;
SET_BIT (done, bb);
sbitmap_zero (frontiers[bb]);
@@ -528,9 +528,9 @@ compute_dominance_frontiers_1 (frontiers, idom, bb, done)
/* Do the frontier of the children first. Not all children in the
dominator tree (blocks dominated by this one) are children in the
CFG, so check all blocks. */
- for (c = 0; c < n_basic_blocks; ++c)
- if (idom[c] == bb && ! TEST_BIT (done, c))
- compute_dominance_frontiers_1 (frontiers, idom, c, done);
+ FOR_EACH_BB (c)
+ if (idom[c->index] == bb && ! TEST_BIT (done, c->index))
+ compute_dominance_frontiers_1 (frontiers, idom, c->index, done);
/* Find blocks conforming to rule (1) above. */
for (e = b->succ; e; e = e->succ_next)
@@ -542,11 +542,11 @@ compute_dominance_frontiers_1 (frontiers, idom, bb, done)
}
/* Find blocks conforming to rule (2). */
- for (c = 0; c < n_basic_blocks; ++c)
- if (idom[c] == bb)
+ FOR_EACH_BB (c)
+ if (idom[c->index] == bb)
{
int x;
- EXECUTE_IF_SET_IN_SBITMAP (frontiers[c], 0, x,
+ EXECUTE_IF_SET_IN_SBITMAP (frontiers[c->index], 0, x,
{
if (idom[x] != bb)
SET_BIT (frontiers[bb], x);
@@ -975,7 +975,7 @@ rename_block (bb, idom)
edge e;
rtx insn, next, last;
struct rename_set_data *set_data = NULL;
- int c;
+ basic_block c;
/* Step One: Walk the basic block, adding new names for sets and
replacing uses. */
@@ -1078,9 +1078,9 @@ rename_block (bb, idom)
/* Step Three: Do the same to the children of this block in
dominator order. */
- for (c = 0; c < n_basic_blocks; ++c)
- if (idom[c] == bb)
- rename_block (c, idom);
+ FOR_EACH_BB (c)
+ if (idom[c->index] == bb)
+ rename_block (c->index, idom);
/* Step Four: Update the sets to refer to their new register,
and restore ssa_rename_to to its previous state. */
@@ -1140,6 +1140,8 @@ convert_to_ssa ()
int nregs;
+ basic_block bb;
+
/* Don't do it twice. */
if (in_ssa_form)
abort ();
@@ -1154,10 +1156,9 @@ convert_to_ssa ()
if (rtl_dump_file)
{
- int i;
fputs (";; Immediate Dominators:\n", rtl_dump_file);
- for (i = 0; i < n_basic_blocks; ++i)
- fprintf (rtl_dump_file, ";\t%3d = %3d\n", i, idom[i]);
+ FOR_EACH_BB (bb)
+ fprintf (rtl_dump_file, ";\t%3d = %3d\n", bb->index, idom[bb->index]);
fflush (rtl_dump_file);
}
@@ -1629,7 +1630,7 @@ make_equivalent_phi_alternatives_equivalent (bb, reg_partition)
static partition
compute_conservative_reg_partition ()
{
- int bb;
+ basic_block bb;
int changed = 0;
/* We don't actually work with hard registers, but it's easier to
@@ -1642,8 +1643,8 @@ compute_conservative_reg_partition ()
be copied on abnormal critical edges are placed in the same
partition. This saves us from having to split abnormal critical
edges. */
- for (bb = n_basic_blocks; --bb >= 0; )
- changed += make_regs_equivalent_over_bad_edges (bb, p);
+ FOR_EACH_BB_REVERSE (bb)
+ changed += make_regs_equivalent_over_bad_edges (bb->index, p);
/* Now we have to insure that corresponding arguments of phi nodes
assigning to corresponding regs are equivalent. Iterate until
@@ -1651,8 +1652,8 @@ compute_conservative_reg_partition ()
while (changed > 0)
{
changed = 0;
- for (bb = n_basic_blocks; --bb >= 0; )
- changed += make_equivalent_phi_alternatives_equivalent (bb, p);
+ FOR_EACH_BB_REVERSE (bb)
+ changed += make_equivalent_phi_alternatives_equivalent (bb->index, p);
}
return p;
@@ -1848,7 +1849,7 @@ coalesce_regs_in_successor_phi_nodes (bb, p, conflicts)
static partition
compute_coalesced_reg_partition ()
{
- int bb;
+ basic_block bb;
int changed = 0;
regset_head phi_set_head;
regset phi_set = &phi_set_head;
@@ -1860,8 +1861,8 @@ compute_coalesced_reg_partition ()
be copied on abnormal critical edges are placed in the same
partition. This saves us from having to split abnormal critical
edges (which can't be done). */
- for (bb = n_basic_blocks; --bb >= 0; )
- make_regs_equivalent_over_bad_edges (bb, p);
+ FOR_EACH_BB_REVERSE (bb)
+ make_regs_equivalent_over_bad_edges (bb->index, p);
INIT_REG_SET (phi_set);
@@ -1883,12 +1884,11 @@ compute_coalesced_reg_partition ()
blocks first, so that most frequently executed copies would
be more likely to be removed by register coalescing. But any
order will generate correct, if non-optimal, results. */
- for (bb = n_basic_blocks; --bb >= 0; )
+ FOR_EACH_BB_REVERSE (bb)
{
- basic_block block = BASIC_BLOCK (bb);
- changed += coalesce_regs_in_copies (block, p, conflicts);
+ changed += coalesce_regs_in_copies (bb, p, conflicts);
changed +=
- coalesce_regs_in_successor_phi_nodes (block, p, conflicts);
+ coalesce_regs_in_successor_phi_nodes (bb, p, conflicts);
}
conflict_graph_delete (conflicts);
@@ -2094,11 +2094,10 @@ static void
rename_equivalent_regs (reg_partition)
partition reg_partition;
{
- int bb;
+ basic_block b;
- for (bb = n_basic_blocks; --bb >= 0; )
+ FOR_EACH_BB_REVERSE (b)
{
- basic_block b = BASIC_BLOCK (bb);
rtx next = b->head;
rtx last = b->end;
rtx insn;
@@ -2141,7 +2140,7 @@ rename_equivalent_regs (reg_partition)
void
convert_from_ssa ()
{
- int bb;
+ basic_block b, bb;
partition reg_partition;
rtx insns = get_insns ();
@@ -2167,9 +2166,8 @@ convert_from_ssa ()
rename_equivalent_regs (reg_partition);
/* Eliminate the PHI nodes. */
- for (bb = n_basic_blocks; --bb >= 0; )
+ FOR_EACH_BB_REVERSE (b)
{
- basic_block b = BASIC_BLOCK (bb);
edge e;
for (e = b->pred; e; e = e->pred_next)
@@ -2180,17 +2178,17 @@ convert_from_ssa ()
partition_delete (reg_partition);
/* Actually delete the PHI nodes. */
- for (bb = n_basic_blocks; --bb >= 0; )
+ FOR_EACH_BB_REVERSE (bb)
{
- rtx insn = BLOCK_HEAD (bb);
+ rtx insn = bb->head;
while (1)
{
/* If this is a PHI node delete it. */
if (PHI_NODE_P (insn))
{
- if (insn == BLOCK_END (bb))
- BLOCK_END (bb) = PREV_INSN (insn);
+ if (insn == bb->end)
+ bb->end = PREV_INSN (insn);
insn = delete_insn (insn);
}
/* Since all the phi nodes come at the beginning of the
@@ -2199,7 +2197,7 @@ convert_from_ssa ()
else if (INSN_P (insn))
break;
/* If we've reached the end of the block, stop. */
- else if (insn == BLOCK_END (bb))
+ else if (insn == bb->end)
break;
else
insn = NEXT_INSN (insn);