aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphbuild.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2011-04-12 09:27:18 +0000
committerMartin Jambor <mjambor@suse.cz>2011-04-12 09:27:18 +0000
commit4b7de838418ca5be33806412ce7cf5e88b7503b7 (patch)
tree2900c2e60111189ed0a91ca9e536453bdc1ea540 /gcc/cgraphbuild.c
parent489c56a6e85b92960c1442d590434981fa655e9c (diff)
2011-04-12 Martin Jambor <mjambor@suse.cz>
* cgraph.h (cgraph_node): Remove function declaration. (cgraph_create_node): Declare. (cgraph_get_create_node): Likewise. * cgraph.c (cgraph_create_node): Renamed to cgraph_create_node_1. Updated all callers. (cgraph_node): Renamed to cgraph_create_node, assert that a node for the decl does not already exist. Call cgraph_get_create_node instead of cgraph_node. (cgraph_get_create_node): New function. (cgraph_same_body_alias): Update comment. (cgraph_set_call_stmt): Call cgraph_get_node instead of cgraph_node, assert it does not return NULL. (cgraph_update_edges_for_call_stmt): Likewise. (cgraph_clone_edge): Likewise. (cgraph_create_virtual_clone): Likewise. (cgraph_update_edges_for_call_stmt_node): Call cgraph_get_create_node instead of cgraph_node. (cgraph_add_new_function): Call cgraph_create_node or cgraph_get_create_node instead of cgraph_node. * cgraphbuild.c (record_reference): Call cgraph_get_create_node instead of cgraph_node. (record_eh_tables): Likewise. (mark_address): Likewise. (mark_load): Likewise. (build_cgraph_edges): Call cgraph_get_create_node instead of cgraph_node. (rebuild_cgraph_edges): Likewise. * cgraphunit.c (cgraph_finalize_function): Call cgraph_get_create_node instead of cgraph_node. (cgraph_copy_node_for_versioning): Call cgraph_create_node instead of cgraph_node. * lto-symtab.c (lto_symtab_merge_cgraph_nodes_1): Call cgraph_create_node instead of cgraph_node. * c-decl.c (finish_function): Call cgraph_get_create_node instead of cgraph_node. * lto-cgraph.c (input_node): Likewise. * lto-streamer-in.c (input_function): Likewise. * varasm.c (mark_decl_referenced): Likewise. (assemble_alias): Likewise. gcc/c-family/ * c-gimplify.c (c_genericize): Call cgraph_get_create_node instead of cgraph_node. gcc/cp/ * cp/class.c (cp_fold_obj_type_ref): Call cgraph_get_create_node instead of cgraph_node. * cp/decl2.c (cxx_callgraph_analyze_expr): Likewise. (cp_write_global_declarations): Likewise. * cp/optimize.c (maybe_clone_body): Likewise. * cp/semantics.c (maybe_add_lambda_conv_op): Likewise. * cp/mangle.c (mangle_decl): Likewise. * cp/method.c (make_alias_for_thunk): Likewise. (use_thunk): Likewise. gcc/ada/ * gcc-interface/utils.c (end_subprog_body): Call cgraph_get_create_node instead of cgraph_node. gcc/fortran/ * trans-decl.c (gfc_generate_function_code): Call cgraph_get_create_node instead of cgraph_node. gcc/objc/ * objc-act.c (mark_referenced_methods): Call cgraph_get_create_node instead of cgraph_node. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@172307 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraphbuild.c')
-rw-r--r--gcc/cgraphbuild.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c
index 47199f3a783..935462eda83 100644
--- a/gcc/cgraphbuild.c
+++ b/gcc/cgraphbuild.c
@@ -73,10 +73,10 @@ record_reference (tree *tp, int *walk_subtrees, void *data)
decl = get_base_var (*tp);
if (TREE_CODE (decl) == FUNCTION_DECL)
{
+ struct cgraph_node *node = cgraph_get_create_node (decl);
if (!ctx->only_vars)
- cgraph_mark_address_taken_node (cgraph_node (decl));
- ipa_record_reference (NULL, ctx->varpool_node,
- cgraph_node (decl), NULL,
+ cgraph_mark_address_taken_node (node);
+ ipa_record_reference (NULL, ctx->varpool_node, node, NULL,
IPA_REF_ADDR, NULL);
}
@@ -149,8 +149,8 @@ record_eh_tables (struct cgraph_node *node, struct function *fun)
if (DECL_FUNCTION_PERSONALITY (node->decl))
ipa_record_reference (node, NULL,
- cgraph_node (DECL_FUNCTION_PERSONALITY (node->decl)),
- NULL, IPA_REF_ADDR, NULL);
+ cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->decl)),
+ NULL, IPA_REF_ADDR, NULL);
i = fun->eh->region_tree;
if (!i)
@@ -250,7 +250,7 @@ mark_address (gimple stmt, tree addr, void *data)
addr = get_base_address (addr);
if (TREE_CODE (addr) == FUNCTION_DECL)
{
- struct cgraph_node *node = cgraph_node (addr);
+ struct cgraph_node *node = cgraph_get_create_node (addr);
cgraph_mark_address_taken_node (node);
ipa_record_reference ((struct cgraph_node *)data, NULL,
node, NULL,
@@ -285,7 +285,7 @@ mark_load (gimple stmt, tree t, void *data)
{
/* ??? This can happen on platforms with descriptors when these are
directly manipulated in the code. Pretend that it's an address. */
- struct cgraph_node *node = cgraph_node (t);
+ struct cgraph_node *node = cgraph_get_create_node (t);
cgraph_mark_address_taken_node (node);
ipa_record_reference ((struct cgraph_node *)data, NULL,
node, NULL,
@@ -361,9 +361,8 @@ build_cgraph_edges (void)
bb);
decl = gimple_call_fndecl (stmt);
if (decl)
- cgraph_create_edge (node, cgraph_node (decl), stmt,
- bb->count, freq,
- bb->loop_depth);
+ cgraph_create_edge (node, cgraph_get_create_node (decl),
+ stmt, bb->count, freq, bb->loop_depth);
else
cgraph_create_indirect_edge (node, stmt,
gimple_call_flags (stmt),
@@ -376,18 +375,18 @@ build_cgraph_edges (void)
&& gimple_omp_parallel_child_fn (stmt))
{
tree fn = gimple_omp_parallel_child_fn (stmt);
- ipa_record_reference (node, NULL, cgraph_node (fn),
+ ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
NULL, IPA_REF_ADDR, stmt);
}
if (gimple_code (stmt) == GIMPLE_OMP_TASK)
{
tree fn = gimple_omp_task_child_fn (stmt);
if (fn)
- ipa_record_reference (node, NULL, cgraph_node (fn),
+ ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
NULL, IPA_REF_ADDR, stmt);
fn = gimple_omp_task_copy_fn (stmt);
if (fn)
- ipa_record_reference (node, NULL, cgraph_node (fn),
+ ipa_record_reference (node, NULL, cgraph_get_create_node (fn),
NULL, IPA_REF_ADDR, stmt);
}
}
@@ -472,9 +471,8 @@ rebuild_cgraph_edges (void)
bb);
decl = gimple_call_fndecl (stmt);
if (decl)
- cgraph_create_edge (node, cgraph_node (decl), stmt,
- bb->count, freq,
- bb->loop_depth);
+ cgraph_create_edge (node, cgraph_get_create_node (decl), stmt,
+ bb->count, freq, bb->loop_depth);
else
cgraph_create_indirect_edge (node, stmt,
gimple_call_flags (stmt),