From 129a37fc319db84e962397736a3030cb95471df2 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 21 Aug 2008 17:26:59 +0200 Subject: 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 --- gcc/ipa-pure-const.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gcc/ipa-pure-const.c') diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c index 6edd165..20abdf3 100644 --- a/gcc/ipa-pure-const.c +++ b/gcc/ipa-pure-const.c @@ -96,6 +96,8 @@ typedef struct funct_state_d * funct_state; static funct_state *funct_state_vec; +/* Holders of ipa cgraph hooks: */ +static struct cgraph_node_hook_list *function_insertion_hook_holder; /* Init the function state. */ @@ -677,6 +679,21 @@ end: } } +/* Called when new function is inserted to callgraph late. */ +static void +add_new_function (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED) +{ + funct_state_vec = XRESIZEVEC (funct_state, funct_state_vec, cgraph_max_uid); + /* 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 if it is locally PURE or CONST. */ @@ -686,6 +703,8 @@ generate_summary (void) { struct cgraph_node *node; + function_insertion_hook_holder = + cgraph_add_function_insertion_hook (&add_new_function, NULL); init_state (); /* There are some shared nodes, in particular the initializers on static declarations. We do not need to scan them more than once @@ -725,6 +744,7 @@ propagate (void) int i; struct ipa_dfs_info * w_info; + cgraph_remove_function_insertion_hook (function_insertion_hook_holder); order_pos = ipa_utils_reduced_inorder (order, true, false); if (dump_file) { -- cgit v1.1