Commit 4c998ca5 by Richard Biener Committed by Richard Biener

tree-ssa-coalesce.c (struct coalesce_list): Add obstack member.

2018-11-02  Richard Biener  <rguenther@suse.de>

	* tree-ssa-coalesce.c (struct coalesce_list): Add obstack member.
	(pop_cost_one_pair): Do not free pair.
	(pop_best_coalesce): Likewise.
	(create_coalesce_list): Initialize obstack.
	(delete_coalesce_list): Free obstack.
	(find_coalesce_pair): Obstack-allocate coalesce pairs.
	(add_cost_one_coalesce): Likewise.
	(struct live_track): Remove bitmap pointer indirections.
	(new_live_track): Adjust.
	(delete_live_track): Likewise.
	(live_track_remove_partition): Likewise.
	(live_track_add_partition): Likewise.
	(live_track_live_p): Likewise.
	(live_track_process_def): Likewise.
	(live_track_clear_base_vars): Likewise.

From-SVN: r265745
parent 4155777d
2018-11-02 Richard Biener <rguenther@suse.de>
* tree-ssa-coalesce.c (struct coalesce_list): Add obstack member.
(pop_cost_one_pair): Do not free pair.
(pop_best_coalesce): Likewise.
(create_coalesce_list): Initialize obstack.
(delete_coalesce_list): Free obstack.
(find_coalesce_pair): Obstack-allocate coalesce pairs.
(add_cost_one_coalesce): Likewise.
(struct live_track): Remove bitmap pointer indirections.
(new_live_track): Adjust.
(delete_live_track): Likewise.
(live_track_remove_partition): Likewise.
(live_track_add_partition): Likewise.
(live_track_live_p): Likewise.
(live_track_process_def): Likewise.
(live_track_clear_base_vars): Likewise.
2018-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2018-11-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (gcc_cv_as_sparc_register_op): Remove. * configure.ac (gcc_cv_as_sparc_register_op): Remove.
...@@ -135,6 +135,7 @@ struct coalesce_list ...@@ -135,6 +135,7 @@ struct coalesce_list
coalesce_pair **sorted; /* List when sorted. */ coalesce_pair **sorted; /* List when sorted. */
int num_sorted; /* Number in the sorted list. */ int num_sorted; /* Number in the sorted list. */
cost_one_pair *cost_one_list;/* Single use coalesces with cost 1. */ cost_one_pair *cost_one_list;/* Single use coalesces with cost 1. */
obstack ob;
}; };
#define NO_BEST_COALESCE -1 #define NO_BEST_COALESCE -1
...@@ -226,8 +227,6 @@ pop_cost_one_pair (coalesce_list *cl, int *p1, int *p2) ...@@ -226,8 +227,6 @@ pop_cost_one_pair (coalesce_list *cl, int *p1, int *p2)
*p2 = ptr->second_element; *p2 = ptr->second_element;
cl->cost_one_list = ptr->next; cl->cost_one_list = ptr->next;
free (ptr);
return 1; return 1;
} }
...@@ -251,7 +250,6 @@ pop_best_coalesce (coalesce_list *cl, int *p1, int *p2) ...@@ -251,7 +250,6 @@ pop_best_coalesce (coalesce_list *cl, int *p1, int *p2)
*p1 = node->first_element; *p1 = node->first_element;
*p2 = node->second_element; *p2 = node->second_element;
ret = node->cost; ret = node->cost;
free (node);
return ret; return ret;
} }
...@@ -273,6 +271,7 @@ create_coalesce_list (void) ...@@ -273,6 +271,7 @@ create_coalesce_list (void)
list->sorted = NULL; list->sorted = NULL;
list->num_sorted = 0; list->num_sorted = 0;
list->cost_one_list = NULL; list->cost_one_list = NULL;
gcc_obstack_init (&list->ob);
return list; return list;
} }
...@@ -287,6 +286,7 @@ delete_coalesce_list (coalesce_list *cl) ...@@ -287,6 +286,7 @@ delete_coalesce_list (coalesce_list *cl)
cl->list = NULL; cl->list = NULL;
free (cl->sorted); free (cl->sorted);
gcc_assert (cl->num_sorted == 0); gcc_assert (cl->num_sorted == 0);
obstack_free (&cl->ob, NULL);
free (cl); free (cl);
} }
...@@ -328,7 +328,7 @@ find_coalesce_pair (coalesce_list *cl, int p1, int p2, bool create) ...@@ -328,7 +328,7 @@ find_coalesce_pair (coalesce_list *cl, int p1, int p2, bool create)
if (!*slot) if (!*slot)
{ {
struct coalesce_pair * pair = XNEW (struct coalesce_pair); struct coalesce_pair * pair = XOBNEW (&cl->ob, struct coalesce_pair);
gcc_assert (cl->sorted == NULL); gcc_assert (cl->sorted == NULL);
pair->first_element = p.first_element; pair->first_element = p.first_element;
pair->second_element = p.second_element; pair->second_element = p.second_element;
...@@ -346,7 +346,7 @@ add_cost_one_coalesce (coalesce_list *cl, int p1, int p2) ...@@ -346,7 +346,7 @@ add_cost_one_coalesce (coalesce_list *cl, int p1, int p2)
{ {
cost_one_pair *pair; cost_one_pair *pair;
pair = XNEW (cost_one_pair); pair = XOBNEW (&cl->ob, cost_one_pair);
pair->first_element = p1; pair->first_element = p1;
pair->second_element = p2; pair->second_element = p2;
pair->next = cl->cost_one_list; pair->next = cl->cost_one_list;
...@@ -677,8 +677,8 @@ ssa_conflicts_dump (FILE *file, ssa_conflicts *ptr) ...@@ -677,8 +677,8 @@ ssa_conflicts_dump (FILE *file, ssa_conflicts *ptr)
struct live_track struct live_track
{ {
bitmap_obstack obstack; /* A place to allocate our bitmaps. */ bitmap_obstack obstack; /* A place to allocate our bitmaps. */
bitmap live_base_var; /* Indicates if a basevar is live. */ bitmap_head live_base_var; /* Indicates if a basevar is live. */
bitmap *live_base_partitions; /* Live partitions for each basevar. */ bitmap_head *live_base_partitions; /* Live partitions for each basevar. */
var_map map; /* Var_map being used for partition mapping. */ var_map map; /* Var_map being used for partition mapping. */
}; };
...@@ -695,14 +695,14 @@ new_live_track (var_map map) ...@@ -695,14 +695,14 @@ new_live_track (var_map map)
/* Make sure there is a partition view in place. */ /* Make sure there is a partition view in place. */
gcc_assert (map->partition_to_base_index != NULL); gcc_assert (map->partition_to_base_index != NULL);
ptr = (live_track *) xmalloc (sizeof (live_track)); ptr = XNEW (live_track);
ptr->map = map; ptr->map = map;
lim = num_basevars (map); lim = num_basevars (map);
bitmap_obstack_initialize (&ptr->obstack); bitmap_obstack_initialize (&ptr->obstack);
ptr->live_base_partitions = (bitmap *) xmalloc (sizeof (bitmap *) * lim); ptr->live_base_partitions = XNEWVEC (bitmap_head, lim);
ptr->live_base_var = BITMAP_ALLOC (&ptr->obstack); bitmap_initialize (&ptr->live_base_var, &ptr->obstack);
for (x = 0; x < lim; x++) for (x = 0; x < lim; x++)
ptr->live_base_partitions[x] = BITMAP_ALLOC (&ptr->obstack); bitmap_initialize (&ptr->live_base_partitions[x], &ptr->obstack);
return ptr; return ptr;
} }
...@@ -713,8 +713,8 @@ static void ...@@ -713,8 +713,8 @@ static void
delete_live_track (live_track *ptr) delete_live_track (live_track *ptr)
{ {
bitmap_obstack_release (&ptr->obstack); bitmap_obstack_release (&ptr->obstack);
free (ptr->live_base_partitions); XDELETEVEC (ptr->live_base_partitions);
free (ptr); XDELETE (ptr);
} }
...@@ -726,10 +726,10 @@ live_track_remove_partition (live_track *ptr, int partition) ...@@ -726,10 +726,10 @@ live_track_remove_partition (live_track *ptr, int partition)
int root; int root;
root = basevar_index (ptr->map, partition); root = basevar_index (ptr->map, partition);
bitmap_clear_bit (ptr->live_base_partitions[root], partition); bitmap_clear_bit (&ptr->live_base_partitions[root], partition);
/* If the element list is empty, make the base variable not live either. */ /* If the element list is empty, make the base variable not live either. */
if (bitmap_empty_p (ptr->live_base_partitions[root])) if (bitmap_empty_p (&ptr->live_base_partitions[root]))
bitmap_clear_bit (ptr->live_base_var, root); bitmap_clear_bit (&ptr->live_base_var, root);
} }
...@@ -743,9 +743,9 @@ live_track_add_partition (live_track *ptr, int partition) ...@@ -743,9 +743,9 @@ live_track_add_partition (live_track *ptr, int partition)
root = basevar_index (ptr->map, partition); root = basevar_index (ptr->map, partition);
/* If this base var wasn't live before, it is now. Clear the element list /* If this base var wasn't live before, it is now. Clear the element list
since it was delayed until needed. */ since it was delayed until needed. */
if (bitmap_set_bit (ptr->live_base_var, root)) if (bitmap_set_bit (&ptr->live_base_var, root))
bitmap_clear (ptr->live_base_partitions[root]); bitmap_clear (&ptr->live_base_partitions[root]);
bitmap_set_bit (ptr->live_base_partitions[root], partition); bitmap_set_bit (&ptr->live_base_partitions[root], partition);
} }
...@@ -774,8 +774,8 @@ live_track_live_p (live_track *ptr, tree var) ...@@ -774,8 +774,8 @@ live_track_live_p (live_track *ptr, tree var)
if (p != NO_PARTITION) if (p != NO_PARTITION)
{ {
root = basevar_index (ptr->map, p); root = basevar_index (ptr->map, p);
if (bitmap_bit_p (ptr->live_base_var, root)) if (bitmap_bit_p (&ptr->live_base_var, root))
return bitmap_bit_p (ptr->live_base_partitions[root], p); return bitmap_bit_p (&ptr->live_base_partitions[root], p);
} }
return false; return false;
} }
...@@ -819,9 +819,9 @@ live_track_process_def (live_track *ptr, tree def, ssa_conflicts *graph) ...@@ -819,9 +819,9 @@ live_track_process_def (live_track *ptr, tree def, ssa_conflicts *graph)
/* If the bitmap isn't empty now, conflicts need to be added. */ /* If the bitmap isn't empty now, conflicts need to be added. */
root = basevar_index (ptr->map, p); root = basevar_index (ptr->map, p);
if (bitmap_bit_p (ptr->live_base_var, root)) if (bitmap_bit_p (&ptr->live_base_var, root))
{ {
b = ptr->live_base_partitions[root]; b = &ptr->live_base_partitions[root];
EXECUTE_IF_SET_IN_BITMAP (b, 0, x, bi) EXECUTE_IF_SET_IN_BITMAP (b, 0, x, bi)
ssa_conflicts_add (graph, p, x); ssa_conflicts_add (graph, p, x);
} }
...@@ -850,7 +850,7 @@ live_track_clear_base_vars (live_track *ptr) ...@@ -850,7 +850,7 @@ live_track_clear_base_vars (live_track *ptr)
/* Simply clear the live base list. Anything marked as live in the element /* Simply clear the live base list. Anything marked as live in the element
lists will be cleared later if/when the base variable ever comes alive lists will be cleared later if/when the base variable ever comes alive
again. */ again. */
bitmap_clear (ptr->live_base_var); bitmap_clear (&ptr->live_base_var);
} }
......
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