target.h (targetm.address_cost): New.
authorRichard Henderson <rth@redhat.com>
Tue, 28 Jan 2003 18:08:56 +0000 (10:08 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Tue, 28 Jan 2003 18:08:56 +0000 (10:08 -0800)
* 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

83 files changed:
gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/alpha/alpha.h
gcc/config/arc/arc-protos.h
gcc/config/arc/arc.c
gcc/config/arc/arc.h
gcc/config/arm/arm.c
gcc/config/arm/arm.h
gcc/config/avr/avr-protos.h
gcc/config/avr/avr.c
gcc/config/avr/avr.h
gcc/config/c4x/c4x-protos.h
gcc/config/c4x/c4x.c
gcc/config/c4x/c4x.h
gcc/config/d30v/d30v.c
gcc/config/d30v/d30v.h
gcc/config/dsp16xx/dsp16xx-protos.h
gcc/config/dsp16xx/dsp16xx.c
gcc/config/dsp16xx/dsp16xx.h
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/config/i960/i960-protos.h
gcc/config/i960/i960.c
gcc/config/i960/i960.h
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.h
gcc/config/ip2k/ip2k-protos.h
gcc/config/ip2k/ip2k.c
gcc/config/ip2k/ip2k.h
gcc/config/m32r/m32r-protos.h
gcc/config/m32r/m32r.c
gcc/config/m32r/m32r.h
gcc/config/m68hc11/m68hc11-protos.h
gcc/config/m68hc11/m68hc11.c
gcc/config/m68hc11/m68hc11.h
gcc/config/m88k/m88k.c
gcc/config/m88k/m88k.h
gcc/config/mcore/mcore.c
gcc/config/mcore/mcore.h
gcc/config/mips/mips-protos.h
gcc/config/mips/mips.c
gcc/config/mips/mips.h
gcc/config/mmix/mmix-protos.h
gcc/config/mmix/mmix.c
gcc/config/mmix/mmix.h
gcc/config/mn10300/mn10300-protos.h
gcc/config/mn10300/mn10300.c
gcc/config/mn10300/mn10300.h
gcc/config/ns32k/ns32k-protos.h
gcc/config/ns32k/ns32k.c
gcc/config/ns32k/ns32k.h
gcc/config/pa/pa-protos.h
gcc/config/pa/pa.c
gcc/config/pa/pa.h
gcc/config/romp/romp.c
gcc/config/romp/romp.h
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.h
gcc/config/s390/s390-protos.h
gcc/config/s390/s390.c
gcc/config/s390/s390.h
gcc/config/sh/sh.c
gcc/config/sh/sh.h
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.h
gcc/config/stormy16/stormy16.c
gcc/config/stormy16/stormy16.h
gcc/config/v850/v850.c
gcc/config/v850/v850.h
gcc/config/vax/vax-protos.h
gcc/config/vax/vax.c
gcc/config/vax/vax.h
gcc/config/xtensa/xtensa.c
gcc/config/xtensa/xtensa.h
gcc/cse.c
gcc/hooks.c
gcc/hooks.h
gcc/loop.c
gcc/output.h
gcc/system.h
gcc/target-def.h
gcc/target.h

index d2673bba0186cfcea011c221cb6a8f2da89cb174..808a3af10972c961d6533d76658b01a7f242c6b6 100644 (file)
@@ -1,3 +1,66 @@
+2003-01-28  Richard Henderson  <rth@redhat.com>
+
+       * 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.
+
 2003-01-28  Vladimir Makarov  <vmakarov@redhat.com>
 
        * haifa-sched.c (schedule_insn): Return necessary cycle advance
index d10396e6c0a4b2bae88b669f0705302b87cbcb56..4e4de75b6adeaaf7f12fe59b16d6ade938c43234 100644 (file)
@@ -371,6 +371,8 @@ static void unicosmk_unique_section PARAMS ((tree, int));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS alpha_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hook_int_rtx_0
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
index ae28dd2729d6e621b57970881e9c764fe6e942d7..0522ba6c080878e1958821d9668b131cde7ddd55 100644 (file)
@@ -1416,11 +1416,6 @@ do {                                                                          \
 #define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)  \
 { if (GET_CODE (ADDR) == AND) goto LABEL; }
 
-/* Compute the cost of an address.  For the Alpha, all valid addresses are
-   the same cost.  */
-
-#define ADDRESS_COST(X)  0
-
 /* Machine-dependent reorg pass.  */
 #define MACHINE_DEPENDENT_REORG(X)     alpha_reorg(X)
 \f
index cbb8ac2240b6f1450b57d60430a32f70bec23be2..717845eca0d7edb42c0b7eb5f8735c14ea43679f 100644 (file)
@@ -34,7 +34,6 @@ extern const char *output_shift PARAMS ((rtx *));
 
 extern int symbolic_operand PARAMS ((rtx, enum machine_mode));
 extern int arc_double_limm_p PARAMS ((rtx));
-extern int arc_address_cost PARAMS ((rtx));
 extern int arc_eligible_for_epilogue_delay PARAMS ((rtx, int));
 extern void arc_initialize_trampoline PARAMS ((rtx, rtx, rtx));
 extern void arc_print_operand PARAMS ((FILE *, rtx, int));
index 2048bd3e06efa97dc8c05de870d44be79e33f998..bd2afc015f11c57e275c3cf2f5dec9d19f6a5d89 100644 (file)
@@ -97,6 +97,7 @@ static void arc_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static void arc_encode_section_info PARAMS ((tree, int));
 static void arc_internal_label PARAMS ((FILE *, const char *, unsigned long));
 static bool arc_rtx_costs PARAMS ((rtx, int, int, int *));
+static int arc_address_cost PARAMS ((rtx));
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -119,6 +120,8 @@ static bool arc_rtx_costs PARAMS ((rtx, int, int, int *));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS arc_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST arc_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -842,18 +845,75 @@ arc_setup_incoming_varargs (cum, mode, type, pretend_size, no_rtl)
 \f
 /* Cost functions.  */
 
+/* Compute a (partial) cost for rtx X.  Return true if the complete
+   cost has been computed, and false if subexpressions should be
+   scanned.  In either case, *TOTAL contains the cost result.  */
+
+static bool
+arc_rtx_costs (x, code, outer_code, total)
+     rtx x;
+     int code;
+     int outer_code ATTRIBUTE_UNUSED;
+     int *total;
+{
+  switch (code)
+    {
+      /* Small integers are as cheap as registers.  4 byte values can
+        be fetched as immediate constants - let's give that the cost
+        of an extra insn.  */
+    case CONST_INT:
+      if (SMALL_INT (INTVAL (x)))
+       {
+         *total = 0;
+         return true;
+       }
+      /* FALLTHRU */
+
+    case CONST:
+    case LABEL_REF:
+    case SYMBOL_REF:
+      *total = COSTS_N_INSNS (1);
+      return true;
+
+    case CONST_DOUBLE:
+      {
+        rtx high, low;
+        split_double (x, &high, &low);
+       *total = COSTS_N_INSNS (!SMALL_INT (INTVAL (high))
+                               + !SMALL_INT (INTVAL (low)));
+       return true;
+      }
+
+    /* Encourage synth_mult to find a synthetic multiply when reasonable.
+       If we need more than 12 insns to do a multiply, then go out-of-line,
+       since the call overhead will be < 10% of the cost of the multiply.  */
+    case ASHIFT:
+    case ASHIFTRT:
+    case LSHIFTRT:
+      if (TARGET_SHIFTER)
+        *total = COSTS_N_INSNS (1);
+      else if (GET_CODE (XEXP (x, 1)) != CONST_INT)
+        *total = COSTS_N_INSNS (16);
+      else
+        *total = COSTS_N_INSNS (INTVAL (XEXP ((x), 1)));
+      return false;
+
+    default:
+      return false;
+    }
+}
+
+
 /* Provide the costs of an addressing mode that contains ADDR.
    If ADDR is not a valid address, its cost is irrelevant.  */
 
-int
+static int
 arc_address_cost (addr)
      rtx addr;
 {
   switch (GET_CODE (addr))
     {
     case REG :
-      /* This is handled in the macro that calls us.
-        It's here for documentation.  */
       return 1;
 
     case LABEL_REF :
@@ -2380,61 +2440,3 @@ arc_internal_label (stream, prefix, labelno)
   arc_ccfsm_at_label (prefix, labelno);
   default_internal_label (stream, prefix, labelno);
 }
-\f
-/* Compute a (partial) cost for rtx X.  Return true if the complete
-   cost has been computed, and false if subexpressions should be
-   scanned.  In either case, *TOTAL contains the cost result.  */
-
-static bool
-arc_rtx_costs (x, code, outer_code, total)
-     rtx x;
-     int code;
-     int outer_code ATTRIBUTE_UNUSED;
-     int *total;
-{
-  switch (code)
-    {
-      /* Small integers are as cheap as registers.  4 byte values can
-        be fetched as immediate constants - let's give that the cost
-        of an extra insn.  */
-    case CONST_INT:
-      if (SMALL_INT (INTVAL (x)))
-       {
-         *total = 0;
-         return true;
-       }
-      /* FALLTHRU */
-
-    case CONST:
-    case LABEL_REF:
-    case SYMBOL_REF:
-      *total = COSTS_N_INSNS (1);
-      return true;
-
-    case CONST_DOUBLE:
-      {
-        rtx high, low;
-        split_double (x, &high, &low);
-       *total = COSTS_N_INSNS (!SMALL_INT (INTVAL (high))
-                               + !SMALL_INT (INTVAL (low)));
-       return true;
-      }
-
-    /* Encourage synth_mult to find a synthetic multiply when reasonable.
-       If we need more than 12 insns to do a multiply, then go out-of-line,
-       since the call overhead will be < 10% of the cost of the multiply.  */
-    case ASHIFT:
-    case ASHIFTRT:
-    case LSHIFTRT:
-      if (TARGET_SHIFTER)
-        *total = COSTS_N_INSNS (1);
-      else if (GET_CODE (XEXP (x, 1)) != CONST_INT)
-        *total = COSTS_N_INSNS (16);
-      else
-        *total = COSTS_N_INSNS (INTVAL (XEXP ((x), 1)));
-      return false;
-
-    default:
-      return false;
-    }
-}
index 4d7b6338cb0fa4d14d3545f3c094d9ee201c90aa..583398c643bfcbedba07f2f0067f253004727d96 100644 (file)
@@ -995,9 +995,6 @@ arc_select_cc_mode (OP, X, Y)
 \f
 /* Costs.  */
 
-/* Compute the cost of an address.  */
-#define ADDRESS_COST(ADDR) (REG_P (ADDR) ? 1 : arc_address_cost (ADDR))
-
 /* Compute extra cost of moving data between one register class
    and another.  */
 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) 2
index 5bbe6acc90948e565f6b78322a8884717abde1ae..427f68e7bf613eb49a8523d18dec99acc911bc50 100644 (file)
@@ -143,6 +143,7 @@ static void arm_output_mi_thunk                     PARAMS ((FILE *, tree,
 static int arm_rtx_costs_1                     PARAMS ((rtx, enum rtx_code,
                                                         enum rtx_code));
 static bool arm_rtx_costs                      PARAMS ((rtx, int, int, int*));
+static int arm_address_cost                    PARAMS ((rtx));
 
 #undef Hint
 #undef Mmode
@@ -218,6 +219,8 @@ static bool arm_rtx_costs                   PARAMS ((rtx, int, int, int*));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS arm_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST arm_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -3310,6 +3313,40 @@ arm_rtx_costs (x, code, outer_code, total)
   return true;
 }
 
+/* All address computations that can be done are free, but rtx cost returns
+   the same for practically all of them.  So we weight the different types
+   of address here in the order (most pref first):
+   PRE/POST_INC/DEC, SHIFT or NON-INT sum, INT sum, REG, MEM or LABEL. */
+
+static int
+arm_address_cost (X)
+    rtx X;
+{
+#define ARM_ADDRESS_COST(X)                                                 \
+  (10 - ((GET_CODE (X) == MEM || GET_CODE (X) == LABEL_REF                  \
+         || GET_CODE (X) == SYMBOL_REF)                                     \
+        ? 0                                                                 \
+        : ((GET_CODE (X) == PRE_INC || GET_CODE (X) == PRE_DEC              \
+            || GET_CODE (X) == POST_INC || GET_CODE (X) == POST_DEC)        \
+           ? 10                                                             \
+           : (((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS)              \
+               ? 6 + (GET_CODE (XEXP (X, 1)) == CONST_INT ? 2               \
+                      : ((GET_RTX_CLASS (GET_CODE (XEXP (X, 0))) == '2'     \
+                          || GET_RTX_CLASS (GET_CODE (XEXP (X, 0))) == 'c'  \
+                          || GET_RTX_CLASS (GET_CODE (XEXP (X, 1))) == '2'  \
+                          || GET_RTX_CLASS (GET_CODE (XEXP (X, 1))) == 'c') \
+                         ? 1 : 0))                                          \
+               : 4)))))
+        
+#define THUMB_ADDRESS_COST(X)                                  \
+  ((GET_CODE (X) == REG                                        \
+    || (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG  \
+       && GET_CODE (XEXP (X, 1)) == CONST_INT))                \
+   ? 1 : 2)
+     
+  return (TARGET_ARM ? ARM_ADDRESS_COST (X) : THUMB_ADDRESS_COST (X));
+}
+
 static int
 arm_adjust_cost (insn, link, dep, cost)
      rtx insn;
index c2afa4dc21122cf020aa7cbd58714db3473dfdd5..fb82ebcf68ba7cfc4e312b54f651cc9f3fad7f33 100644 (file)
@@ -2144,35 +2144,6 @@ typedef struct
    ((GET_MODE_SIZE (M) < 4 ? 8 : 2 * GET_MODE_SIZE (M))        \
     * (CLASS == LO_REGS ? 1 : 2)))
  
-/* All address computations that can be done are free, but rtx cost returns
-   the same for practically all of them.  So we weight the different types
-   of address here in the order (most pref first):
-   PRE/POST_INC/DEC, SHIFT or NON-INT sum, INT sum, REG, MEM or LABEL. */
-#define ARM_ADDRESS_COST(X)                                                 \
-  (10 - ((GET_CODE (X) == MEM || GET_CODE (X) == LABEL_REF                  \
-         || GET_CODE (X) == SYMBOL_REF)                                     \
-        ? 0                                                                 \
-        : ((GET_CODE (X) == PRE_INC || GET_CODE (X) == PRE_DEC              \
-            || GET_CODE (X) == POST_INC || GET_CODE (X) == POST_DEC)        \
-           ? 10                                                             \
-           : (((GET_CODE (X) == PLUS || GET_CODE (X) == MINUS)              \
-               ? 6 + (GET_CODE (XEXP (X, 1)) == CONST_INT ? 2               \
-                      : ((GET_RTX_CLASS (GET_CODE (XEXP (X, 0))) == '2'     \
-                          || GET_RTX_CLASS (GET_CODE (XEXP (X, 0))) == 'c'  \
-                          || GET_RTX_CLASS (GET_CODE (XEXP (X, 1))) == '2'  \
-                          || GET_RTX_CLASS (GET_CODE (XEXP (X, 1))) == 'c') \
-                         ? 1 : 0))                                          \
-               : 4)))))
-        
-#define THUMB_ADDRESS_COST(X)                                  \
-  ((GET_CODE (X) == REG                                        \
-    || (GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 0)) == REG  \
-       && GET_CODE (XEXP (X, 1)) == CONST_INT))                \
-   ? 1 : 2)
-     
-#define ADDRESS_COST(X) \
-     (TARGET_ARM ? ARM_ADDRESS_COST (X) : THUMB_ADDRESS_COST (X))
-   
 /* Try to generate sequences that don't involve branches, we can then use
    conditional instructions */
 #define BRANCH_COST \
