diff options
author | Jan Hubicka <jh@suse.cz> | 2003-07-12 03:07:40 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2003-07-12 01:07:40 +0000 |
commit | b58b11577a908528c37111404a161f744ca3a694 (patch) | |
tree | f057de333fbf0a3f853e92f6e52227b3713693c6 /gcc/tree-inline.c | |
parent | 27b8e366f8683050afd41e3b23d45f77591fa6a8 (diff) | |
download | gcc-b58b11577a908528c37111404a161f744ca3a694.zip gcc-b58b11577a908528c37111404a161f744ca3a694.tar.gz gcc-b58b11577a908528c37111404a161f744ca3a694.tar.bz2 |
cgraph.c (cgraph_max_uid): New global variable.
* cgraph.c (cgraph_max_uid): New global variable.
(cgraph_node): Set uid field.
(create_edge): Keep inline flags consistent.
(dump_cgraph): Dump more info.
* cgraph.h (struct cgraph_local_info): Remove inline_many and
can_inline_once; add inlinable, disgread_inline_limits, and self_insn
(struct cgraph_global_info): Add insns, calls, cloned_times,
will_be_output.
(struct cgraph_node): Add uid.
(struct cgraph_edge): Add inline_call.
(cgraph_max_uid, cgraph_inline_p): Declare.
* cgraph.c: Include params.h and fibheap.h
(cgraph_mark_functions_to_inline_once): Kill.
(INSNS_PER_CALL): New constant.
(ncalls_inlined, nfunctions_inlined, initial_insns, overall_insns): New
static variables.
(cgraph_finalize_function): Do not analyze inlining.
(cgraph_finalize_compilation_unit): Set inlining attributes.
(cgraph_mark_functions_to_output): More consistency checks.
(cgraph_optimize_function): Set current_function_decl to NULL.
(cgraph_expand_function): Use new inline flags.
(cgraph_postorder): Expand from cgraph_expand_functions.
(INLINED_TIMES, SET_INLINED_TIMES): New macros.
(cgraph_inlined_into, cgraph_inlined_callees,
cgraph_estimate_size_after_inlining, cgraph_estimate_growth,
cgraph_mark_inline, cgraph_check_inline_limits,
cgraph_default_inline_p, cgraph_decide_inling_of_small_functions,
cgraph_decide_inlining, cgraph_inline_p): New functions.
* params.def (PARAM_LARGE_FUNCTION_INSNS, PARAM_LARGE_FUNCTION_GROWTH,
PARAM_INLINE_UNIT_GROWTH): New parameters.
* tree-inline.c (struct inline_data): New field current_decl.
(expand_call_inline): Avoid forward declarations; use
inlinable_function_p.
(optimize_inline_calls): Set id.current_decl.
Co-Authored-By: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
From-SVN: r69262
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 3e68983f..3cfe702 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -106,6 +106,7 @@ typedef struct inline_data htab_t tree_pruner; /* Decl of function we are inlining into. */ tree decl; + tree current_decl; } inline_data; /* Prototypes. */ @@ -1145,6 +1146,10 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data) if (!fn) return NULL_TREE; + /* Turn forward declarations into real ones. */ + if (flag_unit_at_a_time) + fn = cgraph_node (fn)->decl; + /* If fn is a declaration of a function in a nested scope that was globally declared inline, we don't set its DECL_INITIAL. However, we can't blindly follow DECL_ABSTRACT_ORIGIN because the @@ -1159,9 +1164,9 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data) /* Don't try to inline functions that are not well-suited to inlining. */ - if ((!flag_unit_at_a_time || !DECL_SAVED_TREE (fn) - || !cgraph_global_info (fn)->inline_once) - && !inlinable_function_p (fn, id, 0)) + if (!DECL_SAVED_TREE (fn) + || (flag_unit_at_a_time && !cgraph_inline_p (id->current_decl, fn)) + || (!flag_unit_at_a_time && !inlinable_function_p (fn, id, 0))) { if (warn_inline && DECL_INLINE (fn) && !DID_INLINE_FUNC (fn) && !DECL_IN_SYSTEM_HEADER (fn)) @@ -1403,7 +1408,12 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data) } /* Recurse into the body of the just inlined function. */ - expand_calls_inline (inlined_body, id); + { + tree old_decl = id->current_decl; + id->current_decl = fn; + expand_calls_inline (inlined_body, id); + id->current_decl = old_decl; + } VARRAY_POP (id->fns); /* If we've returned to the top level, clear out the record of how @@ -1446,6 +1456,7 @@ optimize_inline_calls (tree fn) memset (&id, 0, sizeof (id)); id.decl = fn; + id.current_decl = fn; /* Don't allow recursion into FN. */ VARRAY_TREE_INIT (id.fns, 32, "fns"); VARRAY_PUSH_TREE (id.fns, fn); |