diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-01-28 04:46:33 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-01-28 04:46:33 +0000 |
commit | fab7adbfb5b8861f87531f939ad03f891bba055a (patch) | |
tree | 1eaff917ba37b6f409082db1a76c42c218320c5e /gcc/config/sparc | |
parent | bb5d2966d86c25ca14d0d12cb96249b8069e0ab1 (diff) | |
download | gcc-fab7adbfb5b8861f87531f939ad03f891bba055a.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61954 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/sparc')
-rw-r--r-- | gcc/config/sparc/sparc-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 214 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.h | 21 |
3 files changed, 135 insertions, 101 deletions
diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h index 0aa6e58f7da..31e0a2ccc6c 100644 --- a/gcc/config/sparc/sparc-protos.h +++ b/gcc/config/sparc/sparc-protos.h @@ -120,7 +120,6 @@ extern char *sparc_v8plus_shift PARAMS ((rtx *, rtx, const char *)); extern int sparc_check_64 PARAMS ((rtx, rtx)); extern rtx gen_df_reg PARAMS ((rtx, int)); extern int sparc_extra_constraint_check PARAMS ((rtx, int, int)); -extern int sparc_rtx_costs PARAMS ((rtx, enum rtx_code, enum rtx_code)); #endif /* RTX_CODE */ #endif /* __SPARC_PROTOS_H__ */ diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index aed7e4b79d5..a769ca9d2e7 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -181,6 +181,7 @@ static void sparc_encode_section_info PARAMS ((tree, int)); static bool sparc_function_ok_for_sibcall PARAMS ((tree, tree)); static void sparc_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree)); +static bool sparc_rtx_costs PARAMS ((rtx, int, int, int *)); /* Option handling. */ @@ -252,6 +253,9 @@ enum processor_type sparc_cpu; #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 sparc_rtx_costs + struct gcc_target targetm = TARGET_INITIALIZER; /* Validate and override various options, and do some machine dependent @@ -8156,10 +8160,10 @@ sparc_extra_constraint_check (op, c, strict) ??? scheduler description. Some day, teach genautomata to output ??? the latencies and then CSE will just use that. */ -int -sparc_rtx_costs (x, code, outer_code) +static bool +sparc_rtx_costs (x, code, outer_code, total) rtx x; - enum rtx_code code, outer_code; + int code, outer_code, *total; { switch (code) { @@ -8173,50 +8177,61 @@ sparc_rtx_costs (x, code, outer_code) { case PROCESSOR_ULTRASPARC: case PROCESSOR_ULTRASPARC3: - return COSTS_N_INSNS (4); + *total = COSTS_N_INSNS (4); + return true; case PROCESSOR_SUPERSPARC: - return COSTS_N_INSNS (3); + *total = COSTS_N_INSNS (3); + return true; case PROCESSOR_CYPRESS: - return COSTS_N_INSNS (5); + *total = COSTS_N_INSNS (5); + return true; case PROCESSOR_HYPERSPARC: case PROCESSOR_SPARCLITE86X: default: - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); + return true; } } - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); + return true; case SQRT: switch (sparc_cpu) { case PROCESSOR_ULTRASPARC: if (GET_MODE (x) == SFmode) - return COSTS_N_INSNS (13); + *total = COSTS_N_INSNS (13); else - return COSTS_N_INSNS (23); + *total = COSTS_N_INSNS (23); + return true; case PROCESSOR_ULTRASPARC3: if (GET_MODE (x) == SFmode) - return COSTS_N_INSNS (20); + *total = COSTS_N_INSNS (20); else - return COSTS_N_INSNS (29); + *total = COSTS_N_INSNS (29); + return true; case PROCESSOR_SUPERSPARC: - return COSTS_N_INSNS (12); + *total = COSTS_N_INSNS (12); + return true; case PROCESSOR_CYPRESS: - return COSTS_N_INSNS (63); + *total = COSTS_N_INSNS (63); + return true; case PROCESSOR_HYPERSPARC: case PROCESSOR_SPARCLITE86X: - return COSTS_N_INSNS (17); + *total = COSTS_N_INSNS (17); + return true; default: - return COSTS_N_INSNS (30); + *total = COSTS_N_INSNS (30); + return true; } case COMPARE: @@ -8226,18 +8241,22 @@ sparc_rtx_costs (x, code, outer_code) { case PROCESSOR_ULTRASPARC: case PROCESSOR_ULTRASPARC3: - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); + return true; case PROCESSOR_SUPERSPARC: - return COSTS_N_INSNS (3); + *total = COSTS_N_INSNS (3); + return true; case PROCESSOR_CYPRESS: - return COSTS_N_INSNS (5); + *total = COSTS_N_INSNS (5); + return true; case PROCESSOR_HYPERSPARC: case PROCESSOR_SPARCLITE86X: default: - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); + return true; } } @@ -8245,7 +8264,8 @@ sparc_rtx_costs (x, code, outer_code) ??? all UltraSPARC processors because the result ??? can be bypassed to a branch in the same group. */ - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); + return true; case MULT: if (FLOAT_MODE_P (GET_MODE (x))) @@ -8254,20 +8274,25 @@ sparc_rtx_costs (x, code, outer_code) { case PROCESSOR_ULTRASPARC: case PROCESSOR_ULTRASPARC3: - return COSTS_N_INSNS (4); + *total = COSTS_N_INSNS (4); + return true; case PROCESSOR_SUPERSPARC: - return COSTS_N_INSNS (3); + *total = COSTS_N_INSNS (3); + return true; case PROCESSOR_CYPRESS: - return COSTS_N_INSNS (7); + *total = COSTS_N_INSNS (7); + return true; case PROCESSOR_HYPERSPARC: case PROCESSOR_SPARCLITE86X: - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); + return true; default: - return COSTS_N_INSNS (5); + *total = COSTS_N_INSNS (5); + return true; } } @@ -8304,20 +8329,28 @@ sparc_rtx_costs (x, code, outer_code) Since we do not play any such tricks currently the safest thing to do is report the worst case latency. */ if (sparc_cpu == PROCESSOR_ULTRASPARC) - return (GET_MODE (x) == DImode ? - COSTS_N_INSNS (34) : COSTS_N_INSNS (19)); + { + *total = (GET_MODE (x) == DImode + ? COSTS_N_INSNS (34) : COSTS_N_INSNS (19)); + return true; + } /* Multiply latency on Ultra-III, fortunately, is constant. */ if (sparc_cpu == PROCESSOR_ULTRASPARC3) - return COSTS_N_INSNS (6); + { + *total = COSTS_N_INSNS (6); + return true; + } if (sparc_cpu == PROCESSOR_HYPERSPARC || sparc_cpu == PROCESSOR_SPARCLITE86X) - return COSTS_N_INSNS (17); + { + *total = COSTS_N_INSNS (17); + return true; + } - return (TARGET_HARD_MUL - ? COSTS_N_INSNS (5) - : COSTS_N_INSNS (25)); + *total = (TARGET_HARD_MUL ? COSTS_N_INSNS (5) : COSTS_N_INSNS (25)); + return true; case DIV: case UDIV: @@ -8329,57 +8362,67 @@ sparc_rtx_costs (x, code, outer_code) { case PROCESSOR_ULTRASPARC: if (GET_MODE (x) == SFmode) - return COSTS_N_INSNS (13); + *total = COSTS_N_INSNS (13); else - return COSTS_N_INSNS (23); + *total = COSTS_N_INSNS (23); + return true; case PROCESSOR_ULTRASPARC3: if (GET_MODE (x) == SFmode) - return COSTS_N_INSNS (17); + *total = COSTS_N_INSNS (17); else - return COSTS_N_INSNS (20); + *total = COSTS_N_INSNS (20); + return true; case PROCESSOR_SUPERSPARC: if (GET_MODE (x) == SFmode) - return COSTS_N_INSNS (6); + *total = COSTS_N_INSNS (6); else - return COSTS_N_INSNS (9); + *total = COSTS_N_INSNS (9); + return true; case PROCESSOR_HYPERSPARC: case PROCESSOR_SPARCLITE86X: if (GET_MODE (x) == SFmode) - return COSTS_N_INSNS (8); + *total = COSTS_N_INSNS (8); else - return COSTS_N_INSNS (12); + *total = COSTS_N_INSNS (12); + return true; default: - return COSTS_N_INSNS (7); + *total = COSTS_N_INSNS (7); + return true; } } if (sparc_cpu == PROCESSOR_ULTRASPARC) - return (GET_MODE (x) == DImode ? - COSTS_N_INSNS (68) : COSTS_N_INSNS (37)); - if (sparc_cpu == PROCESSOR_ULTRASPARC3) - return (GET_MODE (x) == DImode ? - COSTS_N_INSNS (71) : COSTS_N_INSNS (40)); - return COSTS_N_INSNS (25); + *total = (GET_MODE (x) == DImode + ? COSTS_N_INSNS (68) : COSTS_N_INSNS (37)); + else if (sparc_cpu == PROCESSOR_ULTRASPARC3) + *total = (GET_MODE (x) == DImode + ? COSTS_N_INSNS (71) : COSTS_N_INSNS (40)); + else + *total = COSTS_N_INSNS (25); + return true; case IF_THEN_ELSE: /* Conditional moves. */ switch (sparc_cpu) { case PROCESSOR_ULTRASPARC: - return COSTS_N_INSNS (2); + *total = COSTS_N_INSNS (2); + return true; case PROCESSOR_ULTRASPARC3: if (FLOAT_MODE_P (GET_MODE (x))) - return COSTS_N_INSNS (3); + *total = COSTS_N_INSNS (3); else - return COSTS_N_INSNS (2); + *total = COSTS_N_INSNS (2); + return true; default: - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); + return true; } case MEM: @@ -8390,9 +8433,10 @@ sparc_rtx_costs (x, code, outer_code) { case PROCESSOR_ULTRASPARC: if (outer_code == ZERO_EXTEND) - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); else - return COSTS_N_INSNS (2); + *total = COSTS_N_INSNS (2); + return true; case PROCESSOR_ULTRASPARC3: if (outer_code == ZERO_EXTEND) @@ -8400,75 +8444,87 @@ sparc_rtx_costs (x, code, outer_code) if (GET_MODE (x) == QImode || GET_MODE (x) == HImode || outer_code == SIGN_EXTEND) - return COSTS_N_INSNS (2); + *total = COSTS_N_INSNS (2); else - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); } else { /* This handles sign extension (3 cycles) and everything else (2 cycles). */ - return COSTS_N_INSNS (2); + *total = COSTS_N_INSNS (2); } + return true; case PROCESSOR_SUPERSPARC: if (FLOAT_MODE_P (GET_MODE (x)) || outer_code == ZERO_EXTEND || outer_code == SIGN_EXTEND) - return COSTS_N_INSNS (0); + *total = COSTS_N_INSNS (0); else - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); + return true; case PROCESSOR_TSC701: if (outer_code == ZERO_EXTEND || outer_code == SIGN_EXTEND) - return COSTS_N_INSNS (2); + *total = COSTS_N_INSNS (2); else - return COSTS_N_INSNS (3); + *total = COSTS_N_INSNS (3); + return true; case PROCESSOR_CYPRESS: if (outer_code == ZERO_EXTEND || outer_code == SIGN_EXTEND) - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); else - return COSTS_N_INSNS (2); + *total = COSTS_N_INSNS (2); + return true; case PROCESSOR_HYPERSPARC: case PROCESSOR_SPARCLITE86X: default: if (outer_code == ZERO_EXTEND || outer_code == SIGN_EXTEND) - return COSTS_N_INSNS (0); + *total = COSTS_N_INSNS (0); else - return COSTS_N_INSNS (1); + *total = COSTS_N_INSNS (1); + return true; } case CONST_INT: if (INTVAL (x) < 0x1000 && INTVAL (x) >= -0x1000) - return 0; + { + *total = 0; + return true; + } + /* FALLTHRU */ - /* fallthru */ case HIGH: - return 2; + *total = 2; + return true; case CONST: case LABEL_REF: case SYMBOL_REF: - return 4; + *total = 4; + return true; case CONST_DOUBLE: - if (GET_MODE (x) == DImode) - if ((XINT (x, 3) == 0 - && (unsigned) XINT (x, 2) < 0x1000) - || (XINT (x, 3) == -1 - && XINT (x, 2) < 0 - && XINT (x, 2) >= -0x1000)) - return 0; - return 8; + if (GET_MODE (x) == DImode + && ((XINT (x, 3) == 0 + && (unsigned HOST_WIDE_INT) XINT (x, 2) < 0x1000) + || (XINT (x, 3) == -1 + && XINT (x, 2) < 0 + && XINT (x, 2) >= -0x1000))) + *total = 0; + else + *total = 8; + return true; default: - abort(); - }; + return false; + } } /* If we are referencing a function make the SYMBOL_REF special. In diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index ab000da6a6e..95a97d240ca 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -2608,27 +2608,6 @@ do { \ : (sparc_cpu == PROCESSOR_ULTRASPARC3 \ ? 9 : 3)) -/* The cases that RTX_COSTS handles. */ - -#define RTX_COSTS_CASES \ -case PLUS: case MINUS: case ABS: case NEG: \ -case FLOAT: case UNSIGNED_FLOAT: \ -case FIX: case UNSIGNED_FIX: \ -case FLOAT_EXTEND: case FLOAT_TRUNCATE: \ -case SQRT: \ -case COMPARE: case IF_THEN_ELSE: \ -case MEM: \ -case MULT: case DIV: case UDIV: case MOD: case UMOD: \ -case CONST_INT: case HIGH: case CONST: \ -case LABEL_REF: case SYMBOL_REF: case CONST_DOUBLE: - -/* Provide the costs of a rtl expression. This is in the body of a - switch on CODE. */ - -#define RTX_COSTS(X,CODE,OUTER_CODE) \ - RTX_COSTS_CASES \ - return sparc_rtx_costs(X,CODE,OUTER_CODE); - #define ADDRESS_COST(RTX) 1 #define PREFETCH_BLOCK \ |