summaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-08 13:26:37 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-08 13:26:37 +0000
commit961e3b1338548a1d9273e622dd9e3041d6264612 (patch)
tree8a4f34953d22192851b98b6fb46d7a44532ecfc0 /gcc/cgraph.c
parentc69cd0fc2c8035ba21cbac23f78c452f66f84b5c (diff)
downloadgcc-961e3b1338548a1d9273e622dd9e3041d6264612.tar.gz
* gcc.dg/inline-3.c: New test.
* c-decl.c: (finish_function): Update call of tree_inlinable_function_p. * cgraph.h: (cgraph_local_info): Add can_inline_once (cgraph_global_info): Add inline_once. (cgraph_node): Add previous. (cgraph_remove_node): New. * cgraphunit.c (cgraph_mark_functions_to_inline_once): New static function. (cgraph_optimize): Call it. (cgraph_finalize_function): Set inlinable flags. (cgraph_finalize_compilation_unit): Actually remove the reclaimed nodes. (cgraph_mark_functions_to_output): Use new inlining heuristics flags. (cgraph_expand_function): Likewise. * cgraph.c (cgraph_node): Put nodes into doubly linked chain. (cgraph_remove_node): New function. * flags.h (flag_inline_functions_called_once): Declare. * tree-inline.c: Include cgraph.h (inlinable_functions_p): Add extra argument to bypass limits. (expand_call_inline): Obey cgraph flag. * tree-inline.h (tree_inlinable_function_p): Update prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63983 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 1a078f6750e..bb035b2ea74 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -48,7 +48,7 @@ bool cgraph_global_info_ready = false;
static struct cgraph_edge *create_edge PARAMS ((struct cgraph_node *,
struct cgraph_node *));
-static void remove_edge PARAMS ((struct cgraph_node *, struct cgraph_node *));
+static void cgraph_remove_edge PARAMS ((struct cgraph_node *, struct cgraph_node *));
static hashval_t hash_node PARAMS ((const PTR));
static int eq_node PARAMS ((const PTR, const PTR));
@@ -95,6 +95,9 @@ cgraph_node (decl)
node = xcalloc (sizeof (*node), 1);
node->decl = decl;
node->next = cgraph_nodes;
+ if (cgraph_nodes)
+ cgraph_nodes->previous = node;
+ node->previous = NULL;
cgraph_nodes = node;
cgraph_n_nodes++;
*slot = node;
@@ -127,7 +130,7 @@ create_edge (caller, callee)
/* Remove the edge from CALLER to CALLEE in the cgraph. */
static void
-remove_edge (caller, callee)
+cgraph_remove_edge (caller, callee)
struct cgraph_node *caller, *callee;
{
struct cgraph_edge **edge, **edge2;
@@ -146,6 +149,37 @@ remove_edge (caller, callee)
*edge2 = (*edge2)->next_callee;
}
+/* Remove the node from cgraph. */
+
+void
+cgraph_remove_node (node)
+ struct cgraph_node *node;
+{
+ while (node->callers)
+ cgraph_remove_edge (node->callers->caller, node);
+ while (node->callees)
+ cgraph_remove_edge (node, node->callees->callee);
+ while (node->nested)
+ cgraph_remove_node (node->nested);
+ if (node->origin)
+ {
+ struct cgraph_node **node2 = &node->origin->nested;
+
+ while (*node2 != node)
+ node2 = &(*node2)->next_nested;
+ *node2 = node->next_nested;
+ }
+ if (node->previous)
+ node->previous->next = node->next;
+ else
+ cgraph_nodes = node;
+ if (node->next)
+ node->next->previous = node->previous;
+ DECL_SAVED_TREE (node->decl) = NULL;
+ /* Do not free the structure itself so the walk over chain can continue. */
+}
+
+
/* Record call from CALLER to CALLEE */
struct cgraph_edge *
@@ -159,7 +193,7 @@ void
cgraph_remove_call (caller, callee)
tree caller, callee;
{
- remove_edge (cgraph_node (caller), cgraph_node (callee));
+ cgraph_remove_edge (cgraph_node (caller), cgraph_node (callee));
}
/* Return true when CALLER_DECL calls CALLEE_DECL. */