aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/ns32k
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2003-01-28 10:08:56 -0800
committerRichard Henderson <rth@gcc.gnu.org>2003-01-28 10:08:56 -0800
commitdcefdf6717c42e30b0058fe26780188ff5978821 (patch)
tree2f6fbc07999c9923c492e499429bdd22d90f295a /gcc/config/ns32k
parentf2ce60b88d09c376e9862b78e5d37045b2e92351 (diff)
downloadgcc-dcefdf6717c42e30b0058fe26780188ff5978821.zip
gcc-dcefdf6717c42e30b0058fe26780188ff5978821.tar.gz
gcc-dcefdf6717c42e30b0058fe26780188ff5978821.tar.bz2
target.h (targetm.address_cost): New.
* target.h (targetm.address_cost): New. * target-def.h (TARGET_ADDRESS_COST): New. (TARGET_RTX_COSTS): Uncomment. Oops. * cse.c (address_cost): Use new target hook. (default_address_cost): New. * output.h (default_address_cost): Declare. * hooks.c (hook_int_rtx_0): New. * hooks.h (hook_int_rtx_0): Declare. * loop.c (combine_givs_p): Remove if 0 code. * system.h (ADDRESS_COST): Poison. * config/alpha/alpha.c, config/alpha/alpha.h, config/d30v/d30v.c, config/d30v/d30v.h, config/ia64/ia64.c, config/ia64/ia64.h, config/m32r/m32r.c, config/m32r/m32r.h, config/mcore/mcore.c, config/mcore/mcore.h, config/mmix/mmix.c, config/mmix/mmix.h, config/rs6000/rs6000.c, config/rs6000/rs6000.h, config/sparc/sparc.c, config/sparc/sparc.h, config/v850/v850.c, config/v850/v850.h, config/xtensa/xtensa.c, config/xtensa/xtensa.h (TARGET_ADDRESS_COST): Define as hook_int_rtx_0. (ADDRESS_COST): Remove. * config/arc/arc-protos.h, config/arc/arc.c, config/arc/arc.h, config/avr/avr-protos.h, config/avr/avr.c, config/avr/avr.h, config/c4x/c4x-protos.h, config/c4x/c4x.c, config/c4x/c4x.h, config/dsp16xx/dsp16xx-protos.h, config/dsp16xx/dsp16xx.c, config/dsp16xx/dsp16xx.h, config/i386/i386-protos.h, config/i386/i386.c, config/i386/i386.h, config/i960/i960-protos.h, config/i960/i960.c, config/i960/i960.h, config/ip2k/ip2k-protos.h, config/ip2k/ip2k.c, config/ip2k/ip2k.h, config/mips/mips-protos.h, config/mips/mips.c, config/mips/mips.h, config/m68hc11/m68hc11-protos.h, config/m68hc11/m68hc11.c, config/m68hc11/m68hc11.h, config/ns32k/ns32k-protos.h, config/ns32k/ns32k.c, config/ns32k/ns32k.h, config/pa/pa-protos.h, config/pa/pa.c, config/pa/pa.h, config/s390/s390-protos.h, config/s390/s390.c, config/s390/s390.h, config/vax/vax-protos.h, config/vax/vax.c, config/vax/vax.h (foo_address_cost): Make static. (TARGET_ADDRESS_COST): New. (ADDRESS_COST): Remove. * config/arm/arm.h, config/arm/arm.c, config/m88k/m88k.h, config/m88k/m88k.c, config/romp/romp.h, config/romp/romp.c, config/sh/sh.c, config/sh/sh.h, config/stormy16/stormy16.c, config/stormy16/stormy16.h (ADDRESS_COST): Move code ... (foo_address_cost): ... here. (TARGET_ADDRESS_COST): New. * config/m32r/m32r.c (m32r_address_cost): Remove. * config/m32r/m32r-protos.h: Update. * config/mmix/mmix.c (mmix_address_cost): Remove. * config/mmix/mmix-protos.h: Update. * config/mn10300/mn10300.c (mn10300_address_cost_1): Rename from mn10300_address_cost; move unsig allocation ... (mn10300_address_cost): ... here. (TARGET_ADDRESS_COST): New. * config/mn10300/mn10300-protos.h: Update. * config/mn10300/mn10300.h (ADDRESS_COST): Remove. From-SVN: r61988
Diffstat (limited to 'gcc/config/ns32k')
-rw-r--r--gcc/config/ns32k/ns32k-protos.h1
-rw-r--r--gcc/config/ns32k/ns32k.c32
-rw-r--r--gcc/config/ns32k/ns32k.h5
3 files changed, 19 insertions, 19 deletions
diff --git a/gcc/config/ns32k/ns32k-protos.h b/gcc/config/ns32k/ns32k-protos.h
index 64b484b..6f2c650 100644
--- a/gcc/config/ns32k/ns32k-protos.h
+++ b/gcc/config/ns32k/ns32k-protos.h
@@ -22,7 +22,6 @@ Boston, MA 02111-1307, USA. */
/* Prototypes for functions in ns32k.c */
#ifdef RTX_CODE
-extern int calc_address_cost PARAMS ((rtx));
extern enum reg_class secondary_reload_class PARAMS ((enum reg_class,
enum machine_mode, rtx));
extern int reg_or_mem_operand PARAMS ((rtx, enum machine_mode));
diff --git a/gcc/config/ns32k/ns32k.c b/gcc/config/ns32k/ns32k.c
index 58650c4..73b16df 100644
--- a/gcc/config/ns32k/ns32k.c
+++ b/gcc/config/ns32k/ns32k.c
@@ -73,6 +73,7 @@ static void ns32k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
static void ns32k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
static void ns32k_encode_section_info PARAMS ((tree, int));
static bool ns32k_rtx_costs PARAMS ((rtx, int, int, int *));
+static int ns32k_address_cost PARAMS ((rtx));
/* Initialize the GCC target structure. */
#undef TARGET_ATTRIBUTE_TABLE
@@ -95,6 +96,8 @@ static bool ns32k_rtx_costs PARAMS ((rtx, int, int, int *));
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS ns32k_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST ns32k_address_cost
struct gcc_target targetm = TARGET_INITIALIZER;
@@ -559,28 +562,26 @@ int secondary_memory_needed (CLASS1, CLASS2, M)
#endif
-/* ADDRESS_COST calls this. This function is not optimal
+/* TARGET_ADDRESS_COST calls this. This function is not optimal
for the 32032 & 32332, but it probably is better than
the default. */
-int
-calc_address_cost (operand)
+static int
+ns32k_address_cost (operand)
rtx operand;
{
- int i;
int cost = 0;
- if (GET_CODE (operand) == MEM)
- cost += 3;
- if (GET_CODE (operand) == MULT)
- cost += 2;
+
switch (GET_CODE (operand))
{
case REG:
cost += 1;
break;
+
case POST_DEC:
case PRE_DEC:
break;
+
case CONST_INT:
if (INTVAL (operand) <= 7 && INTVAL (operand) >= -8)
break;
@@ -597,18 +598,23 @@ calc_address_cost (operand)
case CONST_DOUBLE:
cost += 5;
break;
+
case MEM:
- cost += calc_address_cost (XEXP (operand, 0));
+ cost += ns32k_address_cost (XEXP (operand, 0)) + 3;
break;
+
case MULT:
+ cost += 2;
+ /* FALLTHRU */
case PLUS:
- for (i = 0; i < GET_RTX_LENGTH (GET_CODE (operand)); i++)
- {
- cost += calc_address_cost (XEXP (operand, i));
- }
+ cost += ns32k_address_cost (XEXP (operand, 0));
+ cost += ns32k_address_cost (XEXP (operand, 1));
+ break;
+
default:
break;
}
+
return cost;
}
diff --git a/gcc/config/ns32k/ns32k.h b/gcc/config/ns32k/ns32k.h
index 36c23f2..9f2c026 100644
--- a/gcc/config/ns32k/ns32k.h
+++ b/gcc/config/ns32k/ns32k.h
@@ -1161,11 +1161,6 @@ __transfer_from_trampoline () \
is a byte address (for indexing purposes)
so give the MEM rtx a byte's mode. */
#define FUNCTION_MODE QImode
-
-/* Compute the cost of address ADDRESS. */
-
-#define ADDRESS_COST(RTX) calc_address_cost (RTX)
-
/* Tell final.c how to eliminate redundant test instructions. */