summaryrefslogtreecommitdiff
path: root/gcc/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/bitmap.c')
-rw-r--r--gcc/bitmap.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index 0a94e648807..ac20ae5830f 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -35,7 +35,7 @@ bitmap_register (bitmap b MEM_STAT_DECL)
/* Account the overhead. */
static void
-register_overhead (bitmap b, int amount)
+register_overhead (bitmap b, size_t amount)
{
if (bitmap_mem_desc.contains_descriptor_for_instance (b))
bitmap_mem_desc.register_instance_overhead (amount, b);
@@ -468,6 +468,27 @@ bitmap_copy (bitmap to, const_bitmap from)
to_ptr = to_elt;
}
}
+
+/* Move a bitmap to another bitmap. */
+
+void
+bitmap_move (bitmap to, bitmap from)
+{
+ gcc_assert (to->obstack == from->obstack);
+
+ bitmap_clear (to);
+
+ *to = *from;
+
+ if (GATHER_STATISTICS)
+ {
+ size_t sz = 0;
+ for (bitmap_element *e = to->first; e; e = e->next)
+ sz += sizeof (bitmap_element);
+ register_overhead (to, sz);
+ register_overhead (from, -sz);
+ }
+}
/* Find a bitmap element that would hold a bitmap's bit.
Update the `current' field even if we can't find an element that