Commit 497f1b81 by Jan Hubicka Committed by Jan Hubicka

tree-ssa-operands.h (struct ssa_operand_memory_d): add ssa_operand_mem_size.

	* tree-ssa-operands.h (struct ssa_operand_memory_d):
	add ssa_operand_mem_size.
	* tree-ssa-operands.c (operands_bitmap_obstack): New.               
	(ssa_operand_mem_size): Remove.
	(init_ssa_operands): Initialize obstack; use it.
	(fini_ssa_operands): Release obstack.
	(ssa_operand_alloc): Update.
	(finalize_ssa_vdefs, finalize_ssa_vuse_ops, copy_virtual_operands,
	get_mpt_for): Use obstack.
	* tree-ssa.c (delete_tree_ssa): Call fini_ssa_operands.
	* tree-outof-ssa.c: (remove_ssa_form): Don't call it here.

From-SVN: r120189
parent 7a223fd4
2006-12-24 Jan Hubicka <jh@suse.cz> 2006-12-24 Jan Hubicka <jh@suse.cz>
* tree-ssa-operands.h (struct ssa_operand_memory_d):
add ssa_operand_mem_size.
* tree-ssa-operands.c (operands_bitmap_obstack): New.
(ssa_operand_mem_size): Remove.
(init_ssa_operands): Initialize obstack; use it.
(fini_ssa_operands): Release obstack.
(ssa_operand_alloc): Update.
(finalize_ssa_vdefs, finalize_ssa_vuse_ops, copy_virtual_operands,
get_mpt_for): Use obstack.
* tree-ssa.c (delete_tree_ssa): Call fini_ssa_operands.
* tree-outof-ssa.c: (remove_ssa_form): Don't call it here.
2006-12-24 Jan Hubicka <jh@suse.cz>
* tree-mudflap.c (ml_decl_cache_locals, md_build_check_statement_for): * tree-mudflap.c (ml_decl_cache_locals, md_build_check_statement_for):
add newly referenced vars. add newly referenced vars.
......
...@@ -1180,9 +1180,6 @@ remove_ssa_form (bool perform_ter) ...@@ -1180,9 +1180,6 @@ remove_ssa_form (bool perform_ter)
} }
} }
/* we no longer maintain the SSA operand cache at this point. */
fini_ssa_operands ();
/* If any copies were inserted on edges, analyze and insert them now. */ /* If any copies were inserted on edges, analyze and insert them now. */
perform_edge_inserts (); perform_edge_inserts ();
......
...@@ -139,6 +139,9 @@ static VEC(tree,heap) *build_vdefs; ...@@ -139,6 +139,9 @@ static VEC(tree,heap) *build_vdefs;
/* Set for building all the VUSE operands. */ /* Set for building all the VUSE operands. */
static VEC(tree,heap) *build_vuses; static VEC(tree,heap) *build_vuses;
/* Bitmap obstack for our datastructures that needs to survive across
compilations of multiple funcitons. */
static bitmap_obstack operands_bitmap_obstack;
/* Set for building all the loaded symbols. */ /* Set for building all the loaded symbols. */
static bitmap build_loads; static bitmap build_loads;
...@@ -351,9 +354,6 @@ add_vop_to_freelist (voptype_p ptr) ...@@ -351,9 +354,6 @@ add_vop_to_freelist (voptype_p ptr)
#define OP_SIZE_2 110 #define OP_SIZE_2 110
#define OP_SIZE_3 511 #define OP_SIZE_3 511
/* Current size of the operand memory buffer. */
static unsigned int ssa_operand_mem_size;
/* Initialize the operand cache routines. */ /* Initialize the operand cache routines. */
void void
...@@ -365,18 +365,20 @@ init_ssa_operands (void) ...@@ -365,18 +365,20 @@ init_ssa_operands (void)
build_uses = VEC_alloc (tree, heap, 10); build_uses = VEC_alloc (tree, heap, 10);
build_vuses = VEC_alloc (tree, heap, 25); build_vuses = VEC_alloc (tree, heap, 25);
build_vdefs = VEC_alloc (tree, heap, 25); build_vdefs = VEC_alloc (tree, heap, 25);
build_loads = BITMAP_ALLOC (NULL); bitmap_obstack_initialize (&operands_bitmap_obstack);
build_stores = BITMAP_ALLOC (NULL); build_loads = BITMAP_ALLOC (&operands_bitmap_obstack);
build_stores = BITMAP_ALLOC (&operands_bitmap_obstack);
scb_stack = VEC_alloc (scb_t, heap, 20); scb_stack = VEC_alloc (scb_t, heap, 20);
} }
gcc_assert (gimple_ssa_operands (cfun)->operand_memory == NULL); gcc_assert (gimple_ssa_operands (cfun)->operand_memory == NULL);
gcc_assert (gimple_ssa_operands (cfun)->mpt_table == NULL); gcc_assert (gimple_ssa_operands (cfun)->mpt_table == NULL);
gimple_ssa_operands (cfun)->operand_memory_index = ssa_operand_mem_size; gimple_ssa_operands (cfun)->operand_memory_index
= gimple_ssa_operands (cfun)->ssa_operand_mem_size;
gimple_ssa_operands (cfun)->ops_active = true; gimple_ssa_operands (cfun)->ops_active = true;
memset (&clobber_stats, 0, sizeof (clobber_stats)); memset (&clobber_stats, 0, sizeof (clobber_stats));
init_vop_buckets (); init_vop_buckets ();
ssa_operand_mem_size = OP_SIZE_INIT; gimple_ssa_operands (cfun)->ssa_operand_mem_size = OP_SIZE_INIT;
} }
...@@ -426,6 +428,8 @@ fini_ssa_operands (void) ...@@ -426,6 +428,8 @@ fini_ssa_operands (void)
gimple_ssa_operands (cfun)->ops_active = false; gimple_ssa_operands (cfun)->ops_active = false;
if (!n_initialized)
bitmap_obstack_release (&operands_bitmap_obstack);
if (dump_file && (dump_flags & TDF_STATS)) if (dump_file && (dump_flags & TDF_STATS))
{ {
fprintf (dump_file, "Original clobbered vars: %d\n", fprintf (dump_file, "Original clobbered vars: %d\n",
...@@ -452,31 +456,36 @@ ssa_operand_alloc (unsigned size) ...@@ -452,31 +456,36 @@ ssa_operand_alloc (unsigned size)
char *ptr; char *ptr;
if (gimple_ssa_operands (cfun)->operand_memory_index + size if (gimple_ssa_operands (cfun)->operand_memory_index + size
>= ssa_operand_mem_size) >= gimple_ssa_operands (cfun)->ssa_operand_mem_size)
{ {
struct ssa_operand_memory_d *ptr; struct ssa_operand_memory_d *ptr;
if (ssa_operand_mem_size == OP_SIZE_INIT) if (gimple_ssa_operands (cfun)->ssa_operand_mem_size == OP_SIZE_INIT)
ssa_operand_mem_size = OP_SIZE_1 * sizeof (struct voptype_d); gimple_ssa_operands (cfun)->ssa_operand_mem_size
= OP_SIZE_1 * sizeof (struct voptype_d);
else else
if (ssa_operand_mem_size == OP_SIZE_1 * sizeof (struct voptype_d)) if (gimple_ssa_operands (cfun)->ssa_operand_mem_size
ssa_operand_mem_size = OP_SIZE_2 * sizeof (struct voptype_d); == OP_SIZE_1 * sizeof (struct voptype_d))
gimple_ssa_operands (cfun)->ssa_operand_mem_size
= OP_SIZE_2 * sizeof (struct voptype_d);
else else
ssa_operand_mem_size = OP_SIZE_3 * sizeof (struct voptype_d); gimple_ssa_operands (cfun)->ssa_operand_mem_size
= OP_SIZE_3 * sizeof (struct voptype_d);
/* Go right to the maximum size if the request is too large. */ /* Go right to the maximum size if the request is too large. */
if (size > ssa_operand_mem_size) if (size > gimple_ssa_operands (cfun)->ssa_operand_mem_size)
ssa_operand_mem_size = OP_SIZE_3 * sizeof (struct voptype_d); gimple_ssa_operands (cfun)->ssa_operand_mem_size
= OP_SIZE_3 * sizeof (struct voptype_d);
/* Fail if there is not enough space. If there are this many operands /* Fail if there is not enough space. If there are this many operands
required, first make sure there isn't a different problem causing this required, first make sure there isn't a different problem causing this
many operands. If the decision is that this is OK, then we can many operands. If the decision is that this is OK, then we can
specially allocate a buffer just for this request. */ specially allocate a buffer just for this request. */
gcc_assert (size <= ssa_operand_mem_size); gcc_assert (size <= gimple_ssa_operands (cfun)->ssa_operand_mem_size);
ptr = (struct ssa_operand_memory_d *) ptr = (struct ssa_operand_memory_d *)
ggc_alloc (sizeof (struct ssa_operand_memory_d) ggc_alloc (sizeof (struct ssa_operand_memory_d)
+ ssa_operand_mem_size - 1); + gimple_ssa_operands (cfun)->ssa_operand_mem_size - 1);
ptr->next = gimple_ssa_operands (cfun)->operand_memory; ptr->next = gimple_ssa_operands (cfun)->operand_memory;
gimple_ssa_operands (cfun)->operand_memory = ptr; gimple_ssa_operands (cfun)->operand_memory = ptr;
gimple_ssa_operands (cfun)->operand_memory_index = 0; gimple_ssa_operands (cfun)->operand_memory_index = 0;
...@@ -876,7 +885,7 @@ finalize_ssa_vdefs (tree stmt) ...@@ -876,7 +885,7 @@ finalize_ssa_vdefs (tree stmt)
if (!bitmap_empty_p (build_stores)) if (!bitmap_empty_p (build_stores))
{ {
if (ann->operands.stores == NULL) if (ann->operands.stores == NULL)
ann->operands.stores = BITMAP_ALLOC (NULL); ann->operands.stores = BITMAP_ALLOC (&operands_bitmap_obstack);
bitmap_copy (ann->operands.stores, build_stores); bitmap_copy (ann->operands.stores, build_stores);
} }
...@@ -982,7 +991,7 @@ finalize_ssa_vuse_ops (tree stmt) ...@@ -982,7 +991,7 @@ finalize_ssa_vuse_ops (tree stmt)
if (!bitmap_empty_p (build_loads)) if (!bitmap_empty_p (build_loads))
{ {
if (ann->operands.loads == NULL) if (ann->operands.loads == NULL)
ann->operands.loads = BITMAP_ALLOC (NULL); ann->operands.loads = BITMAP_ALLOC (&operands_bitmap_obstack);
bitmap_copy (ann->operands.loads, build_loads); bitmap_copy (ann->operands.loads, build_loads);
} }
...@@ -2403,13 +2412,13 @@ copy_virtual_operands (tree dest, tree src) ...@@ -2403,13 +2412,13 @@ copy_virtual_operands (tree dest, tree src)
if (LOADED_SYMS (src)) if (LOADED_SYMS (src))
{ {
dest_ann->operands.loads = BITMAP_ALLOC (NULL); dest_ann->operands.loads = BITMAP_ALLOC (&operands_bitmap_obstack);
bitmap_copy (dest_ann->operands.loads, LOADED_SYMS (src)); bitmap_copy (dest_ann->operands.loads, LOADED_SYMS (src));
} }
if (STORED_SYMS (src)) if (STORED_SYMS (src))
{ {
dest_ann->operands.stores = BITMAP_ALLOC (NULL); dest_ann->operands.stores = BITMAP_ALLOC (&operands_bitmap_obstack);
bitmap_copy (dest_ann->operands.stores, STORED_SYMS (src)); bitmap_copy (dest_ann->operands.stores, STORED_SYMS (src));
} }
...@@ -2969,7 +2978,7 @@ get_mpt_for (tree sym) ...@@ -2969,7 +2978,7 @@ get_mpt_for (tree sym)
MTAG_GLOBAL (mpt) = 1; MTAG_GLOBAL (mpt) = 1;
add_referenced_var (mpt); add_referenced_var (mpt);
VEC_safe_push (tree, heap, gimple_ssa_operands (cfun)->mpt_table, mpt); VEC_safe_push (tree, heap, gimple_ssa_operands (cfun)->mpt_table, mpt);
MPT_SYMBOLS (mpt) = BITMAP_ALLOC (NULL); MPT_SYMBOLS (mpt) = BITMAP_ALLOC (&operands_bitmap_obstack);
set_memory_partition (sym, mpt); set_memory_partition (sym, mpt);
} }
......
...@@ -124,6 +124,8 @@ struct ssa_operand_memory_d GTY((chain_next("%h.next"))) ...@@ -124,6 +124,8 @@ struct ssa_operand_memory_d GTY((chain_next("%h.next")))
struct ssa_operands GTY(()) { struct ssa_operands GTY(()) {
struct ssa_operand_memory_d *operand_memory; struct ssa_operand_memory_d *operand_memory;
unsigned operand_memory_index; unsigned operand_memory_index;
/* Current size of the operand memory buffer. */
unsigned int ssa_operand_mem_size;
bool ops_active; bool ops_active;
......
...@@ -834,6 +834,8 @@ delete_tree_ssa (void) ...@@ -834,6 +834,8 @@ delete_tree_ssa (void)
fini_ssanames (); fini_ssanames ();
fini_phinodes (); fini_phinodes ();
/* we no longer maintain the SSA operand cache at this point. */
fini_ssa_operands ();
cfun->gimple_df->global_var = NULL_TREE; cfun->gimple_df->global_var = NULL_TREE;
......
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