OSDN Git Service

emit-rtl.c (init_emit): Clear sequence_stack.
[pf3gnuchains/gcc-fork.git] / gcc / jump.c
index 63f5313..fb4ff23 100644 (file)
@@ -837,6 +837,7 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
              && this_is_condjump && ! this_is_simplejump
              && BRANCH_COST >= 3
              && (temp = next_nonnote_insn (insn)) != 0
+             && GET_CODE (temp) == INSN
              && REG_NOTES (temp) == 0
              && (reallabelprev == temp
                  || ((temp2 = next_active_insn (temp)) != 0
@@ -874,8 +875,10 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
              && this_is_condjump && ! this_is_simplejump
              && BRANCH_COST >= 4
              && (temp = next_nonnote_insn (insn)) != 0
+             && GET_CODE (temp) == INSN
              && REG_NOTES (temp) == 0
              && (temp3 = next_nonnote_insn (temp)) != 0
+             && GET_CODE (temp3) == INSN
              && REG_NOTES (temp3) == 0
              && (reallabelprev == temp3
                  || ((temp2 = next_active_insn (temp3)) != 0
@@ -920,8 +923,10 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
              && this_is_condjump && ! this_is_simplejump
              && BRANCH_COST >= 4
              && (temp = next_nonnote_insn (insn)) != 0
+             && GET_CODE (temp) == INSN
              && REG_NOTES (temp) == 0
              && (temp3 = next_nonnote_insn (temp)) != 0
+             && GET_CODE (temp3) == INSN
              && REG_NOTES (temp3) == 0
              && (reallabelprev == temp3
                  || ((temp2 = next_active_insn (temp3)) != 0
@@ -1186,7 +1191,14 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
             TEMP3 to the condition being tested.
             TEMP4 to the earliest insn used to find the condition.  */
 
-         if (BRANCH_COST >= 2
+         if ((BRANCH_COST >= 2
+#ifdef HAVE_incscc
+              || HAVE_incscc
+#endif
+#ifdef HAVE_decscc
+              || HAVE_decscc
+#endif
+             )
              && ! reload_completed
              && this_is_condjump && ! this_is_simplejump
              && (temp = next_nonnote_insn (insn)) != 0
@@ -1249,7 +1261,7 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
                target = expand_binop (GET_MODE (temp2),
                                       (XEXP (SET_SRC (temp1), 1) == const1_rtx
                                        ? add_optab : sub_optab),
-                                      temp2, target, temp2, OPTAB_WIDEN);
+                                      temp2, target, temp2, 0, OPTAB_WIDEN);
 
              if (target != 0)
                {
@@ -3036,12 +3048,34 @@ void
 delete_jump (insn)
      rtx insn;
 {
-  register rtx x = PATTERN (insn);
+  register rtx set = single_set (insn);
+
+  if (set && GET_CODE (SET_DEST (set)) == PC)
+    delete_computation (insn);
+}
+
+/* Delete INSN and recursively delete insns that compute values used only
+   by INSN.  This uses the REG_DEAD notes computed during flow analysis.
+   If we are running before flow.c, we need do nothing since flow.c will
+   delete dead code.  We also can't know if the registers being used are
+   dead or not at this point.
+
+   Otherwise, look at all our REG_DEAD notes.  If a previous insn does
+   nothing other than set a register that dies in this insn, we can delete
+   that insn as well.
+
+   On machines with CC0, if CC0 is used in this insn, we may be able to
+   delete the insn that set it.  */
+
+void
+delete_computation (insn)
+     rtx insn;
+{
+  rtx note, next;
 
-  if (GET_CODE (x) == SET
-      && GET_CODE (SET_DEST (x)) == PC)
-    {
 #ifdef HAVE_cc0
+  if (reg_referenced_p (cc0_rtx, PATTERN (insn)))
+    {
       rtx prev = prev_nonnote_insn (insn);
       /* We assume that at this stage
         CC's are always set explicitly
@@ -3054,34 +3088,14 @@ delete_jump (insn)
        {
          if (sets_cc0_p (PATTERN (prev)) > 0
              && !FIND_REG_INC_NOTE (prev, NULL_RTX))
-           delete_insn (prev);
+           delete_computation (prev);
          else
            /* Otherwise, show that cc0 won't be used.  */
            REG_NOTES (prev) = gen_rtx (EXPR_LIST, REG_UNUSED,
                                        cc0_rtx, REG_NOTES (prev));
        }
-#endif
-      /* Now delete the jump insn itself.  */
-      delete_computation (insn);
     }
-}
-
-/* Delete INSN and recursively delete insns that compute values used only
-   by INSN.  This uses the REG_DEAD notes computed during flow analysis.
-   If we are running before flow.c, we need do nothing since flow.c will
-   delete dead code.  We also can't know if the registers being used are
-   dead or not at this point.
-
-   Otherwise, look at all our REG_DEAD notes.  If a previous insn does
-   nothing other than set a register that dies in this insn, we can delete
-   that insn as well.  */
-
-void
-delete_computation (insn)
-     rtx insn;
-{
-#ifndef HAVE_cc0
-  rtx note, next;
+#endif
 
   for (note = REG_NOTES (insn); note; note = next)
     {
@@ -3152,7 +3166,7 @@ delete_computation (insn)
            }
        }
     }
-#endif /* Don't HAVE_cc0 */
+
   delete_insn (insn);
 }
 \f