decl2.c (start_static_storage_duration_function): Fix comment.

* decl2.c (start_static_storage_duration_function): Fix comment.
	(finish_file): Create static storage duration functions lazily.

From-SVN: r27029
This commit is contained in:
Mark Mitchell 1999-05-19 11:24:18 +00:00 committed by Mark Mitchell
parent 6ada3468d8
commit c472cdfd0a
2 changed files with 25 additions and 15 deletions

View File

@ -1,3 +1,8 @@
1999-05-19 Mark Mitchell <mark@codesourcery.com>
* decl2.c (start_static_storage_duration_function): Fix comment.
(finish_file): Create static storage duration functions lazily.
1999-05-19 Jason Merrill <jason@yorick.cygnus.com> 1999-05-19 Jason Merrill <jason@yorick.cygnus.com>
Implement anonymous structs. Implement anonymous structs.

View File

@ -3092,7 +3092,7 @@ start_static_storage_duration_function ()
/* Start the function itself. This is equivalent to declarating the /* Start the function itself. This is equivalent to declarating the
function as: function as:
static inline void __ssdf (int __initialize_p, init __priority_p); static void __ssdf (int __initialize_p, init __priority_p);
It is static because we only need to call this function from the It is static because we only need to call this function from the
various constructor and destructor functions for this module. */ various constructor and destructor functions for this module. */
@ -3577,15 +3577,9 @@ finish_file ()
do do
{ {
/* We need to start a new initialization function each time /* Non-zero if we need a static storage duration function on
through the loop. That's because we need to know which this iteration through the loop. */
vtables have been referenced, and TREE_SYMBOL_REFERENCED int need_ssdf_p = 0;
isn't computed until a function is finished, and written out.
That's a deficiency in the back-end. When this is fixed,
these initialization functions could all become inline, with
resulting performance improvements. */
start_static_storage_duration_function ();
push_to_top_level ();
reconsider = 0; reconsider = 0;
@ -3606,10 +3600,6 @@ finish_file ()
/*data=*/0)) /*data=*/0))
reconsider = 1; reconsider = 1;
/* Come back to the static storage duration function; we're
about to emit instructions there for static initializations
and such. */
pop_from_top_level ();
/* The list of objects with static storage duration is built up /* The list of objects with static storage duration is built up
in reverse order, so we reverse it here. We also clear in reverse order, so we reverse it here. We also clear
STATIC_AGGREGATES so that any new aggregates added during the STATIC_AGGREGATES so that any new aggregates added during the
@ -3621,6 +3611,20 @@ finish_file ()
{ {
if (! TREE_ASM_WRITTEN (TREE_VALUE (vars))) if (! TREE_ASM_WRITTEN (TREE_VALUE (vars)))
rest_of_decl_compilation (TREE_VALUE (vars), 0, 1, 1); rest_of_decl_compilation (TREE_VALUE (vars), 0, 1, 1);
if (!need_ssdf_p)
{
/* We need to start a new initialization function each
time through the loop. That's because we need to
know which vtables have been referenced, and
TREE_SYMBOL_REFERENCED isn't computed until a
function is finished, and written out. That's a
deficiency in the back-end. When this is fixed,
these initialization functions could all become
inline, with resulting performance improvements. */
start_static_storage_duration_function ();
need_ssdf_p = 1;
}
do_static_initialization_and_destruction (TREE_VALUE (vars), do_static_initialization_and_destruction (TREE_VALUE (vars),
TREE_PURPOSE (vars)); TREE_PURPOSE (vars));
reconsider = 1; reconsider = 1;
@ -3629,7 +3633,8 @@ finish_file ()
/* Finish up the static storage duration function for this /* Finish up the static storage duration function for this
round. */ round. */
finish_static_storage_duration_function (); if (need_ssdf_p)
finish_static_storage_duration_function ();
/* Go through the various inline functions, and see if any need /* Go through the various inline functions, and see if any need
synthesizing. */ synthesizing. */