summaryrefslogtreecommitdiff
path: root/gcc/ipa-pure-const.c
diff options
context:
space:
mode:
authortbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-02 11:23:49 +0000
committertbsaunde <tbsaunde@138bc75d-0d04-0410-961f-82ee72b054a4>2014-08-02 11:23:49 +0000
commit431205b753bfa26d1711e40ce478d9e92fd157da (patch)
treef0fb192e856fa98b7d91e225ff958dfcc1f602df /gcc/ipa-pure-const.c
parent69d7692e60d4a7c61b4d3581f3285a866ec3abb1 (diff)
downloadgcc-431205b753bfa26d1711e40ce478d9e92fd157da.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213516 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-pure-const.c')
-rw-r--r--gcc/ipa-pure-const.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 2c281be0acb..b9645022b59 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -65,8 +65,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-scalar-evolution.h"
#include "intl.h"
#include "opts.h"
-
-static struct pointer_set_t *visited_nodes;
+#include "hash-set.h"
/* Lattice values for const and pure functions. Everything starts out
being const, then may drop to pure and then neither depending on
@@ -133,13 +132,13 @@ function_always_visible_to_compiler_p (tree decl)
/* Emit suggestion about attribute ATTRIB_NAME for DECL. KNOWN_FINITE
is true if the function is known to be finite. The diagnostic is
- controlled by OPTION. WARNED_ABOUT is a pointer_set unique for
+ controlled by OPTION. WARNED_ABOUT is a hash_set<tree> unique for
OPTION, this function may initialize it and it is always returned
by the function. */
-static struct pointer_set_t *
+static hash_set<tree> *
suggest_attribute (int option, tree decl, bool known_finite,
- struct pointer_set_t *warned_about,
+ hash_set<tree> *warned_about,
const char * attrib_name)
{
if (!option_enabled (option, &global_options))
@@ -149,10 +148,10 @@ suggest_attribute (int option, tree decl, bool known_finite,
return warned_about;
if (!warned_about)
- warned_about = pointer_set_create ();
- if (pointer_set_contains (warned_about, decl))
+ warned_about = new hash_set<tree>;
+ if (warned_about->contains (decl))
return warned_about;
- pointer_set_insert (warned_about, decl);
+ warned_about->add (decl);
warning_at (DECL_SOURCE_LOCATION (decl),
option,
known_finite
@@ -168,7 +167,7 @@ suggest_attribute (int option, tree decl, bool known_finite,
static void
warn_function_pure (tree decl, bool known_finite)
{
- static struct pointer_set_t *warned_about;
+ static hash_set<tree> *warned_about;
warned_about
= suggest_attribute (OPT_Wsuggest_attribute_pure, decl,
@@ -181,7 +180,7 @@ warn_function_pure (tree decl, bool known_finite)
static void
warn_function_const (tree decl, bool known_finite)
{
- static struct pointer_set_t *warned_about;
+ static hash_set<tree> *warned_about;
warned_about
= suggest_attribute (OPT_Wsuggest_attribute_const, decl,
known_finite, warned_about, "const");
@@ -190,7 +189,7 @@ warn_function_const (tree decl, bool known_finite)
static void
warn_function_noreturn (tree decl)
{
- static struct pointer_set_t *warned_about;
+ static hash_set<tree> *warned_about;
if (!lang_hooks.missing_noreturn_ok_p (decl)
&& targetm.warn_func_return (decl))
warned_about
@@ -846,11 +845,8 @@ add_new_function (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
static declarations. We do not need to scan them more than once
since all we would be interested in are the addressof
operations. */
- visited_nodes = pointer_set_create ();
if (node->get_availability () > AVAIL_INTERPOSABLE)
set_function_state (node, analyze_function (node, true));
- pointer_set_destroy (visited_nodes);
- visited_nodes = NULL;
}
/* Called when new clone is inserted to callgraph late. */
@@ -912,12 +908,6 @@ pure_const_generate_summary (void)
register_hooks ();
- /* There are some shared nodes, in particular the initializers on
- static declarations. We do not need to scan them more than once
- since all we would be interested in are the addressof
- operations. */
- visited_nodes = pointer_set_create ();
-
/* Process all of the functions.
We process AVAIL_INTERPOSABLE functions. We can not use the results
@@ -927,9 +917,6 @@ pure_const_generate_summary (void)
FOR_EACH_DEFINED_FUNCTION (node)
if (node->get_availability () >= AVAIL_INTERPOSABLE)
set_function_state (node, analyze_function (node, true));
-
- pointer_set_destroy (visited_nodes);
- visited_nodes = NULL;
}