aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Berlin <dan@cgsoftware.com>2001-06-16 16:13:25 +0000
committerDaniel Berlin <dberlin@gcc.gnu.org>2001-06-16 16:13:25 +0000
commitea1939969e757b057b82adc1a51ee50330b5228f (patch)
tree3a45f5c5fd147ad1c6593514ed6b6fb51ad056d2
parent6d34c1c4f3cb9537b65a57ee9d6c80853ea0017a (diff)
downloadgcc-ea1939969e757b057b82adc1a51ee50330b5228f.zip
gcc-ea1939969e757b057b82adc1a51ee50330b5228f.tar.gz
gcc-ea1939969e757b057b82adc1a51ee50330b5228f.tar.bz2
bitmap.h: Add dump_bitmap...
2001-06-16 Daniel Berlin <dan@cgsoftware.com> * bitmap.h: Add dump_bitmap, bitmap_zero, bitmap_union_of_diffs, bitmap_a_or_b, bitmap_a_and_b, bitmap_first_set_bit, bitmap_last_set_bit. All for compatibility with sbitmap's. *bitmap.c (bitmap_zero): New function. (bitmap_union_of_diffs): New function. (bitmap_first_set_bit): New function. (bitmap_last_set_bit): New function. From-SVN: r43420
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/bitmap.c38
-rw-r--r--gcc/bitmap.h13
3 files changed, 60 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bcdd907..cd9d69d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2001-06-16 Daniel Berlin <dan@cgsoftware.com>
+
+ * bitmap.h: Add dump_bitmap, bitmap_zero, bitmap_union_of_diffs,
+ bitmap_a_or_b, bitmap_a_and_b, bitmap_first_set_bit,
+ bitmap_last_set_bit. All for compatibility with sbitmap's.
+
+ *bitmap.c (bitmap_zero): New function.
+ (bitmap_union_of_diffs): New function.
+ (bitmap_first_set_bit): New function.
+ (bitmap_last_set_bit): New function.
+
2001-06-16 Neil Booth <neil@daikokuya.demon.co.uk>
* cpp.texi, invoke.texi: Update.
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index 56a5fd7..8521ab5 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -507,7 +507,9 @@ bitmap_operation (to, from1, from2, operation)
case BITMAP_IOR:
DOIT (|);
break;
-
+ case BITMAP_IOR_COMPL:
+ DOIT (|~);
+ break;
case BITMAP_XOR:
DOIT (^);
break;
@@ -676,3 +678,37 @@ bitmap_release_memory ()
obstack_free (&bitmap_obstack, NULL);
}
}
+
+int
+bitmap_union_of_diff (dst, a, b, c)
+ bitmap dst;
+ bitmap a;
+ bitmap b;
+ bitmap c;
+{
+ int changed = 0;
+ bitmap temp = BITMAP_ALLOCA ();
+ bitmap_operation (temp, b, c, BITMAP_AND_COMPL);
+ changed = bitmap_operation (dst, temp, a, BITMAP_IOR);
+ return changed;
+}
+
+int
+bitmap_first_set_bit (a)
+ bitmap a;
+{
+ int i;
+ EXECUTE_IF_SET_IN_BITMAP (a, 0, i, return i;);
+ return -1;
+}
+
+int
+bitmap_last_set_bit (a)
+ bitmap a;
+{
+ int i;
+ EXECUTE_IF_SET_IN_BITMAP (a, 0, i, );
+ if (bitmap_bit_p (a, i))
+ return i;
+ return -1;
+}
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index 0eb5992..95c2a5e 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -52,6 +52,7 @@ typedef struct bitmap_head_def {
bitmap_element *first; /* First element in linked list. */
bitmap_element *current; /* Last element looked at. */
unsigned int indx; /* Index of last element looked at. */
+
} bitmap_head, *bitmap;
/* Enumeration giving the various operations we support. */
@@ -59,7 +60,8 @@ enum bitmap_bits {
BITMAP_AND, /* TO = FROM1 & FROM2 */
BITMAP_AND_COMPL, /* TO = FROM1 & ~ FROM2 */
BITMAP_IOR, /* TO = FROM1 | FROM2 */
- BITMAP_XOR /* TO = FROM1 ^ FROM2 */
+ BITMAP_XOR, /* TO = FROM1 ^ FROM2 */
+ BITMAP_IOR_COMPL /* TO = FROM1 | ~FROM2 */
};
/* Global data */
@@ -104,6 +106,15 @@ extern bitmap bitmap_initialize PARAMS ((bitmap));
/* Release all memory held by bitmaps. */
extern void bitmap_release_memory PARAMS ((void));
+/* A few compatibility/functions macros for compatibility with sbitmaps */
+#define dump_bitmap(file, bitmap) bitmap_print (file, bitmap, "", "\n")
+#define bitmap_zero(a) bitmap_clear (a)
+#define bitmap_a_or_b(a,b,c) bitmap_operation (a, b, c, BITMAP_IOR)
+#define bitmap_a_and_b(a,b,c) bitmap_operation (a, b, c, BITMAP_AND)
+extern int bitmap_union_of_diff PARAMS((bitmap, bitmap, bitmap, bitmap));
+extern int bitmap_first_set_bit PARAMS((bitmap));
+extern int bitmap_last_set_bit PARAMS((bitmap));
+
/* Allocate a bitmap with oballoc. */
#define BITMAP_OBSTACK_ALLOC(OBSTACK) \
bitmap_initialize ((bitmap) obstack_alloc (OBSTACK, sizeof (bitmap_head)))