#include "output.h"
#include "tree-flow.h"
-static void duplicate_subloops (struct loop *, struct loop *);
static void copy_loops_to (struct loop **, int,
struct loop *);
static void loop_redirect_edge (edge, basic_block);
placement of subloops of FROM->loop_father, that might also be altered due
to this change; the condition for them is similar, except that instead of
successors we consider edges coming out of the loops.
-
+
If the changes may invalidate the information about irreducible regions,
IRRED_INVALIDATED is set to true. */
edge ae;
basic_block *rem_bbs, *bord_bbs, from, bb;
VEC (basic_block, heap) *dom_bbs;
- int i, nrem, n_bord_bbs, nreml;
+ int i, nrem, n_bord_bbs;
sbitmap seen;
bool irred_invalidated = false;
- struct loop **deleted_loop;
if (!can_remove_branch_p (e))
return false;
{
SET_BIT (seen, ae->dest->index);
bord_bbs[n_bord_bbs++] = ae->dest;
-
+
if (ae->flags & EDGE_IRREDUCIBLE_LOOP)
irred_invalidated = true;
}
dom_bbs = NULL;
/* Cancel loops contained in the path. */
- deleted_loop = XNEWVEC (struct loop *, nrem);
- nreml = 0;
for (i = 0; i < nrem; i++)
if (rem_bbs[i]->loop_father->header == rem_bbs[i])
- deleted_loop[nreml++] = rem_bbs[i]->loop_father;
-
- for (i = 0; i < nreml; i++)
- cancel_loop_tree (deleted_loop[i]);
- free (deleted_loop);
+ cancel_loop_tree (rem_bbs[i]->loop_father);
remove_bbs (rem_bbs, nrem);
free (rem_bbs);
}
/* Creates an if region as shown above. CONDITION is used to create
- the test for the if.
+ the test for the if.
|
| ------------- -------------
create_empty_if_region_on_edge (edge entry_edge, tree condition)
{
- basic_block succ_bb, cond_bb, true_bb, false_bb, join_bb;
+ basic_block cond_bb, true_bb, false_bb, join_bb;
edge e_true, e_false, exit_edge;
gimple cond_stmt;
tree simple_cond;
gimple_stmt_iterator gsi;
- succ_bb = entry_edge->dest;
cond_bb = split_edge (entry_edge);
-
+
/* Insert condition in cond_bb. */
gsi = gsi_last_bb (cond_bb);
simple_cond =
cond_stmt = gimple_build_cond_from_tree (simple_cond, NULL_TREE, NULL_TREE);
gsi = gsi_last_bb (cond_bb);
gsi_insert_after (&gsi, cond_stmt, GSI_NEW_STMT);
-
+
join_bb = split_edge (single_succ_edge (cond_bb));
e_true = single_succ_edge (cond_bb);
{
basic_block loop_header, loop_latch, succ_bb, pred_bb;
struct loop *loop;
- int freq;
- gcov_type cnt;
gimple_stmt_iterator gsi;
gimple_seq stmts;
gimple cond_expr;
add_loop (loop, outer);
/* TODO: Fix frequencies and counts. */
- freq = EDGE_FREQUENCY (entry_edge);
- cnt = entry_edge->count;
-
prob = REG_BR_PROB_BASE / 2;
scale_loop_frequencies (loop, REG_BR_PROB_BASE - prob, REG_BR_PROB_BASE);
condition stated in description of fix_loop_placement holds for them.
It is used in case when we removed some edges coming out of LOOP, which
may cause the right placement of LOOP inside loop tree to change.
-
+
IRRED_INVALIDATED is set to true if a change in the loop structures might
invalidate the information about irreducible regions. */
/* Copies structure of subloops of LOOP into TARGET loop, placing
newly created loops into loop tree. */
-static void
+void
duplicate_subloops (struct loop *loop, struct loop *target)
{
struct loop *aloop, *cloop;
{
edge e;
edge_iterator ei;
-
+
FOR_EACH_EDGE (e, ei, block->preds)
if (e->src->loop_father == loop)
return true;
CP_SIMPLE_PREHEADERS is set in FLAGS, we only force LOOP to have single
entry; otherwise we also force preheader block to have only one successor.
When CP_FALLTHRU_PREHEADERS is set in FLAGS, we force the preheader block
- to be a fallthru predecessor to the loop header and to have only
+ to be a fallthru predecessor to the loop header and to have only
predecessors from outside of the loop.
The function also updates dominators. */
if (nentry == 1)
{
bool need_forwarder_block = false;
-
+
/* We do not allow entry block to be the loop preheader, since we
cannot emit code there. */
if (single_entry->src == ENTRY_BLOCK_PTR)
if (dump_file)
fprintf (dump_file, "Created preheader block for loop %i\n",
loop->num);
-
+
if (flags & CP_FALLTHRU_PREHEADERS)
gcc_assert ((single_succ_edge (dummy)->flags & EDGE_FALLTHRU)
&& !JUMP_P (BB_END (dummy)));
is the ratio by that the frequencies in the original loop should
be scaled. ELSE_SCALE is the ratio by that the frequencies in the
new loop should be scaled.
-
+
If PLACE_AFTER is true, we place the new loop after LOOP in the
instruction stream, otherwise it is placed before LOOP. */