]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
flow.c (find_basic_blocks): Generate correct flow control information when exception...
authorJason Merrill <jason@cygnus.com>
Sat, 1 Nov 1997 23:45:10 +0000 (23:45 +0000)
committerJeff Law <law@gcc.gnu.org>
Sat, 1 Nov 1997 23:45:10 +0000 (16:45 -0700)
        * flow.c (find_basic_blocks): Generate correct flow control
        information when exception handling notes are present.

From-SVN: r16263

gcc/ChangeLog
gcc/flow.c

index 74a56efc7fc3d7703a20abb4fa3b458c9d7ddb10..e153a19f67ed1864c55c1fef2e554dc0004862ec 100644 (file)
@@ -1,3 +1,8 @@
+Sat Nov  1 16:44:49 1997  Jason Merrill  (jason@cygnus.com)
+
+       * flow.c (find_basic_blocks): Generate correct flow control
+       information when exception handling notes are present.
+
 Sat Nov  1 13:42:19 1997  Jeffrey A Law  (law@cygnus.com)
 
        * dwarf2out.c (output_call_frame_info): Fix length argument
index fae7ab088135a12a6516482a60e4cee780861ad4..08dd4e8854622c432ad495b02f588d1672323344 100644 (file)
@@ -522,21 +522,39 @@ find_basic_blocks (f, nonlocal_label_list)
          }
 
       /* Find all call insns and mark them as possibly jumping
-        to all the nonlocal goto handler labels.  */
+        to all the nonlocal goto handler labels, or to the current
+        exception handler.  */
 
-      for (insn = f; insn; insn = NEXT_INSN (insn))
-       if (GET_CODE (insn) == CALL_INSN
-           && ! find_reg_note (insn, REG_RETVAL, NULL_RTX))
-         {
-           for (x = nonlocal_label_list; x; x = XEXP (x, 1))
-             mark_label_ref (gen_rtx (LABEL_REF, VOIDmode, XEXP (x, 0)),
-                             insn, 0);
+      for (note = NULL_RTX, insn = f; insn; insn = NEXT_INSN (insn))
+       {
+         if (! asynchronous_exceptions && GET_CODE (insn) == NOTE)
+           {
+             if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG)
+               {
+                 for (x = exception_handler_labels; x; x = XEXP (x, 1))
+                   if (CODE_LABEL_NUMBER (XEXP (x, 0))
+                       == NOTE_BLOCK_NUMBER (insn))
+                     {
+                       note = gen_rtx (EXPR_LIST, VOIDmode,
+                                        XEXP (x, 0), note);
+                       break;
+                     }
+                 if (x == NULL_RTX)
+                   abort ();
+               }
+             else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END)
+               note = XEXP (note, 1);
+           }
+         else if (GET_CODE (insn) == CALL_INSN
+                  && ! find_reg_note (insn, REG_RETVAL, NULL_RTX))
+           {
+             if (note)
+               mark_label_ref (gen_rtx (LABEL_REF, VOIDmode, XEXP (note, 0)),
+                               insn, 0);
 
-           if (! asynchronous_exceptions)
-             for (x = exception_handler_labels; x; x = XEXP (x, 1))
+             for (x = nonlocal_label_list; x; x = XEXP (x, 1))
                mark_label_ref (gen_rtx (LABEL_REF, VOIDmode, XEXP (x, 0)),
                                insn, 0);
-
            /* ??? This could be made smarter:
               in some cases it's possible to tell that certain
               calls will not do a nonlocal goto.
@@ -546,7 +564,8 @@ find_basic_blocks (f, nonlocal_label_list)
               only calls to those functions or to other nested
               functions that use them could possibly do nonlocal
               gotos.  */
-         }
+           }
+       }
 
       /* All blocks associated with labels in label_value_list are
         trivially considered as marked live, if the list is empty.