This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
reload CSE optimization
- To: egcs at cygnus dot com, egcs-patches at cygnus dot com
- Subject: reload CSE optimization
- From: John Carr <jfc at mit dot edu>
- Date: Mon, 08 Jun 1998 14:25:42 -0400
Reload CSE should not replace a CONST_INT with a REG unless the REG is
cheaper. If they are equal cost other considerations make the original
form preferable (scheduling, human comprehension, and the principle that
one should avoid making changes with no benefit).
This patch also reduces the number of calls to gen_rtx_REG.
Mon Jun 8 14:14:56 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.
*** reload1.c~ Sat Jun 6 20:07:08 1998
--- reload1.c Mon Jun 8 14:12:56 1998
***************
*** 8542,8547 ****
--- 8542,8548 ----
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,8613 ****
--- 8609,8617 ----
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. */
***************
*** 8649,8656 ****
replacement register if we don't have one for this
alternative yet. */
if (op_alt_regno[i][j] == -1
! && reg_fits_class_p (gen_rtx_REG (mode, regno), class,
! 0, mode))
{
alternative_nregs[j]++;
op_alt_regno[i][j] = regno;
--- 8653,8661 ----
replacement register if we don't have one for this
alternative yet. */
if (op_alt_regno[i][j] == -1
! && 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;