From 89480522221ee99f08da1abd7197b5b7c978d5c0 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 8 Sep 2004 11:28:06 +0200 Subject: [PATCH] cgraph.c (cgraph_remove_node): Free DECL_INITIAL field of node. * cgraph.c (cgraph_remove_node): Free DECL_INITIAL field of node. * cgraphunit.c (verify_cgraph): Don't verify on syntax errors. (cgraph_expand_function): Remove stale cgraph edges of currently compiled function; fix non-unit-at-a-time code copying function node for later reuse. From-SVN: r87181 --- gcc/ChangeLog | 8 ++++++++ gcc/cgraph.c | 1 + gcc/cgraphunit.c | 10 ++++++++-- gcc/tree-optimize.c | 13 +++++++++++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87ce651b849..e1a2ac1dd41 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2004-09-08 Jan Hubicka + + * cgraph.c (cgraph_remove_node): Free DECL_INITIAL field of node. + * cgraphunit.c (verify_cgraph): Don't verify on syntax errors. + (cgraph_expand_function): Remove stale cgraph edges of currently + compiled function; fix non-unit-at-a-time code copying function + node for later reuse. + 2004-09-08 Nathan Sidwell * vec.c (vec_p_reserve, vec_o_reserve): Rename to ... diff --git a/gcc/cgraph.c b/gcc/cgraph.c index a2cb174d767..6c93ac5f173 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -354,6 +354,7 @@ cgraph_remove_node (struct cgraph_node *node) { DECL_SAVED_TREE (node->decl) = NULL; DECL_STRUCT_FUNCTION (node->decl) = NULL; + DECL_INITIAL (node->decl) = error_mark_node; } } cgraph_n_nodes--; diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index a045457e21b..81df3099513 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -610,6 +610,9 @@ verify_cgraph (void) { struct cgraph_node *node; + if (sorrycount || errorcount) + return; + for (node = cgraph_nodes; node; node = node->next) verify_cgraph_node (node); } @@ -800,12 +803,15 @@ cgraph_expand_function (struct cgraph_node *node) gcc_assert (TREE_ASM_WRITTEN (node->decl)); current_function_decl = NULL; - if (DECL_SAVED_TREE (node->decl) - && !cgraph_preserve_function_body_p (node->decl)) + if (!cgraph_preserve_function_body_p (node->decl)) { DECL_SAVED_TREE (node->decl) = NULL; DECL_STRUCT_FUNCTION (node->decl) = NULL; DECL_INITIAL (node->decl) = error_mark_node; + /* Elliminate all call edges. This is important so the call_expr no longer + points to the dead function body. */ + while (node->callees) + cgraph_remove_edge (node->callees); } } diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 701b1043087..d081fe0590f 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -604,6 +604,11 @@ tree_rest_of_compilation (tree fndecl, bool nested_p) } } + /* We are not going to maintain the cgraph edges up to date. + Kill it so it won't confuse us. */ + while (node->callees) + cgraph_remove_edge (node->callees); + if (!vars_to_rename) vars_to_rename = BITMAP_XMALLOC (); @@ -632,8 +637,12 @@ tree_rest_of_compilation (tree fndecl, bool nested_p) cgraph_remove_edge (node->callees); node->callees = saved_node->callees; saved_node->callees = NULL; - for (e = saved_node->callees; e; e = e->next_callee) - e->caller = node; + for (e = node->callees; e; e = e->next_callee) + { + if (e->callee->global.inlined_to) + e->callee->global.inlined_to = node; + e->caller = node; + } cgraph_remove_node (saved_node); } } -- 2.30.2