reg-stack.c (next_flags_user): Use current_block->end
authorJan Hubicka <jh@suse.cz>
Mon, 19 Feb 2001 14:59:42 +0000 (15:59 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 19 Feb 2001 14:59:42 +0000 (14:59 +0000)
* reg-stack.c (next_flags_user): Use current_block->end
(swap_rtx_condition): Look for next user if flags don't die;
give up on CALL_INSNs; use current_block->end.

From-SVN: r39884

gcc/ChangeLog
gcc/reg-stack.c

index be525f1a1ba2a2ff623de1396e5347dfc16b9ef4..ee58bb40e5017af2f206cdf27cb88d75c44a34e8 100644 (file)
@@ -1,3 +1,9 @@
+Mon Feb 19 15:51:30 CET 2001  Jan Hubicka  <jh@suse.cz>
+
+       * reg-stack.c (next_flags_user): Use current_block->end
+       (swap_rtx_condition): Look for next user if flags don't die;
+       give up on CALL_INSNs; use current_block->end.
+
 Mon Feb 19 08:27:21 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * sibcall.c (call_ends_block_p): New function.
index 75ffbed105b2eddb7f4a83a1e8bf8409f816ced7..94300c394d42bd1992ee0503fb0951aed07666fc 100644 (file)
@@ -335,22 +335,18 @@ next_flags_user (insn)
 {
   /* Search forward looking for the first use of this value. 
      Stop at block boundaries.  */
-  /* ??? This really cries for BLOCK_END!  */
 
-  while (1)
+  while (insn != current_block->end)
     {
       insn = NEXT_INSN (insn);
-      if (!insn)
-       return NULL_RTX;
 
       if (INSN_P (insn) && reg_mentioned_p (ix86_flags_rtx, PATTERN (insn)))
         return insn;
 
-      if (GET_CODE (insn) == JUMP_INSN
-         || GET_CODE (insn) == CODE_LABEL
-         || GET_CODE (insn) == CALL_INSN)
+      if (GET_CODE (insn) == CALL_INSN)
        return NULL_RTX;
     }
+  return NULL_RTX;
 }
 \f
 /* Reorganise the stack into ascending numbers,
@@ -1231,17 +1227,12 @@ swap_rtx_condition (insn)
 
       /* Search forward looking for the first use of this value. 
         Stop at block boundaries.  */
-      /* ??? This really cries for BLOCK_END!  */
-      while (1)
+      while (insn != current_block->end)
        {
          insn = NEXT_INSN (insn);
-         if (insn == NULL_RTX)
-           return 0;
          if (INSN_P (insn) && reg_mentioned_p (dest, insn))
            break;
-         if (GET_CODE (insn) == JUMP_INSN)
-           return 0;
-         if (GET_CODE (insn) == CODE_LABEL)
+         if (GET_CODE (insn) == CALL_INSN)
            return 0;
        }
 
@@ -1264,8 +1255,19 @@ swap_rtx_condition (insn)
 
   if (swap_rtx_condition_1 (pat))
     {
+      int fail = 0;
       INSN_CODE (insn) = -1;
       if (recog_memoized (insn) == -1)
+       fail = 1;
+      /* In case the flags don't die here, recurse to try fix
+         following user too.  */
+      else if (! dead_or_set_p (insn, ix86_flags_rtx))
+       {
+         insn = next_flags_user (insn);
+         if (!insn || !swap_rtx_condition (insn))
+           fail = 1;
+       }
+      if (fail)
        {
          swap_rtx_condition_1 (pat);
          return 0;