diff options
author | Richard Biener <rguenther@suse.de> | 2018-12-06 11:32:09 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-12-06 11:32:09 +0000 |
commit | 1c252ef3cbf964ce6022e5431de7f264a929a100 (patch) | |
tree | 9d8140a68c008e3bc89ef9eded4d916dcf77f927 /gcc/bitmap.h | |
parent | 98610dc5b630a8ee7f39ed48d45e58fb044dbec1 (diff) | |
download | gcc-1c252ef3cbf964ce6022e5431de7f264a929a100.zip gcc-1c252ef3cbf964ce6022e5431de7f264a929a100.tar.gz gcc-1c252ef3cbf964ce6022e5431de7f264a929a100.tar.bz2 |
bitmap.c (bitmap_head::crashme): Define.
2018-12-06 Richard Biener <rguenther@suse.de>
* bitmap.c (bitmap_head::crashme): Define.
* bitmap.h (bitmap_head): Add constexpr default constructor
poisoning the obstack member.
(bitmap_head::crashme): Declare.
(bitmap_release): New function clearing a bitmap and poisoning
the obstack member.
* gengtype.c (main): Make it recognize CONSTEXPR.
* lra-constraints.c (lra_inheritance): Use bitmap_release
instead of bitmap_clear.
* ira.c (ira): Work around class-memaccess warning.
* regrename.c (create_new_chain): Likewise.
From-SVN: r266850
Diffstat (limited to 'gcc/bitmap.h')
-rw-r--r-- | gcc/bitmap.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 9a180da..7499ebe 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -323,6 +323,12 @@ struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) bitmap_element { already pointed to by the chain started by first, so GTY((skip)) it. */ 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) + {} /* 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. @@ -441,6 +447,18 @@ bitmap_initialize (bitmap head, bitmap_obstack *obstack CXX_MEM_STAT_INFO) bitmap_register (head PASS_MEM_STAT); } +/* Release a bitmap (but not its head). This is suitable for pairing with + bitmap_initialize. */ + +static inline void +bitmap_release (bitmap head) +{ + bitmap_clear (head); + /* Poison the obstack pointer so the obstack can be safely released. + Do not zero it as the bitmap then becomes initialized GC. */ + head->obstack = &bitmap_head::crashme; +} + /* Allocate and free bitmaps from obstack, malloc and gc'd memory. */ extern bitmap bitmap_alloc (bitmap_obstack *obstack CXX_MEM_STAT_INFO); #define BITMAP_ALLOC bitmap_alloc |