except.c (get_dynamic_handler_chain): Only make the call once per function.
authorJason Merrill <jason@yorick.cygnus.com>
Fri, 5 Dec 1997 03:06:17 +0000 (03:06 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 5 Dec 1997 03:06:17 +0000 (22:06 -0500)
* except.c (get_dynamic_handler_chain): Only make the call once per
  function.

From-SVN: r16955

gcc/ChangeLog
gcc/except.c

index bccce410e2a8a3f9348b50347f02873e6642d6a4..da734b73915a5913038fa36a004ad1c9a3bdd024 100644 (file)
@@ -1,5 +1,8 @@
 Thu Dec  4 11:51:00 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
+       * except.c (get_dynamic_handler_chain): Only make the call once per
+       function.
+
        * except.c (expand_end_all_catch): Fix for sjlj exceptions.
 
 Thu Dec  4 12:30:40 1997  J"orn Rennecke <amylaar@cygnus.co.uk>
index 9a2f6a0e3dd40a05768a51020222bd42b1bf86cc..0e9e8142ce51c8244c2e5c49d1c8ba56b61ab1b7 100644 (file)
@@ -728,31 +728,20 @@ add_partial_entry (handler)
    This routine is here to facilitate the porting of this code to
    systems with threads.  One can either replace the routine we emit a
    call for here in libgcc2.c, or one can modify this routine to work
-   with their thread system.  */
+   with their thread system.
+
+   Ideally, we really only want one per real function, not one
+   per inlined function.  */
 
 rtx
 get_dynamic_handler_chain ()
 {
-#if 0
-  /* Do this once we figure out how to get this to the front of the
-     function, and we really only want one per real function, not one
-     per inlined function.  */
-  if (current_function_dhc == 0)
-    {
-      rtx dhc, insns;
-      start_sequence ();
-
-      /* ... */
-      insns = get_insns ();
-      end_sequence ();
-      emit_insns_before (insns, get_first_nonparm_insn ());
-    }
-  /* We don't want a copy of the dhc, but rather, the single dhc.  */
-  return gen_rtx (MEM, Pmode, current_function_dhc);
-#endif
-
   static tree fn;
   tree expr;
+  rtx insns;
+
+  if (current_function_dhc)
+    return current_function_dhc;
 
   if (fn == NULL_TREE)
     {
@@ -779,7 +768,13 @@ get_dynamic_handler_chain ()
   TREE_SIDE_EFFECTS (expr) = 1;
   expr = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (expr)), expr);
 
-  return expand_expr (expr, NULL_RTX, VOIDmode, 0);
+  start_sequence ();
+  current_function_dhc = expand_expr (expr, NULL_RTX, VOIDmode, 0);
+  insns = get_insns ();
+  end_sequence ();
+  emit_insns_before (insns, get_first_nonparm_insn ());
+
+  return current_function_dhc;
 }
 
 /* Get a reference to the dynamic cleanup chain.  It points to the