]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tm.texi.in (TARGET_RTX_COSTS): Add an opno paramter.
authorRichard Sandiford <richard.sandiford@linaro.org>
Thu, 18 Aug 2011 12:37:53 +0000 (12:37 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 18 Aug 2011 12:37:53 +0000 (12:37 +0000)
gcc/
* doc/tm.texi.in (TARGET_RTX_COSTS): Add an opno paramter.
* doc/tm.texi: Regenerate.
* target.def (rtx_costs): Add an opno parameter.
* hooks.h (hook_bool_rtx_int_int_intp_bool_false): Replace with...
(hook_bool_rtx_int_int_int_intp_bool_false): ...this.
* hooks.c (hook_bool_rtx_int_int_intp_bool_false): Replace with...
(hook_bool_rtx_int_int_int_intp_bool_false): ...this.
* cse.c (COST_IN): Add an opno parameter.
(notreg_cost): Likewise.  Update call to rtx_cost.
(COST, fold_rtx): Update accordingly.
* dojump.c (prefer_and_bit_test): Update call to rtx_cost.
* expmed.c (emit_store_flag): Likewise.
* optabs.c (avoid_expensive_constant): Add an opno parameter.
Update call to rtx_cost.
(expand_binop_directly, expand_binop): Likewise.
(expand_twoval_binop, prepare_cmp_insn): Likewise.
* rtl.h (rtx_cost, get_full_rtx_cost): Add opno parameters.
(set_src_cost, get_full_set_src_cost): Update accordingly.
* rtlanal.c (rtx_cost): Add an opno parameter.  Update call
to target hook.
(get_full_rtx_cost): Add an opno paramter.  Update calls to rtx_cost.
(default_adress_cost): Update calls to rtx_cost.

* config/arm/arm.c (arm_rtx_costs_1, arm_size_rtx_costs)
(arm_slowmul_rtx_costs): Adjust calls to rtx_cost.
(arm_rtx_costs): Add an opno parameter.
* config/alpha/alpha.c (alpha_rtx_costs): Add an opno parameter and
adjust any recursive rtx-cost calls.
* config/avr/avr.c (avr_operand_rtx_cost, avr_rtx_costs): Likewise.
* config/bfin/bfin.c (bfin_rtx_costs): Likewise.
* config/c6x/c6x.c (c6x_rtx_costs): Likewise.
* config/cris/cris.c (cris_rtx_costs): Likewise.
* config/frv/frv.c (frv_rtx_costs): Likewise.
* config/h8300/h8300.c (h8300_rtx_costs): Likewise.
* config/i386/i386.c (ix86_rtx_costs): Likewise.
* config/ia64/ia64.c (ia64_rtx_costs): Likewise.
* config/iq2000/iq2000.c (iq2000_rtx_costs): Likewise.
* config/lm32/lm32.c (lm32_rtx_costs): Likewise.
* config/m32c/m32c.c (m32c_rtx_costs): Likewise.
* config/m32r/m32r.c (m32r_rtx_costs): Likewise.
* config/m68k/m68k.c (m68k_rtx_costs): Likewise.
* config/mcore/mcore.c (mcore_rtx_costs): Likewise.
* config/mep/mep.c (mep_rtx_cost): Likewise.
* config/microblaze/microblaze.c (microblaze_rtx_costs): Likewise.
* config/mips/mips.c (mips_binary_cost): Update call to rtx_cost.
(mips_zero_extend_cost): Add an opno parameter.
* config/mmix/mmix.c (mmix_rtx_costs): Likewise.
* config/mn10300/mn10300.c (mn10300_address_cost): Update call
to rtx_cost.
(mn10300_rtx_costs): Add an opno parameter and adjust any recursive
rtx-cost calls.
* config/pa/pa.c (hppa_rtx_costs): Likewise.
* config/pdp11/pdp11.c (pdp11_rtx_costs): Likewise.
* config/picochip/picochip.c (picochip_rtx_costs): Likewise.
* config/rs6000/rs6000.c (rs6000_rtx_costs): Likewise.
(rs6000_debug_rtx_costs): Likewise.
* config/s390/s390.c (s390_rtx_costs): Likewise.
* config/score/score-protos.h (score_rtx_costs): Likewise.
* config/score/score.c (score_rtx_costs): Likewise.
* config/sh/sh.c (andcosts): Update call to rtx_cost.
(sh_rtx_costs): Add an opno parameter.
* config/sparc/sparc.c (sparc_rtx_costs): Likewise.
* config/spu/spu.c (spu_rtx_costs): Likewise.
* config/stormy16/stormy16.c (xstormy16_rtx_costs): Likewise.
* config/v850/v850.c (v850_rtx_costs): Likewise.
* config/vax/vax.c (vax_rtx_costs): Likewise.
* config/xtensa/xtensa.c (xtensa_rtx_costs): Likewise.

From-SVN: r177852

47 files changed:
gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/arm/arm.c
gcc/config/avr/avr.c
gcc/config/bfin/bfin.c
gcc/config/c6x/c6x.c
gcc/config/cris/cris.c
gcc/config/frv/frv.c
gcc/config/h8300/h8300.c
gcc/config/i386/i386.c
gcc/config/ia64/ia64.c
gcc/config/iq2000/iq2000.c
gcc/config/lm32/lm32.c
gcc/config/m32c/m32c.c
gcc/config/m32r/m32r.c
gcc/config/m68k/m68k.c
gcc/config/mcore/mcore.c
gcc/config/mep/mep.c
gcc/config/microblaze/microblaze.c
gcc/config/mips/mips.c
gcc/config/mmix/mmix.c
gcc/config/mn10300/mn10300.c
gcc/config/pa/pa.c
gcc/config/pdp11/pdp11.c
gcc/config/picochip/picochip.c
gcc/config/rs6000/rs6000.c
gcc/config/s390/s390.c
gcc/config/score/score-protos.h
gcc/config/score/score.c
gcc/config/sh/sh.c
gcc/config/sparc/sparc.c
gcc/config/spu/spu.c
gcc/config/stormy16/stormy16.c
gcc/config/v850/v850.c
gcc/config/vax/vax.c
gcc/config/xtensa/xtensa.c
gcc/cse.c
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/dojump.c
gcc/expmed.c
gcc/hooks.c
gcc/hooks.h
gcc/optabs.c
gcc/rtl.h
gcc/rtlanal.c
gcc/target.def

index a0fdc127e91310bf92b75a3a9ab7d8772e7c1c22..27cc3887a33a44bad8b05b4416a5e41e71d9e0d5 100644 (file)
@@ -1,3 +1,73 @@
+2011-08-18  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * doc/tm.texi.in (TARGET_RTX_COSTS): Add an opno paramter.
+       * doc/tm.texi: Regenerate.
+       * target.def (rtx_costs): Add an opno parameter.
+       * hooks.h (hook_bool_rtx_int_int_intp_bool_false): Replace with...
+       (hook_bool_rtx_int_int_int_intp_bool_false): ...this.
+       * hooks.c (hook_bool_rtx_int_int_intp_bool_false): Replace with...
+       (hook_bool_rtx_int_int_int_intp_bool_false): ...this.
+       * cse.c (COST_IN): Add an opno parameter.
+       (notreg_cost): Likewise.  Update call to rtx_cost.
+       (COST, fold_rtx): Update accordingly.
+       * dojump.c (prefer_and_bit_test): Update call to rtx_cost.
+       * expmed.c (emit_store_flag): Likewise.
+       * optabs.c (avoid_expensive_constant): Add an opno parameter.
+       Update call to rtx_cost.
+       (expand_binop_directly, expand_binop): Likewise.
+       (expand_twoval_binop, prepare_cmp_insn): Likewise.
+       * rtl.h (rtx_cost, get_full_rtx_cost): Add opno parameters.
+       (set_src_cost, get_full_set_src_cost): Update accordingly.
+       * rtlanal.c (rtx_cost): Add an opno parameter.  Update call
+       to target hook.
+       (get_full_rtx_cost): Add an opno paramter.  Update calls to rtx_cost.
+       (default_adress_cost): Update calls to rtx_cost.
+
+       * config/arm/arm.c (arm_rtx_costs_1, arm_size_rtx_costs)
+       (arm_slowmul_rtx_costs): Adjust calls to rtx_cost.
+       (arm_rtx_costs): Add an opno parameter.
+       * config/alpha/alpha.c (alpha_rtx_costs): Add an opno parameter and
+       adjust any recursive rtx-cost calls.
+       * config/avr/avr.c (avr_operand_rtx_cost, avr_rtx_costs): Likewise.
+       * config/bfin/bfin.c (bfin_rtx_costs): Likewise.
+       * config/c6x/c6x.c (c6x_rtx_costs): Likewise.
+       * config/cris/cris.c (cris_rtx_costs): Likewise.
+       * config/frv/frv.c (frv_rtx_costs): Likewise.
+       * config/h8300/h8300.c (h8300_rtx_costs): Likewise.
+       * config/i386/i386.c (ix86_rtx_costs): Likewise.
+       * config/ia64/ia64.c (ia64_rtx_costs): Likewise.
+       * config/iq2000/iq2000.c (iq2000_rtx_costs): Likewise.
+       * config/lm32/lm32.c (lm32_rtx_costs): Likewise.
+       * config/m32c/m32c.c (m32c_rtx_costs): Likewise.
+       * config/m32r/m32r.c (m32r_rtx_costs): Likewise.
+       * config/m68k/m68k.c (m68k_rtx_costs): Likewise.
+       * config/mcore/mcore.c (mcore_rtx_costs): Likewise.
+       * config/mep/mep.c (mep_rtx_cost): Likewise.
+       * config/microblaze/microblaze.c (microblaze_rtx_costs): Likewise.
+       * config/mips/mips.c (mips_binary_cost): Update call to rtx_cost.
+       (mips_zero_extend_cost): Add an opno parameter.
+       * config/mmix/mmix.c (mmix_rtx_costs): Likewise.
+       * config/mn10300/mn10300.c (mn10300_address_cost): Update call
+       to rtx_cost.
+       (mn10300_rtx_costs): Add an opno parameter and adjust any recursive
+       rtx-cost calls.
+       * config/pa/pa.c (hppa_rtx_costs): Likewise.
+       * config/pdp11/pdp11.c (pdp11_rtx_costs): Likewise.
+       * config/picochip/picochip.c (picochip_rtx_costs): Likewise.
+       * config/rs6000/rs6000.c (rs6000_rtx_costs): Likewise.
+       (rs6000_debug_rtx_costs): Likewise.
+       * config/s390/s390.c (s390_rtx_costs): Likewise.
+       * config/score/score-protos.h (score_rtx_costs): Likewise.
+       * config/score/score.c (score_rtx_costs): Likewise.
+       * config/sh/sh.c (andcosts): Update call to rtx_cost.
+       (sh_rtx_costs): Add an opno parameter.
+       * config/sparc/sparc.c (sparc_rtx_costs): Likewise.
+       * config/spu/spu.c (spu_rtx_costs): Likewise.
+       * config/stormy16/stormy16.c (xstormy16_rtx_costs): Likewise.
+       * config/v850/v850.c (v850_rtx_costs): Likewise.
+       * config/vax/vax.c (vax_rtx_costs): Likewise.
+       * config/xtensa/xtensa.c (xtensa_rtx_costs): Likewise.
+
 2011-08-18  Richard Sandiford  <richard.sandiford@linaro.org>
 
        * rtl.h (set_src_cost, get_full_set_src_cost): New functions.
index a8a96075ee76385a4966e257cf46f9485a67cee4..e195df5c0d6df8d8bb05563364238fd1601c7c84 100644 (file)
@@ -1154,7 +1154,7 @@ alpha_legitimize_reload_address (rtx x,
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-alpha_rtx_costs (rtx x, int code, int outer_code, int *total,
+alpha_rtx_costs (rtx x, int code, int outer_code, int opno, int *total,
                 bool speed)
 {
   enum machine_mode mode = GET_MODE (x);
@@ -1222,9 +1222,9 @@ alpha_rtx_costs (rtx x, int code, int outer_code, int *total,
               && const48_operand (XEXP (XEXP (x, 0), 1), VOIDmode))
        {
          *total = (rtx_cost (XEXP (XEXP (x, 0), 0),
-                             (enum rtx_code) outer_code, speed)
+                             (enum rtx_code) outer_code, opno, speed)
                    + rtx_cost (XEXP (x, 1),
-                               (enum rtx_code) outer_code, speed)
+                               (enum rtx_code) outer_code, opno, speed)
                    + COSTS_N_INSNS (1));
          return true;
        }
index fc2fd474b7cc3027272a66cdee5fbc97c68a596d..b32e863909a817a63bdbbfb25373d35886ee231e 100644 (file)
@@ -151,7 +151,7 @@ static bool arm_slowmul_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, boo
 static bool arm_fastmul_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, bool);
 static bool arm_xscale_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, bool);
 static bool arm_9e_rtx_costs (rtx, enum rtx_code, enum rtx_code, int *, bool);
