Commit a6ee1a15 by Kazu Hirata Committed by Kazu Hirata

basic-block.h: Update the prototypes of cached_make_edge and rtl_make_eh_edge.

	* basic-block.h: Update the prototypes of cached_make_edge and
	rtl_make_eh_edge.
	* cfg.c (cached_make_edge): Take edge_cache representing one
	row of the adjacency matrix of edges.
	* cfgbuild.c (make_label_edge, rtl_make_eh_edge): Likewise.
	(make_edges): Initialize edge_cache to represent one row of
	the adjacency matrix of edges.

From-SVN: r96440
parent 8eaa0f34
2005-03-14 Kazu Hirata <kazu@cs.umass.edu>
* basic-block.h: Update the prototypes of cached_make_edge and
rtl_make_eh_edge.
* cfg.c (cached_make_edge): Take edge_cache representing one
row of the adjacency matrix of edges.
* cfgbuild.c (make_label_edge, rtl_make_eh_edge): Likewise.
(make_edges): Initialize edge_cache to represent one row of
the adjacency matrix of edges.
2005-03-14 Zdenek Dvorak <dvorakz@suse.cz> 2005-03-14 Zdenek Dvorak <dvorakz@suse.cz>
* tree-ssa-phiopt.c (minmax_replacement, blocks_in_phiopt_order): * tree-ssa-phiopt.c (minmax_replacement, blocks_in_phiopt_order):
......
...@@ -449,7 +449,7 @@ extern void remove_fake_exit_edges (void); ...@@ -449,7 +449,7 @@ 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);
extern edge cached_make_edge (sbitmap *, basic_block, basic_block, int); extern edge cached_make_edge (sbitmap, basic_block, basic_block, int);
extern edge make_edge (basic_block, basic_block, int); extern edge make_edge (basic_block, basic_block, int);
extern edge make_single_succ_edge (basic_block, basic_block, int); extern edge make_single_succ_edge (basic_block, basic_block, int);
extern void remove_edge (edge); extern void remove_edge (edge);
...@@ -817,7 +817,7 @@ extern bool forwarder_block_p (basic_block); ...@@ -817,7 +817,7 @@ extern bool forwarder_block_p (basic_block);
extern bool purge_all_dead_edges (int); extern bool purge_all_dead_edges (int);
extern bool purge_dead_edges (basic_block); extern bool purge_dead_edges (basic_block);
extern void find_many_sub_basic_blocks (sbitmap); extern void find_many_sub_basic_blocks (sbitmap);
extern void rtl_make_eh_edge (sbitmap *, basic_block, rtx); extern void rtl_make_eh_edge (sbitmap, basic_block, rtx);
extern bool can_fallthru (basic_block, basic_block); extern bool can_fallthru (basic_block, basic_block);
extern bool could_fall_through (basic_block, basic_block); extern bool could_fall_through (basic_block, basic_block);
extern void flow_nodes_print (const char *, const sbitmap, FILE *); extern void flow_nodes_print (const char *, const sbitmap, FILE *);
......
...@@ -327,7 +327,7 @@ unchecked_make_edge (basic_block src, basic_block dst, int flags) ...@@ -327,7 +327,7 @@ unchecked_make_edge (basic_block src, basic_block dst, int flags)
edge cache CACHE. Return the new edge, NULL if already exist. */ edge cache CACHE. Return the new edge, NULL if already exist. */
edge edge
cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int flags) cached_make_edge (sbitmap edge_cache, basic_block src, basic_block dst, int flags)
{ {
if (edge_cache == NULL if (edge_cache == NULL
|| src == ENTRY_BLOCK_PTR || src == ENTRY_BLOCK_PTR
...@@ -335,11 +335,11 @@ cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int fla ...@@ -335,11 +335,11 @@ cached_make_edge (sbitmap *edge_cache, basic_block src, basic_block dst, int fla
return make_edge (src, dst, flags); return make_edge (src, dst, flags);
/* Does the requested edge already exist? */ /* Does the requested edge already exist? */
if (! TEST_BIT (edge_cache[src->index], dst->index)) if (! TEST_BIT (edge_cache, dst->index))
{ {
/* The edge does not exist. Create one and update the /* The edge does not exist. Create one and update the
cache. */ cache. */
SET_BIT (edge_cache[src->index], dst->index); SET_BIT (edge_cache, dst->index);
return unchecked_make_edge (src, dst, flags); return unchecked_make_edge (src, dst, flags);
} }
......
...@@ -49,7 +49,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -49,7 +49,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static int count_basic_blocks (rtx); static int count_basic_blocks (rtx);
static void find_basic_blocks_1 (rtx); static void find_basic_blocks_1 (rtx);
static void make_edges (basic_block, basic_block, int); static void make_edges (basic_block, basic_block, int);
static void make_label_edge (sbitmap *, basic_block, rtx, int); static void make_label_edge (sbitmap, basic_block, rtx, int);
static void find_bb_boundaries (basic_block); static void find_bb_boundaries (basic_block);
static void compute_outgoing_frequencies (basic_block); static void compute_outgoing_frequencies (basic_block);
...@@ -179,7 +179,7 @@ count_basic_blocks (rtx f) ...@@ -179,7 +179,7 @@ count_basic_blocks (rtx f)
/* Create an edge from a basic block to a label. */ /* Create an edge from a basic block to a label. */
static void static void
make_label_edge (sbitmap *edge_cache, basic_block src, rtx label, int flags) make_label_edge (sbitmap edge_cache, basic_block src, rtx label, int flags)
{ {
gcc_assert (LABEL_P (label)); gcc_assert (LABEL_P (label));
...@@ -197,7 +197,7 @@ make_label_edge (sbitmap *edge_cache, basic_block src, rtx label, int flags) ...@@ -197,7 +197,7 @@ make_label_edge (sbitmap *edge_cache, basic_block src, rtx label, int flags)
/* Create the edges generated by INSN in REGION. */ /* Create the edges generated by INSN in REGION. */
void void
rtl_make_eh_edge (sbitmap *edge_cache, basic_block src, rtx insn) rtl_make_eh_edge (sbitmap edge_cache, basic_block src, rtx insn)
{ {
int is_call = CALL_P (insn) ? EDGE_ABNORMAL_CALL : 0; int is_call = CALL_P (insn) ? EDGE_ABNORMAL_CALL : 0;
rtx handlers, i; rtx handlers, i;
...@@ -233,46 +233,41 @@ static void ...@@ -233,46 +233,41 @@ static void
make_edges (basic_block min, basic_block max, int update_p) make_edges (basic_block min, basic_block max, int update_p)
{ {
basic_block bb; basic_block bb;
sbitmap *edge_cache = NULL; sbitmap edge_cache = NULL;
/* Heavy use of computed goto in machine-generated code can lead to /* Heavy use of computed goto in machine-generated code can lead to
nearly fully-connected CFGs. In that case we spend a significant nearly fully-connected CFGs. In that case we spend a significant
amount of time searching the edge lists for duplicates. */ amount of time searching the edge lists for duplicates. */
if (forced_labels || cfun->max_jumptable_ents > 100) if (forced_labels || cfun->max_jumptable_ents > 100)
{ edge_cache = sbitmap_alloc (last_basic_block);
edge_cache = sbitmap_vector_alloc (last_basic_block, last_basic_block);
sbitmap_vector_zero (edge_cache, last_basic_block);
if (update_p)
{
FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
if (STATE (bb) != BLOCK_ORIGINAL)
{
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest != EXIT_BLOCK_PTR)
SET_BIT (edge_cache[bb->index], e->dest->index);
}
}
}
/* By nature of the way these get numbered, ENTRY_BLOCK_PTR->next_bb block /* By nature of the way these get numbered, ENTRY_BLOCK_PTR->next_bb block
is always the entry. */ is always the entry. */
if (min == ENTRY_BLOCK_PTR->next_bb) if (min == ENTRY_BLOCK_PTR->next_bb)
cached_make_edge (edge_cache, ENTRY_BLOCK_PTR, min, make_edge (ENTRY_BLOCK_PTR, min, EDGE_FALLTHRU);
EDGE_FALLTHRU);
FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb) FOR_BB_BETWEEN (bb, min, max->next_bb, next_bb)
{ {
rtx insn, x; rtx insn, x;
enum rtx_code code; enum rtx_code code;
edge e; edge e;
edge_iterator ei;
if (STATE (bb) == BLOCK_ORIGINAL) if (STATE (bb) == BLOCK_ORIGINAL)
continue; continue;
/* If we have an edge cache, cache edges going out of BB. */
if (edge_cache)
{
sbitmap_zero (edge_cache);
if (update_p)
{
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest != EXIT_BLOCK_PTR)
SET_BIT (edge_cache, e->dest->index);
}
}
if (LABEL_P (BB_HEAD (bb)) if (LABEL_P (BB_HEAD (bb))
&& LABEL_ALT_ENTRY_P (BB_HEAD (bb))) && LABEL_ALT_ENTRY_P (BB_HEAD (bb)))
cached_make_edge (NULL, ENTRY_BLOCK_PTR, bb, 0); cached_make_edge (NULL, ENTRY_BLOCK_PTR, bb, 0);
......
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