OSDN Git Service

* rtl.h (only_sets_cc0_p): New prototype.
authorwehle <wehle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Aug 2001 19:25:43 +0000 (19:25 +0000)
committerwehle <wehle@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Aug 2001 19:25:43 +0000 (19:25 +0000)
* jump.c (sets_cc0_p): Handle INSN.
(only_sets_cc0_p): New function.
* flow.c (merge_blocks_nomove): Use only_sets_cc0_p.
(tidy_fallthru_edge): Likewise.
* integrate.c (copy_insn_list): Likewise.
* unroll.c (unroll_loop): Likewise.
(copy_loop_body): Likewise.

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

gcc/ChangeLog
gcc/flow.c
gcc/integrate.c
gcc/jump.c
gcc/rtl.h
gcc/unroll.c

index 06984c6..7bddf97 100644 (file)
@@ -1,3 +1,14 @@
+Wed Aug 15 15:22:52 EDT 2001  John Wehle  (john@feith.com)
+
+       * rtl.h (only_sets_cc0_p): New prototype.
+       * jump.c (sets_cc0_p): Handle INSN.
+       (only_sets_cc0_p): New function.
+       * flow.c (merge_blocks_nomove): Use only_sets_cc0_p.
+       (tidy_fallthru_edge): Likewise.
+       * integrate.c (copy_insn_list): Likewise.
+       * unroll.c (unroll_loop): Likewise.
+       (copy_loop_body): Likewise.
+
 2001-08-15  Jason Eckhardt  <jle@redhat.com>
 
        * config/i960/i960.md (trap): Change "faulteq.t" to "faulte.t".
index ca2cedd..1cf81d0 100644 (file)
@@ -3008,7 +3008,7 @@ merge_blocks_nomove (a, b)
 #ifdef HAVE_cc0
       /* If this was a conditional jump, we need to also delete
         the insn that set cc0.  */
-      if (prev && sets_cc0_p (prev))
+      if (only_sets_cc0_p (prev))
        {
          rtx tmp = prev;
          prev = prev_nonnote_insn (prev);
@@ -4213,7 +4213,7 @@ tidy_fallthru_edge (e, b, c)
 #ifdef HAVE_cc0
       /* If this was a conditional jump, we need to also delete
         the insn that set cc0.  */
-      if (any_condjump_p (q) && sets_cc0_p (PREV_INSN (q)))
+      if (any_condjump_p (q) && only_sets_cc0_p (PREV_INSN (q)))
        q = PREV_INSN (q);
 #endif
 
index c865f6f..e0d5a6f 100644 (file)
@@ -1463,7 +1463,7 @@ copy_insn_list (insns, map, static_chain_value)
            {
 #ifdef HAVE_cc0
              /* If the previous insn set cc0 for us, delete it.  */
-             if (sets_cc0_p (PREV_INSN (copy)))
+             if (only_sets_cc0_p (PREV_INSN (copy)))
                delete_insn (PREV_INSN (copy));
 #endif
 
index 0b62ab4..806e190 100644 (file)
@@ -1265,6 +1265,23 @@ onlyjump_p (insn)
 
 #ifdef HAVE_cc0
 
+/* Return non-zero if X is an RTX that only sets the condition codes
+   and has no side effects.  */
+
+int
+only_sets_cc0_p (x)
+     rtx x;
+{
+
+  if (! x)
+    return 0;
+
+  if (INSN_P (x))
+    x = PATTERN (x);
+
+  return sets_cc0_p (x) == 1 && ! side_effects_p (x);
+}
+
 /* Return 1 if X is an RTX that does nothing but set the condition codes
    and CLOBBER or USE registers.
    Return -1 if X does explicitly set the condition codes,
@@ -1272,8 +1289,15 @@ onlyjump_p (insn)
 
 int
 sets_cc0_p (x)
-     rtx x ATTRIBUTE_UNUSED;
+     rtx x;
 {
+
+  if (! x)
+    return 0;
+
+  if (INSN_P (x))
+    x = PATTERN (x);
+
   if (GET_CODE (x) == SET && SET_DEST (x) == cc0_rtx)
     return 1;
   if (GET_CODE (x) == PARALLEL)
index 50ec444..02c672e 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1714,6 +1714,7 @@ extern rtx condjump_label         PARAMS ((rtx));
 extern int simplejump_p                        PARAMS ((rtx));
 extern int returnjump_p                        PARAMS ((rtx));
 extern int onlyjump_p                  PARAMS ((rtx));
+extern int only_sets_cc0_p             PARAMS ((rtx));
 extern int sets_cc0_p                  PARAMS ((rtx));
 extern int invert_jump_1               PARAMS ((rtx, rtx));
 extern int invert_jump                 PARAMS ((rtx, rtx, int));
index f888089..09a0732 100644 (file)
@@ -379,7 +379,7 @@ unroll_loop (loop, insn_count, strength_reduce_p)
 #ifdef HAVE_cc0
          /* The immediately preceding insn may be a compare which must be
             deleted.  */
-         if (sets_cc0_p (prev))
+         if (only_sets_cc0_p (prev))
            delete_insn (prev);
 #endif
        }
@@ -2148,7 +2148,7 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration,
            {
 #ifdef HAVE_cc0
              /* If the previous insn set cc0 for us, delete it.  */
-             if (sets_cc0_p (PREV_INSN (copy)))
+             if (only_sets_cc0_p (PREV_INSN (copy)))
                delete_insn (PREV_INSN (copy));
 #endif