-static bool arm_rtx_costs (rtx, int, int, int *, bool);
+static bool arm_rtx_costs (rtx, int, int, int, int *, bool);
 static int arm_address_cost (rtx, bool);
 static bool arm_memory_load_p (rtx);
 static bool arm_cirrus_insn_p (rtx);
@@ -6881,7 +6881,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
       if (GET_CODE (XEXP (x, 1)) == REG)
        *total = COSTS_N_INSNS (1); /* Need to subtract from 32 */
       else if (GET_CODE (XEXP (x, 1)) != CONST_INT)
-       *total = rtx_cost (XEXP (x, 1), code, speed);
+       *total = rtx_cost (XEXP (x, 1), code, 1, speed);
 
       /* Fall through */
     case ROTATERT:
@@ -6893,7 +6893,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
 
       /* Fall through */
     case ASHIFT: case LSHIFTRT: case ASHIFTRT:
-      *total += rtx_cost (XEXP (x, 0), code, speed);
+      *total += rtx_cost (XEXP (x, 0), code, 0, speed);
       if (mode == DImode)
        {
          *total += COSTS_N_INSNS (3);
@@ -6916,14 +6916,14 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
          if (GET_CODE (XEXP (x, 0)) == CONST_INT
              && const_ok_for_arm (INTVAL (XEXP (x, 0))))
            {
-             *total += rtx_cost (XEXP (x, 1), code, speed);
+             *total += rtx_cost (XEXP (x, 1), code, 1, speed);
              return true;
            }
 
          if (GET_CODE (XEXP (x, 1)) == CONST_INT
              && const_ok_for_arm (INTVAL (XEXP (x, 1))))
            {
-             *total += rtx_cost (XEXP (x, 0), code, speed);
+             *total += rtx_cost (XEXP (x, 0), code, 0, speed);
              return true;
            }
 
@@ -6940,14 +6940,14 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
              if (GET_CODE (XEXP (x, 0)) == CONST_DOUBLE
                  && arm_const_double_rtx (XEXP (x, 0)))
                {
-                 *total += rtx_cost (XEXP (x, 1), code, speed);
+                 *total += rtx_cost (XEXP (x, 1), code, 1, speed);
                  return true;
                }
 
              if (GET_CODE (XEXP (x, 1)) == CONST_DOUBLE
                  && arm_const_double_rtx (XEXP (x, 1)))
                {
-                 *total += rtx_cost (XEXP (x, 0), code, speed);
+                 *total += rtx_cost (XEXP (x, 0), code, 0, speed);
                  return true;
                }
 
@@ -6961,7 +6961,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
       if (GET_CODE (XEXP (x, 0)) == CONST_INT
          && const_ok_for_arm (INTVAL (XEXP (x, 0))))
        {
-         *total += rtx_cost (XEXP (x, 1), code, speed);
+         *total += rtx_cost (XEXP (x, 1), code, 1, speed);
          return true;
        }
 
@@ -6970,8 +6970,8 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
          || subcode == LSHIFTRT
          || subcode == ROTATE || subcode == ROTATERT)
        {
-         *total += rtx_cost (XEXP (x, 0), code, speed);
-         *total += rtx_cost (XEXP (XEXP (x, 1), 0), subcode, speed);
+         *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+         *total += rtx_cost (XEXP (XEXP (x, 1), 0), subcode, 0, speed);
          return true;
        }
 
@@ -6979,23 +6979,23 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
       if (GET_CODE (XEXP (x, 0)) == MULT
          && power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
        {
-         *total += rtx_cost (XEXP (XEXP (x, 0), 0), code, speed);
-         *total += rtx_cost (XEXP (x, 1), code, speed);
+         *total += rtx_cost (XEXP (XEXP (x, 0), 0), code, 0, speed);
+         *total += rtx_cost (XEXP (x, 1), code, 1, speed);
          return true;
        }
 
       if (subcode == MULT
          && power_of_two_operand (XEXP (XEXP (x, 1), 1), SImode))
        {
-         *total += rtx_cost (XEXP (x, 0), code, speed);
-         *total += rtx_cost (XEXP (XEXP (x, 1), 0), subcode, speed);
+         *total += rtx_cost (XEXP (x, 0), code, 0, speed);
+         *total += rtx_cost (XEXP (XEXP (x, 1), 0), subcode, 0, speed);
          return true;
        }
 
       if (GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) == RTX_COMPARE
          || GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) == RTX_COMM_COMPARE)
        {
-         *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, speed);
+         *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, 0, speed);
          if (GET_CODE (XEXP (XEXP (x, 1), 0)) == REG
              && REGNO (XEXP (XEXP (x, 1), 0)) != CC_REGNUM)
            *total += COSTS_N_INSNS (1);
@@ -7012,8 +7012,8 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
        {
          *total = COSTS_N_INSNS (1);
          *total += rtx_cost (XEXP (XEXP (x, 0), 0), GET_CODE (XEXP (x, 0)),
-                             speed);
-         *total += rtx_cost (XEXP (x, 1), code, speed);
+                             0, speed);
+         *total += rtx_cost (XEXP (x, 1), code, 1, speed);
          return true;
        }
 
@@ -7037,7 +7037,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
              if (GET_CODE (XEXP (x, 1)) == CONST_DOUBLE
                  && arm_const_double_rtx (XEXP (x, 1)))
                {
-                 *total += rtx_cost (XEXP (x, 0), code, speed);
+                 *total += rtx_cost (XEXP (x, 0), code, 0, speed);
                  return true;
                }
 
@@ -7051,7 +7051,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
       if (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == RTX_COMPARE
          || GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == RTX_COMM_COMPARE)
        {
-         *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 1), code, speed);
+         *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 1), code, 1, speed);
          if (GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
              && REGNO (XEXP (XEXP (x, 0), 0)) != CC_REGNUM)
            *total += COSTS_N_INSNS (1);
@@ -7078,7 +7078,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
          if (GET_CODE (XEXP (x, 1)) == CONST_INT
              && const_ok_for_op (INTVAL (XEXP (x, 1)), code))
            {
-             *total += rtx_cost (XEXP (x, 0), code, speed);
+             *total += rtx_cost (XEXP (x, 0), code, 0, speed);
              return true;
            }
 
@@ -7089,7 +7089,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
       if (GET_CODE (XEXP (x, 1)) == CONST_INT
          && const_ok_for_op (INTVAL (XEXP (x, 1)), code))
        {
-         *total += rtx_cost (XEXP (x, 0), code, speed);
+         *total += rtx_cost (XEXP (x, 0), code, 0, speed);
          return true;
        }
       subcode = GET_CODE (XEXP (x, 0));
@@ -7097,16 +7097,16 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
          || subcode == LSHIFTRT
          || subcode == ROTATE || subcode == ROTATERT)
        {
-         *total += rtx_cost (XEXP (x, 1), code, speed);
-         *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, speed);
+         *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+         *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 0, speed);
          return true;
        }
 
       if (subcode == MULT
          && power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
        {
-         *total += rtx_cost (XEXP (x, 1), code, speed);
-         *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, speed);
+         *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+         *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 0, speed);
          return true;
        }
 
@@ -7132,7 +7132,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
          && (GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == ZERO_EXTEND
              || GET_CODE (XEXP (XEXP (XEXP (x, 0), 0), 0)) == SIGN_EXTEND))
        {
-         *total = rtx_cost (XEXP (XEXP (x, 0), 0), LSHIFTRT, speed);
+         *total = rtx_cost (XEXP (XEXP (x, 0), 0), LSHIFTRT, 0, speed);
          return true;
        }
       *total = COSTS_N_INSNS (2); /* Plus the cost of the MULT */
@@ -7164,11 +7164,11 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
              || (subcode == MULT
                  && power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode)))
            {
-             *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, speed);
+             *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 0, speed);
              /* Register shifts cost an extra cycle.  */
              if (GET_CODE (XEXP (XEXP (x, 0), 1)) != CONST_INT)
                *total += COSTS_N_INSNS (1) + rtx_cost (XEXP (XEXP (x, 0), 1),
-                                                       subcode, speed);
+                                                       subcode, 1, speed);
              return true;
            }
        }
@@ -7189,14 +7189,14 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
            && GET_CODE (XEXP (operand, 0)) == REG
            && REGNO (XEXP (operand, 0)) == CC_REGNUM))
        *total += COSTS_N_INSNS (1);
-      *total += (rtx_cost (XEXP (x, 1), code, speed)
-                + rtx_cost (XEXP (x, 2), code, speed));
+      *total += (rtx_cost (XEXP (x, 1), code, 1, speed)
+                + rtx_cost (XEXP (x, 2), code, 2, speed));
       return true;
 
     case NE:
       if (mode == SImode && XEXP (x, 1) == const0_rtx)
        {
-         *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, speed);
+         *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, 0, speed);
          return true;
        }
       goto scc_insn;
@@ -7205,7 +7205,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
       if ((GET_CODE (XEXP (x, 0)) != REG || REGNO (XEXP (x, 0)) != CC_REGNUM)
          && mode == SImode && XEXP (x, 1) == const0_rtx)
        {
-         *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, speed);
+         *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, 0, speed);
          return true;
        }
       goto scc_insn;
@@ -7214,7 +7214,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
       if ((GET_CODE (XEXP (x, 0)) != REG || REGNO (XEXP (x, 0)) != CC_REGNUM)
          && mode == SImode && XEXP (x, 1) == const0_rtx)
        {
-         *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, speed);
+         *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, 0, speed);
          return true;
        }
       goto scc_insn;
@@ -7255,7 +7255,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
       if (GET_CODE (XEXP (x, 1)) == CONST_INT
          && const_ok_for_op (INTVAL (XEXP (x, 1)), code))
        {
-         *total += rtx_cost (XEXP (x, 0), code, speed);
+         *total += rtx_cost (XEXP (x, 0), code, 0, speed);
          return true;
        }
 
@@ -7264,16 +7264,16 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
          || subcode == LSHIFTRT
          || subcode == ROTATE || subcode == ROTATERT)
        {
-         *total += rtx_cost (XEXP (x, 1), code, speed);
-         *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, speed);
+         *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+         *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 0, speed);
          return true;
        }
 
       if (subcode == MULT
          && power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
        {
-         *total += rtx_cost (XEXP (x, 1), code, speed);
-         *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, speed);
+         *total += rtx_cost (XEXP (x, 1), code, 1, speed);
+         *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 0, speed);
          return true;
        }
       
@@ -7283,10 +7283,10 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
     case UMAX:
     case SMIN:
     case SMAX:
-      *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, speed);
+      *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, 0, speed);
       if (GET_CODE (XEXP (x, 1)) != CONST_INT
          || !const_ok_for_arm (INTVAL (XEXP (x, 1))))
-       *total += rtx_cost (XEXP (x, 1), code, speed);
+       *total += rtx_cost (XEXP (x, 1), code, 1, speed);
       return true;
 
     case ABS:
@@ -7363,7 +7363,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
 
     case ZERO_EXTRACT:
     case SIGN_EXTRACT:
-      *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, speed);
+      *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, 0, speed);
       return true;
 
     case CONST_INT:
@@ -7388,7 +7388,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
 
     case LO_SUM:
       *total = COSTS_N_INSNS (1);
-      *total += rtx_cost (XEXP (x, 0), code, speed);
+      *total += rtx_cost (XEXP (x, 0), code, 0, speed);
       return true;
 
     case CONST_DOUBLE:
