summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl2.c35
2 files changed, 25 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 63f41580b7c..9a30a2feff4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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>
Implement anonymous structs.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 9b9f4d68a4d..d82fb1c9cdd 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3092,7 +3092,7 @@ start_static_storage_duration_function ()
/* Start the function itself. This is equivalent to declarating the
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
various constructor and destructor functions for this module. */
@@ -3577,15 +3577,9 @@ finish_file ()
do
{
- /* 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 ();
- push_to_top_level ();
+ /* Non-zero if we need a static storage duration function on
+ this iteration through the loop. */
+ int need_ssdf_p = 0;
reconsider = 0;
@@ -3606,10 +3600,6 @@ finish_file ()
/*data=*/0))
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
in reverse order, so we reverse it here. We also clear
STATIC_AGGREGATES so that any new aggregates added during the
@@ -3621,6 +3611,20 @@ finish_file ()
{
if (! TREE_ASM_WRITTEN (TREE_VALUE (vars)))
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),
TREE_PURPOSE (vars));
reconsider = 1;
@@ -3629,7 +3633,8 @@ finish_file ()
/* Finish up the static storage duration function for this
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
synthesizing. */