X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gcc%2Fcgraphbuild.c;h=fb1515d603707e5bd9b733a376cf51507b3f537e;hb=6c84d5762f1e1a60b1d4cee0caf8b4e7e0ba5f6f;hp=ce8f2ee080a798f8fe1a1efab09aa4e8dedbeef0;hpb=c44c2088f77877c43b110c508bbfec492ba487a7;p=gcc.git diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index ce8f2ee080a..fb1515d6037 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -1,6 +1,5 @@ /* Callgraph construction. - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 2003-2013 Free Software Foundation, Inc. Contributed by Jan Hubicka This file is part of GCC. @@ -74,7 +73,7 @@ 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); + struct cgraph_node *node = cgraph_get_create_real_symbol_node (decl); if (!ctx->only_vars) cgraph_mark_address_taken_node (node); ipa_record_reference ((symtab_node)ctx->varpool_node, @@ -84,7 +83,7 @@ record_reference (tree *tp, int *walk_subtrees, void *data) if (TREE_CODE (decl) == VAR_DECL) { - struct varpool_node *vnode = varpool_node (decl); + struct varpool_node *vnode = varpool_node_for_decl (decl); ipa_record_reference ((symtab_node)ctx->varpool_node, (symtab_node)vnode, IPA_REF_ADDR, NULL); @@ -123,7 +122,7 @@ record_type_list (struct cgraph_node *node, tree list) type = TREE_OPERAND (type, 0); if (TREE_CODE (type) == VAR_DECL) { - struct varpool_node *vnode = varpool_node (type); + struct varpool_node *vnode = varpool_node_for_decl (type); ipa_record_reference ((symtab_node)node, (symtab_node)vnode, IPA_REF_ADDR, NULL); @@ -144,7 +143,7 @@ record_eh_tables (struct cgraph_node *node, struct function *fun) { struct cgraph_node *per_node; - per_node = cgraph_get_create_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl)); + per_node = cgraph_get_create_real_symbol_node (DECL_FUNCTION_PERSONALITY (node->symbol.decl)); ipa_record_reference ((symtab_node)node, (symtab_node)per_node, IPA_REF_ADDR, NULL); cgraph_mark_address_taken_node (per_node); } @@ -224,7 +223,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_get_create_node (addr); + struct cgraph_node *node = cgraph_get_create_real_symbol_node (addr); cgraph_mark_address_taken_node (node); ipa_record_reference ((symtab_node)data, (symtab_node)node, @@ -233,7 +232,7 @@ mark_address (gimple stmt, tree addr, void *data) else if (addr && TREE_CODE (addr) == VAR_DECL && (TREE_STATIC (addr) || DECL_EXTERNAL (addr))) { - struct varpool_node *vnode = varpool_node (addr); + struct varpool_node *vnode = varpool_node_for_decl (addr); ipa_record_reference ((symtab_node)data, (symtab_node)vnode, @@ -253,7 +252,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_get_create_node (t); + struct cgraph_node *node = cgraph_get_create_real_symbol_node (t); cgraph_mark_address_taken_node (node); ipa_record_reference ((symtab_node)data, (symtab_node)node, @@ -262,7 +261,7 @@ mark_load (gimple stmt, tree t, void *data) else if (t && TREE_CODE (t) == VAR_DECL && (TREE_STATIC (t) || DECL_EXTERNAL (t))) { - struct varpool_node *vnode = varpool_node (t); + struct varpool_node *vnode = varpool_node_for_decl (t); ipa_record_reference ((symtab_node)data, (symtab_node)vnode, @@ -280,7 +279,7 @@ mark_store (gimple stmt, tree t, void *data) if (t && TREE_CODE (t) == VAR_DECL && (TREE_STATIC (t) || DECL_EXTERNAL (t))) { - struct varpool_node *vnode = varpool_node (t); + struct varpool_node *vnode = varpool_node_for_decl (t); ipa_record_reference ((symtab_node)data, (symtab_node)vnode, @@ -289,6 +288,14 @@ mark_store (gimple stmt, tree t, void *data) return false; } +/* Record all references from NODE that are taken in statement STMT. */ +void +ipa_record_stmt_references (struct cgraph_node *node, gimple stmt) +{ + walk_stmt_load_store_addr_ops (stmt, node, mark_load, mark_store, + mark_address); +} + /* Create cgraph edges for function calls. Also look for functions and variables having addresses taken. */ @@ -324,14 +331,13 @@ build_cgraph_edges (void) gimple_call_flags (stmt), bb->count, freq); } - walk_stmt_load_store_addr_ops (stmt, node, mark_load, - mark_store, mark_address); + ipa_record_stmt_references (node, stmt); if (gimple_code (stmt) == GIMPLE_OMP_PARALLEL && gimple_omp_parallel_child_fn (stmt)) { tree fn = gimple_omp_parallel_child_fn (stmt); ipa_record_reference ((symtab_node)node, - (symtab_node)cgraph_get_create_node (fn), + (symtab_node)cgraph_get_create_real_symbol_node (fn), IPA_REF_ADDR, stmt); } if (gimple_code (stmt) == GIMPLE_OMP_TASK) @@ -339,18 +345,17 @@ build_cgraph_edges (void) tree fn = gimple_omp_task_child_fn (stmt); if (fn) ipa_record_reference ((symtab_node)node, - (symtab_node) cgraph_get_create_node (fn), + (symtab_node) cgraph_get_create_real_symbol_node (fn), IPA_REF_ADDR, stmt); fn = gimple_omp_task_copy_fn (stmt); if (fn) ipa_record_reference ((symtab_node)node, - (symtab_node)cgraph_get_create_node (fn), + (symtab_node)cgraph_get_create_real_symbol_node (fn), IPA_REF_ADDR, stmt); } } for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node, - mark_load, mark_store, mark_address); + ipa_record_stmt_references (node, gsi_stmt (gsi)); } /* Look for initializers of constant variables and private statics. */ @@ -370,6 +375,7 @@ struct gimple_opt_pass pass_build_cgraph_edges = { GIMPLE_PASS, "*build_cgraph_edges", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ NULL, /* gate */ build_cgraph_edges, /* execute */ NULL, /* sub */ @@ -392,7 +398,7 @@ void record_references_in_initializer (tree decl, bool only_vars) { struct pointer_set_t *visited_nodes = pointer_set_create (); - struct varpool_node *node = varpool_node (decl); + struct varpool_node *node = varpool_node_for_decl (decl); struct record_reference_ctx ctx = {false, NULL}; ctx.varpool_node = node; @@ -437,13 +443,10 @@ rebuild_cgraph_edges (void) gimple_call_flags (stmt), bb->count, freq); } - walk_stmt_load_store_addr_ops (stmt, node, mark_load, - mark_store, mark_address); - + ipa_record_stmt_references (node, stmt); } for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node, - mark_load, mark_store, mark_address); + ipa_record_stmt_references (node, gsi_stmt (gsi)); } record_eh_tables (node, cfun); gcc_assert (!node->global.inlined_to); @@ -468,16 +471,9 @@ cgraph_rebuild_references (void) FOR_EACH_BB (bb) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - gimple stmt = gsi_stmt (gsi); - - walk_stmt_load_store_addr_ops (stmt, node, mark_load, - mark_store, mark_address); - - } + ipa_record_stmt_references (node, gsi_stmt (gsi)); for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - walk_stmt_load_store_addr_ops (gsi_stmt (gsi), node, - mark_load, mark_store, mark_address); + ipa_record_stmt_references (node, gsi_stmt (gsi)); } record_eh_tables (node, cfun); } @@ -487,6 +483,7 @@ struct gimple_opt_pass pass_rebuild_cgraph_edges = { GIMPLE_PASS, "*rebuild_cgraph_edges", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ NULL, /* gate */ rebuild_cgraph_edges, /* execute */ NULL, /* sub */ @@ -514,6 +511,7 @@ struct gimple_opt_pass pass_remove_cgraph_callee_edges = { GIMPLE_PASS, "*remove_cgraph_callee_edges", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ NULL, /* gate */ remove_cgraph_callee_edges, /* execute */ NULL, /* sub */