Commit 47907859 by Richard Henderson Committed by Richard Henderson

varasm.c (assemble_constructor): Take a symbol_ref and a priority instead of a bare string.

        * 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
parent 362b68a8
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.
......
......@@ -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)
......
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.
......
......@@ -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);
}
......
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.
......
......@@ -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
......
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.
......
......@@ -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
......
......@@ -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
......
......@@ -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. */
......
......@@ -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);
}
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment