This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: fix pr25335
2006-02-09 J"orn Rennecke <joern.rennecke@st.com>
* reload1.c (gen_reload): Also use find_replacement in UNARY_P case.
That patch suffered from a typo; I have attached the corrected patch.
I'm currently testing that in i686-pc-linux-gnu native, X arm-elf, X
cris-elf,
X sh-elf and X sh64-elf. (native is currently in stage 2, and the SH
crosses
are building newlib.)
OK to apply to mainline if tests succeed?
2006-02-10 J"orn Rennecke <joern.rennecke@st.com>
* reload1.c (gen_reload): Also use find_replacement in UNARY_P case.
Index: config/alpha/alpha.c
===================================================================
/usr/bin/diff -p -d -F^( -u -L config/alpha/alpha.c (revision 110809) -L config/alpha/alpha.c (working copy) config/alpha/.svn/text-base/alpha.c.svn-base config/alpha/alpha.c
--- config/alpha/alpha.c (revision 110809)
+++ config/alpha/alpha.c (working copy)
@@ -1509,7 +1509,7 @@ get_aligned_mem (rtx ref, rtx *paligned_
if (reload_in_progress
&& ! memory_address_p (GET_MODE (ref), XEXP (ref, 0)))
{
- base = find_replacement (&XEXP (ref, 0));
+ base = XEXP (ref, 0);
gcc_assert (memory_address_p (GET_MODE (ref), base));
}
else
@@ -1554,7 +1554,7 @@ get_unaligned_address (rtx ref, int extr
if (reload_in_progress
&& ! memory_address_p (GET_MODE (ref), XEXP (ref, 0)))
{
- base = find_replacement (&XEXP (ref, 0));
+ base = XEXP (ref, 0);
gcc_assert (memory_address_p (GET_MODE (ref), base));
}
Index: config/s390/s390.c
===================================================================
/usr/bin/diff -p -d -F^( -u -L config/s390/s390.c (revision 110809) -L config/s390/s390.c (working copy) config/s390/.svn/text-base/s390.c.svn-base config/s390/s390.c
--- config/s390/s390.c (revision 110809)
+++ config/s390/s390.c (working copy)
@@ -2667,8 +2667,8 @@ s390_expand_plus_operand (rtx target, rt
/* Check if any of the two operands is already scheduled
for replacement by reload. This can happen e.g. when
float registers occur in an address. */
- sum1 = find_replacement (&XEXP (src, 0));
- sum2 = find_replacement (&XEXP (src, 1));
+ sum1 = XEXP (src, 0);
+ sum2 = XEXP (src, 1);
src = gen_rtx_PLUS (Pmode, sum1, sum2);
/* If the address is already strictly valid, there's nothing to do. */
@@ -2691,8 +2691,7 @@ s390_expand_plus_operand (rtx target, rt
/* According to the way these invalid addresses are generated
in reload.c, it should never happen (at least on s390) that
- *neither* of the PLUS components, after find_replacements
- was applied, is an address register. */
+ *neither* of the PLUS components is an address register. */
if (sum1 == scratch && sum2 == scratch)
{
debug_rtx (src);
Index: config/s390/s390.md
===================================================================
/usr/bin/diff -p -d -F^( -u -L config/s390/s390.md (revision 110809) -L config/s390/s390.md (working copy) config/s390/.svn/text-base/s390.md.svn-base config/s390/s390.md
--- config/s390/s390.md (revision 110809)
+++ config/s390/s390.md (working copy)
@@ -883,7 +883,7 @@ (define_expand "reload_outti"
"TARGET_64BIT"
{
gcc_assert (MEM_P (operands[0]));
- s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
+ s390_load_address (operands[2], XEXP (operands[0], 0));
operands[0] = replace_equiv_address (operands[0], operands[2]);
emit_move_insn (operands[0], operands[1]);
DONE;
@@ -1078,7 +1078,7 @@ (define_expand "reload_outdi"
"!TARGET_64BIT"
{
gcc_assert (MEM_P (operands[0]));
- s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
+ s390_load_address (operands[2], XEXP (operands[0], 0));
operands[0] = replace_equiv_address (operands[0], operands[2]);
emit_move_insn (operands[0], operands[1]);
DONE;
@@ -1686,7 +1686,7 @@ (define_expand "reload_outdf"
"!TARGET_64BIT"
{
gcc_assert (MEM_P (operands[0]));
- s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
+ s390_load_address (operands[2], XEXP (operands[0], 0));
operands[0] = replace_equiv_address (operands[0], operands[2]);
emit_move_insn (operands[0], operands[1]);
DONE;
Index: config/m68k/m68k.c
===================================================================
/usr/bin/diff -p -d -F^( -u -L config/m68k/m68k.c (revision 110809) -L config/m68k/m68k.c (working copy) config/m68k/.svn/text-base/m68k.c.svn-base config/m68k/m68k.c
--- config/m68k/m68k.c (revision 110809)
+++ config/m68k/m68k.c (working copy)
@@ -2387,11 +2387,11 @@ emit_move_sequence (rtx *operands, enum
}
if (scratch_reg && reload_in_progress && GET_CODE (operand0) == MEM
- && ((tem = find_replacement (&XEXP (operand0, 0)))
+ && ((tem = XEXP (operand0, 0))
!= XEXP (operand0, 0)))
operand0 = gen_rtx_MEM (GET_MODE (operand0), tem);
if (scratch_reg && reload_in_progress && GET_CODE (operand1) == MEM
- && ((tem = find_replacement (&XEXP (operand1, 0)))
+ && ((tem = XEXP (operand1, 0))
!= XEXP (operand1, 0)))
operand1 = gen_rtx_MEM (GET_MODE (operand1), tem);
Index: config/arm/arm.c
===================================================================
/usr/bin/diff -p -d -F^( -u -L config/arm/arm.c (revision 110809) -L config/arm/arm.c (working copy) config/arm/.svn/text-base/arm.c.svn-base config/arm/arm.c
--- config/arm/arm.c (revision 110809)
+++ config/arm/arm.c (working copy)
@@ -6828,14 +6828,14 @@ arm_reload_in_hi (rtx *operands)
if (reg_equiv_mem[REGNO (ref)])
{
ref = reg_equiv_mem[REGNO (ref)];
- base = find_replacement (&XEXP (ref, 0));
+ base = XEXP (ref, 0);
}
else
/* The slot is out of range, or was dressed up in a SUBREG. */
base = reg_equiv_address[REGNO (ref)];
}
else
- base = find_replacement (&XEXP (ref, 0));
+ base = XEXP (ref, 0);
/* Handle the case where the address is too complex to be offset by 1. */
if (GET_CODE (base) == MINUS
@@ -6945,14 +6945,14 @@ arm_reload_out_hi (rtx *operands)
if (reg_equiv_mem[REGNO (ref)])
{
ref = reg_equiv_mem[REGNO (ref)];
- base = find_replacement (&XEXP (ref, 0));
+ base = XEXP (ref, 0);
}
else
/* The slot is out of range, or was dressed up in a SUBREG. */
base = reg_equiv_address[REGNO (ref)];
}
else
- base = find_replacement (&XEXP (ref, 0));
+ base = XEXP (ref, 0);
scratch = gen_rtx_REG (SImode, REGNO (operands[2]));
Index: config/pa/pa.c
===================================================================
/usr/bin/diff -p -d -F^( -u -L config/pa/pa.c (revision 110809) -L config/pa/pa.c (working copy) config/pa/.svn/text-base/pa.c.svn-base config/pa/pa.c
--- config/pa/pa.c (revision 110809)
+++ config/pa/pa.c (working copy)
@@ -1389,12 +1389,12 @@ emit_move_sequence (rtx *operands, enum
}
if (scratch_reg && reload_in_progress && GET_CODE (operand0) == MEM
- && ((tem = find_replacement (&XEXP (operand0, 0)))
+ && ((tem = XEXP (operand0, 0))
!= XEXP (operand0, 0)))
operand0 = replace_equiv_address (operand0, tem);
if (scratch_reg && reload_in_progress && GET_CODE (operand1) == MEM
- && ((tem = find_replacement (&XEXP (operand1, 0)))
+ && ((tem = XEXP (operand1, 0))
!= XEXP (operand1, 0)))
operand1 = replace_equiv_address (operand1, tem);
Index: reload1.c
===================================================================
/usr/bin/diff -p -d -F^( -u -L reload1.c (revision 110809) -L reload1.c (working copy) .svn/text-base/reload1.c.svn-base reload1.c
--- reload1.c (revision 110809)
+++ reload1.c (working copy)
@@ -7721,6 +7721,10 @@ gen_reload (rtx out, rtx in, int opnum,
rtx out_moded;
rtx set;
+ op1 = find_replacement (&XEXP (in, 0));
+ if (op1 != XEXP (in, 0))
+ in = gen_rtx_fmt_e (GET_CODE (in), GET_MODE (in), op1);
+
/* First, try a plain SET. */
set = emit_insn_if_valid_for_reload (gen_rtx_SET (VOIDmode, out, in));
if (set)
@@ -7729,7 +7733,6 @@ gen_reload (rtx out, rtx in, int opnum,
/* If that failed, move the inner operand to the reload
register, and try the same unop with the inner expression
replaced with the reload register. */
- op1 = XEXP (in, 0);
if (GET_MODE (op1) != GET_MODE (out))
out_moded = gen_rtx_REG (GET_MODE (op1), REGNO (out));