@@ -7574,7 +7574,7 @@ arm_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
     case ROTATE:
       if (mode == SImode && GET_CODE (XEXP (x, 1)) == REG)
        {
-         *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, false);
+         *total = COSTS_N_INSNS (2) + rtx_cost (XEXP (x, 0), code, 0, false);
          return true;
        }
       /* Fall through */
@@ -7584,15 +7584,15 @@ arm_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
     case ASHIFTRT:
       if (mode == DImode && GET_CODE (XEXP (x, 1)) == CONST_INT)
        {
-         *total = COSTS_N_INSNS (3) + rtx_cost (XEXP (x, 0), code, false);
+         *total = COSTS_N_INSNS (3) + rtx_cost (XEXP (x, 0), code, 0, false);
          return true;
        }
       else if (mode == SImode)
        {
-         *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, false);
+         *total = COSTS_N_INSNS (1) + rtx_cost (XEXP (x, 0), code, 0, false);
          /* Slightly disparage register shifts, but not by much.  */
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
-           *total += 1 + rtx_cost (XEXP (x, 1), code, false);
+           *total += 1 + rtx_cost (XEXP (x, 1), code, 1, false);
          return true;
        }
 
@@ -7644,8 +7644,8 @@ arm_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
          && power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
        {
          *total = COSTS_N_INSNS (TARGET_THUMB2 ? 2 : 1);
-         *total += rtx_cost (XEXP (XEXP (x, 0), 0), code, false);
-         *total += rtx_cost (XEXP (x, 1), code, false);
+         *total += rtx_cost (XEXP (XEXP (x, 0), 0), code, 0, false);
+         *total += rtx_cost (XEXP (x, 1), code, 1, false);
          return true;
        }
 
@@ -7757,8 +7757,8 @@ arm_size_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
 
 /* RTX costs when optimizing for size.  */
 static bool
-arm_rtx_costs (rtx x, int code, int outer_code, int *total,
-              bool speed)
+arm_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+              int *total, bool speed)
 {
   if (!speed)
     return arm_size_rtx_costs (x, (enum rtx_code) code,
@@ -7811,7 +7811,7 @@ arm_slowmul_rtx_costs (rtx x, enum rtx_code code, enum rtx_code outer_code,
            }
 
          *total = COSTS_N_INSNS (cost);
-         *total += rtx_cost (XEXP (x, 0), code, speed);
+         *total += rtx_cost (XEXP (x, 0), code, 0, speed);
          return true;
        }
 
index 79cf0a5bffdc9401eab9fecb3dd00fd37e358724..3980feb5f6f45675043ae093193b9891419f289c 100644 (file)
@@ -89,8 +89,9 @@ static void avr_asm_out_ctor (rtx, int);
 static void avr_asm_out_dtor (rtx, int);
 static int avr_register_move_cost (enum machine_mode, reg_class_t, reg_class_t);
 static int avr_memory_move_cost (enum machine_mode, reg_class_t, bool);
-static int avr_operand_rtx_cost (rtx, enum machine_mode, enum rtx_code, bool);
-static bool avr_rtx_costs (rtx, int, int, int *, bool);
+static int avr_operand_rtx_cost (rtx, enum machine_mode, enum rtx_code,
+                                int, bool);
+static bool avr_rtx_costs (rtx, int, int, int, int *, bool);
 static int avr_address_cost (rtx, bool);
 static bool avr_return_in_memory (const_tree, const_tree);
 static struct machine_function * avr_init_machine_status (void);
@@ -1640,7 +1641,8 @@ final_prescan_insn (rtx insn, rtx *operand ATTRIBUTE_UNUSED,
                  set_src_cost (SET_SRC (set), optimize_insn_for_speed_p ()));
       else
         fprintf (asm_out_file, "/* DEBUG: pattern-cost = %d.  */\n",
-                 rtx_cost (PATTERN (insn), INSN, optimize_insn_for_speed_p()));
+                 rtx_cost (PATTERN (insn), INSN, 0,
+                          optimize_insn_for_speed_p()));
     }
 }
 
@@ -5302,7 +5304,7 @@ avr_memory_move_cost (enum machine_mode mode, reg_class_t rclass ATTRIBUTE_UNUSE
 
 static int
 avr_operand_rtx_cost (rtx x, enum machine_mode mode, enum rtx_code outer,
-                     bool speed)
+                     int opno, bool speed)
 {
   enum rtx_code code = GET_CODE (x);
   int total;
@@ -5322,7 +5324,7 @@ avr_operand_rtx_cost (rtx x, enum machine_mode mode, enum rtx_code outer,
     }
 
   total = 0;
-  avr_rtx_costs (x, code, outer, &total, speed);
+  avr_rtx_costs (x, code, outer, opno, &total, speed);
   return total;
 }
 
@@ -5332,8 +5334,8 @@ avr_operand_rtx_cost (rtx x, enum machine_mode mode, enum rtx_code outer,
    case, *TOTAL contains the cost result.  */
 
 static bool
-avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
-              bool speed)
+avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED,
+              int opno ATTRIBUTE_UNUSED, int *total, bool speed)
 {
   enum rtx_code code = (enum rtx_code) codearg;
   enum machine_mode mode = GET_MODE (x);
@@ -5373,7 +5375,7 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
        default:
          return false;
        }
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;
 
     case ABS:
@@ -5387,24 +5389,24 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
        default:
          return false;
        }
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;
 
     case NOT:
       *total = COSTS_N_INSNS (GET_MODE_SIZE (mode));
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;
 
     case ZERO_EXTEND:
       *total = COSTS_N_INSNS (GET_MODE_SIZE (mode)
                              - GET_MODE_SIZE (GET_MODE (XEXP (x, 0))));
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;
 
     case SIGN_EXTEND:
       *total = COSTS_N_INSNS (GET_MODE_SIZE (mode) + 2
                              - GET_MODE_SIZE (GET_MODE (XEXP (x, 0))));
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;
 
     case PLUS:
@@ -5413,14 +5415,15 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
        case QImode:
          *total = COSTS_N_INSNS (1);
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
-           *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+           *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed);
          break;
 
        case HImode:
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (2);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else if (INTVAL (XEXP (x, 1)) >= -63 && INTVAL (XEXP (x, 1)) <= 63)
            *total = COSTS_N_INSNS (1);
@@ -5432,7 +5435,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (4);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else if (INTVAL (XEXP (x, 1)) >= -63 && INTVAL (XEXP (x, 1)) <= 63)
            *total = COSTS_N_INSNS (1);
@@ -5443,22 +5447,22 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
        default:
          return false;
        }
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;
 
     case MINUS:
     case AND:
     case IOR:
       *total = COSTS_N_INSNS (GET_MODE_SIZE (mode));
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       if (GET_CODE (XEXP (x, 1)) != CONST_INT)
-          *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+       *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed);
       return true;
 
     case XOR:
       *total = COSTS_N_INSNS (GET_MODE_SIZE (mode));
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
-      *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed);
       return true;
 
     case MULT:
@@ -5548,8 +5552,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
        default:
          return false;
        }
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
-      *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed);
       return true;
 
     case DIV:
@@ -5560,8 +5564,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
        *total = COSTS_N_INSNS (AVR_HAVE_JMP_CALL ? 2 : 1);
       else
        return false;
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
-      *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed);
       return true;
 
     case ROTATE:
@@ -5596,7 +5600,7 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
        default:
          return false;
        }
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;    
 
     case ASHIFT:
@@ -5606,7 +5610,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (!speed ? 4 : 17);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else
            {
@@ -5635,7 +5640,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (!speed ? 5 : 41);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else
            switch (INTVAL (XEXP (x, 1)))
@@ -5672,7 +5678,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
                break;
              default:
                *total = COSTS_N_INSNS (!speed ? 5 : 41);
-               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                               speed);
              }
          break;
 
@@ -5680,7 +5687,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (!speed ? 7 : 113);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else
            switch (INTVAL (XEXP (x, 1)))
@@ -5704,14 +5712,15 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
                break;
              default:
                *total = COSTS_N_INSNS (!speed ? 7 : 113);
-               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                               speed);
              }
          break;
 
        default:
          return false;
        }
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;
 
     case ASHIFTRT:
@@ -5721,7 +5730,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (!speed ? 4 : 17);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else
            {
@@ -5741,7 +5751,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (!speed ? 5 : 41);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else
            switch (INTVAL (XEXP (x, 1)))
@@ -5777,7 +5788,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
                break;
              default:
                *total = COSTS_N_INSNS (!speed ? 5 : 41);
-               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                               speed);
              }
          break;
 
@@ -5785,7 +5797,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (!speed ? 7 : 113);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else
            switch (INTVAL (XEXP (x, 1)))
@@ -5809,14 +5822,15 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
                break;
              default:
                *total = COSTS_N_INSNS (!speed ? 7 : 113);
-               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                               speed);
              }
          break;
 
        default:
          return false;
        }
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;
 
     case LSHIFTRT:
@@ -5826,7 +5840,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (!speed ? 4 : 17);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else
            {
@@ -5844,7 +5859,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (!speed ? 5 : 41);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else
            switch (INTVAL (XEXP (x, 1)))
@@ -5883,7 +5899,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
                break;
              default:
                *total = COSTS_N_INSNS (!speed ? 5 : 41);
-               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                               speed);
              }
          break;
 
@@ -5891,7 +5908,8 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
            {
              *total = COSTS_N_INSNS (!speed ? 7 : 113);
-             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+             *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                             speed);
            }
          else
            switch (INTVAL (XEXP (x, 1)))
@@ -5915,14 +5933,15 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
                break;
              default:
                *total = COSTS_N_INSNS (!speed ? 7 : 113);
-               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+               *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1,
+                                               speed);
              }
          break;
 
        default:
          return false;
        }
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;
 
     case COMPARE:
@@ -5931,13 +5950,13 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
        case QImode:
          *total = COSTS_N_INSNS (1);
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
-           *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+           *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed);
          break;
 
         case HImode:
          *total = COSTS_N_INSNS (2);
          if (GET_CODE (XEXP (x, 1)) != CONST_INT)
-            *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+            *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed);
          else if (INTVAL (XEXP (x, 1)) != 0)
            *total += COSTS_N_INSNS (1);
           break;
@@ -5945,7 +5964,7 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
         case SImode:
           *total = COSTS_N_INSNS (4);
           if (GET_CODE (XEXP (x, 1)) != CONST_INT)
-            *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, speed);
+            *total += avr_operand_rtx_cost (XEXP (x, 1), mode, code, 1, speed);
          else if (INTVAL (XEXP (x, 1)) != 0)
            *total += COSTS_N_INSNS (3);
           break;
@@ -5953,7 +5972,7 @@ avr_rtx_costs (rtx x, int codearg, int outer_code ATTRIBUTE_UNUSED, int *total,
        default:
          return false;
        }
-      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, speed);
+      *total += avr_operand_rtx_cost (XEXP (x, 0), mode, code, 0, speed);
       return true;
 
     case TRUNCATE:
index 8cd315d9e76492d597aa5584b21c4ef647b0d554..8a0d5a0a807b800009ac7a2da369dcd7f9ccc8da 100644 (file)
@@ -2779,7 +2779,8 @@ bfin_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x)
 }
 
 static bool
-bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int *total, bool speed)
+bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total,
+               bool speed)
 {
   enum rtx_code code = (enum rtx_code) code_i;
   enum rtx_code outer_code = (enum rtx_code) outer_code_i;
@@ -2829,8 +2830,8 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int *total, bool speed)
              if (val == 2 || val == 4)
                {
                  *total = cost2;
-                 *total += rtx_cost (XEXP (op0, 0), outer_code, speed);
-                 *total += rtx_cost (op1, outer_code, speed);
+                 *total += rtx_cost (XEXP (op0, 0), outer_code, opno, speed);
+                 *total += rtx_cost (op1, outer_code, opno, speed);
                  return true;
                }
            }
@@ -2849,10 +2850,10 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int *total, bool speed)
          *total = 6 * cost2;
          if (GET_CODE (op1) != CONST_INT
              || !satisfies_constraint_Ks7 (op1))
-           *total += rtx_cost (op1, PLUS, speed);
+           *total += rtx_cost (op1, PLUS, 1, speed);
          if (GET_CODE (op0) != REG
              && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG))
-           *total += rtx_cost (op0, PLUS, speed);
+           *total += rtx_cost (op0, PLUS, 0, speed);
        }
       return true;
 