index b721b3e5a54f9373cbaab4fd80ae76dfb1c567b6..35ac23295143af9db16c3c79a6a0a100ee24e410 100644 (file)
@@ -104,7 +104,6 @@ extern const char *avr_out_sbxx_branch PARAMS ((rtx insn, rtx operands[]));
 
 extern enum reg_class preferred_reload_class PARAMS ((rtx x,
                                                     enum reg_class class));
-extern int    avr_address_cost       PARAMS ((rtx x));
 extern int    extra_constraint       PARAMS ((rtx x, int c));
 extern rtx    legitimize_address     PARAMS ((rtx x, rtx oldx,
                                             enum machine_mode mode));
index 037801243ba7d1bb8f9d43bcb919d852697dde62..017308bfb8d54934802ad083229de1ead31261a4 100644 (file)
@@ -73,6 +73,7 @@ static void   avr_asm_out_ctor PARAMS ((rtx, int));
 static void   avr_asm_out_dtor PARAMS ((rtx, int));
 static int default_rtx_costs PARAMS ((rtx, enum rtx_code, enum rtx_code));
 static bool avr_rtx_costs PARAMS ((rtx, int, int, int *));
+static int avr_address_cost PARAMS ((rtx));
 
 /* Allocate registers from r25 to r8 for parameters for function calls */
 #define FIRST_CUM_REG 26
@@ -231,6 +232,8 @@ int avr_case_values_threshold = 30000;
 #define TARGET_SECTION_TYPE_FLAGS avr_section_type_flags
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS avr_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST avr_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -5093,7 +5096,7 @@ avr_rtx_costs (x, code, outer_code, total)
 
 /* Calculate the cost of a memory address */
 
