OSDN Git Service

* emit-rtl.c (push_to_full_sequence, end_full_sequence): New functions.
authorloewis <loewis@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 19 Mar 2000 18:25:27 +0000 (18:25 +0000)
committerloewis <loewis@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 19 Mar 2000 18:25:27 +0000 (18:25 +0000)
* except.c (emit_cleanup_handler): Use them.
(expand_end_all_catch): Likewise.
* function.c (fixup_var_refs): Likewise.
(expand_function_end): Clear catch_clauses_last.
* rtl.h (push_to_full_sequence, end_full_sequence): Declare.
* except.h (struct eh_status): New field x_catch_clauses_last.
(catch_clauses_last): New define.

* cp/except.c (expand_exception_blocks): Clear catch_clauses_last.

* java/except.c (emit_handlers): Clear catch_clauses_last.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@32643 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cp/ChangeLog
gcc/cp/except.c
gcc/emit-rtl.c
gcc/except.c
gcc/except.h
gcc/function.c
gcc/java/ChangeLog
gcc/java/except.c
gcc/rtl.h

index 3dce7cf..7f6c40c 100644 (file)
@@ -1,4 +1,13 @@
-2000-03-18  Martin v. Löwis  <loewis@informatik.hu-berlin.de>
+2000-03-19  Martin v. Löwis  <loewis@informatik.hu-berlin.de>
+
+       * emit-rtl.c (push_to_full_sequence, end_full_sequence): New functions.
+       * except.c (emit_cleanup_handler): Use them.
+       (expand_end_all_catch): Likewise.
+       * function.c (fixup_var_refs): Likewise.
+       (expand_function_end): Clear catch_clauses_last.
+       * rtl.h (push_to_full_sequence, end_full_sequence): Declare.
+       * except.h (struct eh_status): New field x_catch_clauses_last.
+       (catch_clauses_last): New define.
 
        * Makefile.in (tree.o): Depend on HASHTAB_H.
        * tree.c: Include hashtab.h.
index fbaaad9..83cec30 100644 (file)
@@ -1,3 +1,7 @@
+2000-03-19  Martin v. Löwis  <loewis@informatik.hu-berlin.de>
+
+       * except.c (expand_exception_blocks): Clear catch_clauses_last.
+
 2000-03-18  Mark Mitchell  <mark@codesourcery.com>
 
        * cp-tree.h (CLEAR_DECL_C_BIT_FIELD): New macro.
index 12523dc..8e32659 100644 (file)
@@ -796,13 +796,13 @@ expand_exception_blocks ()
        expand_eh_region_start ();
 
       emit_insns (catch_clauses);
-      catch_clauses = NULL_RTX;
+      catch_clauses = catch_clauses_last = NULL_RTX;
 
       if (exceptions_via_longjmp == 0)
        expand_eh_region_end (build_terminate_handler ());
 
       emit_insns (catch_clauses);
-      catch_clauses = NULL_RTX;
+      catch_clauses = catch_clauses_last = NULL_RTX;
       emit_label (funcend);
     }
 }
index 764a5ad..e238cfa 100644 (file)
@@ -3422,6 +3422,20 @@ push_to_sequence (first)
   last_insn = last;
 }
 
+/* Set up the insn chain from a chain stort in FIRST to LAST.  */
+
+void
+push_to_full_sequence (first, last)
+     rtx first, last;
+{
+  start_sequence ();
+  first_insn = first;
+  last_insn = last;
+  /* We really should have the end of the insn chain here.  */
+  if (last && NEXT_INSN (last))
+    abort ();
+}
+
 /* Set up the outer-level insn chain
    as the current sequence, saving the previously current one.  */
 
@@ -3484,6 +3498,18 @@ end_sequence ()
   free (tem);
 }
 
+/* This works like end_sequence, but records the old sequence in FIRST
+   and LAST.  */
+
+void
+end_full_sequence (first, last)
+     rtx *first, *last;
+{
+  *first = first_insn;
+  *last = last_insn;
+  end_sequence();
+}
+
 /* Return 1 if currently emitting into a sequence.  */
 
 int
index 44507f8..3146778 100644 (file)
@@ -1865,10 +1865,9 @@ emit_cleanup_handler (entry)
   end_sequence ();
 
   /* And add it to the CATCH_CLAUSES.  */