@@ -2875,7 +2876,7 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int *total, bool speed)
       op1 = XEXP (x, 1);
       if (GET_CODE (op0) != REG
          && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG))
-       *total += rtx_cost (op0, code, speed);
+       *total += rtx_cost (op0, code, 0, speed);
 
       return true;
          
@@ -2900,7 +2901,7 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int *total, bool speed)
 
       if (GET_CODE (op0) != REG
          && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG))
-       *total += rtx_cost (op0, code, speed);
+       *total += rtx_cost (op0, code, 0, speed);
 
       if (GET_MODE (x) == DImode)
        {
@@ -2914,12 +2915,12 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int *total, bool speed)
       if (code == AND)
        {
          if (! rhs_andsi3_operand (XEXP (x, 1), SImode))
-           *total += rtx_cost (XEXP (x, 1), code, speed);
+           *total += rtx_cost (XEXP (x, 1), code, 1, speed);
        }
       else
        {
          if (! regorlog2_operand (XEXP (x, 1), SImode))
-           *total += rtx_cost (XEXP (x, 1), code, speed);
+           *total += rtx_cost (XEXP (x, 1), code, 1, speed);
        }
 
       return true;
@@ -2959,10 +2960,10 @@ bfin_rtx_costs (rtx x, int code_i, int outer_code_i, int *total, bool speed)
 
          if (GET_CODE (op0) != REG
              && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG))
-           *total += rtx_cost (op0, MULT, speed);
+           *total += rtx_cost (op0, MULT, 0, speed);
          if (GET_CODE (op1) != REG
              && (GET_CODE (op1) != SUBREG || GET_CODE (SUBREG_REG (op1)) != REG))
-           *total += rtx_cost (op1, MULT, speed);
+           *total += rtx_cost (op1, MULT, 1, speed);
        }
       return true;
 
index deb2f5395dd723bb48a9052723999c436d887845..e77ed70fd3547c1cbf89c37db36ad5d761d1ddd4 100644 (file)
@@ -4772,7 +4772,8 @@ shift_p (rtx x, enum rtx_code code, int amount)
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-c6x_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed)
+c6x_rtx_costs (rtx x, int code, int outer_code, int opno, int *total,
+              bool speed)
 {
   int cost2 = COSTS_N_INSNS (1);
   rtx op0, op1;
@@ -4826,8 +4827,8 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed)
                *total = COSTS_N_INSNS (2);
              else
                *total = COSTS_N_INSNS (12);
-             *total += rtx_cost (XEXP (op0, 0), code0, speed);
-             *total += rtx_cost (XEXP (op1, 0), code1, speed);
+             *total += rtx_cost (XEXP (op0, 0), code0, 0, speed);
+             *total += rtx_cost (XEXP (op1, 0), code1, 0, speed);
              return true;
            }
        }
@@ -4855,8 +4856,8 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed)
              || INTVAL (XEXP (op0, 1)) == 4
              || (code == PLUS && INTVAL (XEXP (op0, 1)) == 8)))
        {
-         *total += rtx_cost (XEXP (op0, 0), ASHIFT, speed);
-         *total += rtx_cost (op1, (enum rtx_code)code, speed);
+         *total += rtx_cost (XEXP (op0, 0), ASHIFT, 0, speed);
+         *total += rtx_cost (op1, (enum rtx_code) code, 1, speed);
          return true;
        }
       return false;
@@ -4926,10 +4927,10 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed)
 
       if (GET_CODE (op0) != REG
          && (GET_CODE (op0) != SUBREG || GET_CODE (SUBREG_REG (op0)) != REG))
-       *total += rtx_cost (op0, MULT, speed);
+       *total += rtx_cost (op0, MULT, 0, speed);
       if (op1 && GET_CODE (op1) != REG
          && (GET_CODE (op1) != SUBREG || GET_CODE (SUBREG_REG (op1)) != REG))
-       *total += rtx_cost (op1, MULT, speed);
+       *total += rtx_cost (op1, MULT, 1, speed);
       return true;
 
     case UDIV:
@@ -4947,7 +4948,8 @@ c6x_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed)
          && XEXP (op0, 1) == const0_rtx
          && rtx_equal_p (XEXP (x, 1), XEXP (op0, 0)))
        {
-         *total = rtx_cost (XEXP (x, 1), (enum rtx_code)outer_code, speed);
+         *total = rtx_cost (XEXP (x, 1), (enum rtx_code) outer_code,
+                            opno, speed);
          return false;
        }
       return false;
index 0c318268440ac038396378f1425ca8cf090d8768..24cfa5a2d53a28b59c6fb6751f38e06624d3c3f7 100644 (file)
@@ -123,7 +123,7 @@ static void cris_init_libfuncs (void);
 
 static int cris_register_move_cost (enum machine_mode, reg_class_t, reg_class_t);
 static int cris_memory_move_cost (enum machine_mode, reg_class_t, bool);
-static bool cris_rtx_costs (rtx, int, int, int *, bool);
+static bool cris_rtx_costs (rtx, int, int, int, int *, bool);
 static int cris_address_cost (rtx, bool);
 static bool cris_pass_by_reference (cumulative_args_t, enum machine_mode,
                                    const_tree, bool);
@@ -1777,7 +1777,7 @@ cris_expand_return (bool on_stack)
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-cris_rtx_costs (rtx x, int code, int outer_code, int *total,
+cris_rtx_costs (rtx x, int code, int outer_code, int opno, int *total,
                bool speed)
 {
   switch (code)
@@ -1871,7 +1871,8 @@ cris_rtx_costs (rtx x, int code, int outer_code, int *total,
           && !CRIS_CONST_OK_FOR_LETTER_P (INTVAL (XEXP (x, 1)), 'I'))
        {
          *total
-           = (rtx_cost (XEXP (x, 0), (enum rtx_code) outer_code, speed) + 2
+           = (rtx_cost (XEXP (x, 0), (enum rtx_code) outer_code,
+                        opno, speed) + 2
               + 2 * GET_MODE_NUNITS (GET_MODE (XEXP (x, 0))));
          return true;
        }
@@ -1883,7 +1884,7 @@ cris_rtx_costs (rtx x, int code, int outer_code, int *total,
       /* fall through */
 
     case ZERO_EXTEND: case SIGN_EXTEND:
-      *total = rtx_cost (XEXP (x, 0), (enum rtx_code) outer_code, speed);
+      *total = rtx_cost (XEXP (x, 0), (enum rtx_code) outer_code, opno, speed);
       return true;
 
     default:
index 01ed8e769e7ae41e230e73cfa6ca1c5dd5afe03b..7d8b47bb1dd6df04fe6e28a58942594ef18d0f94 100644 (file)
@@ -364,7 +364,8 @@ static void frv_setup_incoming_varargs              (cumulative_args_t,
                                                 tree, int *, int);
 static rtx frv_expand_builtin_saveregs         (void);
 static void frv_expand_builtin_va_start                (tree, rtx);
-static bool frv_rtx_costs                      (rtx, int, int, int*, bool);
+static bool frv_rtx_costs                      (rtx, int, int, int, int*,
+                                                bool);
 static int frv_register_move_cost              (enum machine_mode,
                                                 reg_class_t, reg_class_t);
 static int frv_memory_move_cost                        (enum machine_mode,
@@ -9496,6 +9497,7 @@ static bool
 frv_rtx_costs (rtx x,
                int code ATTRIBUTE_UNUSED,
                int outer_code ATTRIBUTE_UNUSED,
+              int opno ATTRIBUTE_UNUSED,
                int *total,
               bool speed ATTRIBUTE_UNUSED)
 {
index a929a28663a0d4123b59ea31a78c759c1a3656d7..c5603934372558285cb2091bea3572a78c968eb2 100644 (file)
@@ -1174,7 +1174,8 @@ h8300_shift_costs (rtx x)
 /* Worker function for TARGET_RTX_COSTS.  */
 
 static bool
-h8300_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed)
+h8300_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+                int *total, bool speed)
 {
   if (TARGET_H8300SX && outer_code == MEM)
     {
index fe6ccbeb59c66cc7eb1321c8bb2a12bc753d7375..3356cfd748c34b31beacb996111d65f7db1a02e8 100644 (file)
@@ -28825,7 +28825,8 @@ ix86_modes_tieable_p (enum machine_mode mode1, enum machine_mode mode2)
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-ix86_rtx_costs (rtx x, int code, int outer_code_i, int *total, bool speed)
+ix86_rtx_costs (rtx x, int code, int outer_code_i, int opno, int *total,
+               bool speed)
 {
   enum rtx_code outer_code = (enum rtx_code) outer_code_i;
   enum machine_mode mode = GET_MODE (x);
@@ -28949,18 +28950,18 @@ ix86_rtx_costs (rtx x, int code, int outer_code_i, int *total, bool speed)
         /* ??? SSE scalar/vector cost should be used here.  */
         /* ??? Bald assumption that fma has the same cost as fmul.  */
         *total = cost->fmul;
-       *total += rtx_cost (XEXP (x, 1), FMA, speed);
+       *total += rtx_cost (XEXP (x, 1), FMA, 1, speed);
 
         /* Negate in op0 or op2 is free: FMS, FNMA, FNMS.  */
        sub = XEXP (x, 0);
        if (GET_CODE (sub) == NEG)
          sub = XEXP (sub, 0);
-       *total += rtx_cost (sub, FMA, speed);
+       *total += rtx_cost (sub, FMA, 0, speed);
 
        sub = XEXP (x, 2);
        if (GET_CODE (sub) == NEG)
          sub = XEXP (sub, 0);
-       *total += rtx_cost (sub, FMA, speed);
+       *total += rtx_cost (sub, FMA, 2, speed);
        return true;
       }
 
@@ -29022,7 +29023,8 @@ ix86_rtx_costs (rtx x, int code, int outer_code_i, int *total, bool speed)
 
          *total = (cost->mult_init[MODE_INDEX (mode)]
                    + nbits * cost->mult_bit
-                   + rtx_cost (op0, outer_code, speed) + rtx_cost (op1, outer_code, speed));
+                   + rtx_cost (op0, outer_code, opno, speed)
+                   + rtx_cost (op1, outer_code, opno, speed));
 
           return true;
        }
@@ -29056,10 +29058,11 @@ ix86_rtx_costs (rtx x, int code, int outer_code_i, int *total, bool speed)
              if (val == 2 || val == 4 || val == 8)
                {
                  *total = cost->lea;
-                 *total += rtx_cost (XEXP (XEXP (x, 0), 1), outer_code, speed);
+                 *total += rtx_cost (XEXP (XEXP (x, 0), 1),
+                                     outer_code, opno, speed);
                  *total += rtx_cost (XEXP (XEXP (XEXP (x, 0), 0), 0),
-                                     outer_code, speed);
-                 *total += rtx_cost (XEXP (x, 1), outer_code, speed);
+                                     outer_code, opno, speed);
+                 *total += rtx_cost (XEXP (x, 1), outer_code, opno, speed);
                  return true;
                }
            }
@@ -29070,17 +29073,20 @@ ix86_rtx_costs (rtx x, int code, int outer_code_i, int *total, bool speed)
              if (val == 2 || val == 4 || val == 8)
                {
                  *total = cost->lea;
-                 *total += rtx_cost (XEXP (XEXP (x, 0), 0), outer_code, speed);
-                 *total += rtx_cost (XEXP (x, 1), outer_code, speed);
+                 *total += rtx_cost (XEXP (XEXP (x, 0), 0),
+                                     outer_code, opno, speed);
+                 *total += rtx_cost (XEXP (x, 1), outer_code, opno, speed);
                  return true;
                }
            }
          else if (GET_CODE (XEXP (x, 0)) == PLUS)
            {
              *total = cost->lea;
-             *total += rtx_cost (XEXP (XEXP (x, 0), 0), outer_code, speed);
-             *total += rtx_cost (XEXP (XEXP (x, 0), 1), outer_code, speed);
-             *total += rtx_cost (XEXP (x, 1), outer_code, speed);
+             *total += rtx_cost (XEXP (XEXP (x, 0), 0),
+                                 outer_code, opno, speed);
+             *total += rtx_cost (XEXP (XEXP (x, 0), 1),
+                                 outer_code, opno, speed);
+             *total += rtx_cost (XEXP (x, 1), outer_code, opno, speed);
              return true;
            }
        }
