OSDN Git Service

* lib/old-dejagnu.exp (old-dejagnu): Copy extra source files
[pf3gnuchains/gcc-fork.git] / gcc / cfgrtl.c
index 6abac76..48d0e85 100644 (file)
@@ -34,7 +34,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
             redirect_edge_and_branch_force, tidy_fallthru_edge, force_nonfallthru
      - Edge splitting and commiting to edges
          split_edge, insert_insn_on_edge, commit_edge_insertions
-     - Dumpipng and debugging
+     - Dumping and debugging
          print_rtl_with_bb, dump_bb, debug_bb, debug_bb_n
      - Consistency checking
          verify_flow_info
@@ -291,7 +291,7 @@ create_basic_block_structure (index, head, end, bb_note)
 }
 
 /* Create new basic block consisting of instructions in between HEAD and
-   END and place it to the BB chain at possition INDEX.
+   END and place it to the BB chain at position INDEX.
    END can be NULL in to create new empty basic block before HEAD.
    Both END and HEAD can be NULL to create basic block at the end of
    INSN chain.  */
@@ -691,7 +691,7 @@ try_redirect_by_replacing_jump (e, target)
        fprintf (rtl_dump_file, "Removing jump %i.\n", INSN_UID (insn));
       fallthru = 1;
 
-      /* Selectivly unlink whole insn chain.  */
+      /* Selectively unlink whole insn chain.  */
       delete_insn_chain (kill_from, PREV_INSN (target->head));
     }
   /* If this already is simplejump, redirect it.  */
@@ -710,7 +710,7 @@ try_redirect_by_replacing_jump (e, target)
       rtx target_label = block_label (target);
       rtx barrier;
 
-      emit_jump_insn_after (gen_jump (target_label), kill_from);
+      emit_jump_insn_after (gen_jump (target_label), insn);
       JUMP_LABEL (src->end) = target_label;
       LABEL_NUSES (target_label)++;
       if (rtl_dump_file)
@@ -749,9 +749,9 @@ try_redirect_by_replacing_jump (e, target)
 /* Return last loop_beg note appearing after INSN, before start of next
    basic block.  Return INSN if there are no such notes.
 
-   When emmiting jump to redirect an fallthru edge, it should always
+   When emitting jump to redirect an fallthru edge, it should always
    appear after the LOOP_BEG notes, as loop optimizer expect loop to
-   eighter start by fallthru edge or jump following the LOOP_BEG note
+   either start by fallthru edge or jump following the LOOP_BEG note
    jumping to the loop exit test.  */
 
 static rtx
@@ -774,11 +774,11 @@ last_loop_beg_note (insn)
    Don't do that on expense of adding new instructions or reordering
    basic blocks.
 
-   Function can be also called with edge destionation equivalent to the
+   Function can be also called with edge destination equivalent to the
    TARGET.  Then it should try the simplifications and do nothing if
    none is possible.
 
-   Return true if transformation suceeded.  We still return flase in case
+   Return true if transformation succeeded.  We still return false in case
    E already destinated TARGET and we didn't managed to simplify instruction
    stream.  */
 
@@ -958,7 +958,7 @@ force_nonfallthru (e)
 
 /* Redirect edge even at the expense of creating new jump insn or
    basic block.  Return new basic block if created, NULL otherwise.
-   Abort if converison is impossible.  */
+   Abort if conversion is impossible.  */
 
 basic_block
 redirect_edge_and_branch_force (e, target)
@@ -1119,7 +1119,7 @@ split_edge (edge_in)
     abort ();
 
   /* We are going to place the new block in front of edge destination.
-     Avoid existence of fallthru predecesors.  */
+     Avoid existence of fallthru predecessors.  */
   if ((edge_in->flags & EDGE_FALLTHRU) == 0)
     {
       edge e;
@@ -1634,10 +1634,10 @@ verify_flow_info ()
        }
       if (!has_fallthru)
        {
-         rtx insn = bb->end;
+         rtx insn;
 
          /* Ensure existence of barrier in BB with no fallthru edges.  */
-         for (insn = bb->end; GET_CODE (insn) != BARRIER;
+         for (insn = bb->end; !insn || GET_CODE (insn) != BARRIER;
               insn = NEXT_INSN (insn))
            if (!insn
                || (GET_CODE (insn) == NOTE
@@ -1645,6 +1645,7 @@ verify_flow_info ()
                {
                  error ("Missing barrier after block %i", bb->index);
                  err = 1;
+                 break;
                }
        }
 
@@ -1810,7 +1811,7 @@ verify_flow_info ()
   free (edge_checksum);
 }
 \f
-/* Assume that the preceeding pass has possibly eliminated jump instructions
+/* Assume that the preceding pass has possibly eliminated jump instructions
    or converted the unconditional jumps.  Eliminate the edges from CFG.
    Return true if any edges are eliminated.  */
 
@@ -1819,7 +1820,7 @@ purge_dead_edges (bb)
      basic_block bb;
 {
   edge e, next;
-  rtx insn = bb->end;
+  rtx insn = bb->end, note;
   bool purged = false;
 
   if (GET_CODE (insn) == JUMP_INSN && !simplejump_p (insn))
@@ -1837,6 +1838,11 @@ purge_dead_edges (bb)
        {
          next = e->succ_next;
 
+         /* Avoid abnormal flags to leak from computed jumps turned
+            into simplejumps.  */
+         e->flags &= EDGE_ABNORMAL;
+
          /* Check purposes we can have edge.  */
          if ((e->flags & EDGE_FALLTHRU)
              && any_condjump_p (insn))
@@ -1878,6 +1884,17 @@ purge_dead_edges (bb)
       return purged;
     }
 
+  /* If this instruction cannot trap, remove REG_EH_REGION notes.  */
+  if (GET_CODE (insn) == INSN
+      && (note = find_reg_note (insn, REG_EH_REGION, NULL)))
+    {
+      rtx eqnote;
+      if (! may_trap_p (PATTERN (insn))
+         || ((eqnote = find_reg_equal_equiv_note (insn))
+             && ! may_trap_p (XEXP (eqnote, 0))))
+       remove_note (insn, note);
+    }
+
   /* Cleanup abnormal edges caused by throwing insns that have been
      eliminated.  */
   if (! can_throw_internal (bb->end))
@@ -1917,16 +1934,36 @@ purge_dead_edges (bb)
   return purged;
 }
 
-/* Search all basic blocks for potentionally dead edges and purge them.
+/* Search all basic blocks for potentially dead edges and purge them.
 
-   Return true ifif some edge has been elliminated.
+   Return true iff some edge has been eliminated.
  */
 
 bool
-purge_all_dead_edges ()
+purge_all_dead_edges (update_life_p)
+     int update_life_p;
 {
   int i, purged = false;
+  sbitmap blocks;
+
+  if (update_life_p)
+    {
+      blocks = sbitmap_alloc (n_basic_blocks);
+      sbitmap_zero (blocks);
+    }
   for (i = 0; i < n_basic_blocks; i++)
-    purged |= purge_dead_edges (BASIC_BLOCK (i));
+    {
+      bool purged_here;
+      purged_here = purge_dead_edges (BASIC_BLOCK (i));
+      purged |= purged_here;
+      if (purged_here && update_life_p)
+       SET_BIT (blocks, i);
+    }
+  if (update_life_p && purged)
+    update_life_info (blocks, UPDATE_LIFE_GLOBAL,
+                     PROP_DEATH_NOTES | PROP_SCAN_DEAD_CODE
+                     | PROP_KILL_DEAD_CODE);
+  if (update_life_p)
+    sbitmap_free (blocks);
   return purged;
 }