77th Cygnus<->FSF merge
authorMike Stump <mrs@gcc.gnu.org>
Thu, 28 Dec 1995 19:35:49 +0000 (19:35 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Thu, 28 Dec 1995 19:35:49 +0000 (19:35 +0000)
From-SVN: r10894

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/except.c
gcc/cp/sig.c

index bfa05f6189fdef10903bbdcb8f9b970dd60309e9..a1722c270f6b9883a4224c8bb66b29811cf87e43 100644 (file)
@@ -1,3 +1,39 @@
+Thu Dec 28 11:13:15 1995  Mike Stump  <mrs@cygnus.com>
+
+       * except.c (expand_builtin_throw): Use RETURN_ADDR_OFFSET instead of
+       NORMAL_RETURN_ADDR_OFFSET.
+       (end_eh_unwinder): Ditto.
+
+Wed Dec 27 22:18:16 1995  Mike Stump  <mrs@cygnus.com>
+
+       * gc.c (build_dynamic_cast): Make sure we don't cast away const
+       when dealing with references, and make sure we handle dynamic
+       casting to a cv qualified reference.
+
+Thu Dec 21 23:50:35 1995  Mike Stump  <mrs@cygnus.com>
+
+       * except.c (struct eh_context): New structure top hold eh context
+       information.
+       (push_eh_context): New routine.
+       (pop_eh_context): Ditto.
+       * decl.c (push_cp_function_context): Use them.
+       (pop_cp_function_context): Ditto.
+
+Wed Dec 20 12:42:51 1995  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl2.c (finish_file): Also prune uninteresting functions in the
+       inline emission loop.
+
+Wed Dec 20 02:32:07 1995  Jeffrey A Law  (law@cygnus.com)
+
+       * sig.c (build_signature_table_constructor): Mark functions
+       in the signature as referenced.
+
+Tue Dec 19 22:36:56 1995  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl2.c (finish_file): Do all the vtable/synthesis stuff before
+       the inline emission stuff.
+
 Mon Dec 18 15:51:33 1995  Jason Merrill  <jason@yorick.cygnus.com>
 
        * cp-tree.h, decl2.c (flag_weak): New flag to control the use of
@@ -331,7 +367,7 @@ Wed Oct 11 16:30:34 1995  Brendan Kehoe  <brendan@lisa.cygnus.com>
        * parse.y (fn.def1): Call split_specs_attrs in
        declmods notype_declarator case.
 
-Mon Nov 20 14:06:28 1995  Mike Stump  <mrs@cygnus.com>
+Sun Nov 26 14:47:42 1995  Richard Kenner  <kenner@mole.gnu.ai.mit.edu>
 
        * Version 2.7.2 released.
 
@@ -344,7 +380,7 @@ Thu Oct 26 13:59:54 1995  Mike Stump  <mrs@cygnus.com>
        * init.c (expand_aggr_init): Handle cv qualifiers on the object's
        type.
 
-Sun Nov 12 18:09:35 1995  Mike Stump  <mrs@cygnus.com>
+Sat Nov 11 08:25:55 1995  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * Version 2.7.1 released.
 
index f639140bfee2138a4474e96781f5bfb9c8aae06d..869d853e819bdbcc516257fdb4a83d25c42d03f0 100644 (file)
@@ -127,6 +127,8 @@ static tree grokparms                               PROTO((tree, int));
 static tree lookup_nested_type                 PROTO((tree, tree));
 static char *redeclaration_error_message       PROTO((tree, tree));
 static void grok_op_properties                 PROTO((tree, int, int));
+extern void* push_eh_context                   PROTO(());
+extern void pop_eh_context                     PROTO((void *));
 
 tree define_function           
        PROTO((char *, tree, enum built_in_function, void (*)(), char *));
@@ -12807,8 +12809,11 @@ struct cp_function
   rtx result_rtx;
   struct cp_function *next;
   struct binding_level *binding_level;
+  void* eh_context;
 };
 
+
+
 struct cp_function *cp_function_chain;
 
 extern int temp_name_counter;
@@ -12848,6 +12853,8 @@ push_cp_function_context (context)
   p->member_init_list = current_member_init_list;
   p->class_decl = current_class_decl;
   p->C_C_D = C_C_D;
+
+  p->eh_context = push_eh_context ();
 }
 
 /* Restore the variables used during compilation of a C++ function.  */
@@ -12901,6 +12908,8 @@ pop_cp_function_context (context)
   current_class_decl = p->class_decl;
   C_C_D = p->C_C_D;
 