@@ -29112,9 +29118,9 @@ ix86_rtx_costs (rtx x, int code, int outer_code_i, int *total, bool speed)
       if (!TARGET_64BIT && mode == DImode)
        {
          *total = (cost->add * 2
-                   + (rtx_cost (XEXP (x, 0), outer_code, speed)
+                   + (rtx_cost (XEXP (x, 0), outer_code, opno, speed)
                       << (GET_MODE (XEXP (x, 0)) != DImode))
-                   + (rtx_cost (XEXP (x, 1), outer_code, speed)
+                   + (rtx_cost (XEXP (x, 1), outer_code, opno, speed)
                       << (GET_MODE (XEXP (x, 1)) != DImode)));
          return true;
        }
@@ -29156,8 +29162,8 @@ ix86_rtx_costs (rtx x, int code, int outer_code_i, int *total, bool speed)
          /* This kind of construct is implemented using test[bwl].
             Treat it as if we had an AND.  */
          *total = (cost->add
-                   + rtx_cost (XEXP (XEXP (x, 0), 0), outer_code, speed)
-                   + rtx_cost (const1_rtx, outer_code, speed));
+                   + rtx_cost (XEXP (XEXP (x, 0), 0), outer_code, opno, speed)
+                   + rtx_cost (const1_rtx, outer_code, opno, speed));
          return true;
        }
       return false;
index fa3b93fa6cc9ab36918a7e4fcfbf87c02fc94774..f4fbf08396d5b7e82f40c1c1695a58983af9682a 100644 (file)
@@ -217,7 +217,7 @@ static int ia64_register_move_cost (enum machine_mode, reg_class_t,
                                     reg_class_t);
 static int ia64_memory_move_cost (enum machine_mode mode, reg_class_t,
                                  bool);
-static bool ia64_rtx_costs (rtx, int, int, int *, bool);
+static bool ia64_rtx_costs (rtx, int, int, int, int *, bool);
 static int ia64_unspec_may_trap_p (const_rtx, unsigned);
 static void fix_range (const char *);
 static struct machine_function * ia64_init_machine_status (void);
@@ -5244,8 +5244,8 @@ ia64_print_operand (FILE * file, rtx x, int code)
 /* ??? This is incomplete.  */
 
 static bool
-ia64_rtx_costs (rtx x, int code, int outer_code, int *total,
-               bool speed ATTRIBUTE_UNUSED)
+ia64_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+               int *total, bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
     {
index 916acf28408aae47c4c7c44b2b5f56ba86dedcfd..7d8630e6bbb6bd7afa1a62ec0ad73a20f193db64 100644 (file)
@@ -151,7 +151,7 @@ static bool iq2000_return_in_memory   (const_tree, const_tree);
 static void iq2000_setup_incoming_varargs (cumulative_args_t,
                                           enum machine_mode, tree, int *,
                                           int);
-static bool iq2000_rtx_costs          (rtx, int, int, int *, bool);
+static bool iq2000_rtx_costs          (rtx, int, int, int, int *, bool);
 static int  iq2000_address_cost       (rtx, bool);
 static section *iq2000_select_section (tree, int, unsigned HOST_WIDE_INT);
 static rtx  iq2000_legitimize_address (rtx, rtx, enum machine_mode);
@@ -3285,7 +3285,8 @@ iq2000_legitimize_address (rtx xinsn, rtx old_x ATTRIBUTE_UNUSED,
 
 
 static bool
-iq2000_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int * total,
+iq2000_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
+                 int opno ATTRIBUTE_UNUSED, int * total,
                  bool speed ATTRIBUTE_UNUSED)
 {
   enum machine_mode mode = GET_MODE (x);
index e9800e7f55e29b34fae1d3c37097ba36499b7c85..0d0ee5f9a9eb0a7b2c7bab1cd2c851b634ab9f9d 100644 (file)
@@ -68,8 +68,8 @@ static bool lm32_in_small_data_p (const_tree);
 static void lm32_setup_incoming_varargs (cumulative_args_t cum,
                                         enum machine_mode mode, tree type,
                                         int *pretend_size, int no_rtl);
-static bool lm32_rtx_costs (rtx x, int code, int outer_code, int *total,
-                           bool speed);
+static bool lm32_rtx_costs (rtx x, int code, int outer_code, int opno,
+                           int *total, bool speed);
 static bool lm32_can_eliminate (const int, const int);
 static bool
 lm32_legitimate_address_p (enum machine_mode mode, rtx x, bool strict);
@@ -928,7 +928,8 @@ nonpic_symbol_mentioned_p (rtx x)
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-lm32_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed)
+lm32_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+               int *total, bool speed)
 {
   enum machine_mode mode = GET_MODE (x);
   bool small_mode;
index a967e217135d3f802e2369f9b599389219da68a4..39d8ede0dee5dc69796d1486d5f5001744a69c25 100644 (file)
@@ -2429,8 +2429,8 @@ m32c_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS m32c_rtx_costs
 static bool
-m32c_rtx_costs (rtx x, int code, int outer_code, int *total,
-               bool speed ATTRIBUTE_UNUSED)
+m32c_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+               int *total, bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
     {
index 577345e9c98e99f2599eefb7b4d305f806d94425..9763670360255ca769294c3d7ffc76da2e088ef0 100644 (file)
@@ -84,7 +84,7 @@ static bool m32r_function_value_regno_p (const unsigned int);
 static void m32r_setup_incoming_varargs (cumulative_args_t, enum machine_mode,
                                         tree, int *, int);
 static void init_idents (void);
-static bool m32r_rtx_costs (rtx, int, int, int *, bool speed);
+static bool m32r_rtx_costs (rtx, int, int, int, int *, bool speed);
 static int m32r_memory_move_cost (enum machine_mode, reg_class_t, bool);
 static bool m32r_pass_by_reference (cumulative_args_t, enum machine_mode,
                                    const_tree, bool);
@@ -1356,7 +1356,8 @@ m32r_memory_move_cost (enum machine_mode mode,
 }
 
 static bool
-m32r_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total,
+m32r_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
+               int opno ATTRIBUTE_UNUSED, int *total,
                bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
index 8b57d6cd7403ca23bf0c0ff7c1a844d5062d625c..71df1410394ddf8fa94ea16a22d33a37e4245589 100644 (file)
@@ -150,7 +150,7 @@ static bool m68k_save_reg (unsigned int regno, bool interrupt_handler);
 static bool m68k_ok_for_sibcall_p (tree, tree);
 static bool m68k_tls_symbol_p (rtx);
 static rtx m68k_legitimize_address (rtx, rtx, enum machine_mode);
-static bool m68k_rtx_costs (rtx, int, int, int *, bool);
+static bool m68k_rtx_costs (rtx, int, int, int, int *, bool);
 #if M68K_HONOR_TARGET_STRICT_ALIGNMENT
 static bool m68k_return_in_memory (const_tree, const_tree);
 #endif
@@ -2765,8 +2765,8 @@ const_int_cost (HOST_WIDE_INT i)
 }
 
 static bool
-m68k_rtx_costs (rtx x, int code, int outer_code, int *total,
-               bool speed ATTRIBUTE_UNUSED)
+m68k_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+               int *total, bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
     {
index 8a822bd185c76b0ef62fb1a4c770f79b3c715150..82ae0cfe68b39daf70a0111b862b956ec380a095 100644 (file)
@@ -121,7 +121,8 @@ static const char *mcore_strip_name_encoding        (const char *);
 static int        mcore_const_costs                    (rtx, RTX_CODE);
 static int        mcore_and_cost                       (rtx);
 static int        mcore_ior_cost                       (rtx);
-static bool       mcore_rtx_costs              (rtx, int, int, int *, bool);
+static bool       mcore_rtx_costs              (rtx, int, int, int,
+                                                int *, bool);
 static void       mcore_external_libcall       (rtx);
 static bool       mcore_return_in_memory       (const_tree, const_tree);
 static int        mcore_arg_partial_bytes       (cumulative_args_t,
@@ -508,8 +509,8 @@ mcore_ior_cost (rtx x)
 }
 
 static bool
-mcore_rtx_costs (rtx x, int code, int outer_code, int * total,
-                bool speed ATTRIBUTE_UNUSED)
+mcore_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+                int * total, bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
     {
index c18e7b7f04c37308ed544a187b521b673a0c6ca8..39d9cf95d30fe1d7c63604e856785aa552c4caea 100644 (file)
@@ -211,7 +211,7 @@ static void mep_move_ready_insn (rtx *, int, rtx);
 static int mep_sched_reorder (FILE *, int, rtx *, int *, int);
 static rtx mep_make_bundle (rtx, rtx);
 static void mep_bundle_insns (rtx);
-static bool mep_rtx_cost (rtx, int, int, int *, bool);
+static bool mep_rtx_cost (rtx, int, int, int, int *, bool);
 static int mep_address_cost (rtx, bool);
 static void mep_setup_incoming_varargs (cumulative_args_t, enum machine_mode,
                                        tree, int *, int);
@@ -7261,7 +7261,9 @@ mep_expand_binary_intrinsic (int ATTRIBUTE_UNUSED immediate,
 }
 
 static bool
-mep_rtx_cost (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total, bool ATTRIBUTE_UNUSED speed_t)
+mep_rtx_cost (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
+             int opno ATTRIBUTE_UNUSED, int *total,
+             bool ATTRIBUTE_UNUSED speed_t)
 {
   switch (code)
     {
index 288b86fc10f0aedbfed9a9357c38266b1af100a2..97d91ca10f183ac47e62b5382af19737d03d4d65 100644 (file)
@@ -861,7 +861,8 @@ microblaze_expand_block_move (rtx dest, rtx src, rtx length, rtx align_rtx)
 }
 
 static bool
-microblaze_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total, 
+microblaze_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
+                     int opno ATTRIBUTE_UNUSED, int *total,
                      bool speed ATTRIBUTE_UNUSED)
 {
   enum machine_mode mode = GET_MODE (x);
index 88988b66ca26214dda047109b2074d02320a2ddd..1c9b86697af4a42a0ffeaf55f29e89d3adc73ee4 100644 (file)
@@ -3334,7 +3334,7 @@ mips_binary_cost (rtx x, int single_cost, int double_cost, bool speed)
     cost = single_cost;
   return (cost
          + set_src_cost (XEXP (x, 0), speed)
-         + rtx_cost (XEXP (x, 1), GET_CODE (x), speed));
+         + rtx_cost (XEXP (x, 1), GET_CODE (x), 1, speed));
 }
 
 /* Return the cost of floating-point multiplications of mode MODE.  */
@@ -3404,7 +3404,8 @@ mips_zero_extend_cost (enum machine_mode mode, rtx op)
 /* Implement TARGET_RTX_COSTS.  */
 
 static bool
-mips_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed)
+mips_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+               int *total, bool speed)
 {
   enum machine_mode mode = GET_MODE (x);
   bool float_mode_p = FLOAT_MODE_P (mode);
index 29826b5c1b93e5d64fbbeaebf271338e3502a70d..c87d09e0e2f2ee20bad6e77c6269b94e09455999 100644 (file)
@@ -140,7 +140,7 @@ static void mmix_setup_incoming_varargs
   (cumulative_args_t, enum machine_mode, tree, int *, int);
 static void mmix_file_start (void);
 static void mmix_file_end (void);
-static bool mmix_rtx_costs (rtx, int, int, int *, bool);
+static bool mmix_rtx_costs (rtx, int, int, int, int *, bool);
 static int mmix_register_move_cost (enum machine_mode,
                                    reg_class_t, reg_class_t);
 static rtx mmix_struct_value_rtx (tree, int);
@@ -1229,6 +1229,7 @@ static bool
 mmix_rtx_costs (rtx x ATTRIBUTE_UNUSED,
                int code ATTRIBUTE_UNUSED,
                int outer_code ATTRIBUTE_UNUSED,
+               int opno ATTRIBUTE_UNUSED,
                int *total ATTRIBUTE_UNUSED,
                bool speed ATTRIBUTE_UNUSED)
 {
index 24a07d87d554f27656d70c365be9c583e8c65917..eca887133497e6c51ed17506d2370dc0eb765490 100644 (file)
@@ -2182,7 +2182,7 @@ mn10300_address_cost (rtx x, bool speed)
       return speed ? 2 : 6;
 
     default:
-      return rtx_cost (x, MEM, speed);
+      return rtx_cost (x, MEM, 0, speed);
     }
 }
 
