]> gcc.gnu.org Git - gcc.git/commitdiff
varasm.c (assemble_constructor): Take a symbol_ref and a priority instead of a bare...
authorRichard Henderson <rth@redhat.com>
Tue, 7 Aug 2001 00:13:35 +0000 (17:13 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 7 Aug 2001 00:13:35 +0000 (17:13 -0700)
        * varasm.c (assemble_constructor): Take a symbol_ref and a
        priority instead of a bare string.  Move priority handling
        here from cp/decl2.c.
        * output.h: Update decls.

        * c-decl.c (c_expand_body): Update calls to assemble_constructor
        and assemble_destructor.
        * profile.c (output_func_start_profiler): Likewise.
        * objc/objc-act.c (finish_objc): Likewise.
        (build_module_descriptor): Return the symbol not the symbol name.

        * ch/grant.c (chill_finish_compile): Pass a symbol_ref and priority
        to assemble_constructor.

        * cp/decl2.c (finish_objects): Pass a symbol_ref and priority to
        assemble_{constructor,destructor}.  Remove priority handling.

        * java/class.c (emit_register_classes): Pass a symbol_ref and priority
        to assemble_constructor.

From-SVN: r44678

12 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/ch/ChangeLog
gcc/ch/grant.c
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/java/ChangeLog
gcc/java/class.c
gcc/objc/objc-act.c
gcc/output.h
gcc/profile.c
gcc/varasm.c

index 2573197914203704f5b7c335b283ddd64caf1b29..1e18e1e5156e338078329b9994df4de72daafe18 100644 (file)
@@ -1,3 +1,16 @@
+2001-08-06  Richard Henderson  <rth@redhat.com>
+
+       * varasm.c (assemble_constructor): Take a symbol_ref and a
+       priority instead of a bare string.  Move priority handling
+       here from cp/decl2.c.
+       * output.h: Update decls.
+
+       * c-decl.c (c_expand_body): Update calls to assemble_constructor
+       and assemble_destructor.
+       * profile.c (output_func_start_profiler): Likewise.
+       * objc/objc-act.c (finish_objc): Likewise.
+       (build_module_descriptor): Return the symbol not the symbol name.
+
 2001-08-06  David Edelsohn  <edelsohn@gnu.org>
 
        * config/rs6000/darwin.h (DOUBLE_INT_ASM_OP): Add whitespace.
index b57e6d4f18c3cc9269a0d6e382b3436f9ab4b3ad..6c5056f875eab26aa8687f25c31dfaeebac1b3a4 100644 (file)
@@ -6781,9 +6781,10 @@ c_expand_body (fndecl, nested_p)
        static_ctors = tree_cons (NULL_TREE, fndecl, static_ctors);
       else
 #endif
-       assemble_constructor (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)));
-
+       assemble_constructor (XEXP (DECL_RTL (fndecl), 0),
+                             DEFAULT_INIT_PRIORITY);
     }
+
   if (DECL_STATIC_DESTRUCTOR (fndecl))
     {
 #ifndef ASM_OUTPUT_DESTRUCTOR
@@ -6791,7 +6792,8 @@ c_expand_body (fndecl, nested_p)
        static_dtors = tree_cons (NULL_TREE, fndecl, static_dtors);
       else
 #endif
-       assemble_destructor (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (fndecl)));
+       assemble_destructor (XEXP (DECL_RTL (fndecl), 0),
+                            DEFAULT_INIT_PRIORITY);
     }
 
   if (nested_p)
index d2421059f411cb4c6712ccb75f5f2d1fbf3a2724..b1c048b64ea5c74665972f16b5a50e3451d1a4db 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-06  Richard Henderson  <rth@redhat.com>
+
+       * grant.c (chill_finish_compile): Pass a symbol_ref and priority
+       to assemble_constructor.
+
 2001-07-19  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * Makefile.in (lex.o): No dependence on dwarfout.h.
index 29e7ddc1bb56bb040dcb29fcb23d7798567096af..c10eb99dc20fee33a27dbe180e3a70dc65279910 100644 (file)
@@ -3048,7 +3048,8 @@ chill_finish_compile ()
 
       if (pass == 2)
        {
-         assemble_constructor (IDENTIFIER_POINTER (chill_init_name));
+         assemble_constructor (XEXP (DECL_RTL (chill_init_function), 0),
+                               DEFAULT_INIT_PRIORITY);
          globalize_decl (chill_init_function);
        }
 
index 470fd8211884ea488484ea796eb3cb120f90152a..1b3cceb301564f5c4aa21aa6c831feeba21f38f0 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-06  Richard Henderson  <rth@redhat.com>
+
+       * decl2.c (finish_objects): Pass a symbol_ref and priority to
+       assemble_{constructor,destructor}.  Remove priority handling.
+
 2001-08-05  Gabriel Dos Reis  <gdr@merlin.codesourcery.com>
 
        Don't allow template-id in using-declaration.
