diff options
author | Jan Hubicka <jh@suse.cz> | 2004-04-02 01:28:15 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2004-04-01 23:28:15 +0000 |
commit | 18c6ada9b2ee27a40db256f4c32779fc25872050 (patch) | |
tree | 77aa1595ee2a84a8ea2004429140d1fb8bcc2796 /gcc/cgraph.h | |
parent | e86327772eaa1f4b2c352a411afa195b30ff0c8f (diff) | |
download | gcc-18c6ada9b2ee27a40db256f4c32779fc25872050.zip gcc-18c6ada9b2ee27a40db256f4c32779fc25872050.tar.gz gcc-18c6ada9b2ee27a40db256f4c32779fc25872050.tar.bz2 |
cgraph.c: Add overall comment.
* cgraph.c: Add overall comment.
(cgraph_inline_hash): New global variable.
(cgraph_create_node): Break out from ...
(cgraph_node): ... here.
(cgraph_edge): New function.
(cgraph_create_edge): New CALL_EXPR argument; some sanity checking.
(cgraph_remove_edge): Accept edge, intead of source and destination.
(cgraph_redirect_edge_callee): New.
(cgraph_remove_node): Update all new datastructures.
(cgraph_record_call, cgraph_remove_call): Kill.
(dump_cgraph_node): Break out from ... ; dump new datastructures.
(dump_cgraph): ... here.
(cgraph_function_possibly_inlined_p): Use new hashtable.
(cgraph_clone_edge, cgraph_clone_node): New.
* cgraph.h: Include hashtab.h
(struct cgraph_global_info): Kill cloned_times, inline_once, will_be_output
fields, add inlined_to pointer.
(cgraph_node): Add pointer to next_clone.
(cgraph_remove_edge, cgraph_create_edge): Update prototype.
(cgraph_remove_call, cgraph_record_call): Kill.
(cgraph_inline_hash): Declare.
(dump_cgraph_node, cgraph_edge, cg4raph_clone_edge, cgraph_clone_node,
cgraph_redirect_edge_callee): Declare.
(cgraph_create_edges, cgraph_inline_p): Update prorotype.
(cgraph_preserve_function_body_p, verify_cgraph, verify_cgraph_node,
cgraph_mark_inline_edge, cgraph_clone_inlined_nodes): Declare.
* cgraphunit.c: Add overall comment.
(cgraph_optimize_function): Kill.
(cgraph_assemble_pending_functions): Do not assemble inline clones.
(cgraph_finalize_function): Update call of cgraph_remove_node
(record_call_1): Record call sites.
(cgraph_create_edges): Accept node instead of decl argument.
(error_found): New static variable.
(verify_cgraph_node_1, verify_cgraph_node, verify_cgraph): New functions.
(cgraph_analyze_function): Update for new datastructures.
(cgraph_finalize_compilation_unit): Plug memory leak.
(cgraph_optimize_function): Kill.
(cgraph_expand_function): Do not use cgraph_optimize_function.
(INLINED_TIMES, SET_INLINED_TIMES, cgraph_inlined_into,
cgraph_inlined_callees): Kill.
(cgraph_remove_unreachable_nodes): Verify cgraph; update handling of
clones.
(estimate_growth): Simplify.
(cgraph_clone_inlined_nodes): New function.
(cgraph_mark_inline_edge): Re-implement.
(cgraph_mark_inline): Likewise.
(cgraph_check_inline_limits): Simplify.
(cgraph_recursive_inlining_p): New.
(update_callee_keys): Break out from ...
(cgraph_decide_inlining_of_small_functions): ... here; simplify.
(cgraph_decide_inlining, cgraph_decide_inlining_incrementally):
Likewise.
(cgraph_expand_all_functions): Remove inline clones from the ordered
list.
(cgraph_preserve_function_body_p): New predicate.
(cgraph_optimize): Verify cgraph.
* function.h (struct function): Add fields saved_tree/saved_args.
* timevar.def (TV_CGRAPH_VERIFY): Use verifier.
* toplev.c (rest_of_compilation): Do not free cfun.
* tree-inline.c: Include function.h
(struct inline_data): Add saving_p field; replace decl/current_decl by
node/current_node.
(insert_decl_map): New function.
(copy_body_r): Handle saving; update cgraph datastructure.
(copy_body): Handle recursive inlining.
(initialize_inlined_parameters): Likewise.
(expand_call_inline): Propagate node attributes; update cgraph.
(optimize_inline_calls): Verify that datastructure still match.
(save_body): New function.
* tree-inline.h (save_body): New.
* tree-optimize.c (tree_rest_of_compilation): preserve function body; do inlining.
* langhooks-def.c (LANG_HOOKS_UPDATE_DECL_AFTER_SAVING): New.
* langhooks.c (lang_hooks): Add update_decl_after_saving.
* cp-lang. (LANG_HOOKS_UPDATE_DECL_AFTER_SAVING): Define.
* cp-tree.h (cp_update_decl_after_saving): Declare.
* tree.c (cp_update_decl_after_saving): Define.
* Make-lang.in (com.o): Add dependnecy on function.h
* com.c: Include function.h
(finish_function): Clear DECL_STRUCT_FUNCTION.
* utils.c: Include function.h
(end_subprog_body): Clear DECL_STRUCT_FUNCTION.
From-SVN: r80334
Diffstat (limited to 'gcc/cgraph.h')
-rw-r--r-- | gcc/cgraph.h | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h index adbac3b..617861b 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -21,6 +21,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef GCC_CGRAPH_H #define GCC_CGRAPH_H +#include "hashtab.h" /* Information about the function collected locally. Available after function is analyzed. */ @@ -50,21 +51,13 @@ struct cgraph_local_info GTY(()) struct cgraph_global_info GTY(()) { + /* For inline clones this points to the function they will be inlined into. */ + struct cgraph_node *inlined_to; + /* Estimated size of the function after inlining. */ int insns; - /* Number of times given function will be cloned during output. */ - int cloned_times; - - /* Set when the function will be inlined exactly once. */ - bool inline_once; - - /* Set to true for all reachable functions before inlining is decided. - Once we inline all calls to the function and the function is local, - it is set to false. */ - bool will_be_output; - - /* Set iff at least one of the caller edges has inline_call flag set. */ + /* Set iff the function has been inlined at least once. */ bool inlined; }; @@ -97,6 +90,8 @@ struct cgraph_node GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) struct cgraph_node *next_nested; /* Pointer to the next function in cgraph_nodes_queue. */ struct cgraph_node *next_needed; + /* Pointer to the next clone. */ + struct cgraph_node *next_clone; PTR GTY ((skip)) aux; struct cgraph_local_info local; @@ -117,12 +112,14 @@ struct cgraph_node GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) bool output; }; -struct cgraph_edge GTY(()) +struct cgraph_edge GTY((chain_next ("%h.next_caller"))) { struct cgraph_node *caller; struct cgraph_node *callee; struct cgraph_edge *next_caller; struct cgraph_edge *next_callee; + tree call_expr; + PTR GTY ((skip (""))) aux; /* When NULL, inline this call. When non-NULL, points to the explanation why function was not inlined. */ const char *inline_failed; @@ -155,27 +152,34 @@ extern FILE *cgraph_dump_file; extern GTY(()) int cgraph_varpool_n_nodes; extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue; +extern GTY((param_is (union tree_node))) htab_t cgraph_inline_hash; /* In cgraph.c */ void dump_cgraph (FILE *); -void cgraph_remove_edge (struct cgraph_node *, struct cgraph_node *); -void cgraph_remove_call (tree, tree); +void dump_cgraph_node (FILE *, struct cgraph_node *); +void cgraph_remove_edge (struct cgraph_edge *); void cgraph_remove_node (struct cgraph_node *); -struct cgraph_edge *cgraph_record_call (tree, tree); +struct cgraph_edge *cgraph_create_edge (struct cgraph_node *, + struct cgraph_node *, + tree); struct cgraph_node *cgraph_node (tree decl); +struct cgraph_edge *cgraph_edge (struct cgraph_node *, tree call_expr); struct cgraph_node *cgraph_node_for_identifier (tree id); bool cgraph_calls_p (tree, tree); struct cgraph_local_info *cgraph_local_info (tree); struct cgraph_global_info *cgraph_global_info (tree); struct cgraph_rtl_info *cgraph_rtl_info (tree); const char * cgraph_node_name (struct cgraph_node *); +struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *, struct cgraph_node *, tree); +struct cgraph_node * cgraph_clone_node (struct cgraph_node *); struct cgraph_varpool_node *cgraph_varpool_node (tree decl); struct cgraph_varpool_node *cgraph_varpool_node_for_identifier (tree id); void cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *); void cgraph_varpool_finalize_decl (tree); bool cgraph_varpool_assemble_pending_decls (void); +void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *); bool cgraph_function_possibly_inlined_p (tree); @@ -183,10 +187,15 @@ bool cgraph_function_possibly_inlined_p (tree); bool cgraph_assemble_pending_functions (void); void cgraph_finalize_function (tree, bool); void cgraph_finalize_compilation_unit (void); -void cgraph_create_edges (tree, tree); +void cgraph_create_edges (struct cgraph_node *, tree); void cgraph_optimize (void); void cgraph_mark_needed_node (struct cgraph_node *); void cgraph_mark_reachable_node (struct cgraph_node *); -bool cgraph_inline_p (tree, tree, const char **reason); +bool cgraph_inline_p (struct cgraph_edge *, const char **reason); +bool cgraph_preserve_function_body_p (tree); +void verify_cgraph (void); +void verify_cgraph_node (struct cgraph_node *); +void cgraph_mark_inline_edge (struct cgraph_edge *e); +void cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate); #endif /* GCC_CGRAPH_H */ |