Commit b46e8e6a by Trevor Saunders Committed by Trevor Saunders

add [cd]tors to scc_info

gcc/ChangeLog:

2016-07-26  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* tree-ssa-structalias.c (struct scc_info): Change types of
	members to auto_sbitmap and auto_vec.
	(scc_info::scc_info): New constructor.
	(scc_info::~scc_info): New destructor.
	(init_scc_info): Remove.
	(free_scc_info): Remove.
	(find_indirect_cycles): Adjust.
	(perform_var_substitution): Likewise.
	(free_var_substitution_info): Likewise.

From-SVN: r238751
parent 61801db9
2016-07-26 Trevor Saunders <tbsaunde+gcc@tbsaunde.org> 2016-07-26 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* tree-ssa-structalias.c (struct scc_info): Change types of
members to auto_sbitmap and auto_vec.
(scc_info::scc_info): New constructor.
(scc_info::~scc_info): New destructor.
(init_scc_info): Remove.
(free_scc_info): Remove.
(find_indirect_cycles): Adjust.
(perform_var_substitution): Likewise.
(free_var_substitution_info): Likewise.
2016-07-26 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* tree-outof-ssa.c (struct elim_graph): Change type of members * tree-outof-ssa.c (struct elim_graph): Change type of members
to auto_vec and auto_sbitmap. to auto_vec and auto_sbitmap.
(elim_graph::elim_graph): New constructor. (elim_graph::elim_graph): New constructor.
......
...@@ -1379,12 +1379,15 @@ static bitmap changed; ...@@ -1379,12 +1379,15 @@ static bitmap changed;
struct scc_info struct scc_info
{ {
sbitmap visited; scc_info (size_t size);
sbitmap deleted; ~scc_info ();
auto_sbitmap visited;
auto_sbitmap deleted;
unsigned int *dfs; unsigned int *dfs;
unsigned int *node_mapping; unsigned int *node_mapping;
int current_index; int current_index;
vec<unsigned> scc_stack; auto_vec<unsigned> scc_stack;
}; };
...@@ -1824,38 +1827,24 @@ do_complex_constraint (constraint_graph_t graph, constraint_t c, bitmap delta, ...@@ -1824,38 +1827,24 @@ do_complex_constraint (constraint_graph_t graph, constraint_t c, bitmap delta,
/* Initialize and return a new SCC info structure. */ /* Initialize and return a new SCC info structure. */
static struct scc_info * scc_info::scc_info (size_t size) :
init_scc_info (size_t size) visited (size), deleted (size), current_index (0), scc_stack (1)
{ {
struct scc_info *si = XNEW (struct scc_info); bitmap_clear (visited);
size_t i; bitmap_clear (deleted);
node_mapping = XNEWVEC (unsigned int, size);
si->current_index = 0; dfs = XCNEWVEC (unsigned int, size);
si->visited = sbitmap_alloc (size);
bitmap_clear (si->visited);
si->deleted = sbitmap_alloc (size);
bitmap_clear (si->deleted);
si->node_mapping = XNEWVEC (unsigned int, size);
si->dfs = XCNEWVEC (unsigned int, size);
for (i = 0; i < size; i++) for (size_t i = 0; i < size; i++)
si->node_mapping[i] = i; node_mapping[i] = i;
si->scc_stack.create (1);
return si;
} }
/* Free an SCC info structure pointed to by SI */ /* Free an SCC info structure pointed to by SI */
static void scc_info::~scc_info ()
free_scc_info (struct scc_info *si)
{ {
sbitmap_free (si->visited); free (node_mapping);
sbitmap_free (si->deleted); free (dfs);
free (si->node_mapping);
free (si->dfs);
si->scc_stack.release ();
free (si);
} }
...@@ -1871,13 +1860,11 @@ find_indirect_cycles (constraint_graph_t graph) ...@@ -1871,13 +1860,11 @@ find_indirect_cycles (constraint_graph_t graph)
{ {
unsigned int i; unsigned int i;
unsigned int size = graph->size; unsigned int size = graph->size;
struct scc_info *si = init_scc_info (size); scc_info si (size);
for (i = 0; i < MIN (LAST_REF_NODE, size); i ++ ) for (i = 0; i < MIN (LAST_REF_NODE, size); i ++ )
if (!bitmap_bit_p (si->visited, i) && find (i) == i) if (!bitmap_bit_p (si.visited, i) && find (i) == i)
scc_visit (graph, si, i); scc_visit (graph, &si, i);
free_scc_info (si);
} }
/* Compute a topological ordering for GRAPH, and store the result in the /* Compute a topological ordering for GRAPH, and store the result in the
...@@ -2291,7 +2278,7 @@ perform_var_substitution (constraint_graph_t graph) ...@@ -2291,7 +2278,7 @@ perform_var_substitution (constraint_graph_t graph)
{ {
unsigned int i; unsigned int i;
unsigned int size = graph->size; unsigned int size = graph->size;
struct scc_info *si = init_scc_info (size); scc_info *si = new scc_info (size);
bitmap_obstack_initialize (&iteration_obstack); bitmap_obstack_initialize (&iteration_obstack);
pointer_equiv_class_table = new hash_table<equiv_class_hasher> (511); pointer_equiv_class_table = new hash_table<equiv_class_hasher> (511);
...@@ -2422,7 +2409,7 @@ perform_var_substitution (constraint_graph_t graph) ...@@ -2422,7 +2409,7 @@ perform_var_substitution (constraint_graph_t graph)
static void static void
free_var_substitution_info (struct scc_info *si) free_var_substitution_info (struct scc_info *si)
{ {
free_scc_info (si); delete si;
free (graph->pointer_label); free (graph->pointer_label);
free (graph->loc_label); free (graph->loc_label);
free (graph->pointed_by); free (graph->pointed_by);
......
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