diff options
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in index 9b777d4289d..5fec773a994 100644 --- a/gcc/objc/Make-lang.in +++ b/gcc/objc/Make-lang.in @@ -78,7 +78,7 @@ $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in objc-act.o : $(srcdir)/objc/objc-act.c \ $(CONFIG_H) $(TREE_H) $(RTL_H) $(SYSTEM_H) $(EXPR_H) $(TARGET_H) \ - $(srcdir)/c-tree.h $(srcdir)/c-common.h $(srcdir)/c-lex.h \ + $(srcdir)/c-tree.h $(srcdir)/c-common.h $(srcdir)/c-lex.h $(VARRAY_H) \ $(srcdir)/toplev.h $(srcdir)/flags.h $(srcdir)/objc/objc-act.h \ $(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h $(srcdir)/debug.h \ $(srcdir)/langhooks.h $(srcdir)/langhooks-def.h diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index fa2842eda6e..2d345882c2d 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) |