aboutsummaryrefslogtreecommitdiff
path: root/gcc/objc/objc-act.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2001-11-12 00:02:36 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2001-11-12 00:02:36 +0000
commit8b0e9a7297b04510099c0cf5b30ad3c368bd9da0 (patch)
tree98496e95cb60a38b607a253c73d876f87f5d80fd /gcc/objc/objc-act.c
parent950a3816a7e54f132d34e5458474db5465b917ca (diff)
downloadgcc-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/objc/objc-act.c')
-rw-r--r--gcc/objc/objc-act.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index fa2842e..2d34588 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -58,6 +58,7 @@ Boston, MA 02111-1307, USA. */
#include "cpplib.h"
#include "debug.h"
#include "target.h"
+#include "varray.h"
#include "langhooks.h"
#include "langhooks-def.h"
@@ -469,6 +470,8 @@ static int print_struct_values = 0;
/* Each front end provides its own. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+static varray_type deferred_fns;
+
/* Post-switch processing. */
static void
objc_post_options ()
@@ -593,11 +596,36 @@ objc_init ()
objc_act_parse_init ();
c_parse_init ();
+
+ VARRAY_TREE_INIT (deferred_fns, 32, "deferred_fns");
+ ggc_add_tree_varray_root (&deferred_fns, 1);
+}
+
+/* Register a function tree, so that its optimization and conversion
+ to RTL is only done at the end of the compilation. */
+
+int
+defer_fn (fn)
+ tree fn;
+{
+ VARRAY_PUSH_TREE (deferred_fns, fn);
+
+ return 1;
}
void
finish_file ()
{
+ int i;
+
+ for (i = 0; i < VARRAY_ACTIVE_SIZE (deferred_fns); i++)
+ /* Don't output the same function twice. We may run into such
+ situations when an extern inline function is later given a
+ non-extern-inline definition. */
+ if (! TREE_ASM_WRITTEN (VARRAY_TREE (deferred_fns, i)))
+ c_expand_deferred_function (VARRAY_TREE (deferred_fns, i));
+ VARRAY_FREE (deferred_fns);
+
finish_objc (); /* Objective-C finalization */
if (gen_declaration_file)