gcc/gcc/tree-inline.h

43 lines
1.4 KiB
C
Raw Normal View History

/* Tree inlining hooks and declarations.
Copyright 2001, 2003 Free Software Foundation, Inc.
Contributed by Alexandre Oliva <aoliva@redhat.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef GCC_TREE_INLINE_H
#define GCC_TREE_INLINE_H
/* Function prototypes. */
void optimize_inline_calls (tree);
tree.h (DID_INLINE_FUNC): Remove macro. 2003-08-05 Steven Bosscher <steven@gcc.gnu.org> * tree.h (DID_INLINE_FUNC): Remove macro. (DECL_DECLARED_INLINE_P): Move from c-tree.h and cp/cp-tree.h, add tree check for FUNCTION_DECL. (DECL_ESTIMATED_INSNS): Move from c-common.h and java/java-tree.h. (struct tree_decl): Rename inlined_function_flag to declared_inline_flag. * c-common.h (c_lang_decl): Remove. (DECL_ESTIMATED_INSNS): Remove. * c-tree.h (struct lang_decl): Don't include c_lang_decl. (DECL_DECLARED_INLINE_P): Remove. * c-decl.c (grokdeclarator): Update comment. With -finline-functions, do not reset DECL_DECLARED_INLINE_P. Don't use DID_INLINE_FUNC. (finish_function): Make uninlinable a bool. Fixup call to tree_inlinable_function_p() and fix some code style issues. * cgraph.h (disgread_inline_limits): Fix spelling: `disregard'. * cgraph.c (dump_cgraph): Likewise. * cgraphunit.c (cgraph_decide_inlining): Likewise (cgraph_finalize_compilation_unit): Likewise. Also update call to tree_inlinable_function_p(). (cgraph_default_inline_p): Don't use DID_INLINE_FUNC. Instead look at DECL_DECLARED_INLINE and reverse logic. * print-tree.c (print_node): Likewise. * toplev.c (rest_of_handle_inlining): Don't use DID_INLINE_FUNC. * tree-inline.h (tree_inlinable_function_p): Make a bool. Update prototype. * tree-inline.c (inlinable_function_p): Split up in this function to check for basic inlining inhibiting conditions, and new limits_allow_inlining() function. Warn if inlining is impossible because the inline candidate calls alloca or uses sjlj exceptions. (limits_allow_inlining): this new function to check if the inlining limits are satisfied. Throttle from currfn_max_inline_insns, not from MAX_INLINE_INSNS_SINGLE. The latter only makes sense if MAX_INLINE_INSNS_AUTO and MAX_INLINE_INSNS_SINGLE are equal. Update prototypes. (tree_inlinable_function_p): Make a bool. Update call to inlinable_function_p (expand_call_inline): Use limits_allow_inlining() when not in unit-at-a-time mode to decide on inlining. Don't use DID_INLINE_FUNC, instead see if the function was declared `inline'. cp/ * cp-tree.h (struct lang_decl): Don't include c_lang_decl. (DECL_DECLARED_INLINE_P): Remove. * decl2.c (import_export_decl): Only look at DECL_DECLARED_INLINE_P if decl is a FUNCTION_DECL. This never made sense, but now it is required to avoid a tree check failure. * decl.c (grokfndecl): Don't touch DID_INLINE_FUNC. * optimize.c (maybe_clone_body): Likewise. java/ * java-tree.h (DECL_ESTIMATED_INSNS): Remove. From-SVN: r70174
2003-08-05 16:11:53 +02:00
bool tree_inlinable_function_p (tree);
tree copy_tree_r (tree*, int*, void*);
void clone_body (tree, tree, void*);
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
2004-04-02 01:28:15 +02:00
tree save_body (tree, tree *);
c-decl.c (grokdeclarator): Don't frob current_function_decl around variable_size. * c-decl.c (grokdeclarator): Don't frob current_function_decl around variable_size. (set_decl_nonlocal): Remove. (store_parm_decls): Add stmts for pending sizes. * calls.c (calls_function, calls_function_1): Remove. (precompute_arguments): Don't call it. * cfgexpand.c (set_save_expr_context): Remove. (tree_expand_cfg): Don't call it. * dwarf2out.c (add_bound_info): Don't handle SAVE_EXPR. (dwarf2out_finish): Likewise. * expr.c (emit_block_move): Adjust addresses to BLKmode. (store_constructor): Don't pre-evaluate SAVE_EXPR. (safe_from_p): Don't queue SAVE_EXPRs. (expand_expr_real_1 <case SAVE_EXPR>): Rewrite to expect, or build plain VAR_DECLs. * fold-const.c (twoval_comparison_p): Don't look at SAVE_EXPR_RTL. (fold): Likewise. (fold_checksum_tree): Don't special-case SAVE_EXPR. * function.c (free_after_compilation): Don't clear x_save_expr_regs. (put_var_into_stack): Don't handle SAVE_EXPR. (gen_mem_addressof): Likewise. * function.h (struct function): Remove x_save_expr_regs. (save_expr_regs): Remove. * gengtype.c (adjust_field_tree_exp): Don't special-case SAVE_EXPR. * print-tree.c (print_node): Don't dump SAVE_EXPR_NOPLACEHOLDER. * stor-layout.c (variable_size): Don't set it. (force_type_save_exprs, force_type_save_exprs_1): Remove. * tree-inline.c (remap_save_expr): Remove fn argument. Update all callers. Don't set SAVE_EXPR_CONTEXT. * tree-inline.h (remap_save_expr): Update decl. * tree.c (save_expr): Update build size. (first_rtl_op): Don't handle SAVE_EXPR. (unsave_expr_1, contains_placeholder_p): Likewise. (decl_function_context): Likewise. * tree.def (SAVE_EXPR): Remove args 1 and 2. * tree.h (SAVE_EXPR_CONTEXT, SAVE_EXPR_RTL): Remove. (SAVE_EXPR_NOPLACEHOLDER, SAVE_EXPR_PERSISTENT_P): Remove. cp/ * tree.c (cp_unsave_r): Update remap_save_expr call. java/ * jcf-write.c (generate_bytecode_insns <case SAVE_EXPR>): Rewrite. From-SVN: r84036
2004-07-03 02:15:50 +02:00
void remap_save_expr (tree*, void*, int*);
int estimate_num_insns (tree expr);
/* 0 if we should not perform inlining.
1 if we should expand functions calls inline at the tree level.
2 if we should consider *all* functions to be inline
candidates. */
extern int flag_inline_trees;
#endif /* GCC_TREE_INLINE_H */