diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2001-11-12 00:02:36 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2001-11-12 00:02:36 +0000 |
commit | 8b0e9a7297b04510099c0cf5b30ad3c368bd9da0 (patch) | |
tree | 98496e95cb60a38b607a253c73d876f87f5d80fd /gcc/c-decl.c | |
parent | 950a3816a7e54f132d34e5458474db5465b917ca (diff) | |
download | gcc-8b0e9a7297b04510099c0cf5b30ad3c368bd9da0.zip gcc-8b0e9a7297b04510099c0cf5b30ad3c368bd9da0.tar.gz gcc-8b0e9a7297b04510099c0cf5b30ad3c368bd9da0.tar.bz2 |
Makefile.in (c-lang.o): Depend on $(VARRAY_H).
* Makefile.in (c-lang.o): Depend on $(VARRAY_H).
* c-decl.c (c_expand_body): Take argument can_defer_p. Use it
to decide whether to defer a function.
(finish_function): Adjust.
(c_expand_deferred_function): New function.
* c-lang.c (deferred_fns): New variable.
(c_init): Initialize it, and mark it as a root.
(defer_fn): New function.
(finish_file): Expand all deferred functions.
* c-tree.h (defer_fn): Declare.
(c_expand_deferred_function): Likewise.
* objc/Make-lang.in (objc-act.o): Depend on $(VARRAY_H).
* objc-act.c (deferred_fns): New variable.
(objc_init): Initialize it, and mark it as a root.
(defer_fn): New function.
(finish_file): Expand all deferred functions.
From-SVN: r46933
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 8f8edf4..0e4cf0c 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -279,7 +279,7 @@ static tree grokdeclarator PARAMS ((tree, tree, enum decl_context, static tree grokparms PARAMS ((tree, int)); static void layout_array_type PARAMS ((tree)); static tree c_make_fname_decl PARAMS ((tree, int)); -static void c_expand_body PARAMS ((tree, int)); +static void c_expand_body PARAMS ((tree, int, int)); /* C-specific option variables. */ @@ -6748,7 +6748,7 @@ finish_function (nested) if (! nested) { /* Generate RTL for the body of this function. */ - c_expand_body (fndecl, nested); + c_expand_body (fndecl, nested, 1); /* Let the error reporting routines know that we're outside a function. For a nested function, this value is used in pop_c_function_context and then reset via pop_function_context. */ @@ -6756,14 +6756,25 @@ finish_function (nested) } } +/* Generate the RTL for a deferred function FNDECL. */ + +void +c_expand_deferred_function (fndecl) + tree fndecl; +{ + c_expand_body (fndecl, 0, 0); + current_function_decl = NULL; +} + /* Generate the RTL for the body of FNDECL. If NESTED_P is non-zero, then we are already in the process of generating RTL for another - function. */ + function. If can_defer_p is zero, we won't attempt to defer the + generation of RTL. */ static void -c_expand_body (fndecl, nested_p) +c_expand_body (fndecl, nested_p, can_defer_p) tree fndecl; - int nested_p; + int nested_p, can_defer_p; { int uninlinable = 1; @@ -6781,6 +6792,17 @@ c_expand_body (fndecl, nested_p) function completely. */ uninlinable = ! tree_inlinable_function_p (fndecl); + if (! uninlinable && can_defer_p + /* Save function tree for inlining. Should return 0 if the + language does not support function deferring or the + function could not be deferred. */ + && defer_fn (fndecl)) + { + /* Let the back-end know that this funtion exists. */ + (*debug_hooks->deferred_inline_function) (fndecl); + return; + } + /* Then, inline any functions called in it. */ optimize_inline_calls (fndecl); } @@ -7202,7 +7224,7 @@ c_expand_decl_stmt (t) if (TREE_CODE (decl) == FUNCTION_DECL && DECL_CONTEXT (decl) == current_function_decl && DECL_SAVED_TREE (decl)) - c_expand_body (decl, /*nested_p=*/1); + c_expand_body (decl, /*nested_p=*/1, /*can_defer_p=*/0); } /* Return the IDENTIFIER_GLOBAL_VALUE of T, for use in common code, since |