index d35ab7195d28cbe8bc5e7f651e966c20a4fc157f..be02224557f7a63be676b0e7ff4e2df07d181f60 100644 (file)
@@ -2839,8 +2839,8 @@ finish_objects (method_type, initp, body)
      int method_type, initp;
      tree body;
 {
-  const char *fnname;
   tree fn;
+  rtx fnsym;
 
   /* Finish up.  */
   finish_compound_stmt (/*has_no_scope=*/0, body);
@@ -2853,31 +2853,11 @@ finish_objects (method_type, initp, body)
   if (flag_syntax_only)
     return;
 
-  fnname = XSTR (XEXP (DECL_RTL (fn), 0), 0);
-  if (initp == DEFAULT_INIT_PRIORITY)
-    {
-      if (method_type == 'I')
-       assemble_constructor (fnname);
-      else
-       assemble_destructor (fnname);
-    }
-#if defined (ASM_OUTPUT_CONSTRUCTOR)
-  /* If we're using init priority we can't use assemble_*tor, but on ELF
-     targets we can stick the references into named sections for GNU ld
-     to collect.  */
-  else if (targetm.have_named_sections)
-    {
-      char buf[15];
-      sprintf (buf, ".%ctors.%.5u", method_type == 'I' ? 'c' : 'd',
-              /* invert the numbering so the linker puts us in the proper
-                 order; constructors are run from right to left, and the
-                 linker sorts in increasing order.  */
-              MAX_INIT_PRIORITY - initp);
-      named_section (NULL_TREE, buf, 0);
-      assemble_integer (XEXP (DECL_RTL (fn), 0),
-                       POINTER_SIZE / BITS_PER_UNIT, 1);
-    }
-#endif
+  fnsym = XEXP (DECL_RTL (fn), 0);
+  if (method_type == 'I')
+    assemble_constructor (fnsym, initp);
+  else
+    assemble_destructor (fnsym, initp);
 }
 
 /* The names of the parameters to the function created to handle
index 31c9785ac3d1e3bfc97aebbe5af8e4280b40025f..5273aaf5cfa0a23a0c8e2397becf0a5fca09b33f 100644 (file)
@@ -1,3 +1,8 @@
+2001-08-06  Richard Henderson  <rth@redhat.com>
+
+        * class.c (emit_register_classes): Pass a symbol_ref and priority
+       to assemble_constructor.
+
 2001-08-02  Alexandre Petit-Bianco  <apbianco@redhat.com>
 
        * java-tree.h (all_class_filename): New macro.
index 3b56f53ff51f4202722347b7b531eccc0bcc80cc..3cb8aa4e3983bb97c40b71932c8d718acad2dc0b 100644 (file)
@@ -1903,7 +1903,7 @@ emit_register_classes ()
     flag_inline_functions = saved_flag;
   }
   current_function_decl = NULL_TREE;
-  assemble_constructor (IDENTIFIER_POINTER (init_name));
+  assemble_constructor (XEXP (DECL_RTL (init_decl), 0), DEFAULT_INIT_PRIORITY);
 }
 
 void
index 03c3ae4f2627ba80e14ea54f9d911d882a5f8b76..67e4000252b85ed07109536109205dbf12a0d249 100644 (file)
@@ -165,7 +165,7 @@ static void objc_post_options                       PARAMS ((void));
 
 static void synth_module_prologue              PARAMS ((void));
 static tree build_constructor                  PARAMS ((tree, tree));
-static const char *build_module_descriptor      PARAMS ((void));
+static rtx build_module_descriptor             PARAMS ((void));
 static tree init_module_descriptor             PARAMS ((tree));
 static tree build_objc_method_call             PARAMS ((int, tree, tree,
                                                       tree, tree, tree));
@@ -1836,13 +1836,12 @@ init_module_descriptor (type)
 
 /* Write out the data structures to describe Objective C classes defined.
    If appropriate, compile and output a setup function to initialize them.
-   Return a string which is the name of a function to call to initialize
-   the Objective C data structures for this file (and perhaps for other files
-   also).
+   Return a symbol_ref to the function to call to initialize the Objective C
+   data structures for this file (and perhaps for other files also).
 
    struct objc_module { ... } _OBJC_MODULE = { ... };   */
 
-static const char *
+static rtx
 build_module_descriptor ()
 {
   tree decl_specs, field_decl, field_decl_chain;
@@ -1911,7 +1910,7 @@ build_module_descriptor ()
      way of generating the requisite code.  */
 
   if (flag_next_runtime)
-    return 0;
+    return NULL_RTX;
 
   {
     tree parms, function_decl, decelerator, void_list_node_1;
@@ -1967,8 +1966,7 @@ build_module_descriptor ()
     function_decl = current_function_decl;
     finish_function (0);
 
-    /* Return the name of the constructor function.  */
-    return XSTR (XEXP (DECL_RTL (function_decl), 0), 0);
+    return XEXP (DECL_RTL (function_decl), 0);
   }
 }
 