-int
+static int
 avr_address_cost (x)
      rtx x;
 {
index 126a6fdb7b8ee6e6b188b387148820175ebcfcd5..6b3d6774ab902bef67719d767ca96753f9664f3e 100644 (file)
@@ -1521,49 +1521,6 @@ do {                                                                         \
    is a suitable definition for this macro on machines where anything
    `CONSTANT_P' is valid.  */
 
-#define ADDRESS_COST(ADDRESS) avr_address_cost (ADDRESS)
-
-/* An expression giving the cost of an addressing mode that contains
-   ADDRESS.  If not defined, the cost is computed from the ADDRESS
-   expression and the `CONST_COSTS' values.
-
-   For most CISC machines, the default cost is a good approximation
-   of the true cost of the addressing mode.  However, on RISC
-   machines, all instructions normally have the same length and
-   execution time.  Hence all addresses will have equal costs.
-
-   In cases where more than one form of an address is known, the form
-   with the lowest cost will be used.  If multiple forms have the
-   same, lowest, cost, the one that is the most complex will be used.
-
-   For example, suppose an address that is equal to the sum of a
-   register and a constant is used twice in the same basic block.
-   When this macro is not defined, the address will be computed in a
-   register and memory references will be indirect through that
-   register.  On machines where the cost of the addressing mode
-   containing the sum is no higher than that of a simple indirect
-   reference, this will produce an additional instruction and
-   possibly require an additional register.  Proper specification of
-   this macro eliminates this overhead for such machines.
-
-   Similar use of this macro is made in strength reduction of loops.
-
-   ADDRESS need not be valid as an address.  In such a case, the cost
-   is not relevant and can be any value; invalid addresses need not be
-   assigned a different cost.
-
-   On machines where an address involving more than one register is as
-   cheap as an address computation involving only one register,
-   defining `ADDRESS_COST' to reflect this can cause two registers to
-   be live over a region of code where only one would have been if
-   `ADDRESS_COST' were not defined in that manner.  This effect should
-   be considered in the definition of this macro.  Equivalent costs
-   should probably only be given to addresses with different numbers
-   of registers on machines with lots of registers.
-
-   This macro will normally either not be defined or be defined as a
-   constant.  */
-
 #define REGISTER_MOVE_COST(MODE, FROM, TO) ((FROM) == STACK_REG ? 6 \
                                            : (TO) == STACK_REG ? 12 \
                                            : 2)
index ce3bde88e21cda5a8c4f3479039ce75077a7efe1..104d0e5c22d67e23d6fc1e39b655bda9a815a72c 100644 (file)
@@ -81,8 +81,6 @@ extern int c4x_hard_regno_rename_ok PARAMS ((unsigned int, unsigned int));
 extern struct rtx_def *c4x_legitimize_address PARAMS ((rtx,
                                                       enum machine_mode));
 
-extern int c4x_address_cost PARAMS ((rtx));
-
 extern void c4x_print_operand PARAMS ((FILE *, rtx, int));
 
 extern void c4x_print_operand_address PARAMS ((FILE *, rtx));
index 2d83a8c9b663804c3b1b3666ed395540d02146de..77d3e8250ec4293d76c46822485859399a9589ce 100644 (file)
@@ -198,6 +198,7 @@ static int c4x_adjust_cost PARAMS ((rtx, rtx, rtx, int));
 static void c4x_encode_section_info PARAMS ((tree, int));
 static void c4x_globalize_label PARAMS ((FILE *, const char *));
 static bool c4x_rtx_costs PARAMS ((rtx, int, int, int *));
+static int c4x_address_cost PARAMS ((rtx));
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_BYTE_OP
@@ -230,6 +231,8 @@ static bool c4x_rtx_costs PARAMS ((rtx, int, int, int *));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS c4x_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST c4x_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -1699,7 +1702,7 @@ c4x_legitimize_address (orig, mode)
    if it is worthwhile storing a common address into a register. 
    Unfortunately, the C4x address cost depends on other operands.  */
 
-int 
+static int 
 c4x_address_cost (addr)
      rtx addr;
 {
index 891ed4bf200d890ca8424410668384622998002e..68c7db54fbcf8a3568d2b5701f1f04571ec168c8 100644 (file)
@@ -1461,13 +1461,6 @@ CUMULATIVE_ARGS;
 
 /* Descripting Relative Cost of Operations.  */
 
-/* Compute the cost of an address.  This is meant to approximate the size
-   and/or execution delay of an insn using that address.  The value of this
-   macro only matters for valid addresses.  We handle the most common address
-   without a call to c4x_address_cost.  */
-
-#define ADDRESS_COST(ADDR) (REG_P (ADDR) ? 1 : c4x_address_cost (ADDR))
-
 #define        CANONICALIZE_COMPARISON(CODE, OP0, OP1)         \
 if (REG_P (OP1) && ! REG_P (OP0))                      \
 {                                                      \
index b3b72cd21cd4cc5233ac2dbf548f8fa7c3a8fedc..1e79baa5309906ea4d10373a98dc73c8eab5315e 100644 (file)
@@ -102,6 +102,8 @@ enum reg_class reg_class_from_letter[256];
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS d30v_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hook_int_rtx_0
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
index db0e120de28d5a508ab33a3c0c8c52da56920c88..ba9311302292757f7e4151ad664d56182ff959d7 100644 (file)
@@ -2426,45 +2426,6 @@ do {                                                                     \
 \f
 /* Describing Relative Costs of Operations */
 
-/* An expression giving the cost of an addressing mode that contains ADDRESS.
-   If not defined, the cost is computed from the ADDRESS expression and the
-   `CONST_COSTS' values.
-
-   For most CISC machines, the default cost is a good approximation of the true
-   cost of the addressing mode.  However, on RISC machines, all instructions
-   normally have the same length and execution time.  Hence all addresses will
-   have equal costs.
-
-   In cases where more than one form of an address is known, the form with the
-   lowest cost will be used.  If multiple forms have the same, lowest, cost,
-   the one that is the most complex will be used.
-
-   For example, suppose an address that is equal to the sum of a register and a
-   constant is used twice in the same basic block.  When this macro is not
-   defined, the address will be computed in a register and memory references
-   will be indirect through that register.  On machines where the cost of the
-   addressing mode containing the sum is no higher than that of a simple
-   indirect reference, this will produce an additional instruction and possibly
-   require an additional register.  Proper specification of this macro
-   eliminates this overhead for such machines.
-
-   Similar use of this macro is made in strength reduction of loops.
-
-   ADDRESS need not be valid as an address.  In such a case, the cost is not
-   relevant and can be any value; invalid addresses need not be assigned a
-   different cost.
-
-   On machines where an address involving more than one register is as cheap as
-   an address computation involving only one register, defining `ADDRESS_COST'
-   to reflect this can cause two registers to be live over a region of code
-   where only one would have been if `ADDRESS_COST' were not defined in that
-   manner.  This effect should be considered in the definition of this macro.
-   Equivalent costs should probably only be given to addresses with different
-   numbers of registers on machines with lots of registers.
-
-   This macro will normally either not be defined or be defined as a constant.  */
-#define ADDRESS_COST(ADDRESS) 0
-
 /* A C expression for the cost of moving data from a register in class FROM to
    one in class TO.  The classes are expressed using the enumeration values
    such as `GENERAL_REGS'.  A value of 4 is the default; other values are
index c2a2584682d7e7809091bfffc3737e1a31ceff25..633b9b6925a8d7cf6d578184d9ca9a3267ea8c2b 100644 (file)
@@ -47,7 +47,6 @@ extern void print_operand PARAMS ((FILE *, rtx, int));
 extern void print_operand_address PARAMS ((FILE *, rtx));
 extern void output_dsp16xx_float_const PARAMS ((rtx *));
 extern void emit_1600_core_shift PARAMS ((enum rtx_code, rtx *, int));
-extern int dsp16xx_address_cost PARAMS ((rtx));
 extern int symbolic_address_p PARAMS ((rtx));
 extern int uns_comparison_operator PARAMS ((rtx, enum machine_mode));
 #endif /* RTX_CODE */
index 6d402bf6e3fdba2e6efe422f40fd234ce2759d5d..bf3f5861d22c02ce201bfa7ebe5b0dcb9d6baceb 100644 (file)
@@ -152,6 +152,7 @@ static int reg_save_size PARAMS ((void));
 static void dsp16xx_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void dsp16xx_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static bool dsp16xx_rtx_costs PARAMS ((rtx, int, int, int *));
+static int dsp16xx_address_cost PARAMS ((rtx));
 \f
 /* Initialize the GCC target structure.  */
 
@@ -169,6 +170,8 @@ static bool dsp16xx_rtx_costs PARAMS ((rtx, int, int, int *));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS dsp16xx_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST dsp16xx_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -2230,7 +2233,7 @@ asm_output_local(file, name, size, rounded)
        fprintf (file, "int\n");
 }
 
-int
+static int
 dsp16xx_address_cost (addr)
      rtx addr;
 {
index d80213a7a68a5ba7c239e2915d459ac8d7c5e62e..6657fb82004f661ddbb2ce6ccd6f4432d8ab79fb 100644 (file)
@@ -1431,10 +1431,6 @@ extern struct dsp16xx_frame_info current_frame_info;
 \f
 /* DESCRIBING RELATIVE COSTS OF OPERATIONS */
 
-/* An expression giving the cost of an addressing mode that contains
-   address.  */
-#define ADDRESS_COST(ADDR)  dsp16xx_address_cost (ADDR)
-
 /* A c expression for the cost of moving data from a register in
    class FROM to one in class TO. The classes are expressed using
    the enumeration values such as GENERAL_REGS. A value of 2 is
index 0f4137712b65c9fbfc2fa2abec803e38d2382474..c5349a01d28f7007c55572fe9d9fad6ebd4091f2 100644 (file)
@@ -149,7 +149,6 @@ extern void ix86_split_long_move PARAMS ((rtx[]));
 extern void ix86_split_ashldi PARAMS ((rtx *, rtx));
 extern void ix86_split_ashrdi PARAMS ((rtx *, rtx));
 extern void ix86_split_lshrdi PARAMS ((rtx *, rtx));
-extern int ix86_address_cost PARAMS ((rtx));
 extern rtx ix86_find_base_term PARAMS ((rtx));
 
 extern rtx assign_386_stack_local PARAMS ((enum machine_mode, int));
index bb8091dfcb4b2ddeaa3bfb196491ba0c8ad3b01c..9abff89a052afddbf5eb13218d896cdcd1485b05 100644 (file)
@@ -840,6 +840,7 @@ struct ix86_address
 };
 
 static int ix86_decompose_address PARAMS ((rtx, struct ix86_address *));
+static int ix86_address_cost PARAMS ((rtx));
 static bool ix86_cannot_force_const_mem PARAMS ((rtx));
 
 static void ix86_encode_section_info PARAMS ((tree, int)) ATTRIBUTE_UNUSED;
@@ -999,6 +1000,8 @@ static enum x86_64_reg_class merge_classes PARAMS ((enum x86_64_reg_class,
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS ix86_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST ix86_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -5275,7 +5278,7 @@ ix86_decompose_address (addr, out)
    the address into a reg and make a new pseudo.  But not if the address
    requires to two regs - that would mean more pseudos with longer
    lifetimes.  */
-int
+static int
 ix86_address_cost (x)
      rtx x;
 {
index 6543ab018a49e76a880b922603739b42984e673b..1e38d10d36e32c83fa1b09bd8bd494ff2721cf5e 100644 (file)
@@ -2585,55 +2585,6 @@ do {                                                     \
    so give the MEM rtx a byte's mode.  */
 #define FUNCTION_MODE QImode
 \f
-/* An expression giving the cost of an addressing mode that contains
-   ADDRESS.  If not defined, the cost is computed from the ADDRESS
-   expression and the `CONST_COSTS' values.
-
-   For most CISC machines, the default cost is a good approximation
-   of the true cost of the addressing mode.  However, on RISC
-   machines, all instructions normally have the same length and
-   execution time.  Hence all addresses will have equal costs.
-
-   In cases where more than one form of an address is known, the form
-   with the lowest cost will be used.  If multiple forms have the
-   same, lowest, cost, the one that is the most complex will be used.
-
-   For example, suppose an address that is equal to the sum of a
-   register and a constant is used twice in the same basic block.
-   When this macro is not defined, the address will be computed in a
-   register and memory references will be indirect through that
-   register.  On machines where the cost of the addressing mode
-   containing the sum is no higher than that of a simple indirect
-   reference, this will produce an additional instruction and
-   possibly require an additional register.  Proper specification of
-   this macro eliminates this overhead for such machines.
-
-   Similar use of this macro is made in strength reduction of loops.
-
-   ADDRESS need not be valid as an address.  In such a case, the cost
-   is not relevant and can be any value; invalid addresses need not be
-   assigned a different cost.
-
-   On machines where an address involving more than one register is as
-   cheap as an address computation involving only one register,
-   defining `ADDRESS_COST' to reflect this can cause two registers to
-   be live over a region of code where only one would have been if
-   `ADDRESS_COST' were not defined in that manner.  This effect should
-   be considered in the definition of this macro.  Equivalent costs
-   should probably only be given to addresses with different numbers
-   of registers on machines with lots of registers.
-
-   This macro will normally either not be defined or be defined as a
-   constant.
-
-   For i386, it is better to use a complex address than let gcc copy
-   the address into a reg and make a new pseudo.  But not if the address
-   requires to two regs - that would mean more pseudos with longer
-   lifetimes.  */
-
-#define ADDRESS_COST(RTX) \
-  ix86_address_cost (RTX)
-
 /* A C expression for the cost of moving data from a register in class FROM to
    one in class TO.  The classes are expressed using the enumeration values
    such as `GENERAL_REGS'.  A value of 2 is the default; other values are
index aa4d2ec6c157008c84f80e68e7fd91c6e6c3fcd5..983afb2c5a322e3d620e288946791c242de68b41 100644 (file)
@@ -60,7 +60,6 @@ extern int arith32_operand PARAMS ((rtx, enum machine_mode));
 extern int power2_operand PARAMS ((rtx, enum machine_mode));
 extern int cmplpower2_operand PARAMS ((rtx, enum machine_mode));
 extern enum machine_mode select_cc_mode PARAMS ((RTX_CODE, rtx));
-extern int i960_address_cost PARAMS ((rtx));
 extern int emit_move_sequence PARAMS ((rtx *, enum machine_mode));
 extern int i960_bypass PARAMS ((rtx, rtx, rtx, int));
 extern void i960_print_operand_addr PARAMS ((FILE *, rtx));
index 35b72e258118d84f6626eccdc559bec0a06a1ca2..7436104c3ffd26b7290f25e7dc38dd2b82f88f0e 100644 (file)
@@ -51,6 +51,7 @@ static void i960_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
 static void i960_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT,
                                          HOST_WIDE_INT, tree));
 static bool i960_rtx_costs PARAMS ((rtx, int, int, int *));
+static int i960_address_cost PARAMS ((rtx));
 
 /* Save the operands last given to a compare for use when we
    generate a scc or bcc insn.  */
@@ -110,6 +111,8 @@ static int ret_label = 0;
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS i960_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST i960_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -503,15 +506,13 @@ gen_compare_reg (code, x, y)
 
 /* ??? Try using just RTX_COST, i.e. not defining ADDRESS_COST.  */
 
-int
+static int
 i960_address_cost (x)
      rtx x;
 {
-#if 0
-  /* Handled before calling here.  */
   if (GET_CODE (x) == REG)
     return 1;
-#endif
+
   /* This is a MEMA operand -- it's free.  */
   if (GET_CODE (x) == CONST_INT
       && INTVAL (x) >= 0
index 534f5254dbdc665a52a6b561c8a6f626f2845b59..f93f0159f10a2219042eadc50e4e65a34f915e0c 100644 (file)
@@ -1153,12 +1153,6 @@ extern struct rtx_def *i960_compare_op0, *i960_compare_op1;
 #ifndef WIND_RIVER
 #define        TARGET_MEM_FUNCTIONS    1
 #endif
-
-/* The i960 offers addressing modes which are "as cheap as a register".
-   See i960.c (or gcc.texinfo) for details.  */
-
-#define ADDRESS_COST(RTX) \
-  (GET_CODE (RTX) == REG ? 1 : i960_address_cost (RTX))
 \f
 /* Control the assembler format that we output.  */
 
index 9a671a9edeeed8a09dd1de57e93df873b51210bc..f9fc8cadd5afa6d10c70a1abbf522a2209fe5014 100644 (file)
@@ -317,6 +317,8 @@ static const struct attribute_spec ia64_attribute_table[] =
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS ia64_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hook_int_rtx_0
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
index 425d451b8ab66331669100d28cf12cf623fc2d08..3e1f295d73e26c52399e1bd7125e28051fbb8905 100644 (file)
@@ -1673,12 +1673,6 @@ do {                                                                     \
 \f
 /* Describing Relative Costs of Operations */
 
-/* An expression giving the cost of an addressing mode that contains ADDRESS.
-   If not defined, the cost is computed from the ADDRESS expression and the
-   `CONST_COSTS' values.  */
-
-#define ADDRESS_COST(ADDRESS) 0
-
 /* A C expression for the cost of moving data from a register in class FROM to
    one in class TO, using MODE.  */
 
index 48c2c4a750e473831ea89d15625643937c5a8a3f..55f8ba66ab902ae9f61291597c70c08a24b64a47 100644 (file)
@@ -39,7 +39,6 @@ extern int ip2k_return_pops_args PARAMS ((tree, tree, int));
 #ifdef RTX_CODE
 extern int legitimate_address_p PARAMS ((enum machine_mode, rtx, int));
 extern void machine_dependent_reorg PARAMS ((rtx));
-extern int ip2k_address_cost PARAMS ((rtx));
 extern int ip2k_extra_constraint PARAMS ((rtx, int));
 extern rtx legitimize_address PARAMS ((rtx, rtx, enum machine_mode, rtx));
 extern int adjust_insn_length PARAMS ((rtx insn, int len));
index cb1a0952c5f7ede4300c32b25cb907cb0907de01..43d08ae9f9a93798404e0896d1a241eba963bbf7 100644 (file)
@@ -79,6 +79,7 @@ static tree ip2k_handle_progmem_attribute PARAMS ((tree *, tree, tree, int,
 static tree ip2k_handle_fndecl_attribute PARAMS ((tree *, tree, tree, int,
                                                  bool *));
 static bool ip2k_rtx_costs PARAMS ((rtx, int, int, int *));
+static int ip2k_address_cost PARAMS ((rtx));
 
 const struct attribute_spec ip2k_attribute_table[];
 
@@ -104,6 +105,8 @@ const struct attribute_spec ip2k_attribute_table[];
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS ip2k_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST ip2k_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -3418,7 +3421,7 @@ ip2k_rtx_costs (x, code, outer_code, total)
 
 /* Calculate the cost of a memory address.  */
 
-int
+static int
 ip2k_address_cost (x)
      rtx x;
 {
index c656e4a4becc58368d6f18b3aeeddc10901981a3..34f901c2769739f6384727109d449a2ebfd8e0e0 100644 (file)
@@ -1765,49 +1765,6 @@ do {                                                                     \
    is a suitable definition for this macro on machines where anything
    `CONSTANT_P' is valid.  */
 
-#define ADDRESS_COST(ADDRESS) ip2k_address_cost (ADDRESS)
-
-/* An expression giving the cost of an addressing mode that contains
-   ADDRESS.  If not defined, the cost is computed from the ADDRESS
-   expression and the `CONST_COSTS' values.
-
-   For most CISC machines, the default cost is a good approximation
-   of the true cost of the addressing mode.  However, on RISC
-   machines, all instructions normally have the same length and
-   execution time.  Hence all addresses will have equal costs.
-
-   In cases where more than one form of an address is known, the form
-   with the lowest cost will be used.  If multiple forms have the
-   same, lowest, cost, the one that is the most complex will be used.
-
-   For example, suppose an address that is equal to the sum of a
-   register and a constant is used twice in the same basic block.
-   When this macro is not defined, the address will be computed in a
-   register and memory references will be indirect through that
-   register.  On machines where the cost of the addressing mode
-   containing the sum is no higher than that of a simple indirect
-   reference, this will produce an additional instruction and
-   possibly require an additional register.  Proper specification of
-   this macro eliminates this overhead for such machines.
-
-   Similar use of this macro is made in strength reduction of loops.
-
-   ADDRESS need not be valid as an address.  In such a case, the cost
-   is not relevant and can be any value; invalid addresses need not be
-   assigned a different cost.
-
-   On machines where an address involving more than one register is as
-   cheap as an address computation involving only one register,
-   defining `ADDRESS_COST' to reflect this can cause two registers to
-   be live over a region of code where only one would have been if
-   `ADDRESS_COST' were not defined in that manner.  This effect should
-   be considered in the definition of this macro.  Equivalent costs
-   should probably only be given to addresses with different numbers
-   of registers on machines with lots of registers.
-
-   This macro will normally either not be defined or be defined as a
-   constant.  */
-
 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) 7
 /* A C expression for the cost of moving data from a register in class
    FROM to one in class TO.  The classes are expressed using the
index 1a73aa014b4bfbb2314cd5523efc8ea1c70bb0dc..3816dd5e8438be2251852786624a03548be3458e 100644 (file)
@@ -54,7 +54,6 @@ extern void   m32r_output_block_move          PARAMS ((rtx, rtx *));
 extern void   m32r_expand_block_move           PARAMS ((rtx *));
 extern void   m32r_print_operand               PARAMS ((FILE *, rtx, int));
 extern void   m32r_print_operand_address       PARAMS ((FILE *, rtx));
-extern int    m32r_address_cost                PARAMS ((rtx));
 extern int    m32r_not_same_reg                PARAMS ((rtx, rtx));
 
 #ifdef HAVE_MACHINE_MODES
index 6d4f2a30e1f21550f1486ecac49f02b7294af4f7..ff027949e5b5194d6953873172b92f00f9a4bd4f 100644 (file)
@@ -116,6 +116,8 @@ static bool m32r_rtx_costs PARAMS ((rtx, int, int, int *));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS m32r_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hook_int_rtx_0
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -1804,19 +1806,6 @@ m32r_rtx_costs (x, code, outer_code, total)
       return false;
     }
 }
-
-/* Provide the costs of an addressing mode that contains ADDR.
-   If ADDR is not a valid address, its cost is irrelevant.
-
-   This function is trivial at the moment.  This code doesn't live
-   in m32r.h so it's easy to experiment.  */
-
-int
-m32r_address_cost (addr)
-     rtx addr ATTRIBUTE_UNUSED;
-{
-  return 1;
-}
 \f
 /* Type of function DECL.
 
index 22bf095f72cd1ce8370c22db707f706360739a91..74431b6ca53805f0de04d7e39376e6ab786aad53 100644 (file)
@@ -1420,9 +1420,6 @@ do {                                                                      \
 \f
 /* Costs.  */
 
-/* Compute the cost of an address.  */
-#define ADDRESS_COST(ADDR) m32r_address_cost (ADDR)
-
 /* Compute extra cost of moving data between one register class
    and another.  */
 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) 2
index 2d78bed2f00095fc8236fa2e3ab8c0123f20f025..ec43ca0ac1563c86155f9cfad2a3db02a1509110 100644 (file)
@@ -89,8 +89,6 @@ extern int m68hc11_memory_move_cost PARAMS((enum machine_mode, enum reg_class,
                                            int));
 extern int m68hc11_register_move_cost PARAMS((enum machine_mode,
                                              enum reg_class, enum reg_class));
-extern int m68hc11_address_cost PARAMS((rtx));
-
 
 extern void m68hc11_emit_libcall PARAMS((const char*, enum rtx_code,
                                          enum machine_mode, enum machine_mode,
index 0a50c4cc2e641b55b9d5903c196552cec95b6f77..6dafb1988185420399ff4d383b9bde7f961432b0 100644 (file)
@@ -67,6 +67,7 @@ static int go_if_legitimate_address_internal PARAMS((rtx, enum machine_mode,
 static int register_indirect_p PARAMS((rtx, enum machine_mode, int));
 static rtx m68hc11_expand_compare PARAMS((enum rtx_code, rtx, rtx));
 static int must_parenthesize PARAMS ((rtx));
+static int m68hc11_address_cost PARAMS ((rtx));
 static int m68hc11_shift_cost PARAMS ((enum machine_mode, rtx, int));
 static int m68hc11_rtx_costs_1 PARAMS ((rtx, enum rtx_code, enum rtx_code));
 static bool m68hc11_rtx_costs PARAMS ((rtx, int, int, int *));
@@ -233,6 +234,8 @@ static int nb_soft_regs;
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS m68hc11_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST m68hc11_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -5226,7 +5229,7 @@ m68hc11_register_move_cost (mode, from, to)
 /* Provide the costs of an addressing mode that contains ADDR.
    If ADDR is not a valid address, its cost is irrelevant.  */
 
-int
+static int
 m68hc11_address_cost (addr)
      rtx addr;
 {
index 8f3740cb27dac5c118c5abc9b6ce9014e3046cfc..c51f19242549805acec32bc7ca4b977e663faf09 100644 (file)
@@ -1391,11 +1391,6 @@ extern unsigned char m68hc11_reg_valid_for_index[FIRST_PSEUDO_REGISTER];
 #define NOTICE_UPDATE_CC(EXP, INSN) \
        m68hc11_notice_update_cc ((EXP), (INSN))
 
-/* An expression giving the cost of an addressing mode that contains
-   ADDRESS.  */
-
-#define ADDRESS_COST(RTX) m68hc11_address_cost (RTX)
-
 /* Move costs between classes of registers */
 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2)       \
     (m68hc11_register_move_cost (MODE, CLASS1, CLASS2))
index 5a8f26864e8b7f5841b8f0d0c05a4ca520d2f577..441b6f44ab63dc0103382943e1c89a0f380d5ec7 100644 (file)
@@ -80,6 +80,7 @@ static void m88k_encode_section_info PARAMS ((tree, int));
 static void m88k_internal_label PARAMS ((FILE *, const char *, unsigned long));
 #endif
 static bool m88k_rtx_costs PARAMS ((rtx, int, int, int *));
+static int m88k_address_cost PARAMS ((rtx));
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_BYTE_OP
@@ -114,6 +115,8 @@ static bool m88k_rtx_costs PARAMS ((rtx, int, int, int *));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS m88k_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST m88k_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -3429,3 +3432,26 @@ m88k_rtx_costs (x, code, outer_code, total)
       return false;
     }
 }
+
+/* Provide the costs of an addressing mode that contains ADDR.
+   If ADDR is not a valid address, its cost is irrelevant.
+   REG+REG is made slightly more expensive because it might keep
+   a register live for longer than we might like.  */
+static int
+m88k_address_cost (x)
+     rtx x;
+{
+  switch (GET_CODE (x))
+    {
+    case REG:
+    case LO_SUM:
+    case MULT:
+      return 1;
+    case HIGH:
+      return 2;
+    case PLUS:
+      return (REG_P (XEXP (x, 0)) && REG_P (XEXP (x, 1))) ? 2 : 1;
+    default:
+      return 4;
+    }
+}
index 4001927e655926d4b41aeab54877f4821223b8ca..7cf036bbd9a6951316a53f04531c47763b73fd32 100644 (file)
@@ -1504,18 +1504,6 @@ enum reg_class { NO_REGS, AP_REG, XRF_REGS, GENERAL_REGS, AGRF_REGS,
    state with CC_STATUS_INIT for now.  */
 #define CC_STATUS_INIT m88k_volatile_code = '\0'
 
-/* Provide the costs of an addressing mode that contains ADDR.
-   If ADDR is not a valid address, its cost is irrelevant.
-   REG+REG is made slightly more expensive because it might keep
-   a register live for longer than we might like.  */
-#define ADDRESS_COST(ADDR)                             \
-  (GET_CODE (ADDR) == REG ? 1 :                                \
-   GET_CODE (ADDR) == LO_SUM ? 1 :                     \
-   GET_CODE (ADDR) == HIGH ? 2 :                       \
-   GET_CODE (ADDR) == MULT ? 1 :                       \
-   GET_CODE (ADDR) != PLUS ? 4 :                       \
-   (REG_P (XEXP (ADDR, 0)) && REG_P (XEXP (ADDR, 1))) ? 2 : 1)
-
 /* A C expressions returning the cost of moving data of MODE from a register
    to or from memory.  This is more costly than between registers.  */
 #define MEMORY_MOVE_COST(MODE,CLASS,IN) 4
index cb24e937f3ef99812fa6e14800b5aa86219bb927..865cc30ebee7aa7b333e4741bf26318c93f01e7a 100644 (file)
@@ -170,6 +170,8 @@ static bool       mcore_rtx_costs           PARAMS ((rtx, int, int, int *));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS mcore_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hook_int_rtx_0
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
index 42d2d45f9745e81c60113d90b0f48ac18a8c7880..6d2078c966cd5aaca825169e0f9db7ed6f015432 100644 (file)
@@ -1004,10 +1004,6 @@ extern const enum reg_class reg_class_from_letter[];
 #define Pmode          SImode
 #define FUNCTION_MODE  Pmode
 
-/* provide the cost for an address calculation.
-   All addressing modes cost the same on the MCore.  */
-#define        ADDRESS_COST(RTX)       1
-
 /* 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
index 6d3d16783ee449bdb618029eff6ba2bdf8400054..902f1bef48b506e466a4a8416b1545e1e59c08ef 100644 (file)
@@ -90,7 +90,6 @@ extern void           mips_gen_conditional_trap PARAMS ((rtx *));
 extern void            mips_emit_fcc_reload PARAMS ((rtx, rtx, rtx));
 extern void            mips_set_return_address PARAMS ((rtx, rtx));
 extern void            machine_dependent_reorg PARAMS ((rtx));
-extern int             mips_address_cost PARAMS ((rtx));
 extern void            mips_count_memory_refs PARAMS ((rtx, int));
 extern HOST_WIDE_INT   mips_debugger_offset PARAMS ((rtx, HOST_WIDE_INT));
 extern int             mips_check_split PARAMS ((rtx, enum machine_mode));
index 4dcf5248ab57f4938f146dab924b6a99931f9014..a6ad4c0f7ab78867d3c3a7f002c1ffcaf1299e72 100644 (file)
@@ -156,6 +156,7 @@ static void mips_select_rtx_section PARAMS ((enum machine_mode, rtx,
 static int mips_use_dfa_pipeline_interface      PARAMS ((void));
 static void mips_encode_section_info           PARAMS ((tree, int));
 static bool mips_rtx_costs                     PARAMS ((rtx, int, int, int *));
+static int mips_address_cost                   PARAMS ((rtx));
 
 
 /* Structure to be filled in by compute_frame_size with register
@@ -674,6 +675,8 @@ const struct mips_cpu_info mips_cpu_info_table[] = {
 #define TARGET_VALID_POINTER_MODE mips_valid_pointer_mode
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS mips_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST mips_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -3324,12 +3327,15 @@ mips_rtx_costs (x, code, outer_code, total)
 /* Provide the costs of an addressing mode that contains ADDR.
    If ADDR is not a valid address, its cost is irrelevant.  */
 
-int
+static int
 mips_address_cost (addr)
      rtx addr;
 {
   switch (GET_CODE (addr))
     {
+    case REG:
+      return 1;
+
     case LO_SUM:
       return 1;
 
index 696aff2be2f852e057f22a3186c5a81e3125ddc3..24b668b70fef6865a2d8f44869e7d79ae158ce22 100644 (file)
@@ -3385,50 +3385,6 @@ typedef struct mips_args {
 #define FUNCTION_MODE (Pmode == DImode ? DImode : SImode)
 
 \f
-/* An expression giving the cost of an addressing mode that
-   contains ADDRESS.  If not defined, the cost is computed from the
-   form of the ADDRESS expression and the `CONST_COSTS' values.
-
-   For most CISC machines, the default cost is a good approximation
-   of the true cost of the addressing mode.  However, on RISC
-   machines, all instructions normally have the same length and
-   execution time.  Hence all addresses will have equal costs.
-
-   In cases where more than one form of an address is known, the
-   form with the lowest cost will be used.  If multiple forms have
-   the same, lowest, cost, the one that is the most complex will be
-   used.
-
-   For example, suppose an address that is equal to the sum of a
-   register and a constant is used twice in the same basic block.
-   When this macro is not defined, the address will be computed in
-   a register and memory references will be indirect through that
-   register.  On machines where the cost of the addressing mode
-   containing the sum is no higher than that of a simple indirect
-   reference, this will produce an additional instruction and
-   possibly require an additional register.  Proper specification
-   of this macro eliminates this overhead for such machines.
-
-   Similar use of this macro is made in strength reduction of loops.
-
-   ADDRESS need not be valid as an address.  In such a case, the
-   cost is not relevant and can be any value; invalid addresses
-   need not be assigned a different cost.
-
-   On machines where an address involving more than one register is
-   as cheap as an address computation involving only one register,
-   defining `ADDRESS_COST' to reflect this can cause two registers
-   to be live over a region of code where only one would have been
-   if `ADDRESS_COST' were not defined in that manner.  This effect
-   should be considered in the definition of this macro.
-   Equivalent costs should probably only be given to addresses with
-   different numbers of registers on machines with lots of registers.
-
-   This macro will normally either not be defined or be defined as
-   a constant.  */
-
-#define ADDRESS_COST(ADDR) (REG_P (ADDR) ? 1 : mips_address_cost (ADDR))
-
 /* A C expression for the cost of moving data from a register in
    class FROM to one in class TO.  The classes are expressed using
    the enumeration values such as `GENERAL_REGS'.  A value of 2 is
index e6c22f093f932aae5ffd6bfc3fa4d9b8c08142c2..2e0571739acd7b1495e7d8f4bed81fe4b069a0a6 100644 (file)
@@ -95,7 +95,6 @@ extern void mmix_initialize_trampoline PARAMS ((rtx, rtx, rtx));
 extern int mmix_constant_address_p PARAMS ((rtx));
 extern int mmix_legitimate_address PARAMS ((enum machine_mode, rtx, int));
 extern int mmix_legitimate_constant_p PARAMS ((rtx));
-extern int mmix_address_cost PARAMS ((rtx));
 extern void mmix_print_operand PARAMS ((FILE *, rtx, int));
 extern void mmix_print_operand_address PARAMS ((FILE *, rtx));
 extern void mmix_machine_dependent_reorg PARAMS ((rtx));
index b8cc2fbd2b9e4c604199cdb688ca81794ee3bb77..0eb36ae07d4d46ca735d9292af4c1ca14c1cf90a 100644 (file)
@@ -175,6 +175,8 @@ static bool mmix_rtx_costs
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS mmix_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hook_int_rtx_0
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -1209,18 +1211,6 @@ mmix_rtx_costs (x, code, outer_code, total)
   return false;
 }
 
-/* ADDRESS_COST.  */
-
-int
-mmix_address_cost (addr)
-     rtx addr ATTRIBUTE_UNUSED;
-{
-  /* There's no difference in the address costs and we have lots of
-     registers.  Some targets use constant 0, many others use 1 to say
-     this.  Let's start with 1.  */
-  return 1;
-}
-
 /* REGISTER_MOVE_COST.  */
 
 int
index 7549f590cdc0c28416fa309572ea8e73d7076b5d..976ceb0b639b1251b220b062390283644bfc18a8 100644 (file)
@@ -881,8 +881,6 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS;
 
 /* Node: Costs */
 
-#define ADDRESS_COST(ADDRESS) mmix_address_cost (ADDRESS)
-
 /* The special registers can only move to and from general regs, and we
    need to check that their constraints match, so say 3 for them.  */
 /* WARNING: gcc-2.7.2.2 i686-pc-linux-gnulibc1 (as shipped with RH 4.2)
index d5a1c4426c64c209178ab08cf883f410a1303974..f51f3c955465e18ab11b625a56b6f9a91203a02c 100644 (file)
@@ -40,8 +40,6 @@ extern int symbolic_operand PARAMS ((rtx, enum machine_mode));
 extern int call_address_operand PARAMS ((rtx, enum machine_mode));
 extern int impossible_plus_operand PARAMS ((rtx, enum machine_mode));
 extern int const_8bit_operand PARAMS ((rtx, enum machine_mode));
-
-extern int mn10300_address_cost PARAMS ((rtx, int *));
 #endif /* RTX_CODE */
 
 #ifdef TREE_CODE
index 7f524ae134c06cd2c07a980c85587b97b09505e5..f040a899d9e0f0353045f5ce7b35ace3817f9d5a 100644 (file)
@@ -55,6 +55,8 @@ Boston, MA 02111-1307, USA.  */
                                || regs_ever_live[16] || regs_ever_live[17]))
 
 
+static int mn10300_address_cost_1 PARAMS ((rtx, int *));
+static int mn10300_address_cost PARAMS ((rtx));
 static bool mn10300_rtx_costs PARAMS ((rtx, int, int, int *));
 
 \f
@@ -64,6 +66,8 @@ static bool mn10300_rtx_costs PARAMS ((rtx, int, int, int *));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS mn10300_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST mn10300_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -1248,15 +1252,11 @@ legitimize_address (x, oldx, mode)
   return x;
 }
 
-int
-mn10300_address_cost (x, unsig)
+static int
+mn10300_address_cost_1 (x, unsig)
      rtx x;
      int *unsig;
 {
-  int _s = 0;
-  if (unsig == 0)
-    unsig = &_s;
-  
   switch (GET_CODE (x))
     {
     case REG:
@@ -1285,17 +1285,17 @@ mn10300_address_cost (x, unsig)
     case ASHIFT:
     case AND:
     case IOR:
-      return (mn10300_address_cost (XEXP (x, 0), unsig)
-             + mn10300_address_cost (XEXP (x, 1), unsig));
+      return (mn10300_address_cost_1 (XEXP (x, 0), unsig)
+             + mn10300_address_cost_1 (XEXP (x, 1), unsig));
 
     case EXPR_LIST:
     case SUBREG:
     case MEM:
-      return ADDRESS_COST (XEXP (x, 0));
+      return mn10300_address_cost (XEXP (x, 0));
 
     case ZERO_EXTEND:
       *unsig = 1;
-      return mn10300_address_cost (XEXP (x, 0), unsig);
+      return mn10300_address_cost_1 (XEXP (x, 0), unsig);
 
     case CONST_INT:
       if (INTVAL (x) == 0)
@@ -1317,7 +1317,7 @@ mn10300_address_cost (x, unsig)
       switch (GET_CODE (XEXP (x, 0)))
        {
        case MEM:
-         return ADDRESS_COST (XEXP (x, 0));
+         return mn10300_address_cost (XEXP (x, 0));
 
        case REG:
          return 1;
@@ -1332,6 +1332,14 @@ mn10300_address_cost (x, unsig)
     }
 }
 
+static int
+mn10300_address_cost (x)
+     rtx x;
+{
+  int s = 0;
+  return mn10300_address_cost_1 (x, &s);
+}
+
 static bool
 mn10300_rtx_costs (x, code, outer_code, total)
      rtx x;
index 67dc1ebee3f8f3c2febfba6f0f8cc14f5bc7674c..7ddd9d5291bdce1c90cdbf6129aba28c3d4210ec 100644 (file)
@@ -812,8 +812,6 @@ struct cum_arg {int nbytes; };
    (CLASS1 == EXTENDED_REGS || CLASS2 == EXTENDED_REGS) ? 4 : \
    4)
 
-#define ADDRESS_COST(X) mn10300_address_cost((X), 0)
-
 /* Nonzero if access to memory by bytes or half words is no faster
    than accessing full words.  */
 #define SLOW_BYTE_ACCESS 1
index 64b484b5f5a0abffb2acdced682cc60ce78cb2f5..6f2c6508c0f804e3a1d17bb413e457331c7074a6 100644 (file)
@@ -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));
index 58650c4c924bdd9f05599b2ea59da7d20e2639d2..73b16df9058e43828ccb23c58773cd8ace3c18c9 100644 (file)
@@ -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));
 \f
 /* 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;
 \f
@@ -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;
 }
 
index 36c23f2640f92f591684b98740885aead78b5689..9f2c0260fe82d796ce280a0df81dddf8bfa4303a 100644 (file)
@@ -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)
-
 \f
 /* Tell final.c how to eliminate redundant test instructions.  */
 
index 8ea36f3a44e8617c13d3cf6c9a2c863f6bcfc576..243cc10dbf5c938b2e559dbd28ee8a70dff3a07b 100644 (file)
@@ -65,7 +65,6 @@ extern void hppa_encode_label PARAMS ((rtx));
 extern int arith11_operand PARAMS ((rtx, enum machine_mode));
 extern int adddi3_operand PARAMS ((rtx, enum machine_mode));
 extern int symbolic_expression_p PARAMS ((rtx));
-extern int hppa_address_cost PARAMS ((rtx));
 extern int symbolic_memory_operand PARAMS ((rtx, enum machine_mode));
 extern int pa_adjust_insn_length PARAMS ((rtx, int));
 extern int int11_operand PARAMS ((rtx, enum machine_mode));
index 9b2f98ef041e4e9eaee28c8834a445bbd0d89120..21afcbb8466da11083a5a0bab5fb1713153be5d0 100644 (file)
@@ -97,6 +97,7 @@ hppa_fpstore_bypass_p (out_insn, in_insn)
 #endif
 #endif
 
+static int hppa_address_cost PARAMS ((rtx));
 static bool hppa_rtx_costs PARAMS ((rtx, int, int, int *));
 static inline rtx force_mode PARAMS ((enum machine_mode, rtx));
 static void pa_combine_instructions PARAMS ((rtx));
@@ -223,6 +224,8 @@ static size_t n_deferred_plabels = 0;
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS hppa_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hppa_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -1306,17 +1309,22 @@ hppa_legitimize_address (x, oldx, mode)
 
    It is no coincidence that this has the same structure
    as GO_IF_LEGITIMATE_ADDRESS.  */
-int
+
+static int
 hppa_address_cost (X)
      rtx X;
 {
-  if (GET_CODE (X) == PLUS)
+  switch (GET_CODE (X))
+    {
+    case REG:
+    case PLUS:
+    case LO_SUM:
       return 1;
-  else if (GET_CODE (X) == LO_SUM)
-    return 1;
-  else if (GET_CODE (X) == HIGH)
-    return 2;
-  return 4;
+    case HIGH:
+      return 2;
+    default:
+      return 4;
+    }
 }
 
 /* Compute a (partial) cost for rtx X.  Return true if the complete
index 8be8d88e3a0d3f74b163bee88f0b928ab39c4d5a..595253c8926095c5cd06fa5af69fc50b62273c02 100644 (file)
@@ -1595,9 +1595,6 @@ do {                                                                      \
    few bits.  */
 #define SHIFT_COUNT_TRUNCATED 1
 
-#define ADDRESS_COST(RTX) \
-  (GET_CODE (RTX) == REG ? 1 : hppa_address_cost (RTX))
-
 /* Compute extra cost of moving data between one register class
    and another.
 
index 36e8b54b1607e56bf3f970397c137be1881a351a..0811ee81f46df1d50833c758b7cfc32d10e855f6 100644 (file)
@@ -60,6 +60,7 @@ static void romp_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                             unsigned HOST_WIDE_INT));
 static void romp_encode_section_info PARAMS ((tree, int));
 static bool romp_rtx_costs PARAMS ((rtx, int, int, int *));
+static int romp_address_cost PARAMS ((rtx));
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_FUNCTION_PROLOGUE
@@ -72,6 +73,8 @@ static bool romp_rtx_costs PARAMS ((rtx, int, int, int *));
 #define TARGET_ENCODE_SECTION_INFO romp_encode_section_info
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS romp_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST romp_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -2165,3 +2168,23 @@ romp_rtx_costs (x, code, outer_code, total)
       return false;
     }
 }
+
+/* For the ROMP, everything is cost 0 except for addresses involving
+   symbolic constants, which are cost 1.  */
+
+static int
+romp_address_cost (x)
+     rtx x;
+{
+  return 
+  ((GET_CODE (x) == SYMBOL_REF
+    && ! CONSTANT_POOL_ADDRESS_P (x))
+   || GET_CODE (x) == LABEL_REF
+   || (GET_CODE (x) == CONST
+       && ! constant_pool_address_operand (x, Pmode))
+   || (GET_CODE (x) == PLUS
+       && ((GET_CODE (XEXP (x, 1)) == SYMBOL_REF
+           && ! CONSTANT_POOL_ADDRESS_P (XEXP (x, 0)))
+          || GET_CODE (XEXP (x, 1)) == LABEL_REF
+          || GET_CODE (XEXP (x, 1)) == CONST)));
+}
index 16b543dfa80249c7d168efd46c53186c5e696f1e..f81d88ae14e006a7cb7d59647470401685bc5b65 100644 (file)
@@ -1162,29 +1162,6 @@ struct rt_cargs {int gregs, fregs; };
 
 /* #define SHIFT_COUNT_TRUNCATED */
 
-/* Compute the cost of an address.  This is meant to approximate the size
-   and/or execution delay of an insn using that address.  If the cost is
-   approximated by the RTL complexity, including CONST_COSTS above, as
-   is usually the case for CISC machines, this macro should not be defined.
-   For aggressively RISCy machines, only one insn format is allowed, so
-   this macro should be a constant.  The value of this macro only matters
-   for valid addresses.
-
-   For the ROMP, everything is cost 0 except for addresses involving
-   symbolic constants, which are cost 1.  */
-
-#define ADDRESS_COST(RTX)                              \
-  ((GET_CODE (RTX) == SYMBOL_REF                       \
-    && ! CONSTANT_POOL_ADDRESS_P (RTX))                        \
-   || GET_CODE (RTX) == LABEL_REF                      \
-   || (GET_CODE (RTX) == CONST                         \
-       && ! constant_pool_address_operand (RTX, Pmode))        \
-   || (GET_CODE (RTX) == PLUS                          \
-       && ((GET_CODE (XEXP (RTX, 1)) == SYMBOL_REF     \
-           && ! CONSTANT_POOL_ADDRESS_P (XEXP (RTX, 0))) \
-          || GET_CODE (XEXP (RTX, 1)) == LABEL_REF     \
-          || GET_CODE (XEXP (RTX, 1)) == CONST)))
-
 /* Adjust the length of an INSN.  LENGTH is the currently-computed length and
    should be adjusted to reflect any required changes.  This macro is used when
    there is some systematic length adjustment required that would be difficult
index 69fda814afbd410e1454adba6bb19f3e8e3045fc..31eb55e2ec75822389b29df75add975840a8694d 100644 (file)
@@ -407,6 +407,8 @@ static const char alt_reg_names[][8] =
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS rs6000_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hook_int_rtx_0
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
index 71288817dc5bf9e57a5695f58eb09c998a29f9ce..b3fa442c0cf01bf1aeb806d746d42cb3e9f2dd44 100644 (file)
@@ -2291,18 +2291,6 @@ do {                                                                          \
 
 #define SHIFT_COUNT_TRUNCATED (TARGET_POWER ? 1 : 0)
 
-/* Compute the cost of an address.  This is meant to approximate the size
-   and/or execution delay of an insn using that address.  If the cost is
-   approximated by the RTL complexity, including CONST_COSTS above, as
-   is usually the case for CISC machines, this macro should not be defined.
-   For aggressively RISCy machines, only one insn format is allowed, so
-   this macro should be a constant.  The value of this macro only matters
-   for valid addresses.
-
-   For the RS/6000, everything is cost 0.  */
-
-#define ADDRESS_COST(RTX) 0
-
 /* Adjust the length of an INSN.  LENGTH is the currently-computed length and
    should be adjusted to reflect any required changes.  This macro is used when
    there is some systematic length adjustment required that would be difficult
index 3e315dd369a1b9e9803b65699dd3db6144394286..a1a3ba52d933d5a7786d1293e269686fb83ecd12 100644 (file)
@@ -29,7 +29,6 @@ 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 7149ae90f751ac6e67e81bd8378661e86603f609..6dfb3d54118a51ea2ae14274ab4fff92833656df 100644 (file)
@@ -67,6 +67,7 @@ static int s390_adjust_cost PARAMS ((rtx, rtx, rtx, int));
 static int s390_issue_rate PARAMS ((void));
 static int s390_use_dfa_pipeline_interface PARAMS ((void));
 static bool s390_rtx_costs PARAMS ((rtx, int, int, int *));
+static int s390_address_cost PARAMS ((rtx));
 
 
 #undef  TARGET_ASM_ALIGNED_HI_OP
@@ -116,6 +117,8 @@ static bool s390_rtx_costs PARAMS ((rtx, int, int, int *));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS s390_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST s390_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -1270,7 +1273,7 @@ s390_rtx_costs (x, code, outer_code, total)
 
 /* Return the cost of an address rtx ADDR.  */
 
-int
+static int
 s390_address_cost (addr)
      rtx addr;
 {
index 066f2cf36706cdcf08cd2a072e3900a099b27dac..1623666cb658562b8f7d86ebf0dc1dc67c244547 100644 (file)
@@ -812,11 +812,6 @@ extern struct rtx_def *s390_compare_op0, *s390_compare_op1;
 
 /* Relative costs of operations.  */
 
-/* An expression giving the cost of an addressing mode that contains
-   ADDRESS.  If not defined, the cost is computed from the ADDRESS
-   expression and the `CONST_COSTS' values.  */
-#define ADDRESS_COST(RTX) s390_address_cost ((RTX))
-
 /* On s390, copy between fprs and gprs is expensive.  */
 #define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2)                        \
   ((   (   reg_classes_intersect_p ((CLASS1), GENERAL_REGS)            \
index 93e7978c0207264b92790eda2dac06a7b4ef098c..dadc1c951b3afbcd3a318b1319c7d460eb1a12d5 100644 (file)
@@ -219,6 +219,7 @@ static int andcosts PARAMS ((rtx));
 static int addsubcosts PARAMS ((rtx));
 static int multcosts PARAMS ((rtx));
 static bool sh_rtx_costs PARAMS ((rtx, int, int, int *));
+static int sh_address_cost PARAMS ((rtx));
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ATTRIBUTE_TABLE
@@ -272,6 +273,8 @@ static bool sh_rtx_costs PARAMS ((rtx, int, int, int *));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS sh_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST sh_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -1522,6 +1525,18 @@ sh_rtx_costs (x, code, outer_code, total)
     }
 }
 
+/* Compute the cost of an address.  For the SH, all valid addresses are
+   the same cost.  Use a slightly higher cost for reg + reg addressing,
+   since it increases pressure on r0.  */
+
+static int
+sh_address_cost (X)
+     rtx X;
+{
+  return (GET_CODE (X) == PLUS
+         && ! CONSTANT_P (XEXP (X, 1))
+         && ! TARGET_SHMEDIA ? 1 : 0);
+}
 
 /* Code to expand a shift.  */
 
index e5d0677ed60e787331680726234a57c6ffa126dd..cf8ac7fd910c7ab1ea0f06d32ccc85d929f8ee40 100644 (file)
@@ -2752,14 +2752,6 @@ while (0)
 ((GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == LABEL_REF)     \
   && nonpic_symbol_mentioned_p (X))
 \f
-/* Compute the cost of an address.  For the SH, all valid addresses are
-   the same cost.  Use a slightly higher cost for reg + reg addressing,
-   since it increases pressure on r0.  */
-
-#define ADDRESS_COST(X) (GET_CODE (X) == PLUS && ! CONSTANT_P (XEXP (X, 1)) \
-                        && ! TARGET_SHMEDIA \
-                        ? 1 : 0)
-
 /* Compute extra cost of moving data between one register class
    and another.  */
 
index a769ca9d2e7f0e9de3d62e2a81aed004da6200db..50e81f0b8d8535db7874315888336f2b414e2746 100644 (file)
@@ -255,6 +255,8 @@ enum processor_type sparc_cpu;
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS sparc_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hook_int_rtx_0
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
index 95a97d240cafe82d3958d554918db5ed82c57631..c6d8aac5982fe3cdd57a1646c632d462aba37410 100644 (file)
@@ -2608,8 +2608,6 @@ do {                                                                    \
          : (sparc_cpu == PROCESSOR_ULTRASPARC3 \
             ? 9 : 3))
 
-#define ADDRESS_COST(RTX)  1
-
 #define PREFETCH_BLOCK \
        ((sparc_cpu == PROCESSOR_ULTRASPARC \
           || sparc_cpu == PROCESSOR_ULTRASPARC3) \
index 7a034626dd9efbaf270a910f6c73ff9c9c28eff2..7a20df4993c1605f1dbac0119b2ede15fe1406e5 100644 (file)
@@ -58,6 +58,7 @@ static void xstormy16_asm_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT,
 static void xstormy16_init_builtins PARAMS ((void));
 static rtx xstormy16_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int));
 static bool xstormy16_rtx_costs PARAMS ((rtx, int, int, int *));
+static int xstormy16_address_cost PARAMS ((rtx));
 
 /* Define the information needed to generate branch and scc insns.  This is
    stored from the compare operation.  */
@@ -138,6 +139,14 @@ xstormy16_rtx_costs (x, code, outer_code, total)
     }
 }
 
+static int
+xstormy16_address_cost (x)
+     rtx x;
+{
+  return (GET_CODE (x) == CONST_INT ? 2
+         : GET_CODE (x) == PLUS ? 7
+         : 5);
+}
 
 /* Branches are handled as follows:
 
@@ -2209,5 +2218,7 @@ xstormy16_expand_builtin(exp, target, subtarget, mode, ignore)
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS xstormy16_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST xstormy16_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
index b8a90c49f47018f354e29654412246f638312dee..505236484d99e4116d83727a45d9ad343baac017 100644 (file)
@@ -2197,49 +2197,6 @@ do {                                                     \
 \f
 /* Describing Relative Costs of Operations */
 
-/* An expression giving the cost of an addressing mode that contains ADDRESS.
-   If not defined, the cost is computed from the ADDRESS expression and the
-   `CONST_COSTS' values.
-
-   For most CISC machines, the default cost is a good approximation of the true
-   cost of the addressing mode.  However, on RISC machines, all instructions
-   normally have the same length and execution time.  Hence all addresses will
-   have equal costs.
-
-   In cases where more than one form of an address is known, the form with the
-   lowest cost will be used.  If multiple forms have the same, lowest, cost,
-   the one that is the most complex will be used.
-
-   For example, suppose an address that is equal to the sum of a register and a
-   constant is used twice in the same basic block.  When this macro is not
-   defined, the address will be computed in a register and memory references
-   will be indirect through that register.  On machines where the cost of the
-   addressing mode containing the sum is no higher than that of a simple
-   indirect reference, this will produce an additional instruction and possibly
-   require an additional register.  Proper specification of this macro
-   eliminates this overhead for such machines.
-
-   Similar use of this macro is made in strength reduction of loops.
-
-   ADDRESS need not be valid as an address.  In such a case, the cost is not
-   relevant and can be any value; invalid addresses need not be assigned a
-   different cost.
-
-   On machines where an address involving more than one register is as cheap as
-   an address computation involving only one register, defining `ADDRESS_COST'
-   to reflect this can cause two registers to be live over a region of code
-   where only one would have been if `ADDRESS_COST' were not defined in that
-   manner.  This effect should be considered in the definition of this macro.
-   Equivalent costs should probably only be given to addresses with different
-   numbers of registers on machines with lots of registers.
-
-   This macro will normally either not be defined or be defined as a
-   constant.  */
-#define ADDRESS_COST(ADDRESS)                  \
-  (GET_CODE (ADDRESS) == CONST_INT ? 2         \
-   : GET_CODE (ADDRESS) == PLUS ? 7            \
-   : 5)
-
 /* A C expression for the cost of moving data of mode MODE from a
    register in class FROM to one in class TO.  The classes are
    expressed using the enumeration values such as `GENERAL_REGS'.  A
index f16114ec6c99f3aa91b6e7a529e2b45bed581fae..2295a552a00af7be90a99aa4a5a1976c976a1ba7 100644 (file)
@@ -109,6 +109,8 @@ static int v850_interrupt_p = FALSE;
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS v850_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hook_int_rtx_0
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
index 447e247ea36d15cc71e46cf10a350f60601aa1d7..8e1d28bd4c2b2f6bbc931ec1205f93b0b22cb331 100644 (file)
@@ -1025,9 +1025,6 @@ do {                                                                      \
 #define CC_NO_CARRY CC_NO_OVERFLOW
 #define NOTICE_UPDATE_CC(EXP, INSN) notice_update_cc(EXP, INSN)
 
-/* All addressing modes have the same cost on the V850 series.  */
-#define ADDRESS_COST(ADDR) 1
-
 /* Nonzero if access to memory by bytes or half words is no faster
    than accessing full words.  */
 #define SLOW_BYTE_ACCESS 1
index 0e8cfb1f484ba4e17910e76999cb0d87c16517a9..d62b2ac8c8d2d5531e53744d8a75d71772bcc9ca 100644 (file)
@@ -25,8 +25,6 @@ extern const char *rev_cond_name PARAMS ((rtx));
 extern void split_quadword_operands PARAMS ((rtx *, rtx *, int));
 extern void print_operand_address PARAMS ((FILE *, rtx));
 extern int vax_float_literal PARAMS ((rtx));
-extern int vax_address_cost PARAMS ((rtx));
-extern int vax_rtx_cost PARAMS ((rtx));
 extern int reg_was_0_p PARAMS ((rtx, rtx));
 #endif /* RTX_CODE */
 
index 9bff82b15e8fd4f265834d39a082b6ea4ec13681..1413882f4a638a0f676096a4059e685b2c0a17c4 100644 (file)
@@ -45,6 +45,8 @@ static int follows_p PARAMS ((rtx, rtx));
 static void vax_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void vax_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT,
                                         HOST_WIDE_INT, tree));
+static int vax_address_cost_1 PARAMS ((rtx));
+static int vax_address_cost PARAMS ((rtx));
 static int vax_rtx_costs_1 PARAMS ((rtx, enum rtx_code, enum rtx_code));
 static bool vax_rtx_costs PARAMS ((rtx, int, int, int *));
 \f
@@ -62,6 +64,8 @@ static bool vax_rtx_costs PARAMS ((rtx, int, int, int *));
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS vax_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST vax_address_cost
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -418,8 +422,8 @@ vax_float_literal(c)
    2 - indirect */
 
 
-int
-vax_address_cost (addr)
+static int
+vax_address_cost_1 (addr)
     register rtx addr;
 {
   int reg = 0, indexed = 0, indir = 0, offset = 0, predec = 0;
@@ -487,6 +491,13 @@ vax_address_cost (addr)
   return reg + indexed + indir + offset + predec;
 }
 
+static int
+vax_address_cost (x)
+     rtx x;
+{
+  return (1 + (GET_CODE (x) == REG ? 0 : vax_address_cost_1 (x)));
+}
+
 /* Cost of an expression on a VAX.  This version has costs tuned for the
    CVAX chip (found in the VAX 3 series) with comments for variations on
    other models.  */
@@ -649,7 +660,7 @@ vax_rtx_costs_1 (x, code, outer_code)
       x = XEXP (x, 0);
       if (GET_CODE (x) == REG || GET_CODE (x) == POST_INC)
        return c;
-      return c + vax_address_cost (x);
+      return c + vax_address_cost_1 (x);
     default:
       c = 3;
       break;
@@ -703,7 +714,7 @@ vax_rtx_costs_1 (x, code, outer_code)
        case MEM:
          c += 1;               /* 2 on VAX 2 */
          if (GET_CODE (XEXP (op, 0)) != REG)
-           c += vax_address_cost (XEXP (op, 0));
+           c += vax_address_cost_1 (XEXP (op, 0));
          break;
        case REG:
        case SUBREG:
index e2a1d95e13de1194dee675c0cfbf35b255d16f50..d52f31d854e3a9cbb1f0b950ae210cf295498a4c 100644 (file)
@@ -848,8 +848,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES };
 
 #define TARGET_FLOAT_FORMAT VAX_FLOAT_FORMAT
 
-#define        ADDRESS_COST(RTX) (1 + (GET_CODE (RTX) == REG ? 0 : vax_address_cost(RTX)))
-
 /* Specify the cost of a branch insn; roughly the number of extra insns that
    should be added to avoid a branch.
 
index 645ad1adbfd646e5c1115fb0bc06c66a7ce5041c..a05386cf4e55f55383408a8010ec142419cde68f 100644 (file)
@@ -243,6 +243,8 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] =
 
 #undef TARGET_RTX_COSTS
 #define TARGET_RTX_COSTS xtensa_rtx_costs
+#undef TARGET_ADDRESS_COST
+#define TARGET_ADDRESS_COST hook_int_rtx_0
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
index 3ae66f1240ee9e67e488d6065c18f061d249d333..b11fa5e81a77d4428247f262ee0f69e077875f7b 100644 (file)
@@ -1281,10 +1281,6 @@ typedef struct xtensa_args {
    indexing purposes) so give the MEM rtx a words's mode.  */
 #define FUNCTION_MODE SImode
 
-/* An expression giving the cost of an addressing mode that
-   contains ADDRESS.  */
-#define ADDRESS_COST(ADDR) 1
-
 /* A C expression for the cost of moving data from a register in
    class FROM to one in class TO.  The classes are expressed using
    the enumeration values such as 'GENERAL_REGS'.  A value of 2 is
index e396042111ee31beded4ca9619e3fb27e66bc63e..59253a9a28b80fbd1dae796f43af3071dc4528b0 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -896,7 +896,7 @@ address_cost (x, mode)
      rtx x;
      enum machine_mode mode;
 {
-  /* The ADDRESS_COST macro does not deal with ADDRESSOF nodes.  But,
+  /* The address_cost target hook does not deal with ADDRESSOF nodes.  But,
      during CSE, such nodes are present.  Using an ADDRESSOF node which
      refers to the address of a REG is a good thing because we can then
      turn (MEM (ADDRESSSOF (REG))) into just plain REG.  */
@@ -906,17 +906,22 @@ address_cost (x, mode)
 
   /* We may be asked for cost of various unusual addresses, such as operands
      of push instruction.  It is not worthwhile to complicate writing
-     of ADDRESS_COST macro by such cases.  */
+     of the target hook by such cases.  */
 
   if (!memory_address_p (mode, x))
     return 1000;
-#ifdef ADDRESS_COST
-  return ADDRESS_COST (x);
-#else
-  return rtx_cost (x, MEM);
-#endif
+
+  return (*targetm.address_cost) (x);
 }
 
+/* If the target doesn't override, compute the cost as with arithmetic.  */
+
+int
+default_address_cost (x)
+     rtx x;
+{
+  return rtx_cost (x, MEM);
+}
 \f
 static struct cse_reg_info *
 get_cse_reg_info (regno)
index 5911716766567910c00ae592a25495aaa2ca28e3..0954bde936bad8ef2f8d55d8db4af56abba79cfc 100644 (file)
@@ -97,6 +97,13 @@ hook_int_tree_tree_1 (a, b)
   return 1;
 }
 
+int
+hook_int_rtx_0 (a)
+     rtx a ATTRIBUTE_UNUSED;
+{
+  return 0;
+}
+
 void
 hook_void_tree (a)
      tree a ATTRIBUTE_UNUSED;
index 954f2181ead4993a461c9cfb88fb831afbb63e41..d36e3fcbc6433cf01830995dda9147048cf29d00 100644 (file)
@@ -38,6 +38,7 @@ void hook_void_tree PARAMS ((tree));
 void hook_void_tree_treeptr PARAMS ((tree, tree *));
 
 int hook_int_tree_tree_1 PARAMS ((tree, tree));
+int hook_int_rtx_0 PARAMS ((rtx));
 
 bool default_can_output_mi_thunk_no_vcall
   PARAMS ((tree, HOST_WIDE_INT, HOST_WIDE_INT, tree));
index c7165e54ed70bc205ef8d6b9e18b4be6ebb0bb87..50c1692c44968d9c39d1346a09afaa0e91c3d2a0 100644 (file)
@@ -7333,21 +7333,8 @@ combine_givs_p (g1, g2)
      the expression of G2 in terms of G1 can be used.  */
   if (ret != NULL_RTX
       && g2->giv_type == DEST_ADDR
-      && memory_address_p (GET_MODE (g2->mem), ret)
-      /* ??? Looses, especially with -fforce-addr, where *g2->location
-        will always be a register, and so anything more complicated
-        gets discarded.  */
-#if 0
-#ifdef ADDRESS_COST
-      && ADDRESS_COST (tem) <= ADDRESS_COST (*g2->location)
-#else
-      && rtx_cost (tem, MEM) <= rtx_cost (*g2->location, MEM)
-#endif
-#endif
-      )
-    {
-      return ret;
-    }
+      && memory_address_p (GET_MODE (g2->mem), ret))
+    return ret;
 
   return NULL_RTX;
 }
index 3f6c0cdbbdd8075fa6752f0bd86ddac2a001a427..18e0b230712fe7b3e765e29016ec336a8632f2d7 100644 (file)
@@ -530,3 +530,5 @@ extern bool default_valid_pointer_mode PARAMS ((enum machine_mode));
 extern void assemble_vtable_entry PARAMS ((struct rtx_def *, HOST_WIDE_INT));
 extern void assemble_vtable_inherit PARAMS ((struct rtx_def *,
                                             struct rtx_def *));
+
+extern int default_address_cost PARAMS ((rtx));
index 6858d30f04906555aaf81f4fb3e9fe1fa1550e95..81988c517586ea28ec28e5e3cf0e822ddfbb1566 100644 (file)
@@ -613,7 +613,8 @@ typedef char _Bool;
        ASM_OUTPUT_DESTRUCTOR SIGNED_CHAR_SPEC MAX_CHAR_TYPE_SIZE       \
        WCHAR_UNSIGNED UNIQUE_SECTION SELECT_SECTION SELECT_RTX_SECTION \
        ENCODE_SECTION_INFO STRIP_NAME_ENCODING ASM_GLOBALIZE_LABEL     \
-       ASM_OUTPUT_MI_THUNK CONST_COSTS RTX_COSTS DEFAULT_RTX_COSTS
+       ASM_OUTPUT_MI_THUNK CONST_COSTS RTX_COSTS DEFAULT_RTX_COSTS     \
+       ADDRESS_COST
 
 /* Other obsolete target macros, or macros that used to be in target
    headers and were not used, and may be obsolete or may never have
index a6f1357921532871dc6910dcf2fc1337b8faac3d..18929d101cb9da49da8b328b1340826fe662546f 100644 (file)
@@ -227,11 +227,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    TARGET_SCHED_INIT_DFA_BUBBLES,                              \
    TARGET_SCHED_DFA_BUBBLE}
 
-/* All in tree.c.  */
+/* In tree.c.  */
 #define TARGET_MERGE_DECL_ATTRIBUTES merge_decl_attributes
 #define TARGET_MERGE_TYPE_ATTRIBUTES merge_type_attributes
 #define TARGET_ATTRIBUTE_TABLE NULL
 
+/* In cse.c.  */
+#define TARGET_ADDRESS_COST default_address_cost
+
 /* In builtins.c.  */
 #define TARGET_INIT_BUILTINS default_init_builtins
 #define TARGET_EXPAND_BUILTIN default_expand_builtin
@@ -262,7 +265,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #define TARGET_INSERT_ATTRIBUTES hook_void_tree_treeptr
 #define TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P hook_bool_tree_false
 #define TARGET_MS_BITFIELD_LAYOUT_P hook_bool_tree_false
-/* #define TARGET_RTX_COSTS hook_bool_rtx_int_int_intp_false */
+#define TARGET_RTX_COSTS hook_bool_rtx_int_int_intp_false
 
 #ifndef TARGET_IN_SMALL_DATA_P
 #define TARGET_IN_SMALL_DATA_P hook_bool_tree_false
@@ -297,6 +300,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   TARGET_STRIP_NAME_ENCODING,                  \
   TARGET_VALID_POINTER_MODE,                    \
   TARGET_RTX_COSTS,                            \
+  TARGET_ADDRESS_COST,                         \
   TARGET_HAVE_NAMED_SECTIONS,                  \
   TARGET_HAVE_CTORS_DTORS,                     \
   TARGET_HAVE_TLS,                             \
index 933da66b5268514e6b74babcee18e7ddcb95661f..b6d7f8dd4ce4c496acbcd1eadfeb6b88ee2b1502 100644 (file)
@@ -321,6 +321,10 @@ struct gcc_target
      not necessarily defined at this point.  */
   bool (* rtx_costs) PARAMS ((rtx x, int code, int outer_code, int *total));
 
+  /* Compute the cost of X, used as an address.  Never called with
+     invalid addresses.  */
+  int (* address_cost) PARAMS ((rtx x));
+
   /* Leave the boolean fields at the end.  */
 
   /* True if arbitrary sections are supported.  */