tm.texi.in (TARGET_RTX_COSTS): Add an opno paramter.

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
This commit is contained in:
Richard Sandiford 2011-08-18 12:37:53 +00:00 committed by Richard Sandiford
parent 5e8f01f434
commit 68f932c443
47 changed files with 403 additions and 264 deletions

View 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.

View 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;
}

View 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;
}

View 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:

View 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;

View 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;

View 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:

View 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)
{

View 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)
{

View 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;

View 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)
{

View 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);

View 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;

View 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)
{

View 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)

View 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)
{

View 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)
{

View 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)
{

View 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);

View 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);

View 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)
{

View 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;
}
}

View 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)
{

View 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)

View 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;

View 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");

View 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;

View 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);

View 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);

View 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)
{

View 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);

View 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);

View 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)
{

View 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;

View 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 */

View 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)
{

View File

@ -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);
}
@ -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

View 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

View 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

View 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

View 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,

View 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;
}

View 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);

View 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);

View File

@ -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

View 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);
}
@ -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);
}

View 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. */