OSDN Git Service

PR c/20740
[pf3gnuchains/gcc-fork.git] / gcc / sbitmap.c
index 554a425..7c912a9 100644 (file)
@@ -1,5 +1,5 @@
 /* Simple bitmaps.
-   Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "rtl.h"
 #include "flags.h"
 #include "hard-reg-set.h"
+#include "obstack.h"
 #include "basic-block.h"
 
 /* Bitmap manipulation routines.  */
@@ -103,7 +104,7 @@ sbitmap_resize (sbitmap bmap, unsigned int n_elms, int def)
   return bmap;
 }
 
-/* Re-allocate a simple bitmap of N_ELMS bits. New storage is uninitialized.   */
+/* Re-allocate a simple bitmap of N_ELMS bits. New storage is uninitialized.  */
 
 sbitmap
 sbitmap_realloc (sbitmap src, unsigned int n_elms)
@@ -315,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.  */
 
@@ -636,8 +655,9 @@ sbitmap_union_of_preds (sbitmap dst, sbitmap *src, int bb)
   edge e;
   unsigned ix;
 
-  for (e = NULL, ix = 0; ix < EDGE_COUNT (b->preds); ix++)
+  for (ix = 0; ix < EDGE_COUNT (b->preds); ix++)
     {
+      e = EDGE_PRED (b, ix);
       if (e->src== ENTRY_BLOCK_PTR)
        continue;