diff options
author | Richard Henderson <rth@redhat.com> | 2003-01-27 20:46:33 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2003-01-27 20:46:33 -0800 |
commit | 3c50106f69e2a73f98a24f154979249e3b5ff79d (patch) | |
tree | 1eaff917ba37b6f409082db1a76c42c218320c5e /gcc/config/i960 | |
parent | 5ca9898002fc6c777cd25caa42e58ece40fe9978 (diff) | |
download | gcc-3c50106f69e2a73f98a24f154979249e3b5ff79d.zip gcc-3c50106f69e2a73f98a24f154979249e3b5ff79d.tar.gz gcc-3c50106f69e2a73f98a24f154979249e3b5ff79d.tar.bz2 |
Makefile.in (cse.o): Depend on TARGET_H.
* Makefile.in (cse.o): Depend on TARGET_H.
* cse.c (rtx_cost): Use targetm.rtx_costs.
* system.h (CONST_COSTS RTX_COSTS DEFAULT_RTX_COSTS): Poison.
* doc/tm.texi: Update.
* target.h (targetm.rtx_costs): New.
* target-def.h (TARGET_RTX_COSTS): New.
* hooks.c (hook_bool_rtx_int_int_intp_false): New.
* hooks.h: Update.
* config/alpha/alpha.c (alpha_rtx_cost_data): New.
(alpha_rtx_costs, TARGET_RTX_COSTS): New.
* config/alpha/alpha.h (PROCESSOR_MAX): New.
(CONST_COSTS, RTX_COSTS): Remove.
* config/arc/arc.c, config/arc/arc.h, config/c4x/c4x.c,
config/c4x/c4x.h, config/cris/cris.c, config/cris/cris.h,
config/d30v/d30v.c, config/d30v/d30v.h, config/dsp16xx/dsp16xx.c,
config/dsp16xx/dsp16xx.h, config/frv/frv.c, config/frv/frv.h,
config/h8300/h8300.c, config/h8300/h8300.h, config/i370/i370.c,
config/i370/i370.h, config/i386/i386.c, config/i386/i386.h,
config/i960/i960.c, config/i960/i960.h, config/ia64/ia64.c,
config/ia64/ia64.h, config/m32r/m32r.c, config/m32r/m32r.h,
config/m68k/m68k.c, config/m68k/m68k.h, config/m88k/m88k.c,
config/m88k/m88k.h, config/mcore/mcore.c, config/mcore/mcore.h,
config/mips/mips.c, config/mips/mips.h, config/mn10200/mn10200.c,
config/mn10200/mn10200.h, config/mn10300/mn10300.c,
config/mn10300/mn10300.h, config/ns32k/ns32k.c, config/ns32k/ns32k.h,
config/pa/pa.c, config/pa/pa.h, config/pdp11/pdp11.c,
config/pdp11/pdp11.h, config/romp/romp.c, config/romp/romp.h,
config/rs6000/rs6000.c, config/rs6000/rs6000.h, config/s390/s390.c,
config/s390/s390.h, config/sh/sh.c, config/sh/sh.h,
config/stormy16/stormy16.c, config/stormy16/stormy16.h,
config/v850/v850.c, config/v850/v850.h,
config/xtensa/xtensa.c, config/xtensa/xtensa.h
(CONST_COSTS, RTX_COSTS): Move code ...
(foo_rtx_costs, TARGET_RTX_COSTS): ... here.
* config/arm/arm.c (arm_rtx_costs_1): Rename from arm_rtx_costs.
(arm_rtx_costs, TARGET_RTX_COSTS): New.
* config/arm/arm-protos.h: Update.
* config/arm/arm.h (DEFAULT_RTX_COSTS): Remove.
* config/avr/avr.h (CONST_COSTS): Move code ...
* config/avr/avr.c (avr_rtx_costs): ... here.
(default_rtx_costs): Make static.
* config/avr/avr-protos.h: Update.
* config/h8300/h8300.c (const_costs): Make static.
(h8300_and_costs, h8300_shift_costs): Likewise.
* config/h8300/h8300-protos.h: Update.
* config/ip2k/ip2k.h (DEFAULT_RTX_COSTS): Remove.
(CONST_COSTS): Move code ...
* config/ip2k/ip2k.c (ip2k_rtx_costs): ... here. Rename from
default_rtx_costs; update for signature change.
* config/ip2k/ip2k-protos.h: Update.
* config/m68hc11/m68hc11.h (RTX_COSTS): Remove.
(CONST_COSTS): Move code ...
* config/m68hc11/m68hc11.c (m68hc11_rtx_costs): ... here.
(TARGET_RTX_COSTS): New.
(m68hc11_rtx_costs_1): Rename from m68hc11_rtx_costs; make static.
* config/m68hc11/m68hc11-protos.h: Update.
* config/m68k/m68k.c (const_int_cost): Make static.
* config/m68k/m68k-protos.h: Update.
* config/mcore/mcore.c (mcore_const_costs): Make static.
(mcore_and_cost, mcore_ior_cost): Likewise.
* config/mcore/mcore-protos.h: Update.
* config/mmix/mmix.c (mmix_rtx_costs, TARGET_RTX_COSTS): New.
(mmix_rtx_cost_recalculated): Remove.
* config/mmix/mmix.h (DEFAULT_RTX_COSTS): Remove.
* config/mmix/mmix-protos.h: Update.
* config/sh/sh.c (shiftcosts): Make static.
(addsubcosts, andcosts, multcosts): Likewise.
* config/sh/sh-protos.h: Update.
* config/sparc/sparc.c (TARGET_RTX_COSTS): New.
(sparc_rtx_costs): Make static; update for change in signature.
* config/sparc/sparc.h (RTX_COSTS_CASES, RTX_COSTS): Remove.
* config/sparc/sparc-protos.h: Update.
* config/v850/v850.c (const_costs): Make static.
* config/v850/v850-protos.h: Update.
* config/vax/vax.h (RTX_COSTS): Remove.
(CONST_COSTS): Move code ...
* config/vax/vax.c (vax_rtx_costs_1): ... here; rename
from vax_rtx_cost.
(vax_rtx_costs, TARGET_RTX_COSTS): New.
From-SVN: r61954
Diffstat (limited to 'gcc/config/i960')
-rw-r--r-- | gcc/config/i960/i960.c | 53 | ||||
-rw-r--r-- | gcc/config/i960/i960.h | 30 |
2 files changed, 53 insertions, 30 deletions
diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c index 08894aa..35b72e2 100644 --- a/gcc/config/i960/i960.c +++ b/gcc/config/i960/i960.c @@ -50,6 +50,7 @@ static void i960_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void i960_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT)); static void i960_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree)); +static bool i960_rtx_costs PARAMS ((rtx, int, int, int *)); /* Save the operands last given to a compare for use when we generate a scc or bcc insn. */ @@ -107,6 +108,9 @@ static int ret_label = 0; #undef TARGET_CAN_ASM_OUTPUT_MI_THUNK #define TARGET_CAN_ASM_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall +#undef TARGET_RTX_COSTS +#define TARGET_RTX_COSTS i960_rtx_costs + struct gcc_target targetm = TARGET_INITIALIZER; /* Override conflicting target switch options. @@ -2856,3 +2860,52 @@ i960_output_mi_thunk (file, thunk, delta, vcall_offset, function) assemble_name (file, XSTR (XEXP (DECL_RTL (function), 0), 0)); fprintf (file, "\n"); } + +static bool +i960_rtx_costs (x, code, outer_code, total) + rtx x; + int code, outer_code; + int *total; +{ + switch (code) + { + /* Constants that can be (non-ldconst) insn operands are cost 0. + Constants that can be non-ldconst operands in rare cases are cost 1. + Other constants have higher costs. + + Must check for OUTER_CODE of SET for power2_operand, because + reload_cse_move2add calls us with OUTER_CODE of PLUS to decide + when to replace set with add. */ + + case CONST_INT: + if ((INTVAL (x) >= 0 && INTVAL (x) < 32) + || (outer_code == SET && power2_operand (x, VOIDmode))) + { + *total = 0; + return true; + } + else if (INTVAL (x) >= -31 && INTVAL (x) < 0) + { + *total = 1; + return true; + } + /* FALLTHRU */ + + case CONST: + case LABEL_REF: + case SYMBOL_REF: + *total = (TARGET_C_SERIES ? 6 : 8); + return true; + + case CONST_DOUBLE: + if (x == CONST0_RTX (DFmode) || x == CONST0_RTX (SFmode) + || x == CONST1_RTX (DFmode) || x == CONST1_RTX (SFmode)) + *total = 1; + else + *total = 12; + return true; + + default: + return false; + } +} diff --git a/gcc/config/i960/i960.h b/gcc/config/i960/i960.h index 3b84d04..534f525 100644 --- a/gcc/config/i960/i960.h +++ b/gcc/config/i960/i960.h @@ -1154,36 +1154,6 @@ extern struct rtx_def *i960_compare_op0, *i960_compare_op1; #define TARGET_MEM_FUNCTIONS 1 #endif -/* Compute the cost of computing a constant rtl expression RTX - whose rtx-code is CODE. The body of this macro is a portion - of a switch statement. If the code is computed here, - return it with a return statement. Otherwise, break from the switch. */ - -/* Constants that can be (non-ldconst) insn operands are cost 0. Constants - that can be non-ldconst operands in rare cases are cost 1. Other constants - have higher costs. */ - -/* Must check for OUTER_CODE of SET for power2_operand, because - reload_cse_move2add calls us with OUTER_CODE of PLUS to decide when - to replace set with add. */ - -#define CONST_COSTS(RTX, CODE, OUTER_CODE) \ - case CONST_INT: \ - if ((INTVAL (RTX) >= 0 && INTVAL (RTX) < 32) \ - || (OUTER_CODE == SET && power2_operand (RTX, VOIDmode))) \ - return 0; \ - else if (INTVAL (RTX) >= -31 && INTVAL (RTX) < 0) \ - return 1; \ - case CONST: \ - case LABEL_REF: \ - case SYMBOL_REF: \ - return (TARGET_C_SERIES ? 6 : 8); \ - case CONST_DOUBLE: \ - if ((RTX) == CONST0_RTX (DFmode) || (RTX) == CONST0_RTX (SFmode) \ - || (RTX) == CONST1_RTX (DFmode) || (RTX) == CONST1_RTX (SFmode))\ - return 1; \ - return 12; - /* The i960 offers addressing modes which are "as cheap as a register". See i960.c (or gcc.texinfo) for details. */ |