+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>
* configure.ac (gcc_cv_as_sparc_register_op): Remove.
coalesce_pair **sorted; /* List when sorted. */
int num_sorted; /* Number in the sorted list. */
cost_one_pair *cost_one_list;/* Single use coalesces with cost 1. */
+ obstack ob;
};
#define NO_BEST_COALESCE -1
*p2 = ptr->second_element;
cl->cost_one_list = ptr->next;
- free (ptr);
-
return 1;
}
*p1 = node->first_element;
*p2 = node->second_element;
ret = node->cost;
- free (node);
return ret;
}
list->sorted = NULL;
list->num_sorted = 0;
list->cost_one_list = NULL;
+ gcc_obstack_init (&list->ob);
return list;
}
cl->list = NULL;
free (cl->sorted);
gcc_assert (cl->num_sorted == 0);
+ obstack_free (&cl->ob, NULL);
free (cl);
}
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);
pair->first_element = p.first_element;
pair->second_element = p.second_element;
{
cost_one_pair *pair;
- pair = XNEW (cost_one_pair);
+ pair = XOBNEW (&cl->ob, cost_one_pair);
pair->first_element = p1;
pair->second_element = p2;
pair->next = cl->cost_one_list;
struct live_track
{
bitmap_obstack obstack; /* A place to allocate our bitmaps. */
- bitmap live_base_var; /* Indicates if a basevar is live. */
- bitmap *live_base_partitions; /* Live partitions for each basevar. */
+ bitmap_head live_base_var; /* Indicates if a basevar is live. */
+ bitmap_head *live_base_partitions; /* Live partitions for each basevar. */
var_map map; /* Var_map being used for partition mapping. */
};
/* Make sure there is a partition view in place. */
gcc_assert (map->partition_to_base_index != NULL);
- ptr = (live_track *) xmalloc (sizeof (live_track));
+ ptr = XNEW (live_track);
ptr->map = map;
lim = num_basevars (map);
bitmap_obstack_initialize (&ptr->obstack);
- ptr->live_base_partitions = (bitmap *) xmalloc (sizeof (bitmap *) * lim);
- ptr->live_base_var = BITMAP_ALLOC (&ptr->obstack);
+ ptr->live_base_partitions = XNEWVEC (bitmap_head, lim);
+ bitmap_initialize (&ptr->live_base_var, &ptr->obstack);
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;
}
delete_live_track (live_track *ptr)
{
bitmap_obstack_release (&ptr->obstack);
- free (ptr->live_base_partitions);
- free (ptr);
+ XDELETEVEC (ptr->live_base_partitions);
+ XDELETE (ptr);
}
int root;
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 (bitmap_empty_p (ptr->live_base_partitions[root]))
- bitmap_clear_bit (ptr->live_base_var, root);
+ if (bitmap_empty_p (&ptr->live_base_partitions[root]))
+ bitmap_clear_bit (&ptr->live_base_var, root);
}
root = basevar_index (ptr->map, partition);
/* If this base var wasn't live before, it is now. Clear the element list
since it was delayed until needed. */
- if (bitmap_set_bit (ptr->live_base_var, root))
- bitmap_clear (ptr->live_base_partitions[root]);
- bitmap_set_bit (ptr->live_base_partitions[root], partition);
+ if (bitmap_set_bit (&ptr->live_base_var, root))
+ bitmap_clear (&ptr->live_base_partitions[root]);
+ bitmap_set_bit (&ptr->live_base_partitions[root], partition);
}
if (p != NO_PARTITION)
{
root = basevar_index (ptr->map, p);
- if (bitmap_bit_p (ptr->live_base_var, root))
- return bitmap_bit_p (ptr->live_base_partitions[root], p);
+ if (bitmap_bit_p (&ptr->live_base_var, root))
+ return bitmap_bit_p (&ptr->live_base_partitions[root], p);
}
return false;
}
/* If the bitmap isn't empty now, conflicts need to be added. */
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)
ssa_conflicts_add (graph, p, x);
}
/* 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
again. */
- bitmap_clear (ptr->live_base_var);
+ bitmap_clear (&ptr->live_base_var);
}