* 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
+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".
#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);
#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
{
#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
#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,
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)
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));
#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
}
{
#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