OSDN Git Service

* config/mips/mips.c (mips_rtx_cost_optimize_size): New table of
authordavidu <davidu@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Nov 2006 14:28:08 +0000 (14:28 +0000)
committerdavidu <davidu@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 Nov 2006 14:28:08 +0000 (14:28 +0000)
costs when optimizing for size.
(override_options): Use mips_rtx_cost_optimize_size table for cost
calculations.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118550 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/mips/mips.c

index adee11f..ae1706c 100644 (file)
@@ -1,8 +1,15 @@
+2006-11-07  David Ung  <davidu@mips.com>
+
+       * config/mips/mips.c (mips_rtx_cost_optimize_size): New table of
+       costs when optimizing for size.
+       (override_options): Use mips_rtx_cost_optimize_size table for cost
+       calculations.
+
 2006-11-07  Jie Zhang  <jie.zhang@analog.com>
 
        * gcc.c (process_command): Treat -b as normal switch if its argument
        has no dash.
 2006-11-07  Jie Zhang  <jie.zhang@analog.com>
 
        * gcc.c (process_command): Treat -b as normal switch if its argument
        has no dash.
-
+       
 2006-11-07  David Ung  <davidu@mips.com>
        
        * config/mips/mips.h (ISA_HAS_PREFETCHX): Add ISA_MIPS32R2 to the
 2006-11-07  David Ung  <davidu@mips.com>
        
        * config/mips/mips.h (ISA_HAS_PREFETCHX): Add ISA_MIPS32R2 to the
index 6706b83..52e2aab 100644 (file)
@@ -796,6 +796,21 @@ const struct mips_cpu_info mips_cpu_info_table[] = {
                       COSTS_N_INSNS (256), /* fp_div_sf */    \
                       COSTS_N_INSNS (256)  /* fp_div_df */
 
                       COSTS_N_INSNS (256), /* fp_div_sf */    \
                       COSTS_N_INSNS (256)  /* fp_div_df */
 
+static struct mips_rtx_cost_data const mips_rtx_cost_optimize_size =
+  {
+      COSTS_N_INSNS (1),            /* fp_add */
+      COSTS_N_INSNS (1),            /* fp_mult_sf */
+      COSTS_N_INSNS (1),            /* fp_mult_df */
+      COSTS_N_INSNS (1),            /* fp_div_sf */
+      COSTS_N_INSNS (1),            /* fp_div_df */
+      COSTS_N_INSNS (1),            /* int_mult_si */
+      COSTS_N_INSNS (1),            /* int_mult_di */
+      COSTS_N_INSNS (1),            /* int_div_si */
+      COSTS_N_INSNS (1),            /* int_div_di */
+                       2,           /* branch_cost */
+                       4            /* memory_latency */
+  };
+
 static struct mips_rtx_cost_data const mips_rtx_cost_data[PROCESSOR_MAX] =
   {
     { /* R3000 */
 static struct mips_rtx_cost_data const mips_rtx_cost_data[PROCESSOR_MAX] =
   {
     { /* R3000 */
@@ -4756,7 +4771,10 @@ override_options (void)
     mips_set_tune (mips_arch_info);
 
   /* Set cost structure for the processor.  */
     mips_set_tune (mips_arch_info);
 
   /* Set cost structure for the processor.  */
-  mips_cost = &mips_rtx_cost_data[mips_tune];
+  if (optimize_size)
+    mips_cost = &mips_rtx_cost_optimize_size;
+  else
+    mips_cost = &mips_rtx_cost_data[mips_tune];
 
   if ((target_flags_explicit & MASK_64BIT) != 0)
     {
 
   if ((target_flags_explicit & MASK_64BIT) != 0)
     {