diff options
author | John Wehle <john@feith.com> | 2001-08-15 19:25:43 +0000 |
---|---|---|
committer | John Wehle <wehle@gcc.gnu.org> | 2001-08-15 19:25:43 +0000 |
commit | 44ce0063663da883cd4d1281310734d4a36e8a00 (patch) | |
tree | f447cb6b2c6dd7264add243638d8718cd3935065 | |
parent | cff27f1d82b78847d0e4dd25469f4487c9c2dae7 (diff) | |
download | gcc-44ce0063663da883cd4d1281310734d4a36e8a00.tar.gz |
rtl.h (only_sets_cc0_p): New prototype.
* 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.
From-SVN: r44927
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/flow.c | 4 | ||||
-rw-r--r-- | gcc/integrate.c | 2 | ||||
-rw-r--r-- | gcc/jump.c | 26 | ||||
-rw-r--r-- | gcc/rtl.h | 1 | ||||
-rw-r--r-- | gcc/unroll.c | 4 |
6 files changed, 42 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 06984c612ab..7bddf9729d3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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". diff --git a/gcc/flow.c b/gcc/flow.c index ca2cedd3c28..1cf81d0f753 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -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 diff --git a/gcc/integrate.c b/gcc/integrate.c index c865f6f1aee..e0d5a6fc937 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -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 diff --git a/gcc/jump.c b/gcc/jump.c index 0b62ab42114..806e190822d 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -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) diff --git a/gcc/rtl.h b/gcc/rtl.h index 50ec444a6c9..02c672e269c 100644 --- 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)); diff --git a/gcc/unroll.c b/gcc/unroll.c index f888089da9f..09a07321e47 100644 --- a/gcc/unroll.c +++ b/gcc/unroll.c @@ -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 |