Commit 0009eff2 by Richard Kenner

*** empty log message ***

From-SVN: r641
parent 4e09f580
...@@ -5424,9 +5424,9 @@ gen_input_reload (reloadreg, in, before_insn) ...@@ -5424,9 +5424,9 @@ gen_input_reload (reloadreg, in, before_insn)
is recognized and matches its constraints. If so, it can be used. is recognized and matches its constraints. If so, it can be used.
It might be better not to actually emit the insn unless it is valid, It might be better not to actually emit the insn unless it is valid,
but we need to pass the insn as an operand to `recog' and it is but we need to pass the insn as an operand to `recog' and
simpler to emit and then delete the insn if not valid than to `insn_extract'and it is simpler to emit and then delete the insn if
dummy things up. */ not valid than to dummy things up. */
rtx move_operand, other_operand, insn; rtx move_operand, other_operand, insn;
int code; int code;
...@@ -5621,6 +5621,10 @@ inc_for_reload (reloadreg, value, inc_amount, insn) ...@@ -5621,6 +5621,10 @@ inc_for_reload (reloadreg, value, inc_amount, insn)
rtx incloc = XEXP (value, 0); rtx incloc = XEXP (value, 0);
/* Nonzero if increment after copying. */ /* Nonzero if increment after copying. */
int post = (GET_CODE (value) == POST_DEC || GET_CODE (value) == POST_INC); int post = (GET_CODE (value) == POST_DEC || GET_CODE (value) == POST_INC);
rtx prev = PREV_INSN (insn);
rtx inc;
rtx add_insn;
int code;
/* No hard register is equivalent to this register after /* No hard register is equivalent to this register after
inc/dec operation. If REG_LAST_RELOAD_REG were non-zero, inc/dec operation. If REG_LAST_RELOAD_REG were non-zero,
...@@ -5632,78 +5636,71 @@ inc_for_reload (reloadreg, value, inc_amount, insn) ...@@ -5632,78 +5636,71 @@ inc_for_reload (reloadreg, value, inc_amount, insn)
if (GET_CODE (value) == PRE_DEC || GET_CODE (value) == POST_DEC) if (GET_CODE (value) == PRE_DEC || GET_CODE (value) == POST_DEC)
inc_amount = - inc_amount; inc_amount = - inc_amount;
/* First handle preincrement, which is simpler. */ inc = gen_rtx (CONST_INT, VOIDmode, inc_amount);
if (! post)
/* If this is post-increment, first copy the location to the reload reg. */
if (post)
emit_insn_before (gen_move_insn (reloadreg, incloc), insn);
/* See if we can directly increment INCLOC. Use a method similar to that
in gen_input_reload. */
add_insn = emit_insn_before (gen_rtx (SET, VOIDmode, incloc,
gen_rtx (PLUS, GET_MODE (incloc),
incloc, inc)), insn);
code = recog_memoized (add_insn);
if (code >= 0)
{ {
/* If incrementing a register, assume we can insn_extract (add_insn);
output an insn to increment it directly. */ if (constrain_operands (code, 1))
if (GET_CODE (incloc) == REG
&& (REGNO (incloc) < FIRST_PSEUDO_REGISTER
|| reg_renumber[REGNO (incloc)] >= 0))
{ {
rtx first_new /* If this is a pre-increment and we have incremented the value
= emit_insn_before (gen_add2_insn (incloc, where it lives, copy the incremented value to RELOADREG to
gen_rtx (CONST_INT, VOIDmode, be used as an address. */
inc_amount)),
insn); if (! post)
emit_insn_before (gen_move_insn (reloadreg, incloc), insn); emit_insn_before (gen_move_insn (reloadreg, incloc), insn);
return first_new; return NEXT_INSN (prev);
}
else
/* Else we must not assume we can increment the location directly
(even though on many target machines we can);
copy it to the reload register, increment there, then save back. */
{
rtx first_new
= emit_insn_before (gen_move_insn (reloadreg, incloc), insn);
emit_insn_before (gen_add2_insn (reloadreg,
gen_rtx (CONST_INT, VOIDmode,
inc_amount)),
insn);
emit_insn_before (gen_move_insn (incloc, reloadreg), insn);
return first_new;
} }
} }
/* Postincrement.
Because this might be a jump insn or a compare, and because RELOADREG
may not be available after the insn in an input reload,
we must do the incrementation before the insn being reloaded for. */
else
{
/* Copy the value, then increment it. */
rtx first_new
= emit_insn_before (gen_move_insn (reloadreg, incloc), insn);
/* If incrementing a register, assume we can if (PREV_INSN (add_insn))
output an insn to increment it directly. */ NEXT_INSN (PREV_INSN (add_insn)) = NEXT_INSN (add_insn);
if (GET_CODE (incloc) == REG if (NEXT_INSN (add_insn))
&& (REGNO (incloc) < FIRST_PSEUDO_REGISTER PREV_INSN (NEXT_INSN (add_insn)) = PREV_INSN (add_insn);
|| reg_renumber[REGNO (incloc)] >= 0))
/* If couldn't do the increment directly, must increment in RELOADREG.
The way we do this depends on whether this is pre- or post-increment.
For pre-increment, copy INCLOC to the reload register, increment it
there, then save back. */
if (! post)
{ {
emit_insn_before (gen_add2_insn (incloc, emit_insn_before (gen_move_insn (reloadreg, incloc), insn);
gen_rtx (CONST_INT, VOIDmode, emit_insn_before (gen_add2_insn (reloadreg, inc), insn);
inc_amount)), emit_insn_before (gen_move_insn (incloc, reloadreg), insn);
insn);
} }
else else
/* Else we must not assume we can increment INCLOC
(even though on many target machines we can);
increment the copy in the reload register,
save that back, then decrement the reload register
so it has the original value. */
{ {
emit_insn_before (gen_add2_insn (reloadreg, /* Postincrement.
gen_rtx (CONST_INT, VOIDmode, Because this might be a jump insn or a compare, and because RELOADREG
inc_amount)), may not be available after the insn in an input reload, we must do
insn); the incrementation before the insn being reloaded for.
We have already copied INCLOC to RELOADREG. Increment the copy in
RELOADREG, save that back, then decrement RELOADREG so it has
the original value. */
emit_insn_before (gen_add2_insn (reloadreg, inc), insn);
emit_insn_before (gen_move_insn (incloc, reloadreg), insn); emit_insn_before (gen_move_insn (incloc, reloadreg), insn);
emit_insn_before (gen_add2_insn (reloadreg, emit_insn_before (gen_add2_insn (reloadreg,
gen_rtx (CONST_INT, VOIDmode, gen_rtx (CONST_INT, VOIDmode,
-inc_amount)), -inc_amount)),
insn); insn);
} }
return first_new;
} return NEXT_INSN (prev);
} }
/* Return 1 if we are certain that the constraint-string STRING allows /* Return 1 if we are certain that the constraint-string STRING allows
...@@ -5743,9 +5740,9 @@ constraint_accepts_reg_p (string, reg) ...@@ -5743,9 +5740,9 @@ constraint_accepts_reg_p (string, reg)
default: default:
/* Any reg in specified class wins for this alternative. */ /* Any reg in specified class wins for this alternative. */
{ {
int class = REG_CLASS_FROM_LETTER (c); enum reg_class class = REG_CLASS_FROM_LETTER (c);
if (TEST_HARD_REG_BIT (reg_class_contents[class], regno)) if (TEST_HARD_REG_BIT (reg_class_contents[(int) class], regno))
value = 1; value = 1;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment