Commit 092ae4ba by Jeffrey A Law Committed by Jeff Law

gcse.c (post_dominators): Kill.


        * gcse.c (post_dominators): Kill.
        (alloc_code_hoist_mem, free_code_hoist_mem); Kill post_dominators.
        (compute_code_hoist_data): Use compute_flow_dominators.  Do not
        pass in a pdom array since we do not need pdoms.
        * haifa-sched.c (schedule_insns): Similarly.
        * flow.c (compute_dominators): Remove dead function.
        (compute_flow_dominators): Do not compute doms or pdoms if the
        caller does not request them.  Split up loop to build doms and
        pdoms.  Use a worklist to compute doms and pdoms.
        * basic-block.h (compute_dominators): Remove prototype.

From-SVN: r30437
parent ea1fd424
Sat Nov 6 17:34:39 1999 Jeffrey A Law (law@cygnus.com)
* gcse.c (post_dominators): Kill.
(alloc_code_hoist_mem, free_code_hoist_mem); Kill post_dominators.
(compute_code_hoist_data): Use compute_flow_dominators. Do not
pass in a pdom array since we do not need pdoms.
* haifa-sched.c (schedule_insns): Similarly.
* flow.c (compute_dominators): Remove dead function.
(compute_flow_dominators): Do not compute doms or pdoms if the
caller does not request them. Split up loop to build doms and
pdoms. Use a worklist to compute doms and pdoms.
* basic-block.h (compute_dominators): Remove prototype.
Sat Nov 6 11:38:39 1999 Richard Henderson <rth@cygnus.com> Sat Nov 6 11:38:39 1999 Richard Henderson <rth@cygnus.com>
* haifa-sched.c (struct haifa_insn_data, h_i_d): New. * haifa-sched.c (struct haifa_insn_data, h_i_d): New.
......
...@@ -294,9 +294,6 @@ int find_edge_index PROTO ((struct edge_list *, ...@@ -294,9 +294,6 @@ int find_edge_index PROTO ((struct edge_list *,
extern void compute_preds_succs PROTO ((int_list_ptr *, int_list_ptr *, extern void compute_preds_succs PROTO ((int_list_ptr *, int_list_ptr *,
int *, int *)); int *, int *));
extern void compute_dominators PROTO ((sbitmap *, sbitmap *,
int_list_ptr *,
int_list_ptr *));
extern void compute_flow_dominators PROTO ((sbitmap *, sbitmap *)); extern void compute_flow_dominators PROTO ((sbitmap *, sbitmap *));
extern void compute_immediate_dominators PROTO ((int *, sbitmap *)); extern void compute_immediate_dominators PROTO ((int *, sbitmap *));
......
...@@ -5317,95 +5317,109 @@ free_bb_mem () ...@@ -5317,95 +5317,109 @@ free_bb_mem ()
free_int_list (&pred_int_list_blocks); free_int_list (&pred_int_list_blocks);
} }
/* Compute dominator relationships. */ /* Compute dominator relationships using new flow graph structures. */
void void
compute_dominators (dominators, post_dominators, s_preds, s_succs) compute_flow_dominators (dominators, post_dominators)
sbitmap *dominators; sbitmap *dominators;
sbitmap *post_dominators; sbitmap *post_dominators;
int_list_ptr *s_preds;
int_list_ptr *s_succs;
{ {
int bb, changed, passes; int bb;
sbitmap *temp_bitmap; sbitmap *temp_bitmap;
edge e;
basic_block *worklist, *tos;
/* Allocate a worklist array/queue. Entries are only added to the
list if they were not already on the list. So the size is
bounded by the number of basic blocks. */
tos = worklist = (basic_block *) xmalloc (sizeof (basic_block)
* n_basic_blocks);
temp_bitmap = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); temp_bitmap = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
sbitmap_vector_ones (dominators, n_basic_blocks);
sbitmap_vector_ones (post_dominators, n_basic_blocks);
sbitmap_vector_zero (temp_bitmap, n_basic_blocks); sbitmap_vector_zero (temp_bitmap, n_basic_blocks);
sbitmap_zero (dominators[0]); if (dominators)
SET_BIT (dominators[0], 0);
sbitmap_zero (post_dominators[n_basic_blocks - 1]);
SET_BIT (post_dominators[n_basic_blocks - 1], 0);
passes = 0;
changed = 1;
while (changed)
{ {
changed = 0; sbitmap_vector_ones (dominators, n_basic_blocks);
for (bb = 1; bb < n_basic_blocks; bb++) sbitmap_zero (dominators[0]);
SET_BIT (dominators[0], 0);
/* Put the successors of the entry block on the worklist. */
for (e = BASIC_BLOCK (0)->succ; e; e = e->succ_next)
{ {
sbitmap_intersect_of_predecessors (temp_bitmap[bb], dominators, *tos++ = e->dest;
bb, s_preds); e->dest->aux = e;
SET_BIT (temp_bitmap[bb], bb);
changed |= sbitmap_a_and_b (dominators[bb],
dominators[bb],
temp_bitmap[bb]);
sbitmap_intersect_of_successors (temp_bitmap[bb], post_dominators,
bb, s_succs);
SET_BIT (temp_bitmap[bb], bb);
changed |= sbitmap_a_and_b (post_dominators[bb],
post_dominators[bb],
temp_bitmap[bb]);
} }
passes++;
}
free (temp_bitmap); /* Iterate until the worklist is empty. */
} while (tos != worklist)
{
/* Take the first entry off the worklist. */
basic_block b = *--tos;
b->aux = NULL;
bb = b->index;
/* Compute dominator relationships using new flow graph structures. */ sbitmap_intersection_of_preds (temp_bitmap[bb], dominators, bb);
void SET_BIT (temp_bitmap[bb], bb);
compute_flow_dominators (dominators, post_dominators)
sbitmap *dominators;
sbitmap *post_dominators;
{
int bb, changed, passes;
sbitmap *temp_bitmap;
temp_bitmap = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); /* If the out state of this block changed, then we need to
sbitmap_vector_ones (dominators, n_basic_blocks); add the successors of this block to the worklist if they
sbitmap_vector_ones (post_dominators, n_basic_blocks); are not already on the worklist. */
sbitmap_vector_zero (temp_bitmap, n_basic_blocks); if (sbitmap_a_and_b (dominators[bb], dominators[bb], temp_bitmap[bb]))
{
for (e = b->succ; e; e = e->succ_next)
{
if (!e->dest->aux && e->dest != EXIT_BLOCK_PTR)
{
*tos++ = e->dest;
e->dest->aux = e;
}
}
}
}
}
sbitmap_zero (dominators[0]); if (post_dominators)
SET_BIT (dominators[0], 0); {
sbitmap_vector_ones (post_dominators, n_basic_blocks);
sbitmap_zero (post_dominators[n_basic_blocks - 1]);
SET_BIT (post_dominators[n_basic_blocks - 1], 0);
sbitmap_zero (post_dominators[n_basic_blocks - 1]); /* Put the predecessors of the exit block on the worklist. */
SET_BIT (post_dominators[n_basic_blocks - 1], 0); for (e = BASIC_BLOCK (n_basic_blocks - 1)->pred; e; e = e->pred_next)
{
*tos++ = e->src;
e->src->aux = e;
}
passes = 0; /* Iterate until the worklist is empty. */
changed = 1; while (tos != worklist)
while (changed)
{
changed = 0;
for (bb = 1; bb < n_basic_blocks; bb++)
{ {
sbitmap_intersection_of_preds (temp_bitmap[bb], dominators, bb); /* Take the first entry off the worklist. */
SET_BIT (temp_bitmap[bb], bb); basic_block b = *--tos;
changed |= sbitmap_a_and_b (dominators[bb], b->aux = NULL;
dominators[bb], bb = b->index;
temp_bitmap[bb]);
sbitmap_intersection_of_succs (temp_bitmap[bb], post_dominators, bb); sbitmap_intersection_of_succs (temp_bitmap[bb], post_dominators, bb);
SET_BIT (temp_bitmap[bb], bb); SET_BIT (temp_bitmap[bb], bb);
changed |= sbitmap_a_and_b (post_dominators[bb],
post_dominators[bb], /* If the out state of this block changed, then we need to
temp_bitmap[bb]); add the successors of this block to the worklist if they
are not already on the worklist. */
if (sbitmap_a_and_b (post_dominators[bb],
post_dominators[bb],
temp_bitmap[bb]))
{
for (e = b->pred; e; e = e->pred_next)
{
if (!e->src->aux && e->src != ENTRY_BLOCK_PTR)
{
*tos++ = e->src;
e->src->aux = e;
}
}
}
} }
passes++;
} }
free (temp_bitmap); free (temp_bitmap);
} }
......
...@@ -5330,7 +5330,6 @@ static sbitmap *hoist_exprs; ...@@ -5330,7 +5330,6 @@ static sbitmap *hoist_exprs;
/* Dominator bitmaps. */ /* Dominator bitmaps. */
static sbitmap *dominators; static sbitmap *dominators;
static sbitmap *post_dominators;
/* ??? We could compute post dominators and run this algorithm in /* ??? We could compute post dominators and run this algorithm in
reverse to to perform tail merging, doing so would probably be reverse to to perform tail merging, doing so would probably be
...@@ -5355,7 +5354,6 @@ alloc_code_hoist_mem (n_blocks, n_exprs) ...@@ -5355,7 +5354,6 @@ alloc_code_hoist_mem (n_blocks, n_exprs)
transpout = sbitmap_vector_alloc (n_blocks, n_exprs); transpout = sbitmap_vector_alloc (n_blocks, n_exprs);
dominators = sbitmap_vector_alloc (n_blocks, n_blocks); dominators = sbitmap_vector_alloc (n_blocks, n_blocks);
post_dominators = sbitmap_vector_alloc (n_blocks, n_blocks);
} }
/* Free vars used for code hoisting analysis. */ /* Free vars used for code hoisting analysis. */
...@@ -5373,7 +5371,6 @@ free_code_hoist_mem () ...@@ -5373,7 +5371,6 @@ free_code_hoist_mem ()
free (transpout); free (transpout);
free (dominators); free (dominators);
free (post_dominators);
} }
/* Compute the very busy expressions at entry/exit from each block. /* Compute the very busy expressions at entry/exit from each block.
...@@ -5418,7 +5415,7 @@ compute_code_hoist_data () ...@@ -5418,7 +5415,7 @@ compute_code_hoist_data ()
compute_local_properties (transp, comp, antloc, 0); compute_local_properties (transp, comp, antloc, 0);
compute_transpout (); compute_transpout ();
compute_code_hoist_vbeinout (); compute_code_hoist_vbeinout ();
compute_flow_dominators (dominators, post_dominators); compute_flow_dominators (dominators, NULL);
if (gcse_file) if (gcse_file)
fprintf (gcse_file, "\n"); fprintf (gcse_file, "\n");
} }
......
...@@ -6965,7 +6965,7 @@ schedule_insns (dump_file) ...@@ -6965,7 +6965,7 @@ schedule_insns (dump_file)
{ {
int_list_ptr *s_preds, *s_succs; int_list_ptr *s_preds, *s_succs;
int *num_preds, *num_succs; int *num_preds, *num_succs;
sbitmap *dom, *pdom; sbitmap *dom;
s_preds = (int_list_ptr *) xmalloc (n_basic_blocks s_preds = (int_list_ptr *) xmalloc (n_basic_blocks
* sizeof (int_list_ptr)); * sizeof (int_list_ptr));
...@@ -6974,7 +6974,6 @@ schedule_insns (dump_file) ...@@ -6974,7 +6974,6 @@ schedule_insns (dump_file)
num_preds = (int *) xmalloc (n_basic_blocks * sizeof (int)); num_preds = (int *) xmalloc (n_basic_blocks * sizeof (int));
num_succs = (int *) xmalloc (n_basic_blocks * sizeof (int)); num_succs = (int *) xmalloc (n_basic_blocks * sizeof (int));
dom = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks); dom = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
pdom = sbitmap_vector_alloc (n_basic_blocks, n_basic_blocks);
/* The scheduler runs after flow; therefore, we can't blindly call /* The scheduler runs after flow; therefore, we can't blindly call
back into find_basic_blocks since doing so could invalidate the back into find_basic_blocks since doing so could invalidate the
...@@ -6993,7 +6992,7 @@ schedule_insns (dump_file) ...@@ -6993,7 +6992,7 @@ schedule_insns (dump_file)
/* Compute the dominators and post dominators. We don't /* Compute the dominators and post dominators. We don't
currently use post dominators, but we should for currently use post dominators, but we should for
speculative motion analysis. */ speculative motion analysis. */
compute_dominators (dom, pdom, s_preds, s_succs); compute_flow_dominators (dom, NULL);
/* build_control_flow will return nonzero if it detects unreachable /* build_control_flow will return nonzero if it detects unreachable
blocks or any other irregularity with the cfg which prevents blocks or any other irregularity with the cfg which prevents
...@@ -7010,7 +7009,6 @@ schedule_insns (dump_file) ...@@ -7010,7 +7009,6 @@ schedule_insns (dump_file)
to using the cfg code in flow.c. */ to using the cfg code in flow.c. */
free_bb_mem (); free_bb_mem ();
free (dom); free (dom);
free (pdom);
free (s_preds); free (s_preds);
free (s_succs); free (s_succs);
free (num_preds); free (num_preds);
......
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