+  pop_eh_context (p->eh_context);
+
   free (p);
 }
 
index 437247f7a2100f5c621b187e955bffdda82603cf..117687a31914696baf3262237585c70e8b129848 100644 (file)
@@ -3126,53 +3126,46 @@ finish_file ()
 
     while (reconsider)
       {
-       tree last = saved_inlines = tree_cons (NULL_TREE, NULL_TREE,
-                                              saved_inlines);
-       tree last_head = last;
-       tree place = TREE_CHAIN (saved_inlines);
+       tree *p = &saved_inlines;
        reconsider = 0;
 
        walk_vtables ((void (*)())0, finish_vtable_vardecl);
 
-       for (; place; place = TREE_CHAIN (place))
+       while (*p)
          {
-           tree decl = TREE_VALUE (place);
+           tree decl = TREE_VALUE (*p);
 
-           /* Slice out the empty elements put in just above in the
-              previous reconsidering.  */
-           if (decl == NULL_TREE)
+           if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl)
+               && TREE_USED (decl))
              {
-               TREE_CHAIN (last) = TREE_CHAIN (place);
-               continue;
+               synthesize_method (decl);
+               reconsider = 1;
              }
 
-           if (DECL_ARTIFICIAL (decl) && ! DECL_INITIAL (decl))
-             {
-               if (TREE_USED (decl))
-                 {
-                   synthesize_method (decl);
-                   if (TREE_ASM_WRITTEN (decl))
-                     reconsider = 1;
-                 }
-               else
-                 {
-                   last = place;
-                   continue;
-                 }
-             }
+           if (TREE_ASM_WRITTEN (decl)
+               || (DECL_SAVED_INSNS (decl) == 0 && ! DECL_ARTIFICIAL (decl)))
+             *p = TREE_CHAIN (*p);
+           else
+             p = &TREE_CHAIN (*p);
+         }
+      }
 
-           if (TREE_ASM_WRITTEN (decl) || DECL_SAVED_INSNS (decl) == 0)
-             {
-               TREE_CHAIN (last) = TREE_CHAIN (place);
-               continue;
-             }
+    reconsider = 1;            /* More may be referenced; check again */
+    while (reconsider)
+      {
+       tree *p = &saved_inlines;
+       reconsider = 0;
 
-           if ((TREE_PUBLIC (decl) && ! DECL_WEAK (decl))
-               || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
-               || flag_keep_inline_functions)
-             {
-               TREE_CHAIN (last) = TREE_CHAIN (place);
+       while (*p)
+         {
+           tree decl = TREE_VALUE (*p);
 
+           if (TREE_ASM_WRITTEN (decl) || DECL_SAVED_INSNS (decl) == 0)
+             *p = TREE_CHAIN (*p);
+           else if ((TREE_PUBLIC (decl) && ! DECL_WEAK (decl))
+                    || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
+                    || flag_keep_inline_functions)
+             {
                if (DECL_NOT_REALLY_EXTERN (decl))
                  {
                    DECL_EXTERNAL (decl) = 0;
@@ -3182,10 +3175,10 @@ finish_file ()
                    permanent_allocation (1);
                  }
 
-               continue;
+               *p = TREE_CHAIN (*p);
              }
-
-           last = place;
+           else
+             p = &TREE_CHAIN (*p);
          }
       }
   }
index 88587f0acf92823278dba51af9990504f4e5bf26..38fcb357c6b1cb92dfd686e34ae26af59c66dfb6 100644 (file)
@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA.  */
 #include "flags.h"
 #include "obstack.h"
 #include "expr.h"
+#include "output.h"
 
 tree protect_list;
 
@@ -330,7 +331,6 @@ tree saved_cleanup;
 int throw_used;
 
 static rtx catch_clauses;
-static first_catch_label;
 
 static struct ehStack ehstack;
 static struct ehQueue ehqueue;
@@ -352,6 +352,58 @@ static tree top_label_entry                PROTO((struct labelNode **labelstack));
 static struct ehEntry *copy_eh_entry   PROTO((struct ehEntry *entry));
 
 
