aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2008-08-24 19:11:13 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2008-08-24 17:11:13 +0000
commit0dbca53731ccc8e6785b30ccb679bad2faa9ea2c (patch)
treee4ad7a1bdbd2155344888e32eac895842bc01109 /gcc/ipa-inline.c
parent30b608eb7c0432299ade3b19200315bf5e147d31 (diff)
downloadgcc-0dbca53731ccc8e6785b30ccb679bad2faa9ea2c.zip
gcc-0dbca53731ccc8e6785b30ccb679bad2faa9ea2c.tar.gz
gcc-0dbca53731ccc8e6785b30ccb679bad2faa9ea2c.tar.bz2
ipa-cp.c (ipcp_analyze_node): New function.
* ipa-cp.c (ipcp_analyze_node): New function. (ipcp_update_cloned_node): Use it. (ipcp_init_stage): Likewise. * ipa-inline.c (function_insertion_hook_holder): New static var. (analyze_function): Break out from .... (inline_generate_summary): Here; register insertion hook. (cgraph_decide_inlining): Remove hook. (add_new_function): New function. From-SVN: r139536
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c58
1 files changed, 34 insertions, 24 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index d5f280f..3f44d2f 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -166,6 +166,9 @@ static int nfunctions_inlined;
static int overall_insns;
static gcov_type max_count;
+/* Holders of ipa cgraph hooks: */
+static struct cgraph_node_hook_list *function_insertion_hook_holder;
+
static inline struct inline_summary *
inline_summary (struct cgraph_node *node)
{
@@ -1073,6 +1076,8 @@ cgraph_decide_inlining (void)
int i;
int initial_insns = 0;
+ cgraph_remove_function_insertion_hook (function_insertion_hook_holder);
+
max_count = 0;
for (node = cgraph_nodes; node; node = node->next)
if (node->analyzed && (node->needed || node->reachable))
@@ -1657,12 +1662,34 @@ inline_indirect_intraprocedural_analysis (struct cgraph_node *node)
/* Note function body size. */
static void
+analyze_function (struct cgraph_node *node)
+{
+ push_cfun (DECL_STRUCT_FUNCTION (node->decl));
+ current_function_decl = node->decl;
+
+ compute_inline_parameters (node);
+ if (flag_indirect_inlining)
+ inline_indirect_intraprocedural_analysis (node);
+
+ current_function_decl = NULL;
+ pop_cfun ();
+}
+
+/* Called when new function is inserted to callgraph late. */
+static void
+add_new_function (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
+{
+ analyze_function (node);
+}
+
+/* Note function body size. */
+static void
inline_generate_summary (void)
{
- struct cgraph_node **order =
- XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
- int nnodes = cgraph_postorder (order);
- int i;
+ struct cgraph_node *node;
+
+ function_insertion_hook_holder =
+ cgraph_add_function_insertion_hook (&add_new_function, NULL);
if (flag_indirect_inlining)
{
@@ -1671,27 +1698,10 @@ inline_generate_summary (void)
ipa_check_create_edge_args ();
}
- for (i = nnodes - 1; i >= 0; i--)
- {
- struct cgraph_node *node = order[i];
-
- /* Allow possibly removed nodes to be garbage collected. */
- order[i] = NULL;
- if (node->analyzed && (node->needed || node->reachable))
- {
- push_cfun (DECL_STRUCT_FUNCTION (node->decl));
- current_function_decl = node->decl;
- compute_inline_parameters (node);
-
- if (flag_indirect_inlining)
- inline_indirect_intraprocedural_analysis (node);
-
- pop_cfun ();
- }
- }
+ for (node = cgraph_nodes; node; node = node->next)
+ if (node->analyzed)
+ analyze_function (node);
- current_function_decl = NULL;
- free (order);
return;
}