@@ -8361,9 +8359,9 @@ finish_objc ()
       || meth_var_names_chain || meth_var_types_chain || sel_ref_chain)
     {
       /* Arrange for Objc data structures to be initialized at run time.  */
-      const char *init_name = build_module_descriptor ();
-      if (init_name)
-       assemble_constructor (init_name);
+      rtx init_sym = build_module_descriptor ();
+      if (init_sym)
+       assemble_constructor (init_sym, DEFAULT_INIT_PRIORITY);
     }
 
   /* Dump the class references.  This forces the appropriate classes
index f28c7afe2a62c53a9bb563aebd92c4e337099ae3..574d6f654b2ccca483820978d5e45abe1a8c0514 100644 (file)
@@ -257,16 +257,14 @@ extern void assemble_variable             PARAMS ((tree, int, int, int));
 extern void assemble_external          PARAMS ((tree));
 #endif /* TREE_CODE */
 
-/* Record an element in the table of global destructors.
-   How this is done depends on what sort of assembler and linker
-   are in use.
-
-   NAME should be the name of a global function to be called
-   at exit time.  This name is output using assemble_name.  */
-extern void assemble_destructor                PARAMS ((const char *));
+#ifdef RTX_CODE
+/* Record an element in the table of global destructors.  The argument
+   should be a SYMBOL_REF of the function to be called.  */
+extern void assemble_destructor                PARAMS ((rtx, int));
 
 /* Likewise for global constructors.  */
-extern void assemble_constructor       PARAMS ((const char *));
+extern void assemble_constructor       PARAMS ((rtx, int));
+#endif
 
 /* Likewise for entries we want to record for garbage collection.
    Garbage collection is still under development.  */
index b3ecf4c4429f06dfbb28847867de930c0f4fafa8..a872ab850c6b25625251579218c98259557c7c77 100644 (file)
@@ -1147,5 +1147,5 @@ output_func_start_profiler ()
     fflush (asm_out_file);
   current_function_decl = NULL_TREE;
 
-  assemble_constructor (IDENTIFIER_POINTER (DECL_NAME (fndecl)));
+  assemble_constructor (XEXP (DECL_RTL (fndecl), 0), DEFAULT_INIT_PRIORITY);
 }
index d574a80253987e86ac55f5f16872c6bcb3819e62..b7335d3b04588c7a2947978e1fc6de40502f22ba 100644 (file)
@@ -813,17 +813,34 @@ assemble_asm (string)
   fprintf (asm_out_file, "\t%s\n", TREE_STRING_POINTER (string));
 }
 
-/* Record an element in the table of global destructors.
-   How this is done depends on what sort of assembler and linker
-   are in use.
-
-   NAME should be the name of a global function to be called
-   at exit time.  This name is output using assemble_name.  */
+/* Record an element in the table of global destructors.  The argument
+   should be a SYMBOL_REF of the function to be called.  */
 
 void
-assemble_destructor (name)
-     const char *name;
+assemble_destructor (symbol, priority)
+     rtx symbol;
+     int priority;
 {
+  const char *name;
+
+  if (GET_CODE (symbol) != SYMBOL_REF)
+    abort ();
+  name = XSTR (symbol, 0);
+
+  if (priority != DEFAULT_INIT_PRIORITY
+      && targetm.have_named_sections)
+    {
+      char buf[15];
+      sprintf (buf, ".dtors.%.5u",
+              /* Invert the numbering so the linker puts us in the proper
+                 order; constructors are run from right to left, and the
+                 linker sorts in increasing order.  */
+              MAX_INIT_PRIORITY - priority);
+      named_section_flags (buf, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT);
+      assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+      return;
+    }
+
 #ifdef ASM_OUTPUT_DESTRUCTOR
   ASM_OUTPUT_DESTRUCTOR (asm_out_file, name);
 #else
@@ -841,9 +858,30 @@ assemble_destructor (name)
 /* Likewise for global constructors.  */
 
 void
-assemble_constructor (name)
-     const char *name;
+assemble_constructor (symbol, priority)
+     rtx symbol;
+     int priority;
 {
+  const char *name;
+
+  if (GET_CODE (symbol) != SYMBOL_REF)
+    abort ();
+  name = XSTR (symbol, 0);
+
+  if (priority != DEFAULT_INIT_PRIORITY
+      && targetm.have_named_sections)
+    {
+      char buf[15];
+      sprintf (buf, ".ctors.%.5u",
+              /* Invert the numbering so the linker puts us in the proper
+                 order; constructors are run from right to left, and the
+                 linker sorts in increasing order.  */
+              MAX_INIT_PRIORITY - priority);
+      named_section_flags (buf, SECTION_WRITE, POINTER_SIZE / BITS_PER_UNIT);
+      assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, 1);
+      return;
+    }
+
 #ifdef ASM_OUTPUT_CONSTRUCTOR
   ASM_OUTPUT_CONSTRUCTOR (asm_out_file, name);
 #else
This page took 0.119466 seconds and 5 git commands to generate.