From 61801db927998bb09c0c5c267869d3bf895d551a Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Tue, 26 Jul 2016 10:44:25 +0000 Subject: [PATCH] add a constructor to elim_graph gcc/ChangeLog: 2016-07-26 Trevor Saunders * tree-outof-ssa.c (struct elim_graph): Change type of members to auto_vec and auto_sbitmap. (elim_graph::elim_graph): New constructor. (delete_elim_graph): Remove. (expand_phi_nodes): Adjust. From-SVN: r238750 --- gcc/ChangeLog | 8 +++++++ gcc/tree-outof-ssa.c | 64 +++++++++++++--------------------------------------- 2 files changed, 24 insertions(+), 48 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ce2a9a2..dca0e9f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2016-07-26 Trevor Saunders + * tree-outof-ssa.c (struct elim_graph): Change type of members + to auto_vec and auto_sbitmap. + (elim_graph::elim_graph): New constructor. + (delete_elim_graph): Remove. + (expand_phi_nodes): Adjust. + +2016-07-26 Trevor Saunders + * tree-outof-ssa.c (struct elim_graph): Remove typedef. (new_elim_graph): Adjust. (clear_elim_graph): Likewise. diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index 5047788..be57ce4 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -128,23 +128,25 @@ ssa_is_replaceable_p (gimple *stmt) struct elim_graph { + elim_graph (var_map map); + /* Size of the elimination vectors. */ int size; /* List of nodes in the elimination graph. */ - vec nodes; + auto_vec nodes; /* The predecessor and successor edge list. */ - vec edge_list; + auto_vec edge_list; /* Source locus on each edge */ - vec edge_locus; + auto_vec edge_locus; /* Visited vector. */ - sbitmap visited; + auto_sbitmap visited; /* Stack for visited nodes. */ - vec stack; + auto_vec stack; /* The variable partition map. */ var_map map; @@ -153,11 +155,11 @@ struct elim_graph edge e; /* List of constant copies to emit. These are pushed on in pairs. */ - vec const_dests; - vec const_copies; + auto_vec const_dests; + auto_vec const_copies; /* Source locations for any constant copies. */ - vec copy_locus; + auto_vec copy_locus; }; @@ -392,25 +394,12 @@ insert_part_to_rtx_on_edge (edge e, rtx dest, int src, source_location locus) } -/* Create an elimination graph with SIZE nodes and associated data - structures. */ +/* Create an elimination graph for map. */ -static elim_graph * -new_elim_graph (int size) +elim_graph::elim_graph (var_map map) : + nodes (30), edge_list (20), edge_locus (10), visited (map->num_partitions), + stack (30), map (map), const_dests (20), const_copies (20), copy_locus (10) { - elim_graph *g = (elim_graph *) xmalloc (sizeof (struct elim_graph)); - - g->nodes.create (30); - g->const_dests.create (20); - g->const_copies.create (20); - g->copy_locus.create (10); - g->edge_list.create (20); - g->edge_locus.create (10); - g->stack.create (30); - - g->visited = sbitmap_alloc (size); - - return g; } @@ -425,24 +414,6 @@ clear_elim_graph (elim_graph *g) } -/* Delete elimination graph G. */ - -static inline void -delete_elim_graph (elim_graph *g) -{ - sbitmap_free (g->visited); - g->stack.release (); - g->edge_list.release (); - g->const_copies.release (); - g->const_dests.release (); - g->nodes.release (); - g->copy_locus.release (); - g->edge_locus.release (); - - free (g); -} - - /* Return the number of nodes in graph G. */ static inline int @@ -925,8 +896,7 @@ void expand_phi_nodes (struct ssaexpand *sa) { basic_block bb; - elim_graph *g = new_elim_graph (sa->map->num_partitions); - g->map = sa->map; + elim_graph g (sa->map); FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb, EXIT_BLOCK_PTR_FOR_FN (cfun), next_bb) @@ -935,7 +905,7 @@ expand_phi_nodes (struct ssaexpand *sa) edge e; edge_iterator ei; FOR_EACH_EDGE (e, ei, bb->preds) - eliminate_phi (e, g); + eliminate_phi (e, &g); set_phi_nodes (bb, NULL); /* We can't redirect EH edges in RTL land, so we need to do this here. Redirection happens only when splitting is necessary, @@ -961,8 +931,6 @@ expand_phi_nodes (struct ssaexpand *sa) ei_next (&ei); } } - - delete_elim_graph (g); } -- 2.7.4