From: jfc Date: Wed, 10 Jun 1998 06:00:50 +0000 (+0000) Subject: Wed Jun 10 08:56:27 1998 John Carr X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=1162c62d7eb8905838cb349eb1bdec1c168cb3da;p=pf3gnuchains%2Fgcc-fork.git Wed Jun 10 08:56:27 1998 John Carr * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20402 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8f0f748b185..4376465c9aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Wed Jun 10 08:56:27 1998 John Carr + + * 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 bc2a51a4be0..23ad43933e9 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;