Commit 6809cbf9 by Richard Henderson Committed by Richard Henderson

basic-block.h (remove_fake_exit_edges): Declare.

        * basic-block.h (remove_fake_exit_edges): Declare.
        * cfganal.c (remove_fake_predecessors): Rename from
        remove_fake_successors; iterate over predecessors.
        (remove_fake_exit_edges): New.
        * cfgcleanup.c (try_optimize_cfg): Use it.
        * gcse.c (one_pre_gcse_pass, store_motion): Likewise.
        * predict.c (estimate_probability): Likewise.
        (tree_estimate_probability, note_prediction_to_br_prob): Likewise.
        * tree-cfg.c (make_edges): Likewise.
        * tree-ssa-pre.c (fini_pre): Likewise.
        * profile.c (instrument_edges): Don't remove_fake_edges.
        (branch_prob): Do it earlier here.

From-SVN: r84840
parent 7b48e1e0
2004-07-16 Richard Henderson <rth@redhat.com> 2004-07-16 Richard Henderson <rth@redhat.com>
* basic-block.h (remove_fake_exit_edges): Declare.
* cfganal.c (remove_fake_predecessors): Rename from
remove_fake_successors; iterate over predecessors.
(remove_fake_exit_edges): New.
* cfgcleanup.c (try_optimize_cfg): Use it.
* gcse.c (one_pre_gcse_pass, store_motion): Likewise.
* predict.c (estimate_probability): Likewise.
(tree_estimate_probability, note_prediction_to_br_prob): Likewise.
* tree-cfg.c (make_edges): Likewise.
* tree-ssa-pre.c (fini_pre): Likewise.
* profile.c (instrument_edges): Don't remove_fake_edges.
(branch_prob): Do it earlier here.
2004-07-16 Richard Henderson <rth@redhat.com>
* tree-ssa-operands.c (get_expr_operands): Fix 2004-07-15 * tree-ssa-operands.c (get_expr_operands): Fix 2004-07-15
switchification wrt CONSTRUCTOR. Document the reason. switchification wrt CONSTRUCTOR. Document the reason.
......
...@@ -417,6 +417,7 @@ extern void commit_edge_insertions (void); ...@@ -417,6 +417,7 @@ extern void commit_edge_insertions (void);
extern void commit_edge_insertions_watch_calls (void); extern void commit_edge_insertions_watch_calls (void);
extern void remove_fake_edges (void); extern void remove_fake_edges (void);
extern void remove_fake_exit_edges (void);
extern void add_noreturn_fake_exit_edges (void); extern void add_noreturn_fake_exit_edges (void);
extern void connect_infinite_loops_to_exit (void); extern void connect_infinite_loops_to_exit (void);
extern edge unchecked_make_edge (basic_block, basic_block, int); extern edge unchecked_make_edge (basic_block, basic_block, int);
......
...@@ -51,7 +51,6 @@ static void flow_dfs_compute_reverse_add_bb (depth_first_search_ds, ...@@ -51,7 +51,6 @@ static void flow_dfs_compute_reverse_add_bb (depth_first_search_ds,
basic_block); basic_block);
static basic_block flow_dfs_compute_reverse_execute (depth_first_search_ds); static basic_block flow_dfs_compute_reverse_execute (depth_first_search_ds);
static void flow_dfs_compute_reverse_finish (depth_first_search_ds); static void flow_dfs_compute_reverse_finish (depth_first_search_ds);
static void remove_fake_successors (basic_block);
static bool flow_active_insn_p (rtx); static bool flow_active_insn_p (rtx);
/* Like active_insn_p, except keep the return value clobber around /* Like active_insn_p, except keep the return value clobber around
...@@ -529,20 +528,20 @@ flow_edge_list_print (const char *str, const edge *edge_list, int num_edges, FIL ...@@ -529,20 +528,20 @@ flow_edge_list_print (const char *str, const edge *edge_list, int num_edges, FIL
} }
/* This routine will remove any fake successor edges for a basic block. /* This routine will remove any fake predecessor edges for a basic block.
When the edge is removed, it is also removed from whatever predecessor When the edge is removed, it is also removed from whatever successor
list it is in. */ list it is in. */
static void static void
remove_fake_successors (basic_block bb) remove_fake_predecessors (basic_block bb)
{ {
edge e; edge e;
for (e = bb->succ; e;) for (e = bb->pred; e;)
{ {
edge tmp = e; edge tmp = e;
e = e->succ_next; e = e->pred_next;
if ((tmp->flags & EDGE_FAKE) == EDGE_FAKE) if ((tmp->flags & EDGE_FAKE) == EDGE_FAKE)
remove_edge (tmp); remove_edge (tmp);
} }
...@@ -557,10 +556,19 @@ remove_fake_edges (void) ...@@ -557,10 +556,19 @@ remove_fake_edges (void)
{ {
basic_block bb; basic_block bb;
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, next_bb) FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb, NULL, next_bb)
remove_fake_successors (bb); remove_fake_predecessors (bb);
} }
/* This routine will remove all fake edges to the EXIT_BLOCK. */
void
remove_fake_exit_edges (void)
{
remove_fake_predecessors (EXIT_BLOCK_PTR);
}
/* This function will add a fake edge between any block which has no /* This function will add a fake edge between any block which has no
successors, and the exit block. Some data flow equations require these successors, and the exit block. Some data flow equations require these
edges to exist. */ edges to exist. */
......
...@@ -1978,7 +1978,7 @@ try_optimize_cfg (int mode) ...@@ -1978,7 +1978,7 @@ try_optimize_cfg (int mode)
} }
if (mode & CLEANUP_CROSSJUMP) if (mode & CLEANUP_CROSSJUMP)
remove_fake_edges (); remove_fake_exit_edges ();
clear_aux_for_blocks (); clear_aux_for_blocks ();
......
...@@ -4964,7 +4964,7 @@ one_pre_gcse_pass (int pass) ...@@ -4964,7 +4964,7 @@ one_pre_gcse_pass (int pass)
} }
free_ldst_mems (); free_ldst_mems ();
remove_fake_edges (); remove_fake_exit_edges ();
free_hash_table (&expr_hash_table); free_hash_table (&expr_hash_table);
if (gcse_file) if (gcse_file)
...@@ -6858,7 +6858,7 @@ store_motion (void) ...@@ -6858,7 +6858,7 @@ store_motion (void)
free_store_memory (); free_store_memory ();
free_edge_list (edge_list); free_edge_list (edge_list);
remove_fake_edges (); remove_fake_exit_edges ();
end_alias_analysis (); end_alias_analysis ();
} }
......
...@@ -779,7 +779,7 @@ estimate_probability (struct loops *loops_info) ...@@ -779,7 +779,7 @@ estimate_probability (struct loops *loops_info)
&& bb->succ->succ_next != NULL) && bb->succ->succ_next != NULL)
combine_predictions_for_insn (BB_END (bb), bb); combine_predictions_for_insn (BB_END (bb), bb);
remove_fake_edges (); remove_fake_exit_edges ();
/* Fill in the probability values in flowgraph based on the REG_BR_PROB /* Fill in the probability values in flowgraph based on the REG_BR_PROB
notes. */ notes. */
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
...@@ -986,7 +986,7 @@ tree_estimate_probability (void) ...@@ -986,7 +986,7 @@ tree_estimate_probability (void)
estimate_bb_frequencies (&loops_info); estimate_bb_frequencies (&loops_info);
free_dominance_info (CDI_POST_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS);
remove_fake_edges (); remove_fake_exit_edges ();
flow_loops_free (&loops_info); flow_loops_free (&loops_info);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
dump_tree_cfg (dump_file, dump_flags); dump_tree_cfg (dump_file, dump_flags);
...@@ -1220,7 +1220,7 @@ note_prediction_to_br_prob (void) ...@@ -1220,7 +1220,7 @@ note_prediction_to_br_prob (void)
free_dominance_info (CDI_DOMINATORS); free_dominance_info (CDI_DOMINATORS);
free (heads); free (heads);
remove_fake_edges (); remove_fake_exit_edges ();
} }
/* This is used to carry information about basic blocks. It is /* This is used to carry information about basic blocks. It is
......
...@@ -139,8 +139,6 @@ instrument_edges (struct edge_list *el) ...@@ -139,8 +139,6 @@ instrument_edges (struct edge_list *el)
int num_edges = NUM_EDGES (el); int num_edges = NUM_EDGES (el);
basic_block bb; basic_block bb;
remove_fake_edges ();
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
{ {
edge e; edge e;
...@@ -971,6 +969,8 @@ branch_prob (void) ...@@ -971,6 +969,8 @@ branch_prob (void)
compute_value_histograms (n_values, values); compute_value_histograms (n_values, values);
} }
remove_fake_edges ();
/* For each edge not on the spanning tree, add counting code. */ /* For each edge not on the spanning tree, add counting code. */
if (profile_arc_flag if (profile_arc_flag
&& coverage_counter_alloc (GCOV_COUNTER_ARCS, num_instrumented)) && coverage_counter_alloc (GCOV_COUNTER_ARCS, num_instrumented))
...@@ -993,7 +993,6 @@ branch_prob (void) ...@@ -993,7 +993,6 @@ branch_prob (void)
} }
} }
remove_fake_edges ();
free_aux_for_edges (); free_aux_for_edges ();
if (!ir_type ()) if (!ir_type ())
......
...@@ -448,7 +448,7 @@ make_edges (void) ...@@ -448,7 +448,7 @@ make_edges (void)
/* We do not care about fake edges, so remove any that the CFG /* We do not care about fake edges, so remove any that the CFG
builder inserted for completeness. */ builder inserted for completeness. */
remove_fake_edges (); remove_fake_exit_edges ();
/* Clean up the graph and warn for unreachable code. */ /* Clean up the graph and warn for unreachable code. */
cleanup_tree_cfg (); cleanup_tree_cfg ();
......
...@@ -1943,13 +1943,14 @@ fini_pre (void) ...@@ -1943,13 +1943,14 @@ fini_pre (void)
free_alloc_pool (reference_node_pool); free_alloc_pool (reference_node_pool);
free_alloc_pool (unary_node_pool); free_alloc_pool (unary_node_pool);
htab_delete (phi_translate_table); htab_delete (phi_translate_table);
remove_fake_edges (); remove_fake_exit_edges ();
FOR_ALL_BB (bb) FOR_ALL_BB (bb)
{ {
free (bb->aux); free (bb->aux);
bb->aux = NULL; bb->aux = NULL;
} }
free_dominance_info (CDI_POST_DOMINATORS); free_dominance_info (CDI_POST_DOMINATORS);
vn_delete (); vn_delete ();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment