OSDN Git Service

2004-08-21 Bud Davis <bdavis9659@comcast.net>
[pf3gnuchains/gcc-fork.git] / gcc / loop-doloop.c
index fa6b55b..e463eea 100644 (file)
@@ -144,6 +144,7 @@ doloop_valid_p (struct loop *loop, struct niter_desc *desc)
   basic_block *body = get_loop_body (loop), bb;
   rtx insn;
   unsigned i;
+  bool result = true;
 
   /* Check for loops that may not terminate under special conditions.  */
   if (!desc->simple_p
@@ -174,7 +175,8 @@ doloop_valid_p (struct loop *loop, struct niter_desc *desc)
         enable count-register loops in this case.  */
       if (dump_file)
        fprintf (dump_file, "Doloop: Possible infinite iteration case.\n");
-      return false;
+      result = false;
+      goto cleanup;
     }
 
   for (i = 0; i < loop->num_nodes; i++)
@@ -187,28 +189,33 @@ doloop_valid_p (struct loop *loop, struct niter_desc *desc)
        {
          /* A called function may clobber any special registers required for
             low-overhead looping.  */
-         if (GET_CODE (insn) == CALL_INSN)
+         if (CALL_P (insn))
            {
              if (dump_file)
                fprintf (dump_file, "Doloop: Function call in loop.\n");
-             return false;
+             result = false;
+             goto cleanup;
            }
 
          /* Some targets (eg, PPC) use the count register for branch on table
             instructions.  ??? This should be a target specific check.  */
-         if (GET_CODE (insn) == JUMP_INSN
+         if (JUMP_P (insn)
              && (GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC
                  || GET_CODE (PATTERN (insn)) == ADDR_VEC))
            {
              if (dump_file)
                fprintf (dump_file, "Doloop: Computed branch in the loop.\n");
-             return false;
+             result = false;
+             goto cleanup;
            }
        }
     }
+  result = true;
+
+cleanup:
   free (body);
 
-  return true;
+  return result;
 }
 
 /* Adds test of COND jumping to DEST to the end of BB.  */
@@ -507,7 +514,7 @@ doloop_optimize (struct loop *loop)
     {
       while (NEXT_INSN (doloop_pat) != NULL_RTX)
        doloop_pat = NEXT_INSN (doloop_pat);
-      if (GET_CODE (doloop_pat) == JUMP_INSN)
+      if (JUMP_P (doloop_pat))
        doloop_pat = PATTERN (doloop_pat);
       else
        doloop_pat = NULL_RTX;