Commit c472cdfd by Mark Mitchell Committed by Mark Mitchell

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
parent 6ada3468
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.
......
...@@ -3092,7 +3092,7 @@ start_static_storage_duration_function () ...@@ -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 () ...@@ -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 () ...@@ -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 () ...@@ -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,6 +3633,7 @@ finish_file () ...@@ -3629,6 +3633,7 @@ finish_file ()
/* Finish up the static storage duration function for this /* Finish up the static storage duration function for this
round. */ round. */
if (need_ssdf_p)
finish_static_storage_duration_function (); 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
......
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