+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
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);
}
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. */
symtab_node
{
public:
+ friend class symbol_table;
+
/* Return name. */
const char *name () const;
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
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);
/* 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. */
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 *),
else
node = ggc_cleared_alloc<cgraph_node> ();
- node->uid = cgraph_max_uid++;
+ node->m_uid = cgraph_max_uid++;
return 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)
&& (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)
/* 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;
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
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);
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));
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. */
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
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. */
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. */
/* 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. */
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)
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)
{
/* 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);
}
}
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)"
}
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);