-  push_to_sequence (catch_clauses);
+  push_to_full_sequence (catch_clauses, catch_clauses_last);
   emit_insns (handler_insns);
-  catch_clauses = get_insns ();
-  end_sequence ();
+  end_full_sequence (&catch_clauses, &catch_clauses_last);
 
   /* Now we've left the handler.  */
   pop_ehqueue ();
@@ -1990,10 +1989,9 @@ expand_end_all_catch ()
   pop_label_entry (&outer_context_label_stack);
 
   /* Add the new sequence of catches to the main one for this function.  */
-  push_to_sequence (catch_clauses);
+  push_to_full_sequence (catch_clauses, catch_clauses_last);
   emit_insns (new_catch_clause);
-  catch_clauses = get_insns ();
-  end_sequence ();
+  end_full_sequence (&catch_clauses, &catch_clauses_last);
   
   /* Here we fall through into the continuation code.  */
 }
index 1087bc1..ee9ea60 100644 (file)
@@ -120,6 +120,8 @@ struct eh_status
   /* Insns for all of the exception handlers for the current function.
      They are currently emitted by the frontend code.  */
   rtx x_catch_clauses;
+  /* End of exception handler insn sequence.  */
+  rtx x_catch_clauses_last;
   /* A random data area for the front end's own use.  */
   struct label_node *x_false_label_stack;
   /* Keeps track of the label to resume to should one want to resume
@@ -142,6 +144,7 @@ struct eh_status
 #define catchstack (cfun->eh->x_catchstack)
 #define ehqueue (cfun->eh->x_ehqueue)
 #define catch_clauses (cfun->eh->x_catch_clauses)
+#define catch_clauses_last (cfun->eh->x_catch_clauses_last)
 #define false_label_stack (cfun->eh->x_false_label_stack)
 #define caught_return_label_stack (cfun->eh->x_caught_return_label_stack)
 #define protect_list (cfun->eh->x_protect_list)
index e994558..aed4c60 100644 (file)
@@ -1548,10 +1548,10 @@ fixup_var_refs (var, promoted_mode, unsignedp, ht)
     }
 
   /* Scan the catch clauses for exception handling too.  */
-  push_to_sequence (catch_clauses);
+  push_to_full_sequence (catch_clauses, catch_clauses_last);
   fixup_var_refs_insns (var, promoted_mode, unsignedp, catch_clauses,
                        0, 0);
-  end_sequence ();
+  end_full_sequence (&catch_clauses, &catch_clauses_last);
 
   /* Scan sequences saved in CALL_PLACEHOLDERS too.  */
   for (insn = first_insn; insn; insn = NEXT_INSN (insn))
@@ -6549,7 +6549,7 @@ expand_function_end (filename, line, end_bindings)
 
     /* If there are any catch_clauses remaining, output them now.  */
     emit_insns (catch_clauses);
-    catch_clauses = NULL_RTX;
+    catch_clauses = catch_clauses_last = NULL_RTX;
     /* If the above emitted any code, may sure we jump around it.  */
     if (last != get_last_insn ())
       {
index 5d58d88..f96e287 100644 (file)
@@ -1,3 +1,7 @@
+2000-03-19  Martin v. Löwis  <loewis@informatik.hu-berlin.de>
+
+       * except.c (emit_handlers): Clear catch_clauses_last.
+
 Fri Mar 17 08:09:14 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * class.c (make_field_value): Properly handle sizes.
index 0b1590f..80f24f8 100644 (file)
@@ -433,7 +433,7 @@ emit_handlers ()
       emit_jump (funcend);
 
       emit_insns (catch_clauses);
-      catch_clauses = NULL_RTX;
+      catch_clauses = catch_clauses_last = NULL_RTX;
       expand_leftover_cleanups ();
 
       emit_label (funcend);
index 46750ac..fc344ce 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1012,6 +1012,8 @@ extern rtx get_last_insn_anywhere PARAMS ((void));
 extern void start_sequence             PARAMS ((void));
 extern void push_to_sequence           PARAMS ((rtx));
 extern void end_sequence               PARAMS ((void));
+extern void push_to_full_sequence      PARAMS ((rtx, rtx));
+extern void end_full_sequence          PARAMS ((rtx*, rtx*));
 extern rtx gen_sequence                        PARAMS ((void));
 extern rtx immed_double_const          PARAMS ((HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode));
 extern rtx force_const_mem             PARAMS ((enum machine_mode, rtx));