aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorTrevor Saunders <tsaunders@mozilla.com>2014-08-02 11:23:49 +0000
committerTrevor Saunders <tbsaunde@gcc.gnu.org>2014-08-02 11:23:49 +0000
commit6e2830c3dbe0d4972519ddd44bd1b15b2b274ba2 (patch)
treef0fb192e856fa98b7d91e225ff958dfcc1f602df /gcc/tree-inline.c
parent2df06cec0a2fe611c5487bf54c4ef8e3b2b30543 (diff)
downloadgcc-6e2830c3dbe0d4972519ddd44bd1b15b2b274ba2.zip
gcc-6e2830c3dbe0d4972519ddd44bd1b15b2b274ba2.tar.gz
gcc-6e2830c3dbe0d4972519ddd44bd1b15b2b274ba2.tar.bz2
add a hash_set based on hash_table
This allows us to replace the usage of pointer_set outside of pointer_map with a nicer interface. gcc/ada/ * gcc-interface/trans.c: Use hash_set instead of pointer_set. gcc/c-family/ * c-gimplify.c: Use hash_set instead of pointer_set. gcc/c/ * c-decl.c: Use hash_set instead of pointer_set. gcc/cp/ * class.c, cp-gimplify.c, cp-tree.h, decl.c, decl2.c, error.c, method.c, name-lookup.c, pt.c, semantics.c, tree.c: Use hash_set instead of pointer_set. gcc/fortran/ * openmp.c, trans-decl.c: Use hash_set instead of pointer_set. gcc/ * hash-set.h: new File. * cfgexpand.c, cfgloop.c, cgraph.c, cgraphbuild.c, cgraphunit.c, cprop.c, cse.c, gimple-walk.c, gimple-walk.h, gimplify.c, godump.c, ipa-devirt.c, ipa-pure-const.c, ipa-visibility.c, ipa.c, lto-cgraph.c, lto-streamer-out.c, stmt.c, tree-cfg.c, tree-core.h, tree-eh.c, tree-inline.c, tree-inline.h, tree-nested.c, tree-pretty-print.c, tree-ssa-loop-niter.c, tree-ssa-phiopt.c, tree-ssa-threadedge.c, tree-ssa-uninit.c, tree.c, tree.h, value-prof.c, varasm.c, varpool.c: Use hash_set instead of pointer_set. gcc/lto/ * lto-partition.c, lto-partition.h: Use hash_set instead of pointer_set. From-SVN: r213516
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 33705b7..6af4912 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1788,7 +1788,7 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale,
expensive, copy_body can be told to watch for nontrivial
changes. */
if (id->statements_to_fold)
- pointer_set_insert (id->statements_to_fold, stmt);
+ id->statements_to_fold->add (stmt);
/* We're duplicating a CALL_EXPR. Find any corresponding
callgraph edges and update or duplicate them. */
@@ -3507,7 +3507,6 @@ inline_forbidden_p (tree fndecl)
{
struct function *fun = DECL_STRUCT_FUNCTION (fndecl);
struct walk_stmt_info wi;
- struct pointer_set_t *visited_nodes;
basic_block bb;
bool forbidden_p = false;
@@ -3518,10 +3517,10 @@ inline_forbidden_p (tree fndecl)
/* Next, walk the statements of the function looking for
constraucts we can't handle, or are non-optimal for inlining. */
- visited_nodes = pointer_set_create ();
+ hash_set<tree> visited_nodes;
memset (&wi, 0, sizeof (wi));
wi.info = (void *) fndecl;
- wi.pset = visited_nodes;
+ wi.pset = &visited_nodes;
FOR_EACH_BB_FN (bb, fun)
{
@@ -3533,7 +3532,6 @@ inline_forbidden_p (tree fndecl)
break;
}
- pointer_set_destroy (visited_nodes);
return forbidden_p;
}
@@ -4531,7 +4529,7 @@ gimple_expand_calls_inline (basic_block bb, copy_body_data *id)
in the STATEMENTS pointer set. */
static void
-fold_marked_statements (int first, struct pointer_set_t *statements)
+fold_marked_statements (int first, hash_set<gimple> *statements)
{
for (; first < n_basic_blocks_for_fn (cfun); first++)
if (BASIC_BLOCK_FOR_FN (cfun, first))
@@ -4541,7 +4539,7 @@ fold_marked_statements (int first, struct pointer_set_t *statements)
for (gsi = gsi_start_bb (BASIC_BLOCK_FOR_FN (cfun, first));
!gsi_end_p (gsi);
gsi_next (&gsi))
- if (pointer_set_contains (statements, gsi_stmt (gsi)))
+ if (statements->contains (gsi_stmt (gsi)))
{
gimple old_stmt = gsi_stmt (gsi);
tree old_decl = is_gimple_call (old_stmt) ? gimple_call_fndecl (old_stmt) : 0;
@@ -4642,7 +4640,7 @@ optimize_inline_calls (tree fn)
id.transform_return_to_modify = true;
id.transform_parameter = true;
id.transform_lang_insert_block = NULL;
- id.statements_to_fold = pointer_set_create ();
+ id.statements_to_fold = new hash_set<gimple>;
push_gimplify_context ();
@@ -4678,7 +4676,7 @@ optimize_inline_calls (tree fn)
/* Fold queued statements. */
fold_marked_statements (last, id.statements_to_fold);
- pointer_set_destroy (id.statements_to_fold);
+ delete id.statements_to_fold;
gcc_assert (!id.debug_stmts.exists ());
@@ -4920,7 +4918,6 @@ copy_gimple_seq_and_replace_locals (gimple_seq seq)
{
copy_body_data id;
struct walk_stmt_info wi;
- struct pointer_set_t *visited;
gimple_seq copy;
/* There's nothing to do for NULL_TREE. */
@@ -4943,11 +4940,10 @@ copy_gimple_seq_and_replace_locals (gimple_seq seq)
/* Walk the tree once to find local labels. */
memset (&wi, 0, sizeof (wi));
- visited = pointer_set_create ();
+ hash_set<tree> visited;
wi.info = &id;
- wi.pset = visited;
+ wi.pset = &visited;
walk_gimple_seq (seq, mark_local_labels_stmt, NULL, &wi);
- pointer_set_destroy (visited);
copy = gimple_seq_copy (seq);
@@ -5370,7 +5366,7 @@ tree_function_versioning (tree old_decl, tree new_decl,
memset (&id, 0, sizeof (id));
/* Generate a new name for the new version. */
- id.statements_to_fold = pointer_set_create ();
+ id.statements_to_fold = new hash_set<gimple>;
id.decl_map = pointer_map_create ();
id.debug_map = NULL;
@@ -5541,7 +5537,7 @@ tree_function_versioning (tree old_decl, tree new_decl,
free_dominance_info (CDI_POST_DOMINATORS);
fold_marked_statements (0, id.statements_to_fold);
- pointer_set_destroy (id.statements_to_fold);
+ delete id.statements_to_fold;
fold_cond_expr_cond ();
delete_unreachable_blocks_update_callgraph (&id);
if (id.dst_node->definition)