/* Structure describes input reload of the current insns. */
struct input_reload
{
+ /* True for input reload of matched operands. */
+ bool match_p;
/* Reloaded value. */
rtx input;
/* Reload pseudo used. */
{
int i, regno;
enum reg_class new_class;
+ bool unique_p = false;
if (type == OP_OUT)
{
e.g. volatile memory. */
if (! side_effects_p (original))
for (i = 0; i < curr_insn_input_reloads_num; i++)
- if (rtx_equal_p (curr_insn_input_reloads[i].input, original)
- && in_class_p (curr_insn_input_reloads[i].reg, rclass, &new_class))
- {
- rtx reg = curr_insn_input_reloads[i].reg;
- regno = REGNO (reg);
- /* If input is equal to original and both are VOIDmode,
- GET_MODE (reg) might be still different from mode.
- Ensure we don't return *result_reg with wrong mode. */
- if (GET_MODE (reg) != mode)
- {
- if (in_subreg_p)
- continue;
- if (GET_MODE_SIZE (GET_MODE (reg)) < GET_MODE_SIZE (mode))
- continue;
- reg = lowpart_subreg (mode, reg, GET_MODE (reg));
- if (reg == NULL_RTX || GET_CODE (reg) != SUBREG)
- continue;
- }
- *result_reg = reg;
- if (lra_dump_file != NULL)
- {
- fprintf (lra_dump_file, " Reuse r%d for reload ", regno);
- dump_value_slim (lra_dump_file, original, 1);
- }
- if (new_class != lra_get_allocno_class (regno))
- lra_change_class (regno, new_class, ", change to", false);
- if (lra_dump_file != NULL)
- fprintf (lra_dump_file, "\n");
- return false;
- }
- *result_reg = lra_create_new_reg (mode, original, rclass, title);
+ {
+ if (! curr_insn_input_reloads[i].match_p
+ && rtx_equal_p (curr_insn_input_reloads[i].input, original)
+ && in_class_p (curr_insn_input_reloads[i].reg, rclass, &new_class))
+ {
+ rtx reg = curr_insn_input_reloads[i].reg;
+ regno = REGNO (reg);
+ /* If input is equal to original and both are VOIDmode,
+ GET_MODE (reg) might be still different from mode.
+ Ensure we don't return *result_reg with wrong mode. */
+ if (GET_MODE (reg) != mode)
+ {
+ if (in_subreg_p)
+ continue;
+ if (GET_MODE_SIZE (GET_MODE (reg)) < GET_MODE_SIZE (mode))
+ continue;
+ reg = lowpart_subreg (mode, reg, GET_MODE (reg));
+ if (reg == NULL_RTX || GET_CODE (reg) != SUBREG)
+ continue;
+ }
+ *result_reg = reg;
+ if (lra_dump_file != NULL)
+ {
+ fprintf (lra_dump_file, " Reuse r%d for reload ", regno);
+ dump_value_slim (lra_dump_file, original, 1);
+ }
+ if (new_class != lra_get_allocno_class (regno))
+ lra_change_class (regno, new_class, ", change to", false);
+ if (lra_dump_file != NULL)
+ fprintf (lra_dump_file, "\n");
+ return false;
+ }
+ /* If we have an input reload with a different mode, make sure it
+ will get a different hard reg. */
+ else if (REG_P (original)
+ && REG_P (curr_insn_input_reloads[i].input)
+ && REGNO (original) == REGNO (curr_insn_input_reloads[i].input)
+ && (GET_MODE (original)
+ != GET_MODE (curr_insn_input_reloads[i].input)))
+ unique_p = true;
+ }
+ *result_reg = (unique_p
+ ? lra_create_new_reg_with_unique_value
+ : lra_create_new_reg) (mode, original, rclass, title);
lra_assert (curr_insn_input_reloads_num < LRA_MAX_INSN_RELOADS);
curr_insn_input_reloads[curr_insn_input_reloads_num].input = original;
+ curr_insn_input_reloads[curr_insn_input_reloads_num].match_p = false;
curr_insn_input_reloads[curr_insn_input_reloads_num++].reg = *result_reg;
return true;
}
lra_emit_move (copy_rtx (new_in_reg), in_rtx);
*before = get_insns ();
end_sequence ();
+ /* Add the new pseudo to consider values of subsequent input reload
+ pseudos. */
+ lra_assert (curr_insn_input_reloads_num < LRA_MAX_INSN_RELOADS);
+ curr_insn_input_reloads[curr_insn_input_reloads_num].input = in_rtx;
+ curr_insn_input_reloads[curr_insn_input_reloads_num].match_p = true;
+ curr_insn_input_reloads[curr_insn_input_reloads_num++].reg = new_in_reg;
for (i = 0; (in = ins[i]) >= 0; i++)
{
lra_assert