summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-01 00:33:05 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-01 00:33:05 +0000
commit7d0585a5a37c8aac3712340f3bf964453ebc87b1 (patch)
treecd189cb08fa13a7f1b8b3f73f4d5e9b4b6f53621
parenta4aade76261cf858be3bb15b085db257a4aa6035 (diff)
downloadgcc-7d0585a5a37c8aac3712340f3bf964453ebc87b1.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91550 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/modulo-sched.c10
-rw-r--r--gcc/sbitmap.c18
-rw-r--r--gcc/sbitmap.h1
-rw-r--r--gcc/tree-ssa-alias.c16
5 files changed, 33 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 16dfb198220..5bbe2e995f6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+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>
* tree-vectorizer.c (vect_analyze_data_refs): Reformat and avoid
diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c
index 14f006a58ba..57879baf799 100644
--- a/gcc/modulo-sched.c
+++ b/gcc/modulo-sched.c
@@ -1219,8 +1219,6 @@ sms_schedule_by_order (ddg_ptr g, int mii, int maxii, int *nodes_order, FILE *du
ddg_edge_ptr e;
int start, end, step; /* Place together into one struct? */
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_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
continue;
/* 1. compute sched window for u (start, end, step). */
- sbitmap_zero (psp);
- sbitmap_zero (pss);
- 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);
+ psp_not_empty = sbitmap_any_common_bits (u_node_preds, sched_nodes);
+ pss_not_empty = sbitmap_any_common_bits (u_node_succs, sched_nodes);
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
} /* While try_again_with_larger_ii. */
sbitmap_free (sched_nodes);
- sbitmap_free (psp);
- sbitmap_free (pss);
if (ii >= maxii)
{
diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c
index f4abaeeba27..7c912a922af 100644
--- a/gcc/sbitmap.c
+++ b/gcc/sbitmap.c
@@ -316,6 +316,24 @@ sbitmap_difference (sbitmap dst, sbitmap a, sbitmap b)
*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).
Return nonzero if any change is made. */
diff --git a/gcc/sbitmap.h b/gcc/sbitmap.h
index 779a9961129..edaa0580ebf 100644
--- a/gcc/sbitmap.h
+++ b/gcc/sbitmap.h
@@ -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 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_any_common_bits (sbitmap, sbitmap);
extern void sbitmap_a_and_b (sbitmap, sbitmap, sbitmap);
extern bool sbitmap_a_and_b_cg (sbitmap, sbitmap, sbitmap);
extern void sbitmap_a_or_b (sbitmap, sbitmap, sbitmap);
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 3fce93a8001..37ea0f25290 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -927,7 +927,6 @@ static void
compute_flow_insensitive_aliasing (struct alias_info *ai)
{
size_t i;
- sbitmap res;
/* Initialize counter for the total number of virtual operands that
aliasing will introduce. When AI->TOTAL_ALIAS_VOPS goes beyond the
@@ -1021,8 +1020,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
To avoid this problem, we do a final traversal of AI->POINTERS
looking for pairs of pointers that have no aliased symbols in
common and yet have conflicting alias set numbers. */
- res = sbitmap_alloc (num_referenced_vars);
-
for (i = 0; i < ai->num_pointers; i++)
{
size_t j;
@@ -1042,8 +1039,7 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
/* The two pointers may alias each other. If they already have
symbols in common, do nothing. */
- sbitmap_a_and_b (res, may_aliases1, may_aliases2);
- if (sbitmap_first_set_bit (res) >= 0)
+ if (sbitmap_any_common_bits (may_aliases1, may_aliases2))
continue;
if (sbitmap_first_set_bit (may_aliases2) >= 0)
@@ -1065,8 +1061,6 @@ compute_flow_insensitive_aliasing (struct alias_info *ai)
}
}
- sbitmap_free (res);
-
if (dump_file)
fprintf (dump_file, "%s: Total number of aliased vops: %ld\n",
get_name (current_function_decl),
@@ -1209,15 +1203,12 @@ static void
group_aliases (struct alias_info *ai)
{
size_t i;
- sbitmap res;
/* Sort the POINTERS array in descending order of contributed
virtual operands. */
qsort (ai->pointers, ai->num_pointers, sizeof (struct alias_map_d *),
total_alias_vops_cmp);
- res = sbitmap_alloc (num_referenced_vars);
-
/* For every pointer in AI->POINTERS, reverse the roles of its tag
and the tag's may-aliases set. */
for (i = 0; i < ai->num_pointers; i++)
@@ -1237,8 +1228,7 @@ group_aliases (struct alias_info *ai)
{
sbitmap tag2_aliases = ai->pointers[j]->may_aliases;
- sbitmap_a_and_b (res, tag1_aliases, tag2_aliases);
- if (sbitmap_first_set_bit (res) >= 0)
+ if (sbitmap_any_common_bits (tag1_aliases, tag2_aliases))
{
tree tag2 = var_ann (ai->pointers[j]->var)->type_mem_tag;
@@ -1308,8 +1298,6 @@ group_aliases (struct alias_info *ai)
}
}
- sbitmap_free (res);
-
if (dump_file)
fprintf (dump_file,
"%s: Total number of aliased vops after grouping: %ld%s\n",