diff options
author | Richard Biener <rguenther@suse.de> | 2016-02-23 14:01:51 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-02-23 14:01:51 +0000 |
commit | 43331dfbb8266227a13bb5919dd9f1c4b74a8d16 (patch) | |
tree | 09fcc969fcebe3a9bbdca051a20be5196aedb6d0 | |
parent | c60ec7c23830edc6e4f33b2f7858df8e84ce2c37 (diff) | |
download | gcc-43331dfbb8266227a13bb5919dd9f1c4b74a8d16.zip gcc-43331dfbb8266227a13bb5919dd9f1c4b74a8d16.tar.gz gcc-43331dfbb8266227a13bb5919dd9f1c4b74a8d16.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/bitmap.c | 23 | ||||
-rw-r--r-- | gcc/bitmap.h | 15 | ||||
-rw-r--r-- | gcc/df-problems.c | 5 | ||||
-rw-r--r-- | gcc/mem-stats.h | 13 | ||||
-rw-r--r-- | gcc/tree.c | 2 |
6 files changed, 52 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 951f208..ce8d366 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +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. + 2016-02-23 Jakub Jelinek <jakub@redhat.com> PR c++/69902 diff --git a/gcc/bitmap.c b/gcc/bitmap.c index 0a94e64..ac20ae5 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 diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 013c9fb..805e37e 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -157,12 +157,14 @@ struct bitmap_usage: public mem_usage { char *location_string = loc->to_string (); - fprintf (stderr, "%-48s %10li:%5.1f%%%10li%10li:%5.1f%%%12li%12li%10s\n", - location_string, - (long)m_allocated, get_percent (m_allocated, total.m_allocated), - (long)m_peak, (long)m_times, + fprintf (stderr, "%-48s %10" PRIu64 ":%5.1f%%" + "%10" PRIu64 "%10" PRIu64 ":%5.1f%%" + "%12" PRIu64 "%12" PRIu64 "%10s\n", + location_string, (uint64_t)m_allocated, + get_percent (m_allocated, total.m_allocated), + (uint64_t)m_peak, (uint64_t)m_times, get_percent (m_times, total.m_times), - (long)m_nsearches, (long)m_search_iter, + m_nsearches, m_search_iter, loc->m_ggc ? "ggc" : "heap"); free (location_string); @@ -253,6 +255,9 @@ extern void bitmap_clear (bitmap); /* Copy a bitmap to another bitmap. */ extern void bitmap_copy (bitmap, const_bitmap); +/* Move a bitmap to another bitmap. */ +extern void bitmap_move (bitmap, bitmap); + /* True if two bitmaps are identical. */ extern bool bitmap_equal_p (const_bitmap, const_bitmap); diff --git a/gcc/df-problems.c b/gcc/df-problems.c index 6313888..f7bf3c8 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -517,10 +517,7 @@ df_rd_transfer_function (int bb_index) bitmap_ior_into (&tmp, gen); changed = !bitmap_equal_p (&tmp, out); if (changed) - { - bitmap_clear (out); - bb_info->out = tmp; - } + bitmap_move (out, &tmp); else bitmap_clear (&tmp); } diff --git a/gcc/mem-stats.h b/gcc/mem-stats.h index 0b1dda2..d3a324e 100644 --- a/gcc/mem-stats.h +++ b/gcc/mem-stats.h @@ -190,10 +190,11 @@ struct mem_usage { char *location_string = loc->to_string (); - fprintf (stderr, "%-48s %10li:%5.1f%%%10li%10li:%5.1f%%%10s\n", - location_string, - (long)m_allocated, get_percent (m_allocated, total.m_allocated), - (long)m_peak, (long)m_times, + fprintf (stderr, "%-48s %10" PRIu64 ":%5.1f%%" + "%10" PRIu64 "%10" PRIu64 ":%5.1f%%%10s\n", + location_string, (uint64_t)m_allocated, + get_percent (m_allocated, total.m_allocated), + (uint64_t)m_peak, (uint64_t)m_times, get_percent (m_times, total.m_times), loc->m_ggc ? "ggc" : "heap"); free (location_string); @@ -204,8 +205,8 @@ struct mem_usage dump_footer () const { print_dash_line (); - fprintf (stderr, "%s%54li%27li\n", "Total", (long)m_allocated, - (long)m_times); + fprintf (stderr, "%s%54" PRIu64 "%27" PRIu64 "\n", "Total", + (uint64_t)m_allocated, (uint64_t)m_times); print_dash_line (); } @@ -1114,7 +1114,7 @@ free_node (tree node) { tree_code_counts[(int) TREE_CODE (node)]--; tree_node_counts[(int) t_kind]--; - tree_node_sizes[(int) t_kind] -= tree_code_size (TREE_CODE (node)); + tree_node_sizes[(int) t_kind] -= tree_size (node); } if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR)) vec_free (CONSTRUCTOR_ELTS (node)); |