diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-23 19:23:51 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-23 19:23:51 +0000 |
commit | 4c26117afc55fbf0b998d0bf25f1ab56da4dd180 (patch) | |
tree | d9ef360c452a150ca3f25a23e593846ce26b64f0 /gcc/profile.c | |
parent | df64d85ee58f6385c06511417a9a8a2f60a17261 (diff) | |
download | gcc-4c26117afc55fbf0b998d0bf25f1ab56da4dd180.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53804 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/profile.c')
-rw-r--r-- | gcc/profile.c | 64 |
1 files changed, 24 insertions, 40 deletions
diff --git a/gcc/profile.c b/gcc/profile.c index 5924e0cbf33..10f2afba6d2 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -137,14 +137,13 @@ static void instrument_edges (el) struct edge_list *el; { - int i; int num_instr_edges = 0; int num_edges = NUM_EDGES (el); + basic_block bb; remove_fake_edges (); - for (i = 0; i < n_basic_blocks + 2; i++) + FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) { - basic_block bb = GCOV_INDEX_TO_BB (i); edge e = bb->succ; while (e) { @@ -216,8 +215,8 @@ static gcov_type * get_exec_counts () { int num_edges = 0; - int i; - int okay = 1; + basic_block bb; + int okay = 1, i; int mismatch = 0; gcov_type *profile; char *function_name_buffer; @@ -233,15 +232,12 @@ get_exec_counts () /* Count the edges to be (possibly) instrumented. */ - for (i = 0; i < n_basic_blocks + 2; i++) + FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) { - basic_block bb = GCOV_INDEX_TO_BB (i); edge e; for (e = bb->succ; e; e = e->succ_next) if (!EDGE_INFO (e)->ignore && !EDGE_INFO (e)->on_tree) - { - num_edges++; - } + num_edges++; } /* now read and combine all matching profiles. */ @@ -382,6 +378,7 @@ get_exec_counts () static void compute_branch_probabilities () { + basic_block bb; int i; int num_edges = 0; int changes; @@ -395,9 +392,8 @@ compute_branch_probabilities () /* Attach extra info block to each bb. */ alloc_aux_for_blocks (sizeof (struct bb_info)); - for (i = 0; i < n_basic_blocks + 2; i++) + FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) { - basic_block bb = GCOV_INDEX_TO_BB (i); edge e; for (e = bb->succ; e; e = e->succ_next) @@ -418,9 +414,8 @@ compute_branch_probabilities () /* The first count in the .da file is the number of times that the function was entered. This is the exec_count for block zero. */ - for (i = 0; i < n_basic_blocks + 2; i++) + FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) { - basic_block bb = GCOV_INDEX_TO_BB (i); edge e; for (e = bb->succ; e; e = e->succ_next) if (!EDGE_INFO (e)->ignore && !EDGE_INFO (e)->on_tree) @@ -472,9 +467,8 @@ compute_branch_probabilities () { passes++; changes = 0; - for (i = n_basic_blocks + 1; i >= 0; i--) + FOR_BB_BETWEEN (bb, EXIT_BLOCK_PTR, NULL, prev_bb) { - basic_block bb = GCOV_INDEX_TO_BB (i); struct bb_info *bi = BB_INFO (bb); if (! bi->count_valid) { @@ -569,9 +563,8 @@ compute_branch_probabilities () /* If the graph has been correctly solved, every block will have a succ and pred count of zero. */ - for (i = 0; i < n_basic_blocks; i++) + FOR_EACH_BB (bb) { - basic_block bb = BASIC_BLOCK (i); if (BB_INFO (bb)->succ_count || BB_INFO (bb)->pred_count) abort (); } @@ -584,9 +577,8 @@ compute_branch_probabilities () num_never_executed = 0; num_branches = 0; - for (i = 0; i <= n_basic_blocks + 1; i++) + FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) { - basic_block bb = GCOV_INDEX_TO_BB (i); edge e; gcov_type total; rtx note; @@ -702,12 +694,10 @@ static long compute_checksum () { long chsum = 0; - int i; - + basic_block bb; - for (i = 0; i < n_basic_blocks ; i++) + FOR_EACH_BB (bb) { - basic_block bb = BASIC_BLOCK (i); edge e; for (e = bb->succ; e; e = e->succ_next) @@ -740,6 +730,7 @@ compute_checksum () void branch_prob () { + basic_block bb; int i; int num_edges, ignored_edges; struct edge_list *el; @@ -768,11 +759,10 @@ branch_prob () We also add fake exit edges for each call and asm statement in the basic, since it may not return. */ - for (i = 0; i < n_basic_blocks ; i++) + FOR_EACH_BB (bb) { int need_exit_edge = 0, need_entry_edge = 0; int have_exit_edge = 0, have_entry_edge = 0; - basic_block bb = BASIC_BLOCK (i); rtx insn; edge e; @@ -797,7 +787,7 @@ branch_prob () { /* We should not get abort here, as call to setjmp should not be the very first instruction of function. */ - if (!i) + if (bb == ENTRY_BLOCK_PTR) abort (); make_edge (ENTRY_BLOCK_PTR, bb, EDGE_FAKE); } @@ -864,10 +854,8 @@ branch_prob () GCOV utility. */ if (flag_test_coverage) { - int i = 0; - for (i = 0 ; i < n_basic_blocks; i++) + FOR_EACH_BB (bb) { - basic_block bb = BASIC_BLOCK (i); rtx insn = bb->head; static int ignore_next_note = 0; @@ -976,9 +964,8 @@ branch_prob () __write_long (n_basic_blocks + 2, bbg_file, 4); __write_long (num_edges - ignored_edges + 1, bbg_file, 4); - for (i = 0; i < n_basic_blocks + 1; i++) + FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb) { - basic_block bb = GCOV_INDEX_TO_BB (i); edge e; long count = 0; @@ -1088,12 +1075,11 @@ find_spanning_tree (el) { int i; int num_edges = NUM_EDGES (el); + basic_block bb; /* We use aux field for standard union-find algorithm. */ - EXIT_BLOCK_PTR->aux = EXIT_BLOCK_PTR; - ENTRY_BLOCK_PTR->aux = ENTRY_BLOCK_PTR; - for (i = 0; i < n_basic_blocks; i++) - BASIC_BLOCK (i)->aux = BASIC_BLOCK (i); + FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) + bb->aux = bb; /* Add fake edge exit to entry we can't instrument. */ union_groups (EXIT_BLOCK_PTR, ENTRY_BLOCK_PTR); @@ -1149,10 +1135,8 @@ find_spanning_tree (el) } } - EXIT_BLOCK_PTR->aux = NULL; - ENTRY_BLOCK_PTR->aux = NULL; - for (i = 0; i < n_basic_blocks; i++) - BASIC_BLOCK (i)->aux = NULL; + FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) + bb->aux = NULL; } /* Perform file-level initialization for branch-prob processing. */ |