s390.c (s390_address_cost): New function.
authorUlrich Weigand <uweigand@de.ibm.com>
Wed, 18 Sep 2002 18:57:18 +0000 (18:57 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Wed, 18 Sep 2002 18:57:18 +0000 (18:57 +0000)
* 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

gcc/ChangeLog
gcc/config/s390/s390-protos.h
gcc/config/s390/s390.c
gcc/config/s390/s390.h

index 365c689a447c05665517079bcf2c995d4c931e03..37ae8149c1ec60fd17cf8c1a9eaf37caf237b3b1 100644 (file)
@@ -1,3 +1,10 @@
+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>
            Donn Terry  <donnte@microsoft.com>
 
index c66207ad0727b46e5507842ab3b9621631334705..f5a190fd9e927ce763cadb171f05b56c4be952b8 100644 (file)
@@ -29,6 +29,7 @@ extern void s390_emit_epilogue PARAMS ((void));
 extern void s390_function_profiler PARAMS ((FILE *, int));
 
 #ifdef RTX_CODE
+extern int s390_address_cost PARAMS ((rtx));
 extern int q_constraint PARAMS ((rtx));
 extern int const0_operand PARAMS ((rtx, enum machine_mode));
 extern int consttable_operand PARAMS ((rtx, enum machine_mode));
index 877014d5e6c6159064502a8cb1e6dbcf0a1dcb01..ecc1679cd4dabd22b9a43f7f63d532817ee21b77 100644 (file)
@@ -1050,6 +1050,19 @@ q_constraint (op)
   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.
    OP is the current operation.
    MODE is the current operation mode.  */
index 40b94f0b1a22b339f2351b440e876ff00d451971..58ad2e71829e92e9fe8900e19c4a6d40917c4687 100644 (file)
@@ -1145,17 +1145,17 @@ CUMULATIVE_ARGS;
   case MINUS:                                                           \
   case NEG:                                                             \
   case NOT:                                                             \
-          return 1;                                                     \
+    return COSTS_N_INSNS (1);                                           \
   case MULT:                                                            \
     if (GET_MODE (XEXP (X, 0)) == DImode)                               \
-      return 40;                                                        \
-        else                                                            \
-      return 7;                                                         \
+      return COSTS_N_INSNS (40);                                        \
+    else                                                                \
+      return COSTS_N_INSNS (7);                                         \
   case DIV:                                                             \
   case UDIV:                                                            \
   case MOD:                                                             \
   case UMOD:                                                            \
-          return 33;
+    return COSTS_N_INSNS (33);
 
 
 /* An expression giving the cost of an addressing mode that contains
@@ -1197,13 +1197,9 @@ CUMULATIVE_ARGS;
    of registers on machines with lots of registers.
 
    This macro will normally either not be defined or be defined as a
-   constant.
+   constant.  */
 
-   On s390 symbols are expensive if compiled with fpic
-   lifetimes.  */
-
-#define ADDRESS_COST(RTX) \
-  ((flag_pic && GET_CODE (RTX) == SYMBOL_REF) ? 2 : 1)
+#define ADDRESS_COST(RTX) s390_address_cost ((RTX))
 
 /* On s390, copy between fprs and gprs is expensive.  */