Commit 874437bc by Jeff Law Committed by Jeff Law

sbitmap.c (sbitmap_any_common_bits): New function.



        * sbitmap.c (sbitmap_any_common_bits): New function.
        * sbitmap.h (sbitmap_any_common_bits): Prototype.
        * modulo-sched.c (sms_schedule_by_order): Use sbitmap_any_common_bits
        No longer allocate/free "psp", "pss" sbitmaps.
        * tree-ssa-alias.c (compute_flow_insensitive_aliasing): Similarly for
        the "res" sbitmap.
        (group_aliases): Similarly.

From-SVN: r91550
parent 29b0a291
2004-11-30 Jeff Law <law@redhat.com>
* sbitmap.c (sbitmap_any_common_bits): New function.
* sbitmap.h (sbitmap_any_common_bits): Prototype.
* modulo-sched.c (sms_schedule_by_order): Use sbitmap_any_common_bits
No longer allocate/free "psp", "pss" sbitmaps.
* tree-ssa-alias.c (compute_flow_insensitive_aliasing): Similarly for
the "res" sbitmap.
(group_aliases): Similarly.
2004-11-30 Nathan Sidwell <nathan@codesourcery.com> 2004-11-30 Nathan Sidwell <nathan@codesourcery.com>
* tree-vectorizer.c (vect_analyze_data_refs): Reformat and avoid * tree-vectorizer.c (vect_analyze_data_refs): Reformat and avoid
......
...@@ -1219,8 +1219,6 @@ sms_schedule_by_order (ddg_ptr g, int mii, int maxii, int *nodes_order, FILE *du ...@@ -1219,8 +1219,6 @@ sms_schedule_by_order (ddg_ptr g, int mii, int maxii, int *nodes_order, FILE *du
ddg_edge_ptr e; ddg_edge_ptr e;
int start, end, step; /* Place together into one struct? */ int start, end, step; /* Place together into one struct? */
sbitmap sched_nodes = sbitmap_alloc (num_nodes); sbitmap sched_nodes = sbitmap_alloc (num_nodes);
sbitmap psp = sbitmap_alloc (num_nodes);
sbitmap pss = sbitmap_alloc (num_nodes);
sbitmap must_precede = sbitmap_alloc (num_nodes); sbitmap must_precede = sbitmap_alloc (num_nodes);
sbitmap must_follow = sbitmap_alloc (num_nodes); sbitmap must_follow = sbitmap_alloc (num_nodes);
...@@ -1250,10 +1248,8 @@ sms_schedule_by_order (ddg_ptr g, int mii, int maxii, int *nodes_order, FILE *du ...@@ -1250,10 +1248,8 @@ sms_schedule_by_order (ddg_ptr g, int mii, int maxii, int *nodes_order, FILE *du
continue; continue;
/* 1. compute sched window for u (start, end, step). */ /* 1. compute sched window for u (start, end, step). */
sbitmap_zero (psp); psp_not_empty = sbitmap_any_common_bits (u_node_preds, sched_nodes);
sbitmap_zero (pss); pss_not_empty = sbitmap_any_common_bits (u_node_succs, sched_nodes);
psp_not_empty = sbitmap_a_and_b_cg (psp, u_node_preds, sched_nodes);
pss_not_empty = sbitmap_a_and_b_cg (pss, u_node_succs, sched_nodes);
if (psp_not_empty && !pss_not_empty) if (psp_not_empty && !pss_not_empty)
{ {
...@@ -1399,8 +1395,6 @@ sms_schedule_by_order (ddg_ptr g, int mii, int maxii, int *nodes_order, FILE *du ...@@ -1399,8 +1395,6 @@ sms_schedule_by_order (ddg_ptr g, int mii, int maxii, int *nodes_order, FILE *du
} /* While try_again_with_larger_ii. */ } /* While try_again_with_larger_ii. */
sbitmap_free (sched_nodes); sbitmap_free (sched_nodes);
sbitmap_free (psp);
sbitmap_free (pss);
if (ii >= maxii) if (ii >= maxii)
{ {
......
...@@ -316,6 +316,24 @@ sbitmap_difference (sbitmap dst, sbitmap a, sbitmap b) ...@@ -316,6 +316,24 @@ sbitmap_difference (sbitmap dst, sbitmap a, sbitmap b)
*dstp++ = *ap++; *dstp++ = *ap++;
} }
/* Return true if there are any bits set in A are also set in B.
Return false otherwise. */
bool
sbitmap_any_common_bits (sbitmap a, sbitmap b)
{
sbitmap_ptr ap = a->elms;
sbitmap_ptr bp = b->elms;
unsigned int i, n;
n = MIN (a->size, b->size);
for (i = 0; i < n; i++)
if ((*ap++ & *bp++) != 0)
return true;
return false;
}
/* Set DST to be (A and B). /* Set DST to be (A and B).
Return nonzero if any change is made. */ Return nonzero if any change is made. */
......
...@@ -141,6 +141,7 @@ extern void sbitmap_a_or_b_and_c (sbitmap, sbitmap, sbitmap, sbitmap); ...@@ -141,6 +141,7 @@ extern void sbitmap_a_or_b_and_c (sbitmap, sbitmap, sbitmap, sbitmap);
extern bool sbitmap_a_or_b_and_c_cg (sbitmap, sbitmap, sbitmap, sbitmap); extern bool sbitmap_a_or_b_and_c_cg (sbitmap, sbitmap, sbitmap, sbitmap);
extern void sbitmap_a_and_b_or_c (sbitmap, sbitmap, sbitmap, sbitmap); extern void sbitmap_a_and_b_or_c (sbitmap, sbitmap, sbitmap, sbitmap);
extern bool sbitmap_a_and_b_or_c_cg (sbitmap, sbitmap, sbitmap, sbitmap); extern bool sbitmap_a_and_b_or_c_cg (sbitmap, sbitmap, sbitmap, sbitmap);
extern bool sbitmap_any_common_bits (sbitmap, sbitmap);
extern void sbitmap_a_and_b (sbitmap, sbitmap, sbitmap); extern void sbitmap_a_and_b (sbitmap, sbitmap, sbitmap);
extern bool sbitmap_a_and_b_cg (sbitmap, sbitmap, sbitmap); extern bool sbitmap_a_and_b_cg (sbitmap, sbitmap, sbitmap);
extern void sbitmap_a_or_b (sbitmap, sbitmap, sbitmap); extern void sbitmap_a_or_b (sbitmap, sbitmap, sbitmap);
......
...@@ -927,7 +927,6 @@ static void ...@@ -927,7 +927,6 @@ static void
compute_flow_insensitive_aliasing (struct alias_info *ai) compute_flow_insensitive_aliasing (struct alias_info *ai)
{ {
size_t i; size_t i;
sbitmap res;
/* Initialize counter for the total number of virtual operands that /* Initialize counter for the total number of virtual operands that
aliasing will introduce. When AI->TOTAL_ALIAS_VOPS goes beyond the aliasing will introduce. When AI->TOTAL_ALIAS_VOPS goes beyond the
...@@ -1021,8 +1020,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai) ...@@ -1021,8 +1020,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
To avoid this problem, we do a final traversal of AI->POINTERS To avoid this problem, we do a final traversal of AI->POINTERS
looking for pairs of pointers that have no aliased symbols in looking for pairs of pointers that have no aliased symbols in
common and yet have conflicting alias set numbers. */ common and yet have conflicting alias set numbers. */
res = sbitmap_alloc (num_referenced_vars);
for (i = 0; i < ai->num_pointers; i++) for (i = 0; i < ai->num_pointers; i++)
{ {
size_t j; size_t j;
...@@ -1042,8 +1039,7 @@ compute_flow_insensitive_aliasing (struct alias_info *ai) ...@@ -1042,8 +1039,7 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
/* The two pointers may alias each other. If they already have /* The two pointers may alias each other. If they already have
symbols in common, do nothing. */ symbols in common, do nothing. */
sbitmap_a_and_b (res, may_aliases1, may_aliases2); if (sbitmap_any_common_bits (may_aliases1, may_aliases2))
if (sbitmap_first_set_bit (res) >= 0)
continue; continue;
if (sbitmap_first_set_bit (may_aliases2) >= 0) if (sbitmap_first_set_bit (may_aliases2) >= 0)
...@@ -1065,8 +1061,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai) ...@@ -1065,8 +1061,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
} }
} }
sbitmap_free (res);
if (dump_file) if (dump_file)
fprintf (dump_file, "%s: Total number of aliased vops: %ld\n", fprintf (dump_file, "%s: Total number of aliased vops: %ld\n",
get_name (current_function_decl), get_name (current_function_decl),
...@@ -1209,15 +1203,12 @@ static void ...@@ -1209,15 +1203,12 @@ static void
group_aliases (struct alias_info *ai) group_aliases (struct alias_info *ai)
{ {
size_t i; size_t i;
sbitmap res;
/* Sort the POINTERS array in descending order of contributed /* Sort the POINTERS array in descending order of contributed
virtual operands. */ virtual operands. */
qsort (ai->pointers, ai->num_pointers, sizeof (struct alias_map_d *), qsort (ai->pointers, ai->num_pointers, sizeof (struct alias_map_d *),
total_alias_vops_cmp); total_alias_vops_cmp);
res = sbitmap_alloc (num_referenced_vars);
/* For every pointer in AI->POINTERS, reverse the roles of its tag /* For every pointer in AI->POINTERS, reverse the roles of its tag
and the tag's may-aliases set. */ and the tag's may-aliases set. */
for (i = 0; i < ai->num_pointers; i++) for (i = 0; i < ai->num_pointers; i++)
...@@ -1237,8 +1228,7 @@ group_aliases (struct alias_info *ai) ...@@ -1237,8 +1228,7 @@ group_aliases (struct alias_info *ai)
{ {
sbitmap tag2_aliases = ai->pointers[j]->may_aliases; sbitmap tag2_aliases = ai->pointers[j]->may_aliases;
sbitmap_a_and_b (res, tag1_aliases, tag2_aliases); if (sbitmap_any_common_bits (tag1_aliases, tag2_aliases))
if (sbitmap_first_set_bit (res) >= 0)
{ {
tree tag2 = var_ann (ai->pointers[j]->var)->type_mem_tag; tree tag2 = var_ann (ai->pointers[j]->var)->type_mem_tag;
...@@ -1308,8 +1298,6 @@ group_aliases (struct alias_info *ai) ...@@ -1308,8 +1298,6 @@ group_aliases (struct alias_info *ai)
} }
} }
sbitmap_free (res);
if (dump_file) if (dump_file)
fprintf (dump_file, fprintf (dump_file,
"%s: Total number of aliased vops after grouping: %ld%s\n", "%s: Total number of aliased vops after grouping: %ld%s\n",
......
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