diff options
author | Richard Henderson <rth@redhat.com> | 2003-08-29 16:21:13 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2003-08-29 16:21:13 -0700 |
commit | 4985cde3ef44391a43fd95c0972bf72c86e127cb (patch) | |
tree | d3ecf1a361ca516453ed6172c096bc2f280d5875 /gcc/c-objc-common.c | |
parent | fc2b84778bb51750c841f53b1ba30950935cc901 (diff) | |
download | gcc-4985cde3ef44391a43fd95c0972bf72c86e127cb.zip gcc-4985cde3ef44391a43fd95c0972bf72c86e127cb.tar.gz gcc-4985cde3ef44391a43fd95c0972bf72c86e127cb.tar.bz2 |
tree-optimize.c: New file.
gcc/
* tree-optimize.c: New file.
* Makefile.in (OBJS-archive): Add tree-optimize.o.
(tree-optimize.o): New.
* c-decl.c (store_parm_decls): Use allocate_struct_function.
(finish_function): Don't free_after_parsing or free_after_compilation.
(set_save_expr_context): Move to tree-optimize.c.
(c_expand_body_1): Use tree_rest_of_compilation.
* c-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New.
* objc/objc-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New.
* c-objc-common.c (expand_deferred_fns): Don't emit unused inlines;
iterate until closure.
* langhooks-def.h (LANG_HOOKS_RTL_EXPAND_START,
LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_RTL_EXPAND_END): New.
(LANG_HOOKS_RTL_EXPAND_INITIALIZER): New.
* langhooks.h (struct lang_hooks_for_rtl_expansion): New.
* toplev.h (tree_rest_of_compilation): Declare it.
gcc/cp/
* cp-lang.c (LANG_HOOKS_RTL_EXPAND_START): New.
(LANG_HOOKS_RTL_EXPAND_STMT): New.
* cp-tree.h (cxx_expand_function_start): Declare.
* decl.c (start_function): Use allocate_struct_function.
Move stmts_are_full_exprs_p assertion from expand_body.
Do not free_after_parsing or free_after_compilation.
(cxx_push_function_context): Move code to set struct function
data from genrtl_start_function.
* optimize.c (optimize_function): Don't inc/dec function_depth.
* semantics.c (expand_body): Use tree_rest_of_compilation.
(cxx_expand_function_start): Rename from genrtl_start_function,
omit bits done by tree_rest_of_compilation.
(genrtl_finish_function): Remove.
(clear_decl_rtl): Move to ../tree-optimize.c.
Co-Authored-By: Jason Merrill <jason@redhat.com>
From-SVN: r70933
Diffstat (limited to 'gcc/c-objc-common.c')
-rw-r--r-- | gcc/c-objc-common.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index b5f263f..16e0cff 100644 --- a/gcc/c-objc-common.c +++ b/gcc/c-objc-common.c @@ -289,20 +289,43 @@ static void expand_deferred_fns (void) { unsigned int i; + bool reconsider; - for (i = 0; i < VARRAY_ACTIVE_SIZE (deferred_fns); i++) + do { - tree decl = VARRAY_TREE (deferred_fns, i); - - if (! TREE_ASM_WRITTEN (decl)) + reconsider = false; + for (i = 0; i < VARRAY_ACTIVE_SIZE (deferred_fns); i++) { - /* For static inline functions, delay the decision whether to - emit them or not until wrapup_global_declarations. */ - if (! TREE_PUBLIC (decl)) - DECL_DEFER_OUTPUT (decl) = 1; + tree decl = VARRAY_TREE (deferred_fns, i); + + if (TREE_ASM_WRITTEN (decl)) + continue; + + /* "extern inline" says the symbol exists externally, + which means we should *never* expand it locally + unless we're actually inlining it. */ + /* ??? Why did we queue these in the first place? */ + if (DECL_DECLARED_INLINE_P (decl) && DECL_EXTERNAL (decl)) + continue; + + /* With flag_keep_inline_functions, we're emitting everything, + so we never need to reconsider. */ + if (flag_keep_inline_functions) + ; + /* Must emit all public functions. C doesn't have COMDAT + functions, so we don't need to check that, like C++. */ + else if (TREE_PUBLIC (decl)) + reconsider = true; + /* Must emit if the symbol is referenced. */ + else if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) + reconsider = true; + else + continue; + c_expand_deferred_function (decl); } } + while (reconsider); deferred_fns = 0; } |