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/vax | |
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/vax')
-rw-r--r-- | gcc/config/vax/vax.c | 57 | ||||
-rw-r--r-- | gcc/config/vax/vax.h | 43 |
2 files changed, 52 insertions, 48 deletions
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index 422b936..9bff82b 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -45,6 +45,8 @@ static int follows_p PARAMS ((rtx, rtx)); static void vax_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT)); static void vax_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree)); +static int vax_rtx_costs_1 PARAMS ((rtx, enum rtx_code, enum rtx_code)); +static bool vax_rtx_costs PARAMS ((rtx, int, int, int *)); /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -58,6 +60,9 @@ static void vax_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT, #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK #define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall +#undef TARGET_RTX_COSTS +#define TARGET_RTX_COSTS vax_rtx_costs + struct gcc_target targetm = TARGET_INITIALIZER; /* Set global variables as needed for the options enabled. */ @@ -482,16 +487,15 @@ vax_address_cost (addr) return reg + indexed + indir + offset + predec; } - /* Cost of an expression on a VAX. This version has costs tuned for the CVAX chip (found in the VAX 3 series) with comments for variations on other models. */ -int -vax_rtx_cost (x) +static int +vax_rtx_costs_1 (x, code, outer_code) register rtx x; + enum rtx_code code, outer_code; { - register enum rtx_code code = GET_CODE (x); enum machine_mode mode = GET_MODE (x); register int c; int i = 0; /* may be modified in switch */ @@ -499,6 +503,40 @@ vax_rtx_cost (x) switch (code) { + /* On a VAX, constants from 0..63 are cheap because they can use the + 1 byte literal constant format. compare to -1 should be made cheap + so that decrement-and-branch insns can be formed more easily (if + the value -1 is copied to a register some decrement-and-branch + patterns will not match). */ + case CONST_INT: + if (INTVAL (x) == 0) + return 0; + if (outer_code == AND) + return ((unsigned HOST_WIDE_INT) ~INTVAL (x) <= 077) ? 1 : 2; + if ((unsigned HOST_WIDE_INT) INTVAL (x) <= 077) + return 1; + if (outer_code == COMPARE && INTVAL (x) == -1) + return 1; + if (outer_code == PLUS && (unsigned HOST_WIDE_INT) -INTVAL (x) <= 077) + return 1; + /* FALLTHRU */ + + case CONST: + case LABEL_REF: + case SYMBOL_REF: + return 3; + + case CONST_DOUBLE: + if (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT) + return vax_float_literal (x) ? 5 : 8; + else + return (((CONST_DOUBLE_HIGH (x) == 0 + && (unsigned HOST_WIDE_INT) CONST_DOUBLE_LOW (x) < 64) + || (outer_code == PLUS + && CONST_DOUBLE_HIGH (x) == -1 \ + && (unsigned HOST_WIDE_INT)-CONST_DOUBLE_LOW (x) < 64)) + ? 2 : 5); + case POST_INC: return 2; case PRE_DEC: @@ -617,7 +655,6 @@ vax_rtx_cost (x) break; } - /* Now look inside the expression. Operands which are not registers or short constants add to the cost. @@ -678,6 +715,16 @@ vax_rtx_cost (x) } return c; } + +static bool +vax_rtx_costs (x, code, outer_code, total) + rtx x; + int code, outer_code; + int *total; +{ + *total = vax_rtx_costs_1 (x, code, outer_code); + return true; +} /* Return 1 if insn A follows B. */ diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h index f3f1e46..e2a1d95 100644 --- a/gcc/config/vax/vax.h +++ b/gcc/config/vax/vax.h @@ -848,49 +848,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES }; #define TARGET_FLOAT_FORMAT VAX_FLOAT_FORMAT -/* 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. */ - -/* On a VAX, constants from 0..63 are cheap because they can use the - 1 byte literal constant format. compare to -1 should be made cheap - so that decrement-and-branch insns can be formed more easily (if - the value -1 is copied to a register some decrement-and-branch patterns - will not match). */ - -#define CONST_COSTS(RTX,CODE,OUTER_CODE) \ - case CONST_INT: \ - if (INTVAL (RTX) == 0) return 0; \ - if ((OUTER_CODE) == AND) \ - return ((unsigned) ~INTVAL (RTX) <= 077) ? 1 : 2; \ - if ((unsigned) INTVAL (RTX) <= 077) return 1; \ - if ((OUTER_CODE) == COMPARE && INTVAL (RTX) == -1) \ - return 1; \ - if ((OUTER_CODE) == PLUS && (unsigned) -INTVAL (RTX) <= 077)\ - return 1; \ - case CONST: \ - case LABEL_REF: \ - case SYMBOL_REF: \ - return 3; \ - case CONST_DOUBLE: \ - if (GET_MODE_CLASS (GET_MODE (RTX)) == MODE_FLOAT) \ - return vax_float_literal (RTX) ? 5 : 8; \ - else \ - return (((CONST_DOUBLE_HIGH (RTX) == 0 \ - && (unsigned) CONST_DOUBLE_LOW (RTX) < 64) \ - || ((OUTER_CODE) == PLUS \ - && CONST_DOUBLE_HIGH (RTX) == -1 \ - && (unsigned)-CONST_DOUBLE_LOW (RTX) < 64)) \ - ? 2 : 5); - -#define RTX_COSTS(RTX,CODE,OUTER_CODE) case FIX: case FLOAT: \ - case MULT: case DIV: case UDIV: case MOD: case UMOD: \ - case ASHIFT: case LSHIFTRT: case ASHIFTRT: \ - case ROTATE: case ROTATERT: case PLUS: case MINUS: case IOR: \ - case XOR: case AND: case NEG: case NOT: case ZERO_EXTRACT: \ - case SIGN_EXTRACT: case MEM: return vax_rtx_cost(RTX) - #define ADDRESS_COST(RTX) (1 + (GET_CODE (RTX) == REG ? 0 : vax_address_cost(RTX))) /* Specify the cost of a branch insn; roughly the number of extra insns that |