aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.h
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2019-02-18 09:21:23 +0100
committerMartin Liska <marxin@gcc.gnu.org>2019-02-18 08:21:23 +0000
commitdb30281f0b2ff6dfc0c4146291baf020a27e4065 (patch)
tree419ecfa282d86cfaa3d74625e4883e4a619573c9 /gcc/cgraph.h
parente8cecccc2e5abb5d753291892968bf72533a7045 (diff)
downloadgcc-db30281f0b2ff6dfc0c4146291baf020a27e4065.zip
gcc-db30281f0b2ff6dfc0c4146291baf020a27e4065.tar.gz
gcc-db30281f0b2ff6dfc0c4146291baf020a27e4065.tar.bz2
Come up with fast {function,call}_summary classes (PR ipa/89306).
2019-02-18 Martin Liska <mliska@suse.cz> PR ipa/89306 * cgraph.c (symbol_table::create_edge): Set m_summary_id to -1 by default. (symbol_table::free_edge): Recycle m_summary_id. * cgraph.h (get_summary_id): New. (symbol_table::release_symbol): Set m_summary_id to -1 by default. (symbol_table::allocate_cgraph_symbol): Recycle m_summary_id. * ipa-fnsummary.c (ipa_fn_summary_t): Switch from function_summary to fast_function_summary. * ipa-fnsummary.h (ipa_fn_summary_t): Likewise. * ipa-pure-const.c (class funct_state_summary_t): Switch from function_summary to fast_function_summary. * ipa-reference.c (class ipa_ref_var_info_summary_t): Likewise. (class ipa_ref_opt_summary_t): Switch from function_summary to fast_function_summary. * symbol-summary.h (class function_summary_base): New class that is created from base of former function_summary. (function_summary_base::unregister_hooks): New. (class function_summary): Inherit from function_summary_base. (class call_summary_base): New class that is created from base of former call_summary. (class call_summary): Inherit from call_summary_base. (struct is_same): New. (class fast_function_summary): New summary class. (class fast_call_summary): New summary class. * vec.h (vec_safe_grow_cleared): New function. From-SVN: r268979
Diffstat (limited to 'gcc/cgraph.h')
-rw-r--r--gcc/cgraph.h44
1 files changed, 42 insertions, 2 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index 2f6daa7..c294602 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -1302,6 +1302,12 @@ public:
return m_uid;
}
+ /* Get summary id of the node. */
+ inline int get_summary_id ()
+ {
+ return m_summary_id;
+ }
+
/* Record that DECL1 and DECL2 are semantically identical function
versions. */
static void record_function_versions (tree decl1, tree decl2);
@@ -1470,6 +1476,9 @@ private:
/* Unique id of the node. */
int m_uid;
+ /* Summary id that is recycled. */
+ int m_summary_id;
+
/* Worker for call_for_symbol_and_aliases. */
bool call_for_symbol_and_aliases_1 (bool (*callback) (cgraph_node *,
void *),
@@ -1728,6 +1737,12 @@ struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"),
return m_uid;
}
+ /* Get summary id of the edge. */
+ inline int get_summary_id ()
+ {
+ return m_summary_id;
+ }
+
/* Rebuild cgraph edges for current function node. This needs to be run after
passes that don't update the cgraph. */
static unsigned int rebuild_edges (void);
@@ -1805,6 +1820,9 @@ private:
/* Unique id of the edge. */
int m_uid;
+ /* Summary id that is recycled. */
+ int m_summary_id;
+
/* Remove the edge from the list of the callers of the callee. */
void remove_caller (void);
@@ -2051,7 +2069,8 @@ public:
friend class cgraph_node;
friend class cgraph_edge;
- symbol_table (): cgraph_max_uid (1), edges_max_uid (1)
+ symbol_table (): cgraph_max_uid (1), cgraph_max_summary_id (0),
+ edges_max_uid (1), edges_max_summary_id (0)
{
}
@@ -2254,15 +2273,31 @@ public:
/* Dump symbol table to stderr. */
void DEBUG_FUNCTION debug (void);
+ /* Assign a new summary ID for the callgraph NODE. */
+ inline int assign_summary_id (cgraph_node *node)
+ {
+ node->m_summary_id = cgraph_max_summary_id++;
+ return node->m_summary_id;
+ }
+
+ /* Assign a new summary ID for the callgraph EDGE. */
+ inline int assign_summary_id (cgraph_edge *edge)
+ {
+ edge->m_summary_id = edges_max_summary_id++;
+ return edge->m_summary_id;
+ }
+
/* Return true if assembler names NAME1 and NAME2 leads to the same symbol
name. */
static bool assembler_names_equal_p (const char *name1, const char *name2);
int cgraph_count;
int cgraph_max_uid;
+ int cgraph_max_summary_id;
int edges_count;
int edges_max_uid;
+ int edges_max_summary_id;
symtab_node* GTY(()) nodes;
asm_node* GTY(()) asmnodes;
@@ -2634,8 +2669,10 @@ symbol_table::release_symbol (cgraph_node *node)
/* Clear out the node to NULL all pointers and add the node to the free
list. */
+ int summary_id = node->m_summary_id;
memset (node, 0, sizeof (*node));
node->type = SYMTAB_FUNCTION;
+ node->m_summary_id = summary_id;
SET_NEXT_FREE_NODE (node, free_nodes);
free_nodes = node;
}
@@ -2653,7 +2690,10 @@ symbol_table::allocate_cgraph_symbol (void)
free_nodes = NEXT_FREE_NODE (node);
}
else
- node = ggc_cleared_alloc<cgraph_node> ();
+ {
+ node = ggc_cleared_alloc<cgraph_node> ();
+ node->m_summary_id = -1;
+ }
node->m_uid = cgraph_max_uid++;
return node;