summaryrefslogtreecommitdiff
path: root/gcc/reg-stack.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2001-02-19 14:59:42 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2001-02-19 14:59:42 +0000
commit7ce6501ca1d37a52b26ad88880e9df8a34860383 (patch)
tree625126b53f56c723996597f2f47bd167c61cb6a8 /gcc/reg-stack.c
parent1c5ecca8ce7c60ebe629ad85078d11830a7cae41 (diff)
downloadgcc-7ce6501ca1d37a52b26ad88880e9df8a34860383.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39884 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reg-stack.c')
-rw-r--r--gcc/reg-stack.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 75ffbed105b..94300c394d4 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -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;
}
/* 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;