aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mcore
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-01-27 20:46:33 -0800
committerRichard Henderson <rth@gcc.gnu.org>2003-01-27 20:46:33 -0800
commit3c50106f69e2a73f98a24f154979249e3b5ff79d (patch)
tree1eaff917ba37b6f409082db1a76c42c218320c5e /gcc/config/mcore
parent5ca9898002fc6c777cd25caa42e58ece40fe9978 (diff)
downloadgcc-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/mcore')
-rw-r--r--gcc/config/mcore/mcore-protos.h3
-rw-r--r--gcc/config/mcore/mcore.c55
-rw-r--r--gcc/config/mcore/mcore.h27
3 files changed, 52 insertions, 33 deletions
diff --git a/gcc/config/mcore/mcore-protos.h b/gcc/config/mcore/mcore-protos.h
index 9910c3a..8b99581 100644
--- a/gcc/config/mcore/mcore-protos.h
+++ b/gcc/config/mcore/mcore-protos.h
@@ -61,9 +61,6 @@ extern int mcore_expand_insv PARAMS ((rtx *));
extern int mcore_modify_comparison PARAMS ((RTX_CODE));
extern void mcore_expand_block_move PARAMS ((rtx, rtx, rtx *));
extern void mcore_dependent_reorg PARAMS ((rtx));
-extern int mcore_const_costs PARAMS ((rtx, RTX_CODE));
-extern int mcore_and_cost PARAMS ((rtx));
-extern int mcore_ior_cost PARAMS ((rtx));
extern const char * mcore_output_andn PARAMS ((rtx, rtx *));
extern void mcore_print_operand_address PARAMS ((FILE *, rtx));
extern void mcore_print_operand PARAMS ((FILE *, rtx, int));
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index dfe0282..cb24e93 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -141,6 +141,10 @@ static void mcore_asm_named_section PARAMS ((const char *,
static void mcore_unique_section PARAMS ((tree, int));
static void mcore_encode_section_info PARAMS ((tree, int));
static const char *mcore_strip_name_encoding PARAMS ((const char *));
+static int mcore_const_costs PARAMS ((rtx, RTX_CODE));
+static int mcore_and_cost PARAMS ((rtx));
+static int mcore_ior_cost PARAMS ((rtx));
+static bool mcore_rtx_costs PARAMS ((rtx, int, int, int *));
/* Initialize the GCC target structure. */
#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
@@ -164,6 +168,9 @@ static const char *mcore_strip_name_encoding PARAMS ((const char *));
#undef TARGET_STRIP_NAME_ENCODING
#define TARGET_STRIP_NAME_ENCODING mcore_strip_name_encoding
+#undef TARGET_RTX_COSTS
+#define TARGET_RTX_COSTS mcore_rtx_costs
+
struct gcc_target targetm = TARGET_INITIALIZER;
/* Adjust the stack and return the number of bytes taken to do it. */
@@ -368,7 +375,7 @@ mcore_print_operand (stream, x, code)
/* What does a constant cost ? */
-int
+static int
mcore_const_costs (exp, code)
rtx exp;
enum rtx_code code;
@@ -399,7 +406,7 @@ mcore_const_costs (exp, code)
have been relaxed. We want to ensure that cse will cse relaxed immeds
out. Otherwise we'll get bad code (multiple reloads of the same const). */
-int
+static int
mcore_and_cost (x)
rtx x;
{
@@ -426,7 +433,7 @@ mcore_and_cost (x)
/* What does an or cost - see and_cost(). */
-int
+static int
mcore_ior_cost (x)
rtx x;
{
@@ -451,6 +458,48 @@ mcore_ior_cost (x)
return 5;
}
+static bool
+mcore_rtx_costs (x, code, outer_code, total)
+ rtx x;
+ int code, outer_code;
+ int *total;
+{
+ switch (code)
+ {
+ case CONST_INT:
+ *total = mcore_const_costs (x, outer_code);
+ return true;
+ case CONST:
+ case LABEL_REF:
+ case SYMBOL_REF:
+ *total = 5;
+ return true;
+ case CONST_DOUBLE:
+ *total = 10;
+ return true;
+
+ case AND:
+ *total = COSTS_N_INSNS (mcore_and_cost (x));
+ return true;
+
+ case IOR:
+ *total = COSTS_N_INSNS (mcore_ior_cost (x));
+ return true;
+
+ case DIV:
+ case UDIV:
+ case MOD:
+ case UMOD:
+ case FLOAT:
+ case FIX:
+ *total = COSTS_N_INSNS (100);
+ return true;
+
+ default:
+ return false;
+ }
+}
+
/* Check to see if a comparison against a constant can be made more efficient
by incrementing/decrementing the constant to get one that is more efficient
to load. */
diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h
index bfa8271..42d2d45 100644
--- a/gcc/config/mcore/mcore.h
+++ b/gcc/config/mcore/mcore.h
@@ -1004,37 +1004,10 @@ extern const enum reg_class reg_class_from_letter[];
#define Pmode SImode
#define FUNCTION_MODE Pmode
-/* The relative costs of various types of constants. Note that cse.c defines
- REG = 1, SUBREG = 2, any node = (2 + sum of subnodes). */
-#define CONST_COSTS(RTX, CODE, OUTER_CODE) \
- case CONST_INT: \
- return mcore_const_costs (RTX, OUTER_CODE); \
- case CONST: \
- case LABEL_REF: \
- case SYMBOL_REF: \
- return 5; \
- case CONST_DOUBLE: \
- return 10;
-
/* provide the cost for an address calculation.
All addressing modes cost the same on the MCore. */
#define ADDRESS_COST(RTX) 1
-/* Provide the cost of an rtl expression. */
-#define RTX_COSTS(X, CODE, OUTER_CODE) \
- case AND: \
- return COSTS_N_INSNS (mcore_and_cost (X)); \
- case IOR: \
- return COSTS_N_INSNS (mcore_ior_cost (X)); \
- case DIV: \
- case UDIV: \
- case MOD: \
- case UMOD: \
- return COSTS_N_INSNS (100); \
- case FLOAT: \
- case FIX: \
- return 100;
-
/* Compute extra cost of moving data between one register class
and another. All register moves are cheap. */
#define REGISTER_MOVE_COST(MODE, SRCCLASS, DSTCLASS) 2