aboutsummaryrefslogtreecommitdiff
path: root/gcc/bitmap.h
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-05-07 14:15:45 +0200
committerMartin Liska <marxin@gcc.gnu.org>2019-05-07 12:15:45 +0000
commit7664eeb700d9e95339f04a1c308a095b53d7a5fb (patch)
treeb468ae4fecfc6cb7be9e2510940a0f01564a2975 /gcc/bitmap.h
parent9f708a844853eb2fe87e696d27de14cbd68896f8 (diff)
downloadgcc-7664eeb700d9e95339f04a1c308a095b53d7a5fb.zip
gcc-7664eeb700d9e95339f04a1c308a095b53d7a5fb.tar.gz
gcc-7664eeb700d9e95339f04a1c308a095b53d7a5fb.tar.bz2
Fix bitmap registration of overheads.
2019-05-07 Martin Liska <mliska@suse.cz> * bitmap.c (bitmap_register): Come up with alloc_descriptor_max_uid and assign it for a new bitmap. (register_overhead): Use get_descriptor as a descriptor. (release_overhead): New. (bitmap_elem_to_freelist): Call it. (bitmap_elt_clear_from): Likewise. (bitmap_obstack_free): Likewise. (bitmap_move): Sensitively release memory. * bitmap.h (struct GTY): Add alloc_descriptor and padding. (bitmap_initialize): Initialize alloc_descriptor to zero. * tree-ssa-pre.c (do_hoist_insertion): Use bitmap_move. From-SVN: r270942
Diffstat (limited to 'gcc/bitmap.h')
-rw-r--r--gcc/bitmap.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/bitmap.h b/gcc/bitmap.h
index ed25c1e..39f509d 100644
--- a/gcc/bitmap.h
+++ b/gcc/bitmap.h
@@ -325,14 +325,18 @@ struct GTY(()) bitmap_head {
static bitmap_obstack crashme;
/* Poison obstack to not make it not a valid initialized GC bitmap. */
CONSTEXPR bitmap_head()
- : indx(0), tree_form(false), first(NULL), current(NULL),
- obstack (&crashme)
+ : indx (0), tree_form (false), padding (0), alloc_descriptor (0), first (NULL),
+ current (NULL), obstack (&crashme)
{}
/* Index of last element looked at. */
unsigned int indx;
/* False if the bitmap is in list form; true if the bitmap is in tree form.
Bitmap iterators only work on bitmaps in list form. */
- bool tree_form;
+ unsigned tree_form: 1;
+ /* Next integer is shifted, so padding is needed. */
+ unsigned padding: 2;
+ /* Bitmap UID used for memory allocation statistics. */
+ unsigned alloc_descriptor: 29;
/* In list form, the first element in the linked list;
in tree form, the root of the tree. */
bitmap_element *first;
@@ -340,7 +344,17 @@ struct GTY(()) bitmap_head {
bitmap_element * GTY((skip(""))) current;
/* Obstack to allocate elements from. If NULL, then use GGC allocation. */
bitmap_obstack * GTY((skip(""))) obstack;
+
+ /* Dump bitmap. */
void dump ();
+
+ /* Get bitmap descriptor UID casted to an unsigned integer pointer.
+ Shift the descriptor because pointer_hash<Type>::hash is
+ doing >> 3 shift operation. */
+ unsigned *get_descriptor ()
+ {
+ return (unsigned *)(ptrdiff_t)(alloc_descriptor << 3);
+ }
};
/* Global data */
@@ -441,6 +455,8 @@ bitmap_initialize (bitmap head, bitmap_obstack *obstack CXX_MEM_STAT_INFO)
{
head->first = head->current = NULL;
head->indx = head->tree_form = 0;
+ head->padding = 0;
+ head->alloc_descriptor = 0;
head->obstack = obstack;
if (GATHER_STATISTICS)
bitmap_register (head PASS_MEM_STAT);