@@ -2296,7 +2296,8 @@ mn10300_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
    to represent cycles.  Size-relative costs are in bytes.  */
 
 static bool
-mn10300_rtx_costs (rtx x, int code, int outer_code, int *ptotal, bool speed)
+mn10300_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+                  int *ptotal, bool speed)
 {
   /* This value is used for SYMBOL_REF etc where we want to pretend
      we have a full 32-bit constant.  */
@@ -2387,7 +2388,7 @@ mn10300_rtx_costs (rtx x, int code, int outer_code, int *ptotal, bool speed)
          i = INTVAL (XEXP (x, 1));
          if (i == 1 || i == 4)
            {
-             total = 1 + rtx_cost (XEXP (x, 0), PLUS, speed);
+             total = 1 + rtx_cost (XEXP (x, 0), PLUS, 0, speed);
              goto alldone;
            }
        }
index b208215d36e9c5a91f4f706404b72794580a402f..db404cd3c2e3dbb3bf12ce1ffbd042475613d19f 100644 (file)
@@ -92,7 +92,7 @@ static void fix_range (const char *);
 static int hppa_register_move_cost (enum machine_mode mode, reg_class_t,
                                    reg_class_t);
 static int hppa_address_cost (rtx, bool);
-static bool hppa_rtx_costs (rtx, int, int, int *, bool);
+static bool hppa_rtx_costs (rtx, int, int, int, int *, bool);
 static inline rtx force_mode (enum machine_mode, rtx);
 static void pa_reorg (void);
 static void pa_combine_instructions (void);
