aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJohn Carr <jfc@mit.edu>1998-06-10 06:00:50 +0000
committerJohn Carr <jfc@gcc.gnu.org>1998-06-10 06:00:50 +0000
commit0254c56158b0533600ba9036258c11d377d46adf (patch)
treec2e4c3d9047c45c102dda90162c826873df79eed /gcc
parent71e89f27cd7276f25b80a24edafa66a25ccf2e99 (diff)
downloadgcc-0254c56158b0533600ba9036258c11d377d46adf.zip
gcc-0254c56158b0533600ba9036258c11d377d46adf.tar.gz
gcc-0254c56158b0533600ba9036258c11d377d46adf.tar.bz2
reload1.c (reload_cse_simplify_operands): Do not call gen_rtx_REG for each alternative.
Wed Jun 10 08:56:27 1998 John Carr <jfc@mit.edu> * reload1.c (reload_cse_simplify_operands): Do not call gen_rtx_REG for each alternative. Do not replace a CONST_INT with a REG unless the reg is cheaper. From-SVN: r20402
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/reload1.c17
2 files changed, 20 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8f0f748..4376465 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+Wed Jun 10 08:56:27 1998 John Carr <jfc@mit.edu>
+
+ * reload1.c (reload_cse_simplify_operands): Do not call gen_rtx_REG
+ for each alternative. Do not replace a CONST_INT with a REG unless
+ the reg is cheaper.
+
Wed Jun 10 02:11:55 1998 Jeffrey A Law (law@cygnus.com)
* reload.c (find_reloads_toplev): Use gen_lowpart common to convert
diff --git a/gcc/reload1.c b/gcc/reload1.c
index bc2a51a..23ad439 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -8481,6 +8481,11 @@ reload_cse_simplify_set (set, insn)
&& MEMORY_MOVE_COST (GET_MODE (src), dclass, 1) < 2)
return 0;
+ /* If the constant is cheaper than a register, don't change it. */
+ if (CONSTANT_P (src)
+ && rtx_cost (src, SET) < 2)
+ return 0;
+
dest_mode = GET_MODE (SET_DEST (set));
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
{
@@ -8542,6 +8547,7 @@ reload_cse_simplify_operands (insn)
int *op_alt_regno[MAX_RECOG_OPERANDS];
/* Array of alternatives, sorted in order of decreasing desirability. */
int *alternative_order;
+ rtx reg = gen_rtx_REG (VOIDmode, -1);
/* Find out some information about this insn. */
insn_code_number = recog_memoized (insn);
@@ -8608,6 +8614,9 @@ reload_cse_simplify_operands (insn)
if (! reload_cse_regno_equal_p (regno, recog_operand[i], mode))
continue;
+ REGNO (reg) = regno;
+ PUT_MODE (reg, mode);
+
/* We found a register equal to this operand. Now look for all
alternatives that can accept this register and have not been
assigned a register they can use yet. */
@@ -8647,10 +8656,12 @@ reload_cse_simplify_operands (insn)
case ',': case '\0':
/* See if REGNO fits this alternative, and set it up as the
replacement register if we don't have one for this
- alternative yet. */
+ alternative yet and the operand being replaced is not
+ a cheap CONST_INT. */
if (op_alt_regno[i][j] == -1
- && reg_fits_class_p (gen_rtx_REG (mode, regno), class,
- 0, mode))
+ && reg_fits_class_p (reg, class, 0, mode)
+ && (GET_CODE (recog_operand[i]) != CONST_INT
+ || rtx_cost (recog_operand[i], SET) > rtx_cost (reg, SET)))
{
alternative_nregs[j]++;
op_alt_regno[i][j] = regno;