diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-23 21:11:44 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-23 21:11:44 +0000 |
commit | 3d7bfc56719fe05a07fef313728dca4e0f113a02 (patch) | |
tree | a308ac6242dd91f73480ea940c0237afcc47f134 /gcc/cgraph.c | |
parent | d7bec69564aeb974895eb7c9f882fd0563fc5145 (diff) | |
download | gcc-3d7bfc56719fe05a07fef313728dca4e0f113a02.tar.gz |
* cgraph.c (cgraph_nodes_queue): Declare.
(eq_node): Take identifier as p2.
(cgraph_node): Update htab_find_slot_with_hash call.
(cgraph_node_for_identifier): New.
(cgraph_mark_needed_node): Move here from cgraphunit.c.
* cgraph.h (cgraph_nodes_queue): Declare.
(cgraph_node_for_identifier): Declare.
* cgraphunit.c (cgraph_finalize_function): Collect entry points here
instead of in cgraph_finalize_compilation_unit; constructors and
destructors are entry points.
(cgraph_finalize_compilation_unit): Reorganize debug outout;
examine nested functions after lowerng; call collect_functions hook.
(cgraph_mark_local_functions): DECL_COMDAT functions are not local.
(cgraph_finalize_compilation_unit): Do not collect entry points.
* varasm.c: Include cgraph.h
(assemble_name): Mark referenced identifier as needed.
* cgraphunit.c (record_call_1): Use get_callee_fndecl.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68390 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 82e367f2929..b5753a12831 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -48,6 +48,9 @@ static htab_t cgraph_hash = 0; /* The linked list of cgraph nodes. */ struct cgraph_node *cgraph_nodes; +/* Queue of cgraph nodes scheduled to be lowered. */ +struct cgraph_node *cgraph_nodes_queue; + /* Number of nodes in existence. */ int cgraph_n_nodes; @@ -79,7 +82,7 @@ eq_node (p1, p2) const void *p2; { return ((DECL_ASSEMBLER_NAME (((struct cgraph_node *) p1)->decl)) == - DECL_ASSEMBLER_NAME ((tree) p2)); + (tree) p2); } /* Return cgraph node assigned to DECL. Create new one when needed. */ @@ -100,7 +103,8 @@ cgraph_node (decl) } slot = - (struct cgraph_node **) htab_find_slot_with_hash (cgraph_hash, decl, + (struct cgraph_node **) htab_find_slot_with_hash (cgraph_hash, + DECL_ASSEMBLER_NAME (decl), htab_hash_pointer (DECL_ASSEMBLER_NAME (decl)), 1); @@ -125,6 +129,30 @@ cgraph_node (decl) return node; } +/* Try to find existing function for identifier ID. */ +struct cgraph_node * +cgraph_node_for_identifier (id) + tree id; +{ + struct cgraph_node **slot; + + if (TREE_CODE (id) != IDENTIFIER_NODE) + abort (); + + if (!cgraph_hash) + { + cgraph_hash = htab_create (10, hash_node, eq_node, NULL); + VARRAY_TREE_INIT (known_fns, 32, "known_fns"); + } + + slot = + (struct cgraph_node **) htab_find_slot_with_hash (cgraph_hash, id, + htab_hash_pointer (id), 0); + if (!slot) + return NULL; + return *slot; +} + /* Create edge from CALLER to CALLEE in the cgraph. */ static struct cgraph_edge * @@ -194,6 +222,28 @@ cgraph_remove_node (node) /* Do not free the structure itself so the walk over chain can continue. */ } +/* Notify finalize_compilation_unit that given node is reachable + or needed. */ +void +cgraph_mark_needed_node (node, needed) + struct cgraph_node *node; + int needed; +{ + if (needed) + { + node->needed = 1; + } + if (!node->reachable) + { + node->reachable = 1; + if (DECL_SAVED_TREE (node->decl)) + { + node->aux = cgraph_nodes_queue; + cgraph_nodes_queue = node; + } + } +} + /* Record call from CALLER to CALLEE */ |