summaryrefslogtreecommitdiff
path: root/gcc/bitmap.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-02-23 14:01:51 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-02-23 14:01:51 +0000
commit43331dfbb8266227a13bb5919dd9f1c4b74a8d16 (patch)
tree09fcc969fcebe3a9bbdca051a20be5196aedb6d0 /gcc/bitmap.c
parentc60ec7c23830edc6e4f33b2f7858df8e84ce2c37 (diff)
downloadgcc-43331dfbb8266227a13bb5919dd9f1c4b74a8d16.tar.gz
mem-stats.h (struct mem_usage): Use PRIu64 for printing size_t.
2016-02-23 Richard Biener <rguenther@suse.de> * mem-stats.h (struct mem_usage): Use PRIu64 for printing size_t. * bitmap.h (struct bitmap_usage): Likewise. (bitmap_move): Declare. * bitmap.c (register_overhead): Take size_t argument. (bitmap_move): New function. * df-problems.c (df_rd_transfer_function): Use bitmap_move to properly account overhead. * tree.c (free_node): Use tree_size. From-SVN: r233633
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