diff options
author | Jan Hubicka <jh@suse.cz> | 2008-08-21 17:26:59 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2008-08-21 15:26:59 +0000 |
commit | 129a37fc319db84e962397736a3030cb95471df2 (patch) | |
tree | ea7b07c12837d74f7ef838851f5acf7f97cc0948 /gcc/ipa-reference.c | |
parent | 1e52075c544a9808b4b370ef974c198f3bb639b5 (diff) | |
download | gcc-129a37fc319db84e962397736a3030cb95471df2.zip gcc-129a37fc319db84e962397736a3030cb95471df2.tar.gz gcc-129a37fc319db84e962397736a3030cb95471df2.tar.bz2 |
cgraph.c (first_cgraph_function_insertion_hook): New variable.
* cgraph.c (first_cgraph_function_insertion_hook): New variable.
(cgraph_add_function_insertion_hook, cgraph_remove_function_insertion_hook,
cgraph_call_function_insertion_hooks): New functions.
* cgraph.h (cgraph_add_function_insertion_hook, cgraph_remove_function_insertion_hook,
cgraph_call_function_insertion_hooks): Declare.
* ipa-reference.c (function_insertion_hook_holder): New variable.
(check_operand, look_for_address_of): When checking late, do not care
about module bitmaps.
(add_new_function): New function.
(generate_summary): Register hooks; zero module bitmaps.
(propagate): Unregister hooks.
* ipa-pure-const.c (function_insertion_hook_holder): New variable.
(add_new_function): New function.
(generate_summary): Register hook.
(propagate): Remove hook.
* ipa-cp.c (ipcp_need_redirect_p): Fix to not be constant 0.
* tree-pass.h (pass_ipa_cp): Make ipa_opt_pass.
* ipa-cp.c (ipcp_update_cloned_node): New function.
(build_const_val): Handle functions correctly; bring type logic
into sync with tree-inline.c
(ipcp_init_stage): Take care of computing stuff needed by
indirect inlining; update clones.
(ipcp_generate_summary): Break out of ipcp_driver.
(ipcp_driver): Do only execution and transformation.
(pass_ipa_cp): Make IPA_PASS.
* tree-ssa-ccp.c (fold_stmt_r): Check type before trying to fold
offset to address.
* ipa-inline.c (inline_indirect_intraprocedural_analysis): When doing
ipcp, some info is already available.
* ipa-prop.c (ipa_count_arguments): Grow edge lists as needed.
* tree-inline.c (remap_ssa_name): Unshare expression.
From-SVN: r139389
Diffstat (limited to 'gcc/ipa-reference.c')
-rw-r--r-- | gcc/ipa-reference.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 08bed82..c8b23b6 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -95,6 +95,9 @@ static struct pointer_set_t *visited_nodes; static bitmap_obstack ipa_obstack; +/* Holders of ipa cgraph hooks: */ +static struct cgraph_node_hook_list *function_insertion_hook_holder; + enum initialization_status_t { UNINITIALIZED, @@ -296,7 +299,8 @@ check_operand (ipa_reference_local_vars_info_t local, bitmap_set_bit (local->statics_written, DECL_UID (t)); /* Mark the write so we can tell which statics are readonly. */ - bitmap_set_bit (module_statics_written, DECL_UID (t)); + if (module_statics_written) + bitmap_set_bit (module_statics_written, DECL_UID (t)); } else if (local) bitmap_set_bit (local->statics_read, DECL_UID (t)); @@ -345,7 +349,7 @@ look_for_address_of (tree t) { tree x = get_base_var (t); if (TREE_CODE (x) == VAR_DECL || TREE_CODE (x) == FUNCTION_DECL) - if (has_proper_scope_for_analysis (x)) + if (has_proper_scope_for_analysis (x) && module_statics_escape) bitmap_set_bit (module_statics_escape, DECL_UID (x)); } } @@ -935,6 +939,19 @@ clean_function (struct cgraph_node *fn) get_function_ann (fn->decl)->reference_vars_info = NULL; } +/* Called when new function is inserted to callgraph late. */ +static void +add_new_function (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED) +{ + /* There are some shared nodes, in particular the initializers on + static declarations. We do not need to scan them more than once + since all we would be interested in are the addressof + operations. */ + visited_nodes = pointer_set_create (); + analyze_function (node); + pointer_set_destroy (visited_nodes); + visited_nodes = NULL; +} /* Analyze each function in the cgraph to see which global or statics are read or written. */ @@ -949,6 +966,8 @@ generate_summary (void) bitmap module_statics_readonly; bitmap bm_temp; + function_insertion_hook_holder = + cgraph_add_function_insertion_hook (&add_new_function, NULL); ipa_init (); module_statics_readonly = BITMAP_ALLOC (&ipa_obstack); bm_temp = BITMAP_ALLOC (&ipa_obstack); @@ -1031,6 +1050,8 @@ generate_summary (void) BITMAP_FREE(module_statics_escape); BITMAP_FREE(module_statics_written); + module_statics_escape = NULL; + module_statics_written = NULL; if (dump_file) EXECUTE_IF_SET_IN_BITMAP (all_module_statics, 0, index, bi) @@ -1107,6 +1128,7 @@ propagate (void) int order_pos = ipa_utils_reduced_inorder (order, false, true); int i; + cgraph_remove_function_insertion_hook (function_insertion_hook_holder); if (dump_file) dump_cgraph (dump_file); |