+/* Routines to save and restore eh context information.  */
+struct eh_context {
+  struct ehStack ehstack;
+  struct ehQueue ehqueue;
+  rtx catch_clauses;
+  struct labelNode *false_label_stack;
+  struct labelNode *caught_return_label_stack;
+  tree protect_list;
+};
+
+/* Save the context and push into a new one.  */
+void*
+push_eh_context ()
+{
+  struct eh_context *p
+    = (struct eh_context*)xmalloc (sizeof (struct eh_context));
+
+  p->ehstack = ehstack;
+  p->ehqueue = ehqueue;
+  p->catch_clauses = catch_clauses;
+  p->false_label_stack = false_label_stack;
+  p->caught_return_label_stack = caught_return_label_stack;
+  p->protect_list = protect_list;
+
+  new_eh_stack (&ehstack);
+  new_eh_queue (&ehqueue);
+  catch_clauses = NULL_RTX;
+  false_label_stack = NULL;
+  caught_return_label_stack = NULL;
+  protect_list = NULL_TREE;
+  
+  return p;
+}
+
+/* Pop and restore the context.  */
+void
+pop_eh_context (vp)
+     void *vp;
+{
+  struct eh_context *p = (struct eh_context *)vp;
+
+  protect_list = p->protect_list;
+  caught_return_label_stack = p->caught_return_label_stack;
+  false_label_stack = p->false_label_stack;
+  catch_clauses        = p->catch_clauses;
+  ehqueue = p->ehqueue;
+  ehstack = p->ehstack;
+
+  free (p);
+}
+
+
 
 /* All my cheesy stack/queue/misc data structure handling routines
 
@@ -1323,8 +1375,8 @@ expand_builtin_throw ()
 
     /* Set it up so that we continue inside, at the top of the loop.  */
     emit_move_insn (ret_val, gen_rtx (LABEL_REF, Pmode, top_of_loop));
-#ifdef NORMAL_RETURN_ADDR_OFFSET
-  return_val_rtx = plus_constant (ret_val, -NORMAL_RETURN_ADDR_OFFSET);
+#ifdef RETURN_ADDR_OFFSET
+  return_val_rtx = plus_constant (ret_val, -RETURN_ADDR_OFFSET);
     if (return_val_rtx != ret_val)
       emit_move_insn (ret_val, return_val_rtx);
 #endif
@@ -1434,7 +1486,7 @@ expand_end_eh_spec (raises)
 void
 expand_exception_blocks ()
 {
-  static rtx funcend;
+  rtx funcend;
   rtx insns;
 
   start_sequence ();
@@ -1771,8 +1823,8 @@ end_eh_unwinder (end)
   ret_val = expand_builtin_return_addr (BUILT_IN_RETURN_ADDRESS,
                                        0, hard_frame_pointer_rtx);
   return_val_rtx = copy_to_reg (ret_val);
-#ifdef NORMAL_RETURN_ADDR_OFFSET
-  return_val_rtx = plus_constant (return_val_rtx, NORMAL_RETURN_ADDR_OFFSET-1);
+#ifdef RETURN_ADDR_OFFSET
+  return_val_rtx = plus_constant (return_val_rtx, RETURN_ADDR_OFFSET-1);
 #else
   return_val_rtx = plus_constant (return_val_rtx, -1);
 #endif
@@ -1785,8 +1837,8 @@ end_eh_unwinder (end)
   emit_move_insn (ret_val, gen_rtx (LABEL_REF, Pmode, label));
 #endif
 
-#ifdef NORMAL_RETURN_ADDR_OFFSET
-  return_val_rtx = plus_constant (ret_val, -NORMAL_RETURN_ADDR_OFFSET);
+#ifdef RETURN_ADDR_OFFSET
+  return_val_rtx = plus_constant (ret_val, -RETURN_ADDR_OFFSET);
   if (return_val_rtx != ret_val)
     emit_move_insn (ret_val, return_val_rtx);
 #endif
index 135dc6d77942b02b9ed03f7ad91f611220324372..0337ce3cb896a6e493f40caf34f880715c106442 100644 (file)
@@ -571,6 +571,7 @@ build_signature_table_constructor (sig_ty, rhs)
              delta = integer_zero_node;
              index = integer_zero_node;
              pfn = build_unary_op (ADDR_EXPR, rhs_method, 0);
+             TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (rhs_method)) = 1;
              TREE_TYPE (pfn) = ptr_type_node;
              TREE_ADDRESSABLE (rhs_method) = 1;
              offset_p = 0;     /* we can't offset the rhs sig table */
@@ -595,6 +596,7 @@ build_signature_table_constructor (sig_ty, rhs)
                                               rhstype, 1));
              index = integer_zero_node;
              pfn = build_unary_op (ADDR_EXPR, rhs_method, 0);
+             TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (rhs_method)) = 1;
              TREE_TYPE (pfn) = ptr_type_node;
              TREE_ADDRESSABLE (rhs_method) = 1;
            }