diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-09 22:33:35 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-08-09 22:33:35 +0000 |
commit | 01d15dc570c9d303e03ad64a0f66a38f5ce4b8bd (patch) | |
tree | ddb2d5519f49bc33648c25225b8b8ba84df590b9 /gcc/objc | |
parent | be6b7965bba925cee48dfe2af6c9a40e85c744c1 (diff) | |
download | gcc-01d15dc570c9d303e03ad64a0f66a38f5ce4b8bd.tar.gz |
Move constructor/destructor handling into target hooks.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44747 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/objc')
-rw-r--r-- | gcc/objc/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 66 |
2 files changed, 30 insertions, 38 deletions
diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in index bd2437dacc7..824870be132 100644 --- a/gcc/objc/Make-lang.in +++ b/gcc/objc/Make-lang.in @@ -77,7 +77,7 @@ $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in $(SHELL) $(srcdir)/move-if-change tmp-objc-prs.y $(srcdir)/objc/objc-parse.y objc-act.o : $(srcdir)/objc/objc-act.c \ - $(CONFIG_H) $(TREE_H) $(RTL_H) $(SYSTEM_H) $(EXPR_H) \ + $(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)/toplev.h $(srcdir)/flags.h $(srcdir)/objc/objc-act.h \ $(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h $(srcdir)/debug.h diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 67e4000252b..c0b14b5af29 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -57,6 +57,7 @@ Boston, MA 02111-1307, USA. */ #include "ggc.h" #include "cpplib.h" #include "debug.h" +#include "target.h" /* This is the default way of generating a method name. */ /* I am not sure it is really correct. @@ -1913,60 +1914,51 @@ build_module_descriptor () return NULL_RTX; { - tree parms, function_decl, decelerator, void_list_node_1; - tree function_type; - tree init_function_name = get_file_function_name ('I'); + tree parms, execclass_decl, decelerator, void_list_node_1; + tree init_function_name, init_function_decl; /* Declare void __objc_execClass (void *); */ void_list_node_1 = build_tree_list (NULL_TREE, void_type_node); - function_type - = build_function_type (void_type_node, - tree_cons (NULL_TREE, ptr_type_node, - void_list_node_1)); - function_decl = build_decl (FUNCTION_DECL, - get_identifier (TAG_EXECCLASS), - function_type); - DECL_EXTERNAL (function_decl) = 1; - DECL_ARTIFICIAL (function_decl) = 1; - TREE_PUBLIC (function_decl) = 1; - - pushdecl (function_decl); - rest_of_decl_compilation (function_decl, 0, 0, 0); - - parms - = build_tree_list (NULL_TREE, - build_unary_op (ADDR_EXPR, UOBJC_MODULES_decl, 0)); - decelerator = build_function_call (function_decl, parms); + execclass_decl = build_decl (FUNCTION_DECL, + get_identifier (TAG_EXECCLASS), + build_function_type (void_type_node, + tree_cons (NULL_TREE, ptr_type_node, + void_list_node_1))); + DECL_EXTERNAL (execclass_decl) = 1; + DECL_ARTIFICIAL (execclass_decl) = 1; + TREE_PUBLIC (execclass_decl) = 1; + pushdecl (execclass_decl); + rest_of_decl_compilation (execclass_decl, 0, 0, 0); + assemble_external (execclass_decl); /* void _GLOBAL_$I$<gnyf> () {objc_execClass (&L_OBJC_MODULES);} */ + init_function_name = get_file_function_name ('I'); start_function (void_list_node_1, build_nt (CALL_EXPR, init_function_name, - /* This has the format of the output - of get_parm_info. */ tree_cons (NULL_TREE, NULL_TREE, void_list_node_1), NULL_TREE), NULL_TREE); -#if 0 /* This should be turned back on later - for the systems where collect is not needed. */ - /* Make these functions nonglobal - so each file can use the same name. */ - TREE_PUBLIC (current_function_decl) = 0; -#endif - TREE_USED (current_function_decl) = 1; store_parm_decls (); - assemble_external (function_decl); - c_expand_expr_stmt (decelerator); + init_function_decl = current_function_decl; + TREE_PUBLIC (init_function_decl) = ! targetm.have_ctors_dtors; + TREE_USED (init_function_decl) = 1; + current_function_cannot_inline + = "static constructors and destructors cannot be inlined"; - TREE_PUBLIC (current_function_decl) = 1; + parms + = build_tree_list (NULL_TREE, + build_unary_op (ADDR_EXPR, UOBJC_MODULES_decl, 0)); + decelerator = build_function_call (execclass_decl, parms); + + c_expand_expr_stmt (decelerator); - function_decl = current_function_decl; finish_function (0); - return XEXP (DECL_RTL (function_decl), 0); + return XEXP (DECL_RTL (init_function_decl), 0); } } @@ -8360,8 +8352,8 @@ finish_objc () { /* Arrange for Objc data structures to be initialized at run time. */ rtx init_sym = build_module_descriptor (); - if (init_sym) - assemble_constructor (init_sym, DEFAULT_INIT_PRIORITY); + if (init_sym && targetm.have_ctors_dtors) + (* targetm.asm_out.constructor) (init_sym, DEFAULT_INIT_PRIORITY); } /* Dump the class references. This forces the appropriate classes |