summaryrefslogtreecommitdiffstats
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-21 15:26:59 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-21 15:26:59 +0000
commit50828ed8f6a0f86b90cdf0fdfcbe3e0caac7b3a7 (patch)
treeea7b07c12837d74f7ef838851f5acf7f97cc0948 /gcc/cgraph.c
parentbfcf04b8d058ecf9917f67a8451cc5be169a9649 (diff)
downloadppe42-gcc-50828ed8f6a0f86b90cdf0fdfcbe3e0caac7b3a7.tar.gz
ppe42-gcc-50828ed8f6a0f86b90cdf0fdfcbe3e0caac7b3a7.zip
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139389 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index a8463d40368..a0db5860f39 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -173,6 +173,8 @@ struct cgraph_node_hook_list *first_cgraph_node_removal_hook;
struct cgraph_2edge_hook_list *first_cgraph_edge_duplicated_hook;
/* List of hooks triggered when a node is duplicated. */
struct cgraph_2node_hook_list *first_cgraph_node_duplicated_hook;
+/* List of hooks triggered when an function is inserted. */
+struct cgraph_node_hook_list *first_cgraph_function_insertion_hook;
/* Register HOOK to be called with DATA on each removed edge. */
@@ -255,6 +257,46 @@ cgraph_call_node_removal_hooks (struct cgraph_node *node)
}
}
+/* Register HOOK to be called with DATA on each removed node. */
+struct cgraph_node_hook_list *
+cgraph_add_function_insertion_hook (cgraph_node_hook hook, void *data)
+{
+ struct cgraph_node_hook_list *entry;
+ struct cgraph_node_hook_list **ptr = &first_cgraph_function_insertion_hook;
+
+ entry = (struct cgraph_node_hook_list *) xmalloc (sizeof (*entry));
+ entry->hook = hook;
+ entry->data = data;
+ entry->next = NULL;
+ while (*ptr)
+ ptr = &(*ptr)->next;
+ *ptr = entry;
+ return entry;
+}
+
+/* Remove ENTRY from the list of hooks called on removing nodes. */
+void
+cgraph_remove_function_insertion_hook (struct cgraph_node_hook_list *entry)
+{
+ struct cgraph_node_hook_list **ptr = &first_cgraph_function_insertion_hook;
+
+ while (*ptr != entry)
+ ptr = &(*ptr)->next;
+ *ptr = entry->next;
+}
+
+/* Call all node removal hooks. */
+void
+cgraph_call_function_insertion_hooks (struct cgraph_node *node)
+{
+ struct cgraph_node_hook_list *entry = first_cgraph_function_insertion_hook;
+ while (entry)
+ {
+ entry->hook (node, entry->data);
+ entry = entry->next;
+ }
+}
+
/* Register HOOK to be called with DATA on each duplicated edge. */
struct cgraph_2edge_hook_list *
cgraph_add_edge_duplication_hook (cgraph_2edge_hook hook, void *data)
OpenPOWER on IntegriCloud