diff options
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index b88ab68..51181cb 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -81,7 +81,7 @@ The callgraph: #include "varray.h" #include "output.h" #include "intl.h" -#include "tree-gimple.h" +#include "gimple.h" #include "tree-dump.h" #include "tree-flow.h" @@ -503,9 +503,12 @@ edge_eq (const void *x, const void *y) return ((const struct cgraph_edge *) x)->call_stmt == y; } -/* Return callgraph edge representing CALL_EXPR statement. */ + +/* Return the callgraph edge representing the GIMPLE_CALL statement + CALL_STMT. */ + struct cgraph_edge * -cgraph_edge (struct cgraph_node *node, tree call_stmt) +cgraph_edge (struct cgraph_node *node, gimple call_stmt) { struct cgraph_edge *e, *e2; int n = 0; @@ -526,6 +529,7 @@ cgraph_edge (struct cgraph_node *node, tree call_stmt) break; n++; } + if (n > 100) { node->call_site_hash = htab_create_ggc (120, edge_hash, edge_eq, NULL); @@ -540,13 +544,15 @@ cgraph_edge (struct cgraph_node *node, tree call_stmt) *slot = e2; } } + return e; } -/* Change call_stmt of edge E to NEW_STMT. */ + +/* Change field call_smt of edge E to NEW_STMT. */ void -cgraph_set_call_stmt (struct cgraph_edge *e, tree new_stmt) +cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt) { if (e->caller->call_site_hash) { @@ -571,7 +577,7 @@ cgraph_set_call_stmt (struct cgraph_edge *e, tree new_stmt) struct cgraph_edge * cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, - tree call_stmt, gcov_type count, int freq, int nest) + gimple call_stmt, gcov_type count, int freq, int nest) { struct cgraph_edge *edge = GGC_NEW (struct cgraph_edge); #ifdef ENABLE_CHECKING @@ -581,9 +587,9 @@ cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, gcc_assert (e->call_stmt != call_stmt); #endif - gcc_assert (get_call_expr_in (call_stmt)); + gcc_assert (is_gimple_call (call_stmt)); - if (!DECL_SAVED_TREE (callee->decl)) + if (!gimple_body (callee->decl)) edge->inline_failed = N_("function body not available"); else if (callee->local.redefined_extern_inline) edge->inline_failed = N_("redefined extern inline functions are not " @@ -691,14 +697,15 @@ cgraph_redirect_edge_callee (struct cgraph_edge *e, struct cgraph_node *n) e->callee = n; } -/* Update or remove corresponding cgraph edge if a call OLD_CALL - in OLD_STMT changed into NEW_STMT. */ + +/* Update or remove the corresponding cgraph edge if a GIMPLE_CALL + OLD_STMT changed into NEW_STMT. */ void -cgraph_update_edges_for_call_stmt (tree old_stmt, tree old_call, - tree new_stmt) +cgraph_update_edges_for_call_stmt (gimple old_stmt, gimple new_stmt) { - tree new_call = get_call_expr_in (new_stmt); + tree new_call = (is_gimple_call (new_stmt)) ? gimple_call_fn (new_stmt) : 0; + tree old_call = (is_gimple_call (old_stmt)) ? gimple_call_fn (old_stmt) : 0; struct cgraph_node *node = cgraph_node (cfun->decl); if (old_call != new_call) @@ -716,7 +723,7 @@ cgraph_update_edges_for_call_stmt (tree old_stmt, tree old_call, cgraph_remove_edge (e); if (new_call) { - new_decl = get_callee_fndecl (new_call); + new_decl = gimple_call_fndecl (new_stmt); if (new_decl) { ne = cgraph_create_edge (node, cgraph_node (new_decl), @@ -736,6 +743,7 @@ cgraph_update_edges_for_call_stmt (tree old_stmt, tree old_call, } } + /* Remove all callees from the node. */ void @@ -791,6 +799,7 @@ cgraph_release_function_body (struct cgraph_node *node) delete_tree_ssa (); delete_tree_cfg_annotations (); cfun->eh = NULL; + gimple_set_body (node->decl, NULL); current_function_decl = old_decl; pop_cfun(); } @@ -1006,8 +1015,8 @@ dump_cgraph_node (FILE *f, struct cgraph_node *node) fprintf (f, " needed"); else if (node->reachable) fprintf (f, " reachable"); - if (DECL_SAVED_TREE (node->decl)) - fprintf (f, " tree"); + if (gimple_body (node->decl)) + fprintf (f, " body"); if (node->output) fprintf (f, " output"); if (node->local.local) @@ -1147,7 +1156,7 @@ cgraph_function_possibly_inlined_p (tree decl) /* Create clone of E in the node N represented by CALL_EXPR the callgraph. */ struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, - tree call_stmt, gcov_type count_scale, int freq_scale, + gimple call_stmt, gcov_type count_scale, int freq_scale, int loop_nest, bool update_original) { struct cgraph_edge *new; @@ -1178,8 +1187,8 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, function's profile to reflect the fact that part of execution is handled by node. */ struct cgraph_node * -cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, int loop_nest, - bool update_original) +cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, + int loop_nest, bool update_original) { struct cgraph_node *new = cgraph_create_node (); struct cgraph_edge *e; @@ -1335,8 +1344,8 @@ cgraph_add_new_function (tree fndecl, bool lowered) { push_cfun (DECL_STRUCT_FUNCTION (fndecl)); current_function_decl = fndecl; - tree_register_cfg_hooks (); - tree_lowering_passes (fndecl); + gimple_register_cfg_hooks (); + tree_lowering_passes (fndecl); bitmap_obstack_initialize (NULL); if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl))) execute_pass_list (pass_early_local_passes.pass.sub); @@ -1357,7 +1366,7 @@ cgraph_add_new_function (tree fndecl, bool lowered) to expansion. */ push_cfun (DECL_STRUCT_FUNCTION (fndecl)); current_function_decl = fndecl; - tree_register_cfg_hooks (); + gimple_register_cfg_hooks (); if (!lowered) tree_lowering_passes (fndecl); bitmap_obstack_initialize (NULL); |