* basic-block.h (struct edge_def): Remove crossing_edge.
(EDGE_CROSSING): New define.
(EDGE_ALL_FLAGS): Update.
* bb-reorder.c (find_traces_1_round, better_edge_p,
find_rarely_executed_basic_blocks_and_cr, fix_up_fall_thru_edges,
find_jump_block, fix_crossing_conditional_branches,
fix_crossing_unconditional_branches, add_reg_crossing_jump_notes):
Replace all occurences of crossing_edge with an edge flag check
or set/reset.
* cfgcleanup.c (try_simplify_condjump, try_forward_edges,
try_crossjump_bb): Likewise.
* cfglayout.c (fixup_reorder_chain): Likewise.
* cfgrtl.c (force_nonfallthru_and_redirect,
commit_one_edge_insertion): Likewise.
* Makefile.in (cfganal.o): Depend on TIMEVAR_H.
* tree-flow.h (compute_dominance_frontiers): Move prototype...
* basic-block.h: ...here.
* tree-cfg.c (compute_dominance_frontiers_1,
compute_dominance_frontiers): Move from here...
* cfganal.c: ...to here. Include timevar.h.
From-SVN: r86228
+2004-09-19 Steven Bosscher <stevenb@suse.de>
+
+ * basic-block.h (struct edge_def): Remove crossing_edge.
+ (EDGE_CROSSING): New define.
+ (EDGE_ALL_FLAGS): Update.
+ * bb-reorder.c (find_traces_1_round, better_edge_p,
+ find_rarely_executed_basic_blocks_and_cr, fix_up_fall_thru_edges,
+ find_jump_block, fix_crossing_conditional_branches,
+ fix_crossing_unconditional_branches, add_reg_crossing_jump_notes):
+ Replace all occurences of crossing_edge with an edge flag check
+ or set/reset.
+ * cfgcleanup.c (try_simplify_condjump, try_forward_edges,
+ try_crossjump_bb): Likewise.
+ * cfglayout.c (fixup_reorder_chain): Likewise.
+ * cfgrtl.c (force_nonfallthru_and_redirect,
+ commit_one_edge_insertion): Likewise.
+
+ * Makefile.in (cfganal.o): Depend on TIMEVAR_H.
+ * tree-flow.h (compute_dominance_frontiers): Move prototype...
+ * basic-block.h: ...here.
+ * tree-cfg.c (compute_dominance_frontiers_1,
+ compute_dominance_frontiers): Move from here...
+ * cfganal.c: ...to here. Include timevar.h.
+
2004-08-18 James E Wilson <wilson@specifixinc.com>
* config/mips/mips.h (ASM_SPEC): In comment, change -meabi= to -mabi=.
insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \
function.h except.h $(GGC_H) $(TM_P_H) insn-config.h $(EXPR_H)
cfganal.o : cfganal.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \
- $(BASIC_BLOCK_H) hard-reg-set.h insn-config.h $(RECOG_H) $(GGC_H) $(TM_P_H)
+ $(BASIC_BLOCK_H) hard-reg-set.h insn-config.h $(RECOG_H) $(GGC_H) $(TM_P_H) \
+ $(TIMEVAR_H)
cfgbuild.o : cfgbuild.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(FLAGS_H) \
insn-config.h $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h $(RECOG_H) \
function.h except.h $(GGC_H)
int probability; /* biased by REG_BR_PROB_BASE */
gcov_type count; /* Expected number of executions calculated
in profile.c */
- bool crossing_edge; /* Crosses between hot and cold sections, when
- we do partitioning. */
};
typedef struct edge_def *edge;
predicate is zero. */
#define EDGE_EXECUTABLE 4096 /* Edge is executable. Only
valid during SSA-CCP. */
-#define EDGE_ALL_FLAGS 8191
+#define EDGE_CROSSING 8192 /* Edge crosses between hot
+ and cold sections, when we
+ do partitioning. */
+#define EDGE_ALL_FLAGS 16383
#define EDGE_COMPLEX (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH)
extern int dfs_enumerate_from (basic_block, int,
bool (*)(basic_block, void *),
basic_block *, int, void *);
+extern void compute_dominance_frontiers (bitmap *);
extern void dump_edge_info (FILE *, edge, int);
extern void brief_dump_cfg (FILE *);
extern void clear_edges (void);
&& !(e->flags & EDGE_COMPLEX)
&& !e->dest->rbi->visited
&& !e->dest->pred->pred_next
- && !e->crossing_edge
+ && !(e->flags & EDGE_CROSSING)
&& e->dest->succ
&& (e->dest->succ->flags & EDGE_CAN_FALLTHRU)
&& !(e->dest->succ->flags & EDGE_COMPLEX)
if (!is_better_edge
&& flag_reorder_blocks_and_partition
&& cur_best_edge
- && cur_best_edge->crossing_edge
- && !e->crossing_edge)
+ && (cur_best_edge->flags & EDGE_CROSSING)
+ && !(e->flags & EDGE_CROSSING))
is_better_edge = true;
return is_better_edge;
&& e->dest != EXIT_BLOCK_PTR
&& e->src->partition != e->dest->partition)
{
- e->crossing_edge = true;
+ e->flags |= EDGE_CROSSING;
if (i == *max_idx)
{
*max_idx *= 2;
crossing_edges[i++] = e;
}
else
- e->crossing_edge = false;
+ e->flags &= ~EDGE_CROSSING;
}
}
*n_crossing_edges = i;
{
/* Check to see if the fall-thru edge is a crossing edge. */
- if (fall_thru->crossing_edge)
+ if (fall_thru->flags & EDGE_CROSSING)
{
/* The fall_thru edge crosses; now check the cond jump edge, if
it exists. */
if (cond_jump)
{
- if (!cond_jump->crossing_edge)
+ if (!(cond_jump->flags & EDGE_CROSSING))
cond_jump_crosses = false;
/* We know the fall-thru edge crosses; if the cond
e = fall_thru;
fall_thru = cond_jump;
cond_jump = e;
- cond_jump->crossing_edge = true;
- fall_thru->crossing_edge = false;
+ cond_jump->flags |= EDGE_CROSSING;
+ fall_thru->flags &= ~EDGE_CROSSING;
}
}
}
partition as bb it's falling through from. */
new_bb->partition = cur_bb->partition;
- new_bb->succ->crossing_edge = true;
+ new_bb->succ->flags |= EDGE_CROSSING;
}
/* Add barrier after new jump */
rtx insn;
for (e = jump_dest->pred; e; e = e->pred_next)
- if (e->crossing_edge)
+ if (e->flags & EDGE_CROSSING)
{
basic_block src = e->src;
/* We already took care of fall-through edges, so only one successor
can be a crossing edge. */
- if (succ1 && succ1->crossing_edge)
+ if (succ1 && (succ1->flags & EDGE_CROSSING))
crossing_edge = succ1;
- else if (succ2 && succ2->crossing_edge)
+ else if (succ2 && (succ2->flags & EDGE_CROSSING))
crossing_edge = succ2;
if (crossing_edge)
else
new_edge = new_bb->succ;
- crossing_edge->crossing_edge = false;
- new_edge->crossing_edge = true;
+ crossing_edge->flags &= ~EDGE_CROSSING;
+ new_edge->flags |= EDGE_CROSSING;
}
}
}
this point, no crossing jumps should be conditional. */
if (JUMP_P (last_insn)
- && succ->crossing_edge)
+ && (succ->flags & EDGE_CROSSING))
{
rtx label2, table;
FOR_EACH_BB (bb)
for (e = bb->succ; e; e = e->succ_next)
- if (e->crossing_edge
+ if ((e->flags & EDGE_CROSSING)
&& JUMP_P (BB_END (e->src)))
REG_NOTES (BB_END (e->src)) = gen_rtx_EXPR_LIST (REG_CROSSING_JUMP,
NULL_RTX,
#include "recog.h"
#include "toplev.h"
#include "tm_p.h"
+#include "timevar.h"
/* Store the data structures necessary for depth-first search. */
struct depth_first_search_dsS {
rslt[sp]->flags &= ~BB_VISITED;
return tv;
}
+
+
+/* Computing the Dominance Frontier:
+
+ As described in Morgan, section 3.5, this may be done simply by
+ walking the dominator tree bottom-up, computing the frontier for
+ the children before the parent. When considering a block B,
+ there are two cases:
+
+ (1) A flow graph edge leaving B that does not lead to a child
+ of B in the dominator tree must be a block that is either equal
+ to B or not dominated by B. Such blocks belong in the frontier
+ of B.
+
+ (2) Consider a block X in the frontier of one of the children C
+ of B. If X is not equal to B and is not dominated by B, it
+ is in the frontier of B. */
+
+static void
+compute_dominance_frontiers_1 (bitmap *frontiers, basic_block bb, sbitmap done)
+{
+ edge e;
+ basic_block c;
+
+ SET_BIT (done, bb->index);
+
+ /* Do the frontier of the children first. Not all children in the
+ dominator tree (blocks dominated by this one) are children in the
+ CFG, so check all blocks. */
+ for (c = first_dom_son (CDI_DOMINATORS, bb);
+ c;
+ c = next_dom_son (CDI_DOMINATORS, c))
+ {
+ if (! TEST_BIT (done, c->index))
+ compute_dominance_frontiers_1 (frontiers, c, done);
+ }
+
+ /* Find blocks conforming to rule (1) above. */
+ for (e = bb->succ; e; e = e->succ_next)
+ {
+ if (e->dest == EXIT_BLOCK_PTR)
+ continue;
+ if (get_immediate_dominator (CDI_DOMINATORS, e->dest) != bb)
+ bitmap_set_bit (frontiers[bb->index], e->dest->index);
+ }
+
+ /* Find blocks conforming to rule (2). */
+ for (c = first_dom_son (CDI_DOMINATORS, bb);
+ c;
+ c = next_dom_son (CDI_DOMINATORS, c))
+ {
+ int x;
+
+ EXECUTE_IF_SET_IN_BITMAP (frontiers[c->index], 0, x,
+ {
+ if (get_immediate_dominator (CDI_DOMINATORS, BASIC_BLOCK (x)) != bb)
+ bitmap_set_bit (frontiers[bb->index], x);
+ });
+ }
+}
+
+
+void
+compute_dominance_frontiers (bitmap *frontiers)
+{
+ sbitmap done = sbitmap_alloc (last_basic_block);
+
+ timevar_push (TV_DOM_FRONTIERS);
+
+ sbitmap_zero (done);
+
+ compute_dominance_frontiers_1 (frontiers, ENTRY_BLOCK_PTR->succ->dest, done);
+
+ sbitmap_free (done);
+
+ timevar_pop (TV_DOM_FRONTIERS);
+}
+
if (flag_reorder_blocks_and_partition
&& (jump_block->partition != jump_dest_block->partition
- || cbranch_jump_edge->crossing_edge))
+ || (cbranch_jump_edge->flags & EDGE_CROSSING)))
return false;
/* The conditional branch must target the block after the
may_thread |= target->flags & BB_DIRTY;
if (FORWARDER_BLOCK_P (target)
- && !target->succ->crossing_edge
+ && !(target->succ->flags & EDGE_CROSSING)
&& target->succ->dest != EXIT_BLOCK_PTR)
{
/* Bypass trivial infinite loops. */
if (flag_reorder_blocks_and_partition
&& (bb->pred->src->partition != bb->pred->pred_next->src->partition
- || bb->pred->crossing_edge))
+ || (bb->pred->flags & EDGE_CROSSING)))
return false;
/* It is always cheapest to redirect a block that ends in a branch to
/* If the "jumping" edge is a crossing edge, and the fall
through edge is non-crossing, leave things as they are. */
- else if (e_taken->crossing_edge && !e_fall->crossing_edge)
+ else if ((e_taken->flags & EDGE_CROSSING)
+ && !(e_fall->flags & EDGE_CROSSING))
continue;
/* Otherwise we can try to invert the jump. This will
}
if (JUMP_P (BB_END (bb))
&& !any_condjump_p (BB_END (bb))
- && bb->succ->crossing_edge )
+ && (bb->succ->flags & EDGE_CROSSING))
REG_NOTES (BB_END (bb)) = gen_rtx_EXPR_LIST
(REG_CROSSING_JUMP, NULL_RTX, REG_NOTES (BB_END (bb)));
}
}
if (JUMP_P (BB_END (jump_block))
&& !any_condjump_p (BB_END (jump_block))
- && jump_block->succ->crossing_edge )
+ && (jump_block->succ->flags & EDGE_CROSSING))
REG_NOTES (BB_END (jump_block)) = gen_rtx_EXPR_LIST
(REG_CROSSING_JUMP, NULL_RTX,
REG_NOTES (BB_END (jump_block)));
&& targetm.have_named_sections
&& e->src != ENTRY_BLOCK_PTR
&& e->src->partition == COLD_PARTITION
- && !e->crossing_edge)
+ && !(e->flags & EDGE_CROSSING))
{
rtx bb_note, new_note, cur_insn;
NOTE_BASIC_BLOCK (new_note) = bb;
if (JUMP_P (BB_END (bb))
&& !any_condjump_p (BB_END (bb))
- && bb->succ->crossing_edge )
+ && (bb->succ->flags & EDGE_CROSSING))
REG_NOTES (BB_END (bb)) = gen_rtx_EXPR_LIST
(REG_CROSSING_JUMP, NULL_RTX, REG_NOTES (BB_END (bb)));
if (after == bb_note)
if (e->flags & EDGE_FALLTHRU)
{
n_fallthru++, fallthru = e;
- if (e->crossing_edge
+ if ((e->flags & EDGE_CROSSING)
|| (e->src->partition != e->dest->partition
&& e->src != ENTRY_BLOCK_PTR
&& e->dest != EXIT_BLOCK_PTR))
}
-/* Computing the Dominance Frontier:
-
- As described in Morgan, section 3.5, this may be done simply by
- walking the dominator tree bottom-up, computing the frontier for
- the children before the parent. When considering a block B,
- there are two cases:
-
- (1) A flow graph edge leaving B that does not lead to a child
- of B in the dominator tree must be a block that is either equal
- to B or not dominated by B. Such blocks belong in the frontier
- of B.
-
- (2) Consider a block X in the frontier of one of the children C
- of B. If X is not equal to B and is not dominated by B, it
- is in the frontier of B. */
-
-static void
-compute_dominance_frontiers_1 (bitmap *frontiers, basic_block bb, sbitmap done)
-{
- edge e;
- basic_block c;
-
- SET_BIT (done, bb->index);
-
- /* Do the frontier of the children first. Not all children in the
- dominator tree (blocks dominated by this one) are children in the
- CFG, so check all blocks. */
- for (c = first_dom_son (CDI_DOMINATORS, bb);
- c;
- c = next_dom_son (CDI_DOMINATORS, c))
- {
- if (! TEST_BIT (done, c->index))
- compute_dominance_frontiers_1 (frontiers, c, done);
- }
-
- /* Find blocks conforming to rule (1) above. */
- for (e = bb->succ; e; e = e->succ_next)
- {
- if (e->dest == EXIT_BLOCK_PTR)
- continue;
- if (get_immediate_dominator (CDI_DOMINATORS, e->dest) != bb)
- bitmap_set_bit (frontiers[bb->index], e->dest->index);
- }
-
- /* Find blocks conforming to rule (2). */
- for (c = first_dom_son (CDI_DOMINATORS, bb);
- c;
- c = next_dom_son (CDI_DOMINATORS, c))
- {
- int x;
-
- EXECUTE_IF_SET_IN_BITMAP (frontiers[c->index], 0, x,
- {
- if (get_immediate_dominator (CDI_DOMINATORS, BASIC_BLOCK (x)) != bb)
- bitmap_set_bit (frontiers[bb->index], x);
- });
- }
-}
-
-
-void
-compute_dominance_frontiers (bitmap *frontiers)
-{
- sbitmap done = sbitmap_alloc (last_basic_block);
-
- timevar_push (TV_DOM_FRONTIERS);
-
- sbitmap_zero (done);
-
- compute_dominance_frontiers_1 (frontiers, ENTRY_BLOCK_PTR->succ->dest, done);
-
- sbitmap_free (done);
-
- timevar_pop (TV_DOM_FRONTIERS);
-}
-
-
-
/*---------------------------------------------------------------------------
Debugging functions
---------------------------------------------------------------------------*/
extern void bsi_commit_edge_inserts (int *);
extern void notice_special_calls (tree);
extern void clear_special_calls (void);
-extern void compute_dominance_frontiers (bitmap *);
extern void verify_stmts (void);
extern tree tree_block_label (basic_block bb);
extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);