@@ -1411,8 +1411,8 @@ hppa_address_cost (rtx X,
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-hppa_rtx_costs (rtx x, int code, int outer_code, int *total,
-               bool speed ATTRIBUTE_UNUSED)
+hppa_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+               int *total, bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
     {
index 63e99865dd663a84cfdba060d2f65637d18b2b7b..42e3af078db6a0213cd80bf22837928f8e5c6e5c 100644 (file)
@@ -141,7 +141,7 @@ decode_pdp11_d (const struct real_format *fmt ATTRIBUTE_UNUSED,
 
 static const char *singlemove_string (rtx *);
 static bool pdp11_assemble_integer (rtx, unsigned int, int);
-static bool pdp11_rtx_costs (rtx, int, int, int *, bool);
+static bool pdp11_rtx_costs (rtx, int, int, int, int *, bool);
 static bool pdp11_return_in_memory (const_tree, const_tree);
 static rtx pdp11_function_value (const_tree, const_tree, bool);
 static rtx pdp11_libcall_value (enum machine_mode, const_rtx);
@@ -888,7 +888,8 @@ pdp11_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
 }
 
 static bool
-pdp11_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total,
+pdp11_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
+                int opno ATTRIBUTE_UNUSED, int *total,
                 bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
index c3a7046763aea635ac1e95bf4de6534fc2d0e6d2..b878a1f1777c83dab0ef2b2da4a714d30f159bd9 100644 (file)
@@ -101,7 +101,8 @@ int picochip_sched_reorder (FILE * file, int verbose, rtx * ready,
 void picochip_init_builtins (void);
 rtx picochip_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
 
-bool picochip_rtx_costs (rtx x, int code, int outer_code, int* total, bool speed);
+bool picochip_rtx_costs (rtx x, int code, int outer_code, int opno,
+                        int* total, bool speed);
 bool picochip_return_in_memory(const_tree type,
                               const_tree fntype ATTRIBUTE_UNUSED);
 bool picochip_legitimate_address_p (enum machine_mode, rtx, bool);
@@ -3741,7 +3742,8 @@ gen_SImode_mem(rtx opnd1,rtx opnd2)
 }
 
 bool
-picochip_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int* total, bool speed)
+picochip_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
+                   int opno ATTRIBUTE_UNUSED, int* total, bool speed)
 {
 
   int localTotal = 0;
index a1141f1416dd70b4e40bef66d4f24b9d65ec7731..a94a4f6c40b857a5360bf9e17575adf8fc3a080b 100644 (file)
@@ -948,8 +948,8 @@ static int rs6000_variable_issue (FILE *, int, rtx, int);
 static int rs6000_register_move_cost (enum machine_mode,
                                      reg_class_t, reg_class_t);
 static int rs6000_memory_move_cost (enum machine_mode, reg_class_t, bool);
-static bool rs6000_rtx_costs (rtx, int, int, int *, bool);
-static bool rs6000_debug_rtx_costs (rtx, int, int, int *, bool);
+static bool rs6000_rtx_costs (rtx, int, int, int, int *, bool);
+static bool rs6000_debug_rtx_costs (rtx, int, int, int, int *, bool);
 static int rs6000_debug_address_cost (rtx, bool);
 static int rs6000_adjust_cost (rtx, rtx, rtx, int);
 static int rs6000_debug_adjust_cost (rtx, rtx, rtx, int);
@@ -25730,8 +25730,8 @@ rs6000_xcoff_file_end (void)
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-rs6000_rtx_costs (rtx x, int code, int outer_code, int *total,
-                 bool speed)
+rs6000_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+                 int *total, bool speed)
 {
   enum machine_mode mode = GET_MODE (x);
 
@@ -26074,17 +26074,18 @@ rs6000_rtx_costs (rtx x, int code, int outer_code, int *total,
 /* Debug form of r6000_rtx_costs that is selected if -mdebug=cost.  */
 
 static bool
-rs6000_debug_rtx_costs (rtx x, int code, int outer_code, int *total,
+rs6000_debug_rtx_costs (rtx x, int code, int outer_code, int opno, int *total,
                        bool speed)
 {
-  bool ret = rs6000_rtx_costs (x, code, outer_code, total, speed);
+  bool ret = rs6000_rtx_costs (x, code, outer_code, opno, total, speed);
 
   fprintf (stderr,
           "\nrs6000_rtx_costs, return = %s, code = %s, outer_code = %s, "
-          "total = %d, speed = %s, x:\n",
+          "opno = %d, total = %d, speed = %s, x:\n",
           ret ? "complete" : "scan inner",
           GET_RTX_NAME (code),
           GET_RTX_NAME (outer_code),
+          opno,
           *total,
           speed ? "true" : "false");
 
index c8f9a1ed5b73a02df4fb8a1d8fb787b6ee8f611d..22f05f9fd21592cbb4f2f86e8294c6f1c0cce331 100644 (file)
@@ -2374,8 +2374,8 @@ s390_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
    of the superexpression of x.  */
 
 static bool
-s390_rtx_costs (rtx x, int code, int outer_code, int *total,
-               bool speed ATTRIBUTE_UNUSED)
+s390_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+               int *total, bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
     {
@@ -2480,9 +2480,9 @@ s390_rtx_costs (rtx x, int code, int outer_code, int *total,
       /* Negate in the third argument is free: FMSUB.  */
       if (GET_CODE (XEXP (x, 2)) == NEG)
        {
-         *total += (rtx_cost (XEXP (x, 0), FMA, speed)
-                    + rtx_cost (XEXP (x, 1), FMA, speed)
-                    + rtx_cost (XEXP (XEXP (x, 2), 0), FMA, speed));
+         *total += (rtx_cost (XEXP (x, 0), FMA, 0, speed)
+                    + rtx_cost (XEXP (x, 1), FMA, 1, speed)
+                    + rtx_cost (XEXP (XEXP (x, 2), 0), FMA, 2, speed));
          return true;
        }
       return false;
index 3a96eabd176b91a2dd8d22e1f1c156c4a14fb592..dc56fc7e5dd3fecf5ea99a6b558ba3d7dcc7fa00 100644 (file)
@@ -73,7 +73,8 @@ extern const char * score_select (rtx *ops, const char *inst_pre, bool commu,
 extern const char * score_output_casesi (rtx *operands);
 extern const char * score_rpush (rtx *ops);
 extern const char * score_rpop (rtx *ops);
-extern bool score_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed);
+extern bool score_rtx_costs (rtx x, int code, int outer_code, int opno,
+                            int *total, bool speed);
 
 #ifdef RTX_CODE
 extern enum machine_mode score_select_cc_mode (enum rtx_code op, rtx x, rtx y);
index 6325dd9b7a53cf08d399a15431a5911b489a4cfa..c789f22f1bbfe5379641b9f3e63c518f1f25f611 100644 (file)
@@ -1074,7 +1074,8 @@ score_address_insns (rtx x, enum machine_mode mode)
 
 /* Implement TARGET_RTX_COSTS macro.  */
 bool
-score_rtx_costs (rtx x, int code, int outer_code, int *total, bool speed ATTRIBUTE_UNUSED)
+score_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+                int *total, bool speed ATTRIBUTE_UNUSED)
 {
   enum machine_mode mode = GET_MODE (x);
 
index 1b81e259476d3cbc3901a095334475d976a25c6c..93477ff8b05434567b3e80f468e25410f01f5a53 100644 (file)
@@ -247,7 +247,7 @@ static int addsubcosts (rtx);
 static int multcosts (rtx);
 static bool unspec_caller_rtx_p (rtx);
 static bool sh_cannot_copy_insn_p (rtx);
-static bool sh_rtx_costs (rtx, int, int, int *, bool);
+static bool sh_rtx_costs (rtx, int, int, int, int *, bool);
 static int sh_address_cost (rtx, bool);
 static int sh_pr_n_sets (void);
 static rtx sh_allocate_initial_value (rtx);
@@ -2849,7 +2849,7 @@ andcosts (rtx x)
          || satisfies_constraint_J16 (XEXP (x, 1)))
        return 1;
       else
-       return 1 + rtx_cost (XEXP (x, 1), AND, !optimize_size);
+       return 1 + rtx_cost (XEXP (x, 1), AND, 1, !optimize_size);
     }
 
   /* These constants are single cycle extu.[bw] instructions.  */
@@ -2949,8 +2949,8 @@ multcosts (rtx x ATTRIBUTE_UNUSED)
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-sh_rtx_costs (rtx x, int code, int outer_code, int *total,
-             bool speed ATTRIBUTE_UNUSED)
+sh_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+             int *total, bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
     {
index d4c64d01d26539ad206dca71e200906a47988ab2..de9a7eb6929c9da0ce6021fb7816b6cfbc6b5654 100644 (file)
@@ -428,7 +428,7 @@ static const char *get_some_local_dynamic_name (void);
 static int get_some_local_dynamic_name_1 (rtx *, void *);
 static int sparc_register_move_cost (enum machine_mode,
                                     reg_class_t, reg_class_t);
-static bool sparc_rtx_costs (rtx, int, int, int *, bool);
+static bool sparc_rtx_costs (rtx, int, int, int, int *, bool);
 static rtx sparc_function_value (const_tree, const_tree, bool);
 static rtx sparc_libcall_value (enum machine_mode, const_rtx);
 static bool sparc_function_value_regno_p (const unsigned int);
@@ -9414,8 +9414,8 @@ sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED,
    ??? the latencies and then CSE will just use that.  */
 
 static bool
-sparc_rtx_costs (rtx x, int code, int outer_code, int *total,
-                bool speed ATTRIBUTE_UNUSED)
+sparc_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+                int *total, bool speed ATTRIBUTE_UNUSED)
 {
   enum machine_mode mode = GET_MODE (x);
   bool float_mode_p = FLOAT_MODE_P (mode);
index b8e3fb35da3afe71b65a616af1c2d45b80e6f7d7..952aea5044499e72671dba14e07f8739d1dc7539 100644 (file)
@@ -203,7 +203,7 @@ static int mem_is_padded_component_ref (rtx x);
 static int reg_aligned_for_addr (rtx x);
 static bool spu_assemble_integer (rtx x, unsigned int size, int aligned_p);
 static void spu_asm_globalize_label (FILE * file, const char *name);
-static bool spu_rtx_costs (rtx x, int code, int outer_code,
+static bool spu_rtx_costs (rtx x, int code, int outer_code, int opno,
                           int *total, bool speed);
 static bool spu_function_ok_for_sibcall (tree decl, tree exp);
 static void spu_init_libfuncs (void);
@@ -5482,7 +5482,8 @@ spu_asm_globalize_label (FILE * file, const char *name)
 }
 
 static bool
-spu_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED, int *total,
+spu_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
+              int opno ATTRIBUTE_UNUSED, int *total,
               bool speed ATTRIBUTE_UNUSED)
 {
   enum machine_mode mode = GET_MODE (x);
index 910dc2e302f743eade75429b46efab63e71c022c..99acee6f69b25662fee9c8bdb65a6cc8540a0587 100644 (file)
@@ -57,7 +57,7 @@ static void xstormy16_asm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
 
 static void xstormy16_init_builtins (void);
 static rtx xstormy16_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
-static bool xstormy16_rtx_costs (rtx, int, int, int *, bool);
+static bool xstormy16_rtx_costs (rtx, int, int, int, int *, bool);
 static int xstormy16_address_cost (rtx, bool);
 static bool xstormy16_return_in_memory (const_tree, const_tree);
 
@@ -69,7 +69,8 @@ static GTY(()) section *bss100_section;
 
 static bool
 xstormy16_rtx_costs (rtx x, int code, int outer_code ATTRIBUTE_UNUSED,
-                    int *total, bool speed ATTRIBUTE_UNUSED)
+                    int opno ATTRIBUTE_UNUSED, int *total,
+                    bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
     {
index 5074ebe417fe4177ced4a5218a709850ff53558e..5c43607347edf2883c8ac9e1c84bff2d57dffc97 100644 (file)
@@ -310,6 +310,7 @@ static bool
 v850_rtx_costs (rtx x,
                 int codearg,
                 int outer_code ATTRIBUTE_UNUSED,
+               int opno ATTRIBUTE_UNUSED,
                 int * total, bool speed)
 {
   enum rtx_code code = (enum rtx_code) codearg;
index 13a45158f94fc6c1230916805ff2203183e54d44..4e704b6f714fe3aafb610a8575583733a2880dfa 100644 (file)
@@ -54,7 +54,7 @@ static void vax_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
                                 HOST_WIDE_INT, tree);
 static int vax_address_cost_1 (rtx);
 static int vax_address_cost (rtx, bool);
-static bool vax_rtx_costs (rtx, int, int, int *, bool);
+static bool vax_rtx_costs (rtx, int, int, int, int *, bool);
 static rtx vax_function_arg (cumulative_args_t, enum machine_mode,
                             const_tree, bool);
 static void vax_function_arg_advance (cumulative_args_t, enum machine_mode,
@@ -745,8 +745,8 @@ vax_address_cost (rtx x, bool speed ATTRIBUTE_UNUSED)
    costs on a per cpu basis.  */
 
 static bool
-vax_rtx_costs (rtx x, int code, int outer_code, int *total,
-              bool speed ATTRIBUTE_UNUSED)
+vax_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+              int *total, bool speed ATTRIBUTE_UNUSED)
 {
   enum machine_mode mode = GET_MODE (x);
   int i = 0;                              /* may be modified in switch */
index 5ba468131e0c0d6b3960f614d9200980a8d6c785..7f42e48dd538e6a1bba90c31eef1b5cc6b88cf50 100644 (file)
@@ -136,7 +136,7 @@ static unsigned int xtensa_multibss_section_type_flags (tree, const char *,
                                                        int) ATTRIBUTE_UNUSED;
 static section *xtensa_select_rtx_section (enum machine_mode, rtx,
                                           unsigned HOST_WIDE_INT);
-static bool xtensa_rtx_costs (rtx, int, int, int *, bool);
+static bool xtensa_rtx_costs (rtx, int, int, int, int *, bool);
 static int xtensa_register_move_cost (enum machine_mode, reg_class_t,
                                      reg_class_t);
 static int xtensa_memory_move_cost (enum machine_mode, reg_class_t, bool);
@@ -3342,8 +3342,8 @@ xtensa_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED,
    scanned.  In either case, *TOTAL contains the cost result.  */
 
 static bool
-xtensa_rtx_costs (rtx x, int code, int outer_code, int *total,
-                 bool speed ATTRIBUTE_UNUSED)
+xtensa_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
+                 int *total, bool speed ATTRIBUTE_UNUSED)
 {
   switch (code)
     {
index 54edf7ee94202345ef679ce60ec386eeca9638af..ae676851632fe6604209ff40fee4c12692de26e8 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -475,8 +475,8 @@ struct table_elt
    || (HARD_REGISTER_NUM_P (N)                                         \
        && FIXED_REGNO_P (N) && REGNO_REG_CLASS (N) != NO_REGS))
 
-#define COST(X) (REG_P (X) ? 0 : notreg_cost (X, SET))
-#define COST_IN(X,OUTER) (REG_P (X) ? 0 : notreg_cost (X, OUTER))
+#define COST(X) (REG_P (X) ? 0 : notreg_cost (X, SET, 1))
+#define COST_IN(X, OUTER, OPNO) (REG_P (X) ? 0 : notreg_cost (X, OUTER, OPNO))
 
 /* Get the number of times this register has been updated in this
    basic block.  */
@@ -552,7 +552,7 @@ static bitmap cse_ebb_live_in, cse_ebb_live_out;
 static sbitmap cse_visited_basic_blocks;
 
 static bool fixed_base_plus_p (rtx x);
-static int notreg_cost (rtx, enum rtx_code);
+static int notreg_cost (rtx, enum rtx_code, int);
 static int approx_reg_cost_1 (rtx *, void *);
 static int approx_reg_cost (rtx);
 static int preferable (int, int, int, int);
@@ -752,7 +752,7 @@ preferable (int cost_a, int regcost_a, int cost_b, int regcost_b)
    from COST macro to keep it simple.  */
 
 static int
-notreg_cost (rtx x, enum rtx_code outer)
+notreg_cost (rtx x, enum rtx_code outer, int opno)
 {
   return ((GET_CODE (x) == SUBREG
           && REG_P (SUBREG_REG (x))
@@ -764,7 +764,7 @@ notreg_cost (rtx x, enum rtx_code outer)
           && TRULY_NOOP_TRUNCATION_MODES_P (GET_MODE (x),
                                             GET_MODE (SUBREG_REG (x))))
          ? 0
-         : rtx_cost (x, outer, optimize_this_for_speed_p) * 2);
+         : rtx_cost (x, outer, opno, optimize_this_for_speed_p) * 2);
 }
 
 \f
@@ -3296,7 +3296,7 @@ fold_rtx (rtx x, rtx insn)
           argument.  */
        if (const_arg != 0
            && const_arg != folded_arg
-           && COST_IN (const_arg, code) <= COST_IN (folded_arg, code)
+           && COST_IN (const_arg, code, i) <= COST_IN (folded_arg, code, i)
 
            /* It's not safe to substitute the operand of a conversion
               operator with a constant, as the conversion's identity
index d383ecaa6b20352c52e6843ac8d6f43e46bea36b..832aefef4f1ce92b4cd02feea042a5fd13e5dc0a 100644 (file)
@@ -6415,14 +6415,19 @@ Define this macro if a non-short-circuit operation produced by
 @code{BRANCH_COST} is greater than or equal to the value 2.
 @end defmac
 
-@deftypefn {Target Hook} bool TARGET_RTX_COSTS (rtx @var{x}, int @var{code}, int @var{outer_code}, int *@var{total}, bool @var{speed})
+@deftypefn {Target Hook} bool TARGET_RTX_COSTS (rtx @var{x}, int @var{code}, int @var{outer_code}, int @var{opno}, int *@var{total}, bool @var{speed})
 This target hook describes the relative costs of RTL expressions.
 
 The cost may depend on the precise form of the expression, which is
-available for examination in @var{x}, and the rtx code of the expression
-in which it is contained, found in @var{outer_code}.  @var{code} is the
-expression code---redundant, since it can be obtained with
-@code{GET_CODE (@var{x})}.
+available for examination in @var{x}, and the fact that @var{x} appears
+as operand @var{opno} of an expression with rtx code @var{outer_code}.
+That is, the hook can assume that there is some rtx @var{y} such
+that @samp{GET_CODE (@var{y}) == @var{outer_code}} and such that
+either (a) @samp{XEXP (@var{y}, @var{opno}) == @var{x}} or
+(b) @samp{XVEC (@var{y}, @var{opno})} contains @var{x}.
+
+@var{code} is @var{x}'s expression code---redundant, since it can be
+obtained with @code{GET_CODE (@var{x})}.
 
 In implementing this hook, you can use the construct
 @code{COSTS_N_INSNS (@var{n})} to specify a cost equal to @var{n} fast
index 9d10844d7871bef1a9265aa5fd73b5fcca8bb43d..c53cbe82b662891acfd2ce2532fe67d0c8c3f3b6 100644 (file)
@@ -6357,10 +6357,15 @@ Define this macro if a non-short-circuit operation produced by
 This target hook describes the relative costs of RTL expressions.
 
 The cost may depend on the precise form of the expression, which is
-available for examination in @var{x}, and the rtx code of the expression
-in which it is contained, found in @var{outer_code}.  @var{code} is the
-expression code---redundant, since it can be obtained with
-@code{GET_CODE (@var{x})}.
+available for examination in @var{x}, and the fact that @var{x} appears
+as operand @var{opno} of an expression with rtx code @var{outer_code}.
+That is, the hook can assume that there is some rtx @var{y} such
+that @samp{GET_CODE (@var{y}) == @var{outer_code}} and such that
+either (a) @samp{XEXP (@var{y}, @var{opno}) == @var{x}} or
+(b) @samp{XVEC (@var{y}, @var{opno})} contains @var{x}.
+
+@var{code} is @var{x}'s expression code---redundant, since it can be
+obtained with @code{GET_CODE (@var{x})}.
 
 In implementing this hook, you can use the construct
 @code{COSTS_N_INSNS (@var{n})} to specify a cost equal to @var{n} fast
index 7606c15330dfe73491af5ae0f82ae94579b02244..093d3ef2d6d16078cb7cbc27b9d48678c5bc3818 100644 (file)
@@ -144,6 +144,8 @@ static GTY(()) rtx shift_test;
 static bool
 prefer_and_bit_test (enum machine_mode mode, int bitnum)
 {
+  bool speed_p;
+
   if (and_test == 0)
     {
       /* Set up rtxes for the two variations.  Use NULL as a placeholder
@@ -168,8 +170,9 @@ prefer_and_bit_test (enum machine_mode mode, int bitnum)
                                                 mode);
   XEXP (XEXP (shift_test, 0), 1) = GEN_INT (bitnum);
 
-  return (rtx_cost (and_test, IF_THEN_ELSE, optimize_insn_for_speed_p ())
-         <= rtx_cost (shift_test, IF_THEN_ELSE, optimize_insn_for_speed_p ()));
+  speed_p = optimize_insn_for_speed_p ();
+  return (rtx_cost (and_test, IF_THEN_ELSE, 0, speed_p)
+         <= rtx_cost (shift_test, IF_THEN_ELSE, 0, speed_p));
 }
 
 /* Subroutine of do_jump, dealing with exploded comparisons of the type
index f75ea7acd6178f0e54895436fcc96285a0fcea74..0047cd09076024ff7952822438ee26f9bb98461d 100644 (file)
@@ -5431,7 +5431,7 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1,
 
          /* For the reverse comparison, use either an addition or a XOR.  */
           if (want_add
-             && rtx_cost (GEN_INT (normalizep), PLUS,
+             && rtx_cost (GEN_INT (normalizep), PLUS, 1,
                           optimize_insn_for_speed_p ()) == 0)
            {
              tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0,
@@ -5442,7 +5442,7 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1,
                                     target, 0, OPTAB_WIDEN);
            }
           else if (!want_add
-                  && rtx_cost (trueval, XOR,
+                  && rtx_cost (trueval, XOR, 1,
                                optimize_insn_for_speed_p ()) == 0)
            {
              tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0,
@@ -5535,7 +5535,7 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1,
 
       /* Again, for the reverse comparison, use either an addition or a XOR.  */
       if (want_add
-         && rtx_cost (GEN_INT (normalizep), PLUS,
+         && rtx_cost (GEN_INT (normalizep), PLUS, 1,
                       optimize_insn_for_speed_p ()) == 0)
        {
          tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0,
@@ -5545,7 +5545,7 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1,
                                GEN_INT (normalizep), target, 0, OPTAB_WIDEN);
        }
       else if (!want_add
-              && rtx_cost (trueval, XOR,
+              && rtx_cost (trueval, XOR, 1,
                            optimize_insn_for_speed_p ()) == 0)
        {
          tem = emit_store_flag_1 (subtarget, rcode, op0, op1, mode, 0,
index 9dfde822a5f513d7f4df7ec445faccbefe62d095..90251834e4ec45fa5e9504d126867668a26b6e78 100644 (file)
@@ -267,11 +267,12 @@ hook_bool_uintp_uintp_false (unsigned int *a ATTRIBUTE_UNUSED,
 }
 
 bool
-hook_bool_rtx_int_int_intp_bool_false (rtx a ATTRIBUTE_UNUSED,
-                                      int b ATTRIBUTE_UNUSED,
-                                      int c ATTRIBUTE_UNUSED,
-                                      int *d ATTRIBUTE_UNUSED,
-                                      bool speed_p ATTRIBUTE_UNUSED)
+hook_bool_rtx_int_int_int_intp_bool_false (rtx a ATTRIBUTE_UNUSED,
+                                          int b ATTRIBUTE_UNUSED,
+                                          int c ATTRIBUTE_UNUSED,
+                                          int d ATTRIBUTE_UNUSED,
+                                          int *e ATTRIBUTE_UNUSED,
+                                          bool speed_p ATTRIBUTE_UNUSED)
 {
   return false;
 }
index a1b011203d5b6f16dd77a046935474a7747fc945..156d708ac01244a1c80d4822a5f8c49f56f321f9 100644 (file)
@@ -53,7 +53,8 @@ extern bool hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree,
 extern bool hook_bool_rtx_false (rtx);
 extern bool hook_bool_rtx_int_false (rtx, int);
 extern bool hook_bool_uintp_uintp_false (unsigned int *, unsigned int *);
-extern bool hook_bool_rtx_int_int_intp_bool_false (rtx, int, int, int *, bool);
+extern bool hook_bool_rtx_int_int_int_intp_bool_false (rtx, int, int, int,
+                                                      int *, bool);
 extern bool hook_bool_tree_tree_false (tree, tree);
 extern bool hook_bool_tree_tree_true (tree, tree);
 extern bool hook_bool_tree_bool_false (tree, bool);
index 195853401e5099c3d4c6b21ee4ac2c624d7d8d70..8f1114ec2d9aa8c2f052f66a7f9b213ac42d41fb 100644 (file)
@@ -1204,21 +1204,21 @@ commutative_optab_p (optab binoptab)
          || binoptab == umul_highpart_optab);
 }
 
-/* X is to be used in mode MODE as an operand to BINOPTAB.  If we're
+/* X is to be used in mode MODE as operand OPN to BINOPTAB.  If we're
    optimizing, and if the operand is a constant that costs more than
    1 instruction, force the constant into a register and return that
    register.  Return X otherwise.  UNSIGNEDP says whether X is unsigned.  */
 
 static rtx
 avoid_expensive_constant (enum machine_mode mode, optab binoptab,
-                         rtx x, bool unsignedp)
+                         int opn, rtx x, bool unsignedp)
 {
   bool speed = optimize_insn_for_speed_p ();
 
   if (mode != VOIDmode
       && optimize
       && CONSTANT_P (x)
-      && rtx_cost (x, binoptab->code, speed) > set_src_cost (x, speed))
+      && rtx_cost (x, binoptab->code, opn, speed) > set_src_cost (x, speed))
     {
       if (CONST_INT_P (x))
        {
@@ -1265,9 +1265,9 @@ expand_binop_directly (enum machine_mode mode, optab binoptab,
     }
 
   /* If we are optimizing, force expensive constants into a register.  */
-  xop0 = avoid_expensive_constant (xmode0, binoptab, xop0, unsignedp);
+  xop0 = avoid_expensive_constant (xmode0, binoptab, 0, xop0, unsignedp);
   if (!shift_optab_p (binoptab))
-    xop1 = avoid_expensive_constant (xmode1, binoptab, xop1, unsignedp);
+    xop1 = avoid_expensive_constant (xmode1, binoptab, 1, xop1, unsignedp);
 
   /* In case the insn wants input operands in modes different from
      those of the actual operands, convert the operands.  It would
@@ -1479,10 +1479,10 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1,
                && mclass == MODE_INT)
              {
                no_extend = 1;
-               xop0 = avoid_expensive_constant (mode, binoptab,
+               xop0 = avoid_expensive_constant (mode, binoptab, 0,
                                                 xop0, unsignedp);
                if (binoptab != ashl_optab)
-                 xop1 = avoid_expensive_constant (mode, binoptab,
+                 xop1 = avoid_expensive_constant (mode, binoptab, 1,
                                                   xop1, unsignedp);
              }
 
@@ -2216,8 +2216,8 @@ expand_twoval_binop (optab binoptab, rtx op0, rtx op1, rtx targ0, rtx targ1,
       rtx xop0 = op0, xop1 = op1;
 
       /* If we are optimizing, force expensive constants into a register.  */
-      xop0 = avoid_expensive_constant (mode0, binoptab, xop0, unsignedp);
-      xop1 = avoid_expensive_constant (mode1, binoptab, xop1, unsignedp);
+      xop0 = avoid_expensive_constant (mode0, binoptab, 0, xop0, unsignedp);
+      xop1 = avoid_expensive_constant (mode1, binoptab, 1, xop1, unsignedp);
 
       create_fixed_operand (&ops[0], targ0);
       create_convert_operand_from (&ops[1], op0, mode, unsignedp);
@@ -3790,12 +3790,12 @@ prepare_cmp_insn (rtx x, rtx y, enum rtx_code comparison, rtx size,
 
   /* If we are optimizing, force expensive constants into a register.  */
   if (CONSTANT_P (x) && optimize
-      && (rtx_cost (x, COMPARE, optimize_insn_for_speed_p ())
+      && (rtx_cost (x, COMPARE, 0, optimize_insn_for_speed_p ())
           > COSTS_N_INSNS (1)))
     x = force_reg (mode, x);
 
   if (CONSTANT_P (y) && optimize
-      && (rtx_cost (y, COMPARE, optimize_insn_for_speed_p ())
+      && (rtx_cost (y, COMPARE, 1, optimize_insn_for_speed_p ())
           > COSTS_N_INSNS (1)))
     y = force_reg (mode, y);
 
index 4f126865dea9cc97e69927cd8df1a3f1d2ddb587..5323dcc1b4ebba64b3cbc7092534c357f0926a3e 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1196,9 +1196,10 @@ costs_add_n_insns (struct full_rtx_costs *c, int n)
 }
 
 extern void init_rtlanal (void);
-extern int rtx_cost (rtx, enum rtx_code, bool);
+extern int rtx_cost (rtx, enum rtx_code, int, bool);
 extern int address_cost (rtx, enum machine_mode, addr_space_t, bool);
-extern void get_full_rtx_cost (rtx, enum rtx_code, struct full_rtx_costs *);
+extern void get_full_rtx_cost (rtx, enum rtx_code, int,
+                              struct full_rtx_costs *);
 extern unsigned int subreg_lsb (const_rtx);
 extern unsigned int subreg_lsb_1 (enum machine_mode, enum machine_mode,
                                  unsigned int);
@@ -1224,7 +1225,7 @@ extern int low_bitmask_len (enum machine_mode, unsigned HOST_WIDE_INT);
 static inline int
 set_rtx_cost (rtx x, bool speed_p)
 {
-  return rtx_cost (x, INSN, speed_p);
+  return rtx_cost (x, INSN, 4, speed_p);
 }
 
 /* Like set_rtx_cost, but return both the speed and size costs in C.  */
@@ -1232,7 +1233,7 @@ set_rtx_cost (rtx x, bool speed_p)
 static inline void
 get_full_set_rtx_cost (rtx x, struct full_rtx_costs *c)
 {
-  get_full_rtx_cost (x, INSN, c);
+  get_full_rtx_cost (x, INSN, 4, c);
 }
 
 /* Return the cost of moving X into a register, relative to the cost
@@ -1242,7 +1243,7 @@ get_full_set_rtx_cost (rtx x, struct full_rtx_costs *c)
 static inline int
 set_src_cost (rtx x, bool speed_p)
 {
-  return rtx_cost (x, SET, speed_p);
+  return rtx_cost (x, SET, 1, speed_p);
 }
 
 /* Like set_src_cost, but return both the speed and size costs in C.  */
@@ -1250,7 +1251,7 @@ set_src_cost (rtx x, bool speed_p)
 static inline void
 get_full_set_src_cost (rtx x, struct full_rtx_costs *c)
 {
-  get_full_rtx_cost (x, SET, c);
+  get_full_rtx_cost (x, SET, 1, c);
 }
 #endif
 
index 348371d2ddbbd055b1f633b2d5124b5fc8df712e..7fa3ca6f315b166872944055f7ea8489252da7d4 100644 (file)
@@ -3674,11 +3674,12 @@ label_is_jump_target_p (const_rtx label, const_rtx jump_insn)
    Another is in rtl generation, to pick the cheapest way to multiply.
    Other uses like the latter are expected in the future.
 
-   SPEED parameter specify whether costs optimized for speed or size should
+   X appears as operand OPNO in an expression with code OUTER_CODE.
+   SPEED specifies whether costs optimized for speed or size should
    be returned.  */
 
 int
-rtx_cost (rtx x, enum rtx_code outer_code ATTRIBUTE_UNUSED, bool speed)
+rtx_cost (rtx x, enum rtx_code outer_code, int opno, bool speed)
 {
   int i, j;
   enum rtx_code code;
@@ -3726,7 +3727,7 @@ rtx_cost (rtx x, enum rtx_code outer_code ATTRIBUTE_UNUSED, bool speed)
       break;
 
     default:
-      if (targetm.rtx_costs (x, code, outer_code, &total, speed))
+      if (targetm.rtx_costs (x, code, outer_code, opno, &total, speed))
        return total;
       break;
     }
@@ -3737,22 +3738,23 @@ rtx_cost (rtx x, enum rtx_code outer_code ATTRIBUTE_UNUSED, bool speed)
   fmt = GET_RTX_FORMAT (code);
   for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
     if (fmt[i] == 'e')
-      total += rtx_cost (XEXP (x, i), code, speed);
+      total += rtx_cost (XEXP (x, i), code, i, speed);
     else if (fmt[i] == 'E')
       for (j = 0; j < XVECLEN (x, i); j++)
-       total += rtx_cost (XVECEXP (x, i, j), code, speed);
+       total += rtx_cost (XVECEXP (x, i, j), code, i, speed);
 
   return total;
 }
 
 /* Fill in the structure C with information about both speed and size rtx
-   costs for X, with outer code OUTER.  */
+   costs for X, which is operand OPNO in an expression with code OUTER.  */
 
 void
-get_full_rtx_cost (rtx x, enum rtx_code outer, struct full_rtx_costs *c)
+get_full_rtx_cost (rtx x, enum rtx_code outer, int opno,
+                  struct full_rtx_costs *c)
 {
-  c->speed = rtx_cost (x, outer, true);
-  c->size = rtx_cost (x, outer, false);
+  c->speed = rtx_cost (x, outer, opno, true);
+  c->size = rtx_cost (x, outer, opno, false);
 }
 
 \f
@@ -3780,7 +3782,7 @@ address_cost (rtx x, enum machine_mode mode, addr_space_t as, bool speed)
 int
 default_address_cost (rtx x, bool speed)
 {
-  return rtx_cost (x, MEM, speed);
+  return rtx_cost (x, MEM, 0, speed);
 }
 \f
 
index 9ff97e690e991e76ec8010438a089ab1fea48dbb..479e1a111fc2b77d435d56da2a16e6fbbdaf3445 100644 (file)
@@ -1645,8 +1645,8 @@ DEFHOOKPOD
 DEFHOOK
 (rtx_costs,
  "",
- bool, (rtx x, int code, int outer_code, int *total, bool speed),
- hook_bool_rtx_int_int_intp_bool_false)
+ bool, (rtx x, int code, int outer_code, int opno, int *total, bool speed),
+ hook_bool_rtx_int_int_int_intp_bool_false)
 
 /* Compute the cost of X, used as an address.  Never called with
    invalid addresses.  */