reload.c (reload_adjust_reg_for_mode): New function.

* reload.c (reload_adjust_reg_for_mode): New function.
(subst_reloads): Call it.
(operands_match_p): Adjust registers using HARD_REGNO_NREGS.
* reload.h (reload_adjust_reg_for_mode): Declare.
* reload1.c (emit_input_reload_insns, emit_output_reload_insns):
Call it.

From-SVN: r63766
This commit is contained in:
Alexandre Oliva 2003-03-04 05:54:39 +00:00 committed by Alexandre Oliva
parent fd4290d6c7
commit f12448c818
4 changed files with 42 additions and 9 deletions

View File

@ -1,3 +1,12 @@
2003-03-04 Alexandre Oliva <aoliva@redhat.com>
* reload.c (reload_adjust_reg_for_mode): New function.
(subst_reloads): Call it.
(operands_match_p): Adjust registers using HARD_REGNO_NREGS.
* reload.h (reload_adjust_reg_for_mode): Declare.
* reload1.c (emit_input_reload_insns, emit_output_reload_insns):
Call it.
2003-03-03 James E Wilson <wilson@tuliptree.org>
* optabs.c (add_equal_note): Delete SUBREG_REG use.

View File

@ -2137,10 +2137,10 @@ operands_match_p (x, y)
(reg:SI 1) will be considered the same register. */
if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD
&& i < FIRST_PSEUDO_REGISTER)
i += (GET_MODE_SIZE (GET_MODE (x)) / UNITS_PER_WORD) - 1;
i += HARD_REGNO_NREGS (i, GET_MODE (x)) - 1;
if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (y)) > UNITS_PER_WORD
&& j < FIRST_PSEUDO_REGISTER)
j += (GET_MODE_SIZE (GET_MODE (y)) / UNITS_PER_WORD) - 1;
j += HARD_REGNO_NREGS (j, GET_MODE (y)) - 1;
return i == j;
}
@ -5954,7 +5954,7 @@ subst_reloads (insn)
do the wrong thing if RELOADREG is multi-word. RELOADREG
will always be a REG here. */
if (GET_MODE (reloadreg) != r->mode && r->mode != VOIDmode)
reloadreg = gen_rtx_REG (r->mode, REGNO (reloadreg));
reloadreg = reload_adjust_reg_for_mode (reloadreg, r->mode);
/* If we are putting this into a SUBREG and RELOADREG is a
SUBREG, we would be making nested SUBREGs, so we have to fix
@ -6934,6 +6934,26 @@ regno_clobbered_p (regno, insn, mode, sets)
return 0;
}
/* Find the low part, with mode MODE, of a hard regno RELOADREG. */
rtx
reload_adjust_reg_for_mode (reloadreg, mode)
rtx reloadreg;
enum machine_mode mode;
{
int regno;
if (GET_MODE (reloadreg) == mode)
return reloadreg;
regno = REGNO (reloadreg);
if (WORDS_BIG_ENDIAN)
regno += HARD_REGNO_NREGS (regno, GET_MODE (reloadreg))
- HARD_REGNO_NREGS (regno, mode);
return gen_rtx_REG (mode, regno);
}
static const char *const reload_when_needed_name[] =
{
"RELOAD_FOR_INPUT",

View File

@ -1,6 +1,6 @@
/* Communication between reload.c and reload1.c.
Copyright (C) 1987, 1991, 1992, 1993, 1994, 1995, 1997, 1998,
1999, 2000, 2001 Free Software Foundation, Inc.
1999, 2000, 2001, 2003 Free Software Foundation, Inc.
This file is part of GCC.
@ -385,3 +385,7 @@ extern void cleanup_subreg_operands PARAMS ((rtx));
/* Debugging support. */
extern void debug_reload_to_stream PARAMS ((FILE *));
extern void debug_reload PARAMS ((void));
/* Compute the actual register we should reload to, in case we're
reloading to/from a register that is wider than a word. */
extern rtx reload_adjust_reg_for_mode PARAMS ((rtx, enum machine_mode));

View File

@ -6319,7 +6319,7 @@ emit_input_reload_insns (chain, rl, old, j)
must always be a REG here. */
if (GET_MODE (reloadreg) != mode)
reloadreg = gen_rtx_REG (mode, REGNO (reloadreg));
reloadreg = reload_adjust_reg_for_mode (reloadreg, mode);
while (GET_CODE (oldequiv) == SUBREG && GET_MODE (oldequiv) != mode)
oldequiv = SUBREG_REG (oldequiv);
if (GET_MODE (oldequiv) != VOIDmode
@ -6568,8 +6568,8 @@ emit_input_reload_insns (chain, rl, old, j)
oldequiv = old, real_oldequiv = real_old;
else
second_reload_reg
= gen_rtx_REG (new_mode,
REGNO (second_reload_reg));
= reload_adjust_reg_for_mode (second_reload_reg,
new_mode);
}
}
}
@ -6691,7 +6691,7 @@ emit_output_reload_insns (chain, rl, j)
}
if (GET_MODE (reloadreg) != mode)
reloadreg = gen_rtx_REG (mode, REGNO (reloadreg));
reloadreg = reload_adjust_reg_for_mode (reloadreg, mode);
#ifdef SECONDARY_OUTPUT_RELOAD_CLASS
@ -6732,7 +6732,7 @@ emit_output_reload_insns (chain, rl, j)
= rld[secondary_reload].secondary_out_icode;
if (GET_MODE (reloadreg) != mode)
reloadreg = gen_rtx_REG (mode, REGNO (reloadreg));
reloadreg = reload_adjust_reg_for_mode (reloadreg, mode);
if (tertiary_icode != CODE_FOR_nothing)
{