OSDN Git Service

* sbitmap.c (sbitmap_any_common_bits): New function.
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Dec 2004 00:33:05 +0000 (00:33 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Dec 2004 00:33:05 +0000 (00:33 +0000)
        * 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

gcc/ChangeLog
gcc/modulo-sched.c
gcc/sbitmap.c
gcc/sbitmap.h
gcc/tree-ssa-alias.c

index 16dfb19..5bbe2e9 100644 (file)
@@ -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
index 14f006a..57879ba 100644 (file)
@@ -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)
     {
index f4abaee..7c912a9 100644 (file)
@@ -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.  */
 
index 779a996..edaa058 100644 (file)
@@ -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);
index 3fce93a..37ea0f2 100644 (file)
@@ -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",