Commit 1c252ef3 by Richard Biener Committed by Richard Biener

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
parent 98610dc5
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.
2018-12-06 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/85726
......@@ -26,6 +26,10 @@ along with GCC; see the file COPYING3. If not see
/* Memory allocation statistics purpose instance. */
mem_alloc_description<bitmap_usage> bitmap_mem_desc;
/* Static zero-initialized bitmap obstack used for default initialization
of bitmap_head. */
bitmap_obstack bitmap_head::crashme;
static bitmap_element *bitmap_tree_listify_from (bitmap, bitmap_element *);
/* Register new bitmap. */
......
......@@ -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
......
......@@ -5205,6 +5205,7 @@ main (int argc, char **argv)
POS_HERE (do_scalar_typedef ("void", &pos));
POS_HERE (do_scalar_typedef ("machine_mode", &pos));
POS_HERE (do_scalar_typedef ("fixed_size_mode", &pos));
POS_HERE (do_scalar_typedef ("CONSTEXPR", &pos));
POS_HERE (do_typedef ("PTR",
create_pointer (resolve_typedef ("void", &pos)),
&pos));
......
......@@ -5417,7 +5417,7 @@ ira (FILE *f)
= ((struct ira_spilled_reg_stack_slot *)
ira_allocate (max_regno
* sizeof (struct ira_spilled_reg_stack_slot)));
memset (ira_spilled_reg_stack_slots, 0,
memset ((void *)ira_spilled_reg_stack_slots, 0,
max_regno * sizeof (struct ira_spilled_reg_stack_slot));
}
}
......
......@@ -6651,11 +6651,11 @@ lra_inheritance (void)
inherit_in_ebb. */
update_ebb_live_info (BB_HEAD (start_bb), BB_END (bb));
}
bitmap_clear (&ebb_global_regs);
bitmap_clear (&temp_bitmap);
bitmap_clear (&live_regs);
bitmap_clear (&invalid_invariant_regs);
bitmap_clear (&check_only_regs);
bitmap_release (&ebb_global_regs);
bitmap_release (&temp_bitmap);
bitmap_release (&live_regs);
bitmap_release (&invalid_invariant_regs);
bitmap_release (&check_only_regs);
free (usage_insns);
timevar_pop (TV_LRA_INHERITANCE);
......
......@@ -231,7 +231,7 @@ create_new_chain (unsigned this_regno, unsigned this_nregs, rtx *loc,
struct du_chain *this_du;
int nregs;
memset (head, 0, sizeof *head);
memset ((void *)head, 0, sizeof *head);
head->next_chain = open_chains;
head->regno = this_regno;
head->nregs = this_nregs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment