aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2003-03-04 05:54:39 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2003-03-04 05:54:39 +0000
commitf12448c818cb5c02f6630675998e49f7812b4f02 (patch)
tree9c4b3b8fc4da20af305ea602c1a3ce677c8ef72c /gcc
parentfd4290d6c7057c42a129e1b5001226d255419db7 (diff)
downloadgcc-f12448c818cb5c02f6630675998e49f7812b4f02.zip
gcc-f12448c818cb5c02f6630675998e49f7812b4f02.tar.gz
gcc-f12448c818cb5c02f6630675998e49f7812b4f02.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/reload.c26
-rw-r--r--gcc/reload.h6
-rw-r--r--gcc/reload1.c10
4 files changed, 42 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2dc5507..fe99d98 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/reload.c b/gcc/reload.c
index a2642aa..de1b1a9 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -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",
diff --git a/gcc/reload.h b/gcc/reload.h
index adc2984..7fc4f49 100644
--- a/gcc/reload.h
+++ b/gcc/reload.h
@@ -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));
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 5a0886b..e454947 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -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)
{