Commit dea09b1b by Ulrich Weigand Committed by Ulrich Weigand

s390.c (s390_address_cost): New function.

	* config/s390/s390.c (s390_address_cost): New function.
	config/s390/s390-protos.h (s390_address_cost): Add prototype.
	config/s390/s390.h (ADDRESS_COST): Call s390_address_cost.
	(RTX_COST): Use COSTS_N_INSNS.

From-SVN: r57282
parent e4850f36
2002-09-18 Ulrich Weigand <uweigand@de.ibm.com>
* config/s390/s390.c (s390_address_cost): New function.
config/s390/s390-protos.h (s390_address_cost): Add prototype.
config/s390/s390.h (ADDRESS_COST): Call s390_address_cost.
(RTX_COST): Use COSTS_N_INSNS.
2002-09-18 Douglas Rupp <rupp@gnat.com> 2002-09-18 Douglas Rupp <rupp@gnat.com>
Donn Terry <donnte@microsoft.com> Donn Terry <donnte@microsoft.com>
......
...@@ -29,6 +29,7 @@ extern void s390_emit_epilogue PARAMS ((void)); ...@@ -29,6 +29,7 @@ extern void s390_emit_epilogue PARAMS ((void));
extern void s390_function_profiler PARAMS ((FILE *, int)); extern void s390_function_profiler PARAMS ((FILE *, int));
#ifdef RTX_CODE #ifdef RTX_CODE
extern int s390_address_cost PARAMS ((rtx));
extern int q_constraint PARAMS ((rtx)); extern int q_constraint PARAMS ((rtx));
extern int const0_operand PARAMS ((rtx, enum machine_mode)); extern int const0_operand PARAMS ((rtx, enum machine_mode));
extern int consttable_operand PARAMS ((rtx, enum machine_mode)); extern int consttable_operand PARAMS ((rtx, enum machine_mode));
......
...@@ -1050,6 +1050,19 @@ q_constraint (op) ...@@ -1050,6 +1050,19 @@ q_constraint (op)
return 1; return 1;
} }
/* Return the cost of an address rtx ADDR. */
int
s390_address_cost (addr)
rtx addr;
{
struct s390_address ad;
if (!s390_decompose_address (addr, &ad))
return 1000;
return ad.indx? COSTS_N_INSNS (1) + 1 : COSTS_N_INSNS (1);
}
/* Return true if OP is a valid operand for the BRAS instruction. /* Return true if OP is a valid operand for the BRAS instruction.
OP is the current operation. OP is the current operation.
MODE is the current operation mode. */ MODE is the current operation mode. */
......
...@@ -1145,17 +1145,17 @@ CUMULATIVE_ARGS; ...@@ -1145,17 +1145,17 @@ CUMULATIVE_ARGS;
case MINUS: \ case MINUS: \
case NEG: \ case NEG: \
case NOT: \ case NOT: \
return 1; \ return COSTS_N_INSNS (1); \
case MULT: \ case MULT: \
if (GET_MODE (XEXP (X, 0)) == DImode) \ if (GET_MODE (XEXP (X, 0)) == DImode) \
return 40; \ return COSTS_N_INSNS (40); \
else \ else \
return 7; \ return COSTS_N_INSNS (7); \
case DIV: \ case DIV: \
case UDIV: \ case UDIV: \
case MOD: \ case MOD: \
case UMOD: \ case UMOD: \
return 33; return COSTS_N_INSNS (33);
/* An expression giving the cost of an addressing mode that contains /* An expression giving the cost of an addressing mode that contains
...@@ -1197,13 +1197,9 @@ CUMULATIVE_ARGS; ...@@ -1197,13 +1197,9 @@ CUMULATIVE_ARGS;
of registers on machines with lots of registers. of registers on machines with lots of registers.
This macro will normally either not be defined or be defined as a This macro will normally either not be defined or be defined as a
constant. constant. */
On s390 symbols are expensive if compiled with fpic #define ADDRESS_COST(RTX) s390_address_cost ((RTX))
lifetimes. */
#define ADDRESS_COST(RTX) \
((flag_pic && GET_CODE (RTX) == SYMBOL_REF) ? 2 : 1)
/* On s390, copy between fprs and gprs is expensive. */ /* On s390, copy between fprs and gprs is expensive. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment