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
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++)
{
/* 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. */
{
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;