summaryrefslogtreecommitdiff
path: root/gcc/sel-sched-ir.c
diff options
context:
space:
mode:
authorabel <abel@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-14 07:39:07 +0000
committerabel <abel@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-14 07:39:07 +0000
commit0424f393145c966d073c3329a694ba3526c734dc (patch)
tree40bdd5a81874bbd13e539fa496ff1cf907f8dc6b /gcc/sel-sched-ir.c
parenta52dfddb5ace2b5f7b9c90ce8a1d306d1b2f936c (diff)
downloadgcc-0424f393145c966d073c3329a694ba3526c734dc.tar.gz
* sel-sched-ir.c (maybe_tidy_empty_bb): Simplify comment.
(tidy_control_flow): Tidy vertical space. (sel_remove_bb): New variable idx. Use it to remember the basic block index before deleting the block. (sel_remove_empty_bb): Remove dead code, simplify and insert to ... (sel_merge_blocks): ... here. * sel-sched-ir.h (sel_remove_empty_bb): Remove prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165453 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sel-sched-ir.c')
-rw-r--r--gcc/sel-sched-ir.c66
1 files changed, 13 insertions, 53 deletions
diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index a9d7ccf0fcd..34d5f51c272 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -154,6 +154,7 @@ static void free_history_vect (VEC (expr_history_def, heap) **);
static void move_bb_info (basic_block, basic_block);
static void remove_empty_bb (basic_block, bool);
+static void sel_merge_blocks (basic_block, basic_block);
static void sel_remove_loop_preheader (void);
static bool insn_is_the_only_one_in_bb_p (insn_t);
@@ -3598,13 +3599,11 @@ maybe_tidy_empty_bb (basic_block bb, bool recompute_toporder_p)
}
}
- /* If it is possible - merge BB with its predecessor. */
if (can_merge_blocks_p (bb->prev_bb, bb))
sel_merge_blocks (bb->prev_bb, bb);
else
- /* Otherwise this is a block without fallthru predecessor.
- Just delete it. */
{
+ /* This is a block without fallthru predecessor. Just delete it. */
gcc_assert (pred_bb != NULL);
if (in_current_region_p (pred_bb))
@@ -3700,7 +3699,6 @@ tidy_control_flow (basic_block xbb, bool full_tidying)
else if (recompute_toporder_p)
sel_recompute_toporder ();
}
-
return changed;
}
@@ -5020,16 +5018,18 @@ sel_add_bb (basic_block bb)
static void
sel_remove_bb (basic_block bb, bool remove_from_cfg_p)
{
+ unsigned idx = bb->index;
+
gcc_assert (bb != NULL && BB_NOTE_LIST (bb) == NULL_RTX);
remove_bb_from_region (bb);
return_bb_to_pool (bb);
- bitmap_clear_bit (blocks_to_reschedule, bb->index);
+ bitmap_clear_bit (blocks_to_reschedule, idx);
if (remove_from_cfg_p)
delete_and_free_basic_block (bb);
- rgn_setup_region (CONTAINING_RGN (bb->index));
+ rgn_setup_region (CONTAINING_RGN (idx));
}
/* Concatenate info of EMPTY_BB to info of MERGE_BB. */
@@ -5044,50 +5044,6 @@ move_bb_info (basic_block merge_bb, basic_block empty_bb)
}
-/* Remove an empty basic block EMPTY_BB. When MERGE_UP_P is true, we put
- EMPTY_BB's note lists into its predecessor instead of putting them
- into the successor. When REMOVE_FROM_CFG_P is true, also remove
- the empty block. */
-void
-sel_remove_empty_bb (basic_block empty_bb, bool merge_up_p,
- bool remove_from_cfg_p)
-{
- basic_block merge_bb;
-
- gcc_assert (sel_bb_empty_p (empty_bb));
-
- if (merge_up_p)
- {
- merge_bb = empty_bb->prev_bb;
- gcc_assert (EDGE_COUNT (empty_bb->preds) == 1
- && EDGE_PRED (empty_bb, 0)->src == merge_bb);
- }
- else
- {
- edge e;
- edge_iterator ei;
-
- merge_bb = bb_next_bb (empty_bb);
-
- /* Redirect incoming edges (except fallthrough one) of EMPTY_BB to its
- successor block. */
- for (ei = ei_start (empty_bb->preds);
- (e = ei_safe_edge (ei)); )
- {
- if (! (e->flags & EDGE_FALLTHRU))
- sel_redirect_edge_and_branch (e, merge_bb);
- else
- ei_next (&ei);
- }
-
- gcc_assert (EDGE_COUNT (empty_bb->succs) == 1
- && EDGE_SUCC (empty_bb, 0)->dest == merge_bb);
- }
-
- move_bb_info (merge_bb, empty_bb);
- remove_empty_bb (empty_bb, remove_from_cfg_p);
-}
-
/* Remove EMPTY_BB. If REMOVE_FROM_CFG_P is false, remove EMPTY_BB from
region, but keep it in CFG. */
static void
@@ -5387,12 +5343,16 @@ sel_create_recovery_block (insn_t orig_insn)
}
/* Merge basic block B into basic block A. */
-void
+static void
sel_merge_blocks (basic_block a, basic_block b)
{
- sel_remove_empty_bb (b, true, false);
- merge_blocks (a, b);
+ gcc_assert (sel_bb_empty_p (b)
+ && EDGE_COUNT (b->preds) == 1
+ && EDGE_PRED (b, 0)->src == b->prev_bb);
+ move_bb_info (b->prev_bb, b);
+ remove_empty_bb (b, false);
+ merge_blocks (a, b);
change_loops_latches (b, a);
}