aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog19
-rw-r--r--gcc/cgraph.c4
-rw-r--r--gcc/cgraph.h17
-rw-r--r--gcc/ipa-inline.c4
-rw-r--r--gcc/ipa-utils.c4
-rw-r--r--gcc/lto-cgraph.c2
-rw-r--r--gcc/passes.c8
-rw-r--r--gcc/symbol-summary.h14
-rw-r--r--gcc/tree-pretty-print.c2
-rw-r--r--gcc/tree-sra.c2
10 files changed, 53 insertions, 23 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a7424bb..27d1b7c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,24 @@
2018-06-08 Martin Liska <mliska@suse.cz>
+ * cgraph.c (function_version_hasher::hash): Use
+ cgraph_node::get_uid ().
+ (function_version_hasher::equal):
+ * cgraph.h (cgraph_node::get_uid): New method.
+ * ipa-inline.c (update_caller_keys): Use
+ cgraph_node::get_uid ().
+ (update_callee_keys): Likewise.
+ * ipa-utils.c (searchc): Likewise.
+ (ipa_reduced_postorder): Likewise.
+ * lto-cgraph.c (input_node): Likewise.
+ * passes.c (is_pass_explicitly_enabled_or_disabled): Likewise.
+ * symbol-summary.h (symtab_insertion): Likewise.
+ (symtab_removal): Likewise.
+ (symtab_duplication): Likewise.
+ * tree-pretty-print.c (dump_function_header): Likewise.
+ * tree-sra.c (convert_callers_for_node): Likewise.
+
+2018-06-08 Martin Liska <mliska@suse.cz>
+
* cgraph.c (symbol_table::create_edge): Always assign a new
unique number.
(symbol_table::free_edge): Do not recycle numbers.
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index cf6b35a..bafbed7 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -120,7 +120,7 @@ static GTY(()) hash_table<function_version_hasher> *cgraph_fnver_htab = NULL;
hashval_t
function_version_hasher::hash (cgraph_function_version_info *ptr)
{
- int uid = ptr->this_node->uid;
+ int uid = ptr->this_node->get_uid ();
return (hashval_t)(uid);
}
@@ -129,7 +129,7 @@ bool
function_version_hasher::equal (cgraph_function_version_info *n1,
cgraph_function_version_info *n2)
{
- return n1->this_node->uid == n2->this_node->uid;
+ return n1->this_node->get_uid () == n2->this_node->get_uid ();
}
/* Mark as GC root all allocated nodes. */
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 6d5a2b8..a8b1b4c 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -97,6 +97,8 @@ class GTY((desc ("%h.type"), tag ("SYMTAB_SYMBOL"),
symtab_node
{
public:
+ friend class symbol_table;
+
/* Return name. */
const char *name () const;
@@ -893,6 +895,8 @@ struct cgraph_edge_hasher : ggc_ptr_hash<cgraph_edge>
struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node {
public:
+ friend class symbol_table;
+
/* Remove the node from cgraph and all inline clones inlined into it.
Skip however removal of FORBIDDEN_NODE and return true if it needs to be
removed. This allows to call the function from outer loop walking clone
@@ -1271,6 +1275,12 @@ public:
dump_cgraph (stderr);
}
+ /* Get unique identifier of the node. */
+ inline int get_uid ()
+ {
+ return m_uid;
+ }
+
/* Record that DECL1 and DECL2 are semantically identical function
versions. */
static void record_function_versions (tree decl1, tree decl2);
@@ -1390,8 +1400,6 @@ public:
/* How to scale counts at materialization time; used to merge
LTO units with different number of profile runs. */
int count_materialization_scale;
- /* Unique id of the node. */
- int uid;
/* ID assigned by the profiling. */
unsigned int profile_id;
/* Time profiler: first run of function. */
@@ -1438,6 +1446,9 @@ public:
unsigned indirect_call_target : 1;
private:
+ /* Unique id of the node. */
+ int m_uid;
+
/* Worker for call_for_symbol_and_aliases. */
bool call_for_symbol_and_aliases_1 (bool (*callback) (cgraph_node *,
void *),
@@ -2617,7 +2628,7 @@ symbol_table::allocate_cgraph_symbol (void)
else
node = ggc_cleared_alloc<cgraph_node> ();
- node->uid = cgraph_max_uid++;
+ node->m_uid = cgraph_max_uid++;
return node;
}
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 0d8c6f0..7e4468a 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1337,7 +1337,7 @@ update_caller_keys (edge_heap_t *heap, struct cgraph_node *node,
if ((!node->alias && !ipa_fn_summaries->get_create (node)->inlinable)
|| node->global.inlined_to)
return;
- if (!bitmap_set_bit (updated_nodes, node->uid))
+ if (!bitmap_set_bit (updated_nodes, node->get_uid ()))
return;
FOR_EACH_ALIAS (node, ref)
@@ -1395,7 +1395,7 @@ update_callee_keys (edge_heap_t *heap, struct cgraph_node *node,
&& (callee = e->callee->ultimate_alias_target (&avail, e->caller))
&& ipa_fn_summaries->get_create (callee)->inlinable
&& avail >= AVAIL_AVAILABLE
- && !bitmap_bit_p (updated_nodes, callee->uid))
+ && !bitmap_bit_p (updated_nodes, callee->get_uid ()))
{
if (can_inline_edge_p (e, false)
&& want_inline_small_function_p (e, false)
diff --git a/gcc/ipa-utils.c b/gcc/ipa-utils.c
index aa586f5..9985721 100644
--- a/gcc/ipa-utils.c
+++ b/gcc/ipa-utils.c
@@ -86,7 +86,7 @@ searchc (struct searchc_env* env, struct cgraph_node *v,
/* mark node as old */
v_info->new_node = false;
- splay_tree_remove (env->nodes_marked_new, v->uid);
+ splay_tree_remove (env->nodes_marked_new, v->get_uid ());
v_info->dfn_number = env->count;
v_info->low_link = env->count;
@@ -195,7 +195,7 @@ ipa_reduced_postorder (struct cgraph_node **order,
node->aux = info;
splay_tree_insert (env.nodes_marked_new,
- (splay_tree_key)node->uid,
+ (splay_tree_key)node->get_uid (),
(splay_tree_value)node);
}
else
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index a57bda9..d5e390c 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -1268,7 +1268,7 @@ input_node (struct lto_file_decl_data *file_data,
functions, they are expected to be read more than once. */
if (node->aux && !DECL_BUILT_IN (node->decl))
internal_error ("bytecode stream: found multiple instances of cgraph "
- "node with uid %d", node->uid);
+ "node with uid %d", node->get_uid ());
node->tp_first_run = streamer_read_uhwi (ib);
diff --git a/gcc/passes.c b/gcc/passes.c
index 537e95a..6e61402 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -1170,7 +1170,7 @@ is_pass_explicitly_enabled_or_disabled (opt_pass *pass,
if (!slot)
return false;
- cgraph_uid = func ? cgraph_node::get (func)->uid : 0;
+ cgraph_uid = func ? cgraph_node::get (func)->get_uid () : 0;
if (func && DECL_ASSEMBLER_NAME_SET_P (func))
aname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (func));
@@ -1635,7 +1635,7 @@ do_per_function (void (*callback) (function *, void *data), void *data)
static int nnodes;
static GTY ((length ("nnodes"))) cgraph_node **order;
-#define uid_hash_t hash_set<int_hash <int, 0, -1>>
+#define uid_hash_t hash_set<int_hash <int, 0, -1> >
/* Hook called when NODE is removed and therefore should be
excluded from order vector. DATA is a hash set with removed nodes. */
@@ -1644,7 +1644,7 @@ static void
remove_cgraph_node_from_order (cgraph_node *node, void *data)
{
uid_hash_t *removed_nodes = (uid_hash_t *)data;
- removed_nodes->add (node->uid);
+ removed_nodes->add (node->get_uid ());
}
/* If we are in IPA mode (i.e., current_function_decl is NULL), call
@@ -1675,7 +1675,7 @@ do_per_function_toporder (void (*callback) (function *, void *data), void *data)
cgraph_node *node = order[i];
/* Function could be inlined and removed as unreachable. */
- if (node == NULL || removed_nodes.contains (node->uid))
+ if (node == NULL || removed_nodes.contains (node->get_uid ()))
continue;
/* Allow possibly removed nodes to be garbage collected. */
diff --git a/gcc/symbol-summary.h b/gcc/symbol-summary.h
index 8c80f30..ebf4b17 100644
--- a/gcc/symbol-summary.h
+++ b/gcc/symbol-summary.h
@@ -90,13 +90,13 @@ public:
does not exist it will be created. */
T* get_create (cgraph_node *node)
{
- return get (node->uid, true);
+ return get (node->get_uid (), true);
}
/* Getter for summary callgraph node pointer. */
T* get (cgraph_node *node)
{
- return get (node->uid, false);
+ return get (node->get_uid (), false);
}
/* Return number of elements handled by data structure. */
@@ -108,7 +108,7 @@ public:
/* Return true if a summary for the given NODE already exists. */
bool exists (cgraph_node *node)
{
- return m_map.get (node->uid) != NULL;
+ return m_map.get (node->get_uid ()) != NULL;
}
/* Enable insertion hook invocation. */
@@ -216,7 +216,7 @@ template <typename T>
void
function_summary<T *>::symtab_insertion (cgraph_node *node, void *data)
{
- gcc_checking_assert (node->uid);
+ gcc_checking_assert (node->get_uid ());
function_summary *summary = (function_summary <T *> *) (data);
if (summary->m_insertion_enabled)
@@ -227,10 +227,10 @@ template <typename T>
void
function_summary<T *>::symtab_removal (cgraph_node *node, void *data)
{
- gcc_checking_assert (node->uid);
+ gcc_checking_assert (node->get_uid ());
function_summary *summary = (function_summary <T *> *) (data);
- int uid = node->uid;
+ int uid = node->get_uid ();
T **v = summary->m_map.get (uid);
if (v)
@@ -256,7 +256,7 @@ function_summary<T *>::symtab_duplication (cgraph_node *node,
{
/* This load is necessary, because we insert a new value! */
T *duplicate = summary->allocate_new ();
- summary->m_map.put (node2->uid, duplicate);
+ summary->m_map.put (node2->get_uid (), duplicate);
summary->duplicate (node, node2, v, duplicate);
}
}
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index c5fc041..9441054 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -4056,7 +4056,7 @@ dump_function_header (FILE *dump_file, tree fdecl, dump_flags_t flags)
fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl));
if (node)
{
- fprintf (dump_file, ", cgraph_uid=%d", node->uid);
+ fprintf (dump_file, ", cgraph_uid=%d", node->get_uid ());
fprintf (dump_file, ", symbol_order=%d)%s\n\n", node->order,
node->frequency == NODE_FREQUENCY_HOT
? " (hot)"
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 09d56d1..494afd8 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -5279,7 +5279,7 @@ convert_callers_for_node (struct cgraph_node *node,
}
for (cs = node->callers; cs; cs = cs->next_caller)
- if (bitmap_set_bit (recomputed_callers, cs->caller->uid)
+ if (bitmap_set_bit (recomputed_callers, cs->caller->get_uid ())
&& gimple_in_ssa_p (DECL_STRUCT_FUNCTION (cs->caller->decl)))
compute_fn_summary (cs->caller, true);
BITMAP_FREE (recomputed_callers);