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/df.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/df.c')
-rw-r--r-- | gcc/df.c | 107 |
1 files changed, 50 insertions, 57 deletions
@@ -171,12 +171,6 @@ Perhaps there should be a bitmap argument to df_analyse to specify #include "df.h" #include "fibheap.h" -#define FOR_ALL_BBS(BB, CODE) \ -do { \ - int node_; \ - for (node_ = 0; node_ < n_basic_blocks; node_++) \ - {(BB) = BASIC_BLOCK (node_); CODE;};} while (0) - #define FOR_EACH_BB_IN_BITMAP(BITMAP, MIN, BB, CODE) \ do { \ unsigned int node_; \ @@ -406,8 +400,8 @@ df_bitmaps_alloc (df, flags) struct df *df; int flags; { - unsigned int i; int dflags = 0; + basic_block bb; /* Free the bitmaps if they need resizing. */ if ((flags & DF_LR) && df->n_regs < (unsigned int)max_reg_num ()) @@ -423,9 +417,8 @@ df_bitmaps_alloc (df, flags) df->n_defs = df->def_id; df->n_uses = df->use_id; - for (i = 0; i < df->n_bbs; i++) + FOR_EACH_BB (bb) { - basic_block bb = BASIC_BLOCK (i); struct bb_info *bb_info = DF_BB_INFO (df, bb); if (flags & DF_RD && ! bb_info->rd_in) @@ -474,11 +467,10 @@ df_bitmaps_free (df, flags) struct df *df ATTRIBUTE_UNUSED; int flags; { - unsigned int i; + basic_block bb; - for (i = 0; i < df->n_bbs; i++) + FOR_EACH_BB (bb) { - basic_block bb = BASIC_BLOCK (i); struct bb_info *bb_info = DF_BB_INFO (df, bb); if (!bb_info) @@ -534,7 +526,7 @@ df_alloc (df, n_regs) int n_regs; { int n_insns; - int i; + basic_block bb; gcc_obstack_init (&df_ref_obstack); @@ -572,8 +564,8 @@ df_alloc (df, n_regs) df->bbs = xcalloc (df->n_bbs, sizeof (struct bb_info)); df->all_blocks = BITMAP_XMALLOC (); - for (i = 0; i < n_basic_blocks; i++) - bitmap_set_bit (df->all_blocks, i); + FOR_EACH_BB (bb) + bitmap_set_bit (df->all_blocks, bb->index); } @@ -1946,6 +1938,8 @@ df_analyse_1 (df, blocks, flags, update) int aflags; int dflags; int i; + basic_block bb; + dflags = 0; aflags = flags; if (flags & DF_UD_CHAIN) @@ -2029,17 +2023,16 @@ df_analyse_1 (df, blocks, flags, update) /* Compute the sets of gens and kills for the defs of each bb. */ df_rd_local_compute (df, df->flags & DF_RD ? blocks : df->all_blocks); { - int i; bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks); - for (i = 0; i < n_basic_blocks; i ++) + FOR_EACH_BB (bb) { - in[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_in; - out[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_out; - gen[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_gen; - kill[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->rd_kill; + in[bb->index] = DF_BB_INFO (df, bb)->rd_in; + out[bb->index] = DF_BB_INFO (df, bb)->rd_out; + gen[bb->index] = DF_BB_INFO (df, bb)->rd_gen; + kill[bb->index] = DF_BB_INFO (df, bb)->rd_kill; } iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks, FORWARD, UNION, df_rd_transfer_function, @@ -2066,17 +2059,16 @@ df_analyse_1 (df, blocks, flags, update) uses in each bb. */ df_ru_local_compute (df, df->flags & DF_RU ? blocks : df->all_blocks); { - int i; bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *gen = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *kill = xmalloc (sizeof (bitmap) * n_basic_blocks); - for (i = 0; i < n_basic_blocks; i ++) + FOR_EACH_BB (bb) { - in[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_in; - out[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_out; - gen[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_gen; - kill[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->ru_kill; + in[bb->index] = DF_BB_INFO (df, bb)->ru_in; + out[bb->index] = DF_BB_INFO (df, bb)->ru_out; + gen[bb->index] = DF_BB_INFO (df, bb)->ru_gen; + kill[bb->index] = DF_BB_INFO (df, bb)->ru_kill; } iterative_dataflow_bitmap (in, out, gen, kill, df->all_blocks, BACKWARD, UNION, df_ru_transfer_function, @@ -2106,17 +2098,16 @@ df_analyse_1 (df, blocks, flags, update) /* Compute the sets of defs and uses of live variables. */ df_lr_local_compute (df, df->flags & DF_LR ? blocks : df->all_blocks); { - int i; bitmap *in = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *out = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *use = xmalloc (sizeof (bitmap) * n_basic_blocks); bitmap *def = xmalloc (sizeof (bitmap) * n_basic_blocks); - for (i = 0; i < n_basic_blocks; i ++) + FOR_EACH_BB (bb) { - in[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_in; - out[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_out; - use[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_use; - def[i] = DF_BB_INFO (df, BASIC_BLOCK (i))->lr_def; + in[bb->index] = DF_BB_INFO (df, bb)->lr_in; + out[bb->index] = DF_BB_INFO (df, bb)->lr_out; + use[bb->index] = DF_BB_INFO (df, bb)->lr_use; + def[bb->index] = DF_BB_INFO (df, bb)->lr_def; } iterative_dataflow_bitmap (in, out, use, def, df->all_blocks, BACKWARD, UNION, df_lr_transfer_function, @@ -2270,12 +2261,15 @@ df_modified_p (df, blocks) struct df *df; bitmap blocks; { - unsigned int j; int update = 0; + basic_block bb; + + if (!df->n_bbs) + return 0; - for (j = 0; j < df->n_bbs; j++) - if (bitmap_bit_p (df->bbs_modified, j) - && (! blocks || (blocks == (bitmap) -1) || bitmap_bit_p (blocks, j))) + FOR_EACH_BB (bb) + if (bitmap_bit_p (df->bbs_modified, bb->index) + && (! blocks || (blocks == (bitmap) -1) || bitmap_bit_p (blocks, bb->index))) { update = 1; break; @@ -2408,7 +2402,7 @@ df_refs_unlink (df, blocks) } else { - FOR_ALL_BBS (bb, + FOR_EACH_BB (bb, { df_bb_refs_unlink (df, bb); }); @@ -3274,8 +3268,8 @@ df_dump (df, flags, file) int flags; FILE *file; { - unsigned int i; unsigned int j; + basic_block bb; if (! df || ! file) return; @@ -3286,22 +3280,23 @@ df_dump (df, flags, file) if (flags & DF_RD) { + basic_block bb; + fprintf (file, "Reaching defs:\n"); - for (i = 0; i < df->n_bbs; i++) + FOR_EACH_BB (bb) { - basic_block bb = BASIC_BLOCK (i); struct bb_info *bb_info = DF_BB_INFO (df, bb); if (! bb_info->rd_in) continue; - fprintf (file, "bb %d in \t", i); + fprintf (file, "bb %d in \t", bb->index); dump_bitmap (file, bb_info->rd_in); - fprintf (file, "bb %d gen \t", i); + fprintf (file, "bb %d gen \t", bb->index); dump_bitmap (file, bb_info->rd_gen); - fprintf (file, "bb %d kill\t", i); + fprintf (file, "bb %d kill\t", bb->index); dump_bitmap (file, bb_info->rd_kill); - fprintf (file, "bb %d out \t", i); + fprintf (file, "bb %d out \t", bb->index); dump_bitmap (file, bb_info->rd_out); } } @@ -3329,21 +3324,20 @@ df_dump (df, flags, file) if (flags & DF_RU) { fprintf (file, "Reaching uses:\n"); - for (i = 0; i < df->n_bbs; i++) + FOR_EACH_BB (bb) { - basic_block bb = BASIC_BLOCK (i); struct bb_info *bb_info = DF_BB_INFO (df, bb); if (! bb_info->ru_in) continue; - fprintf (file, "bb %d in \t", i); + fprintf (file, "bb %d in \t", bb->index); dump_bitmap (file, bb_info->ru_in); - fprintf (file, "bb %d gen \t", i); + fprintf (file, "bb %d gen \t", bb->index); dump_bitmap (file, bb_info->ru_gen); - fprintf (file, "bb %d kill\t", i); + fprintf (file, "bb %d kill\t", bb->index); dump_bitmap (file, bb_info->ru_kill); - fprintf (file, "bb %d out \t", i); + fprintf (file, "bb %d out \t", bb->index); dump_bitmap (file, bb_info->ru_out); } } @@ -3371,21 +3365,20 @@ df_dump (df, flags, file) if (flags & DF_LR) { fprintf (file, "Live regs:\n"); - for (i = 0; i < df->n_bbs; i++) + FOR_EACH_BB (bb) { - basic_block bb = BASIC_BLOCK (i); struct bb_info *bb_info = DF_BB_INFO (df, bb); if (! bb_info->lr_in) continue; - fprintf (file, "bb %d in \t", i); + fprintf (file, "bb %d in \t", bb->index); dump_bitmap (file, bb_info->lr_in); - fprintf (file, "bb %d use \t", i); + fprintf (file, "bb %d use \t", bb->index); dump_bitmap (file, bb_info->lr_use); - fprintf (file, "bb %d def \t", i); + fprintf (file, "bb %d def \t", bb->index); dump_bitmap (file, bb_info->lr_def); - fprintf (file, "bb %d out \t", i); + fprintf (file, "bb %d out \t", bb->index); dump_bitmap (file, bb_info->lr_out); } } |