]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
flow.c (find_basic_blocks): During marking phase...
authorJeffrey A Law <law@cygnus.com>
Thu, 13 Nov 1997 23:08:15 +0000 (23:08 +0000)
committerJeff Law <law@gcc.gnu.org>
Thu, 13 Nov 1997 23:08:15 +0000 (16:08 -0700)
        * flow.c (find_basic_blocks): During marking phase, if we encounter
        an insn with a REG_LABEL note, make the target block live and
        create an edge from the insn to the target block.  Do not make
        edges from all blocks to the target block.
Another crack at the flow control problem.

From-SVN: r16468

gcc/ChangeLog
gcc/flow.c

index 1036a200ae035c9be9b20b69917c9c8ccbfc4462..a65a990f46df8b5035011de3d39f2a95274b2f2d 100644 (file)
@@ -20,6 +20,11 @@ Thu Nov 13 11:47:55 1997  Michael Meissner  <meissner@cygnus.com>
 
 Thu Nov 13 11:41:42 1997  Jeffrey A Law  (law@cygnus.com)
 
+       * flow.c (find_basic_blocks): During marking phase, if we encounter
+       an insn with a REG_LABEL note, make the target block live and
+       create an edge from the insn to the target block.  Do not make
+       edges from all blocks to the target block.
+
        * m68k/x-next (OTHER_FIXINCLUDES_DIRS): Include /NextDeveloper/Headers.
 
        * configure.in: Tweak NCR entries.
index 8c5e7e6a16850e2eaa0b6fa21fef79ec8cc96b1c..b98008267dc9e91a1b415817aa79e698f0cff049 100644 (file)
@@ -378,8 +378,6 @@ find_basic_blocks (f, nonlocal_label_list)
   /* List of label_refs to all labels whose addresses are taken
      and used as data.  */
   rtx label_value_list;
-  /* List of label_refs from REG_LABEL notes.  */
-  rtx reg_label_list;
   rtx x, note, eh_note;
   enum rtx_code prev_code, code;
   int depth, pass;
@@ -389,7 +387,6 @@ find_basic_blocks (f, nonlocal_label_list)
  restart:
 
   label_value_list = 0;
-  reg_label_list = 0;
   block_live_static = block_live;
   bzero (block_live, n_basic_blocks);
   bzero (block_marked, n_basic_blocks);
@@ -553,14 +550,26 @@ find_basic_blocks (f, nonlocal_label_list)
                    if (GET_RTX_CLASS (GET_CODE (insn)) == 'i')
                      {
                        
-                       /* We have no idea where the label referenced by this
-                          insn will actually be used.
-
-                          To create an accurate cfg we mark the target blocks
-                          as live and create a list of all the labels
-                          mentioned in REG_LABEL notes.  After we're done
-                          marking blocks, we go back and create an edge from
-                          every live block to labels on the list.  */ 
+                       /* References to labels in non-jumping insns have
+                          REG_LABEL notes attached to them.
+
+                          This can happen for computed gotos; we don't care
+                          about them here since the values are also on the
+                          label_value_list and will be marked live if we find
+                          a live computed goto.
+
+                          This can also happen when we take the address of
+                          a label to pass as an argument to __throw.  Note
+                          throw only uses the value to determine what handler
+                          should be called -- ie the label is not used as
+                          a jump target, it just marks regions in the code.
+
+                          In theory we should be able to ignore the REG_LABEL
+                          notes, but we have to make sure that the label and
+                          associated insns aren't marked dead, so we make
+                          the block in question live and create an edge from
+                          this insn to the label.  This is not strictly
+                          correct, but it is close enough for now.  */
                        for (note = REG_NOTES (insn);
                             note;
                             note = XEXP (note, 1))
@@ -569,9 +578,9 @@ find_basic_blocks (f, nonlocal_label_list)
                              {
                                x = XEXP (note, 0);
                                block_live[BLOCK_NUM (x)] = 1;
-                               reg_label_list
-                                 = gen_rtx (EXPR_LIST, VOIDmode, x,
-                                            reg_label_list);
+                               mark_label_ref (gen_rtx (LABEL_REF,
+                                                        VOIDmode, x),
+                                               insn, 0);
                              }
                          }
 
@@ -632,22 +641,6 @@ find_basic_blocks (f, nonlocal_label_list)
              }
        }
 
-      /* We couldn't determine what edges are needed for labels on the
-        reg_label_list above.  So make an edge from every live block to
-        to every label on the reg_label_list.  */
-      if (reg_label_list)
-       {
-         for (i = 1; i < n_basic_blocks; i++)
-         if (block_live[i])
-           {
-             rtx x;
-
-             for (x = reg_label_list; x; x = XEXP (x, 1))
-               mark_label_ref (gen_rtx (LABEL_REF, VOIDmode, XEXP (x, 0)),
-                               basic_block_end[i], 0);
-           }
-       }
-
       /* This should never happen.  If it does that means we've computed an
         incorrect flow graph, which can lead to aborts/crashes later in the
         compiler or incorrect code generation.