]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Oct 2008 18:39:03 +0000 (18:39 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Oct 2008 18:39:03 +0000 (18:39 +0000)
* config/mips/mips.h (reg_class): Remove HI_AND_GR_REGS,
LO_AND_GR_REGS, HI_AND_FP_REGS, COP0_AND_GR_REGS, COP2_AND_GR_REGS,
COP3_AND_GR_REGS, ALL_COP_REGS and ALL_COP_AND_GR_REGS.
Add GR_AND_MD0_REGS, GR_AND_MD1_REGS, GR_AND_MD_REGS and
GR_AND_ACC_REGS.
(REG_CLASS_NAMES): Update accordingly.
(REG_CLASS_CONTENTS): Likewise.  Use the class name in the comments,
rather than an unpredictable descriptive string.
* config/mips/mips.c (mips_register_move_cost): Remove comment.
(mips_register_move_cost): Check for specific COP*_REGS classes,
instead of ALL_COP_AND_GR_REGS.
(mips_ira_cover_classes): New function.
(mips_secondary_reload_class): Remove MTLO and MTHI workarounds.
(TARGET_IRA_COVER_CLASSES): Define.

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

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

index 6bbf5c252f768d9d729b9f86cdbf42b3801cd683..84625a1f2b1a37036631b7d9ecc6c98f5dab1e79 100644 (file)
@@ -1,3 +1,20 @@
+2008-10-14  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * config/mips/mips.h (reg_class): Remove HI_AND_GR_REGS,
+       LO_AND_GR_REGS, HI_AND_FP_REGS, COP0_AND_GR_REGS, COP2_AND_GR_REGS,
+       COP3_AND_GR_REGS, ALL_COP_REGS and ALL_COP_AND_GR_REGS.
+       Add GR_AND_MD0_REGS, GR_AND_MD1_REGS, GR_AND_MD_REGS and
+       GR_AND_ACC_REGS.
+       (REG_CLASS_NAMES): Update accordingly.
+       (REG_CLASS_CONTENTS): Likewise.  Use the class name in the comments,
+       rather than an unpredictable descriptive string.
+       * config/mips/mips.c (mips_register_move_cost): Remove comment.
+       (mips_register_move_cost): Check for specific COP*_REGS classes,
+       instead of ALL_COP_AND_GR_REGS.
+       (mips_ira_cover_classes): New function.
+       (mips_secondary_reload_class): Remove MTLO and MTHI workarounds.
+       (TARGET_IRA_COVER_CLASSES): Define.
+
 2008-10-14  Douglas Gregor  <doug.gregor@gmail.com>
 
        PR c++/37553
index 8508f61fe2cc3660c36ea861706a83403e196d4e..eb76ff4791eef5d9fb3054418766f559e0486923 100644 (file)
@@ -9697,10 +9697,6 @@ mips_register_move_cost (enum machine_mode mode,
 {
   if (TARGET_MIPS16)
     {
-      /* ??? We cannot move general registers into HI and LO because
-        MIPS16 has no MTHI and MTLO instructions.  Make the cost of
-        moves in the opposite direction just as high, which stops the
-        register allocators from using HI and LO for pseudos.  */
       if (reg_class_subset_p (from, GENERAL_REGS)
          && reg_class_subset_p (to, GENERAL_REGS))
        {
@@ -9717,7 +9713,9 @@ mips_register_move_cost (enum machine_mode mode,
        return 2;
       if (reg_class_subset_p (to, FP_REGS))
        return 4;
-      if (reg_class_subset_p (to, ALL_COP_AND_GR_REGS))
+      if (reg_class_subset_p (to, COP0_REGS)
+         || reg_class_subset_p (to, COP2_REGS)
+         || reg_class_subset_p (to, COP3_REGS))
        return 5;
       if (reg_class_subset_p (to, ACC_REGS))
        return 6;
@@ -9729,7 +9727,9 @@ mips_register_move_cost (enum machine_mode mode,
       if (reg_class_subset_p (from, ST_REGS))
        /* LUI followed by MOVF.  */
        return 4;
-      if (reg_class_subset_p (from, ALL_COP_AND_GR_REGS))
+      if (reg_class_subset_p (from, COP0_REGS)
+         || reg_class_subset_p (from, COP2_REGS)
+         || reg_class_subset_p (from, COP3_REGS))
        return 5;
       if (reg_class_subset_p (from, ACC_REGS))
        return 6;
@@ -9747,6 +9747,25 @@ mips_register_move_cost (enum machine_mode mode,
   return 12;
 }
 
+/* Implement TARGET_IRA_COVER_CLASSES.  */
+
+static const enum reg_class *
+mips_ira_cover_classes (void)
+{
+  static const enum reg_class acc_classes[] = {
+    GR_AND_ACC_REGS, FP_REGS, COP0_REGS, COP2_REGS, COP3_REGS,
+    ST_REGS, LIM_REG_CLASSES
+  };
+  static const enum reg_class no_acc_classes[] = {
+    GR_REGS, FP_REGS, COP0_REGS, COP2_REGS, COP3_REGS,
+    ST_REGS, LIM_REG_CLASSES
+  };
+
+  /* Don't allow the register allocators to use LO and HI in MIPS16 mode,
+     which has no MTLO or MTHI instructions.  */
+  return TARGET_MIPS16 ? no_acc_classes : acc_classes;
+}
+
 /* Return the register class required for a secondary register when
    copying between one of the registers in RCLASS and value X, which
    has mode MODE.  X is the source of the move if IN_P, otherwise it
@@ -9771,10 +9790,6 @@ mips_secondary_reload_class (enum reg_class rclass,
       if (!reg_class_subset_p (rclass, M16_REGS) && !M16_REG_P (regno))
        return M16_REGS;
 
-      /* We can't really copy to HI or LO at all in MIPS16 mode.  */
-      if (in_p ? reg_classes_intersect_p (rclass, ACC_REGS) : ACC_REG_P (regno))
-       return M16_REGS;
-
       return NO_REGS;
     }
 
@@ -14203,6 +14218,9 @@ mips_order_regs_for_local_alloc (void)
 #undef TARGET_DWARF_REGISTER_SPAN
 #define TARGET_DWARF_REGISTER_SPAN mips_dwarf_register_span
 
+#undef TARGET_IRA_COVER_CLASSES
+#define TARGET_IRA_COVER_CLASSES mips_ira_cover_classes
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 #include "gt-mips.h"
index b0f39dc9a57ce13e197a99009b6a3cb92a6048ee..acfcc00f8e2fe99838907732b2019b26d1284bab 100644 (file)
@@ -1796,18 +1796,14 @@ enum reg_class
   COP0_REGS,                   /* generic coprocessor classes */
   COP2_REGS,
   COP3_REGS,
-  HI_AND_GR_REGS,              /* union classes */
-  LO_AND_GR_REGS,
-  HI_AND_FP_REGS,
-  COP0_AND_GR_REGS,
-  COP2_AND_GR_REGS,
-  COP3_AND_GR_REGS,
-  ALL_COP_REGS,
-  ALL_COP_AND_GR_REGS,
   ST_REGS,                     /* status registers (fp status) */
   DSP_ACC_REGS,                        /* DSP accumulator registers */
   ACC_REGS,                    /* Hi/Lo and DSP accumulator registers */
   FRAME_REGS,                  /* $arg and $frame */
+  GR_AND_MD0_REGS,             /* union classes */
+  GR_AND_MD1_REGS,
+  GR_AND_MD_REGS,
+  GR_AND_ACC_REGS,
   ALL_REGS,                    /* all registers */
   LIM_REG_CLASSES              /* max value + 1 */
 };
@@ -1838,18 +1834,14 @@ enum reg_class
   "COP0_REGS",                                                         \
   "COP2_REGS",                                                         \
   "COP3_REGS",                                                         \
-  "HI_AND_GR_REGS",                                                    \
-  "LO_AND_GR_REGS",                                                    \
-  "HI_AND_FP_REGS",                                                    \
-  "COP0_AND_GR_REGS",                                                  \
-  "COP2_AND_GR_REGS",                                                  \
-  "COP3_AND_GR_REGS",                                                  \
-  "ALL_COP_REGS",                                                      \
-  "ALL_COP_AND_GR_REGS",                                               \
   "ST_REGS",                                                           \
   "DSP_ACC_REGS",                                                      \
   "ACC_REGS",                                                          \
   "FRAME_REGS",                                                                \
+  "GR_AND_MD0_REGS",                                                   \
+  "GR_AND_MD1_REGS",                                                   \
+  "GR_AND_MD_REGS",                                                    \
+  "GR_AND_ACC_REGS",                                                   \
   "ALL_REGS"                                                           \
 }
 
@@ -1866,34 +1858,30 @@ enum reg_class
 
 #define REG_CLASS_CONTENTS                                                                             \
 {                                                                                                      \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* no registers */      \
-  { 0x000300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* mips16 registers */  \
-  { 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* mips16 T register */ \
-  { 0x010300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* mips16 and T regs */ \
-  { 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* SVR4 PIC function address register */ \
-  { 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* only $v1 */ \
-  { 0xfdffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* Every other GPR except $25 */   \
-  { 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* integer registers */ \
-  { 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* floating registers*/ \
-  { 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000 },  /* hi register */       \
-  { 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000 },  /* lo register */       \
-  { 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000 },  /* mul/div registers */ \
-  { 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000, 0x00000000 },   /* cop0 registers */    \
-  { 0x00000000, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000 },   /* cop2 registers */    \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff },   /* cop3 registers */    \
-  { 0xffffffff, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000 },  /* union classes */     \
-  { 0xffffffff, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000 },                          \
-  { 0x00000000, 0xffffffff, 0x00000001, 0x00000000, 0x00000000, 0x00000000 },                          \
-  { 0xffffffff, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000, 0x00000000 },                          \
-  { 0xffffffff, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000 },                          \
-  { 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff },                           \
-  { 0x00000000, 0x00000000, 0xffff0000, 0xffffffff, 0xffffffff, 0x0000ffff },                           \
-  { 0xffffffff, 0x00000000, 0xffff0000, 0xffffffff, 0xffffffff, 0x0000ffff },                           \
-  { 0x00000000, 0x00000000, 0x000007f8, 0x00000000, 0x00000000, 0x00000000 },  /* status registers */  \
-  { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x003f0000 },  /* dsp accumulator registers */ \
-  { 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x003f0000 },  /* hi/lo and dsp accumulator registers */       \
-  { 0x00000000, 0x00000000, 0x00006000, 0x00000000, 0x00000000, 0x00000000 },  /* frame registers */   \
-  { 0xffffffff, 0xffffffff, 0xffff67ff, 0xffffffff, 0xffffffff, 0x0fffffff }   /* all registers */     \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* NO_REGS */           \
+  { 0x000300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* M16_REGS */          \
+  { 0x01000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* T_REG */             \
+  { 0x010300fc, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* M16_T_REGS */        \
+  { 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* PIC_FN_ADDR_REG */   \
+  { 0x00000008, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* V1_REG */            \
+  { 0xfdffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* LEA_REGS */          \
+  { 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* GR_REGS */           \
+  { 0x00000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },  /* FP_REGS */           \
+  { 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000 },  /* MD0_REG */           \
+  { 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000 },  /* MD1_REG */           \
+  { 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000 },  /* MD_REGS */           \
+  { 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000, 0x00000000 },   /* COP0_REGS */                \
+  { 0x00000000, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff, 0x00000000 },   /* COP2_REGS */                \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffff0000, 0x0000ffff },   /* COP3_REGS */                \
+  { 0x00000000, 0x00000000, 0x000007f8, 0x00000000, 0x00000000, 0x00000000 },  /* ST_REGS */           \
+  { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x003f0000 },  /* DSP_ACC_REGS */      \
+  { 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x003f0000 },  /* ACC_REGS */          \
+  { 0x00000000, 0x00000000, 0x00006000, 0x00000000, 0x00000000, 0x00000000 },  /* FRAME_REGS */        \
+  { 0xffffffff, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000 },  /* GR_AND_MD0_REGS */   \
+  { 0xffffffff, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000 },  /* GR_AND_MD1_REGS */   \
+  { 0xffffffff, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000 },  /* GR_AND_MD_REGS */    \
+  { 0xffffffff, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x003f0000 },  /* GR_AND_ACC_REGS */   \
+  { 0xffffffff, 0xffffffff, 0xffff67ff, 0xffffffff, 0xffffffff, 0x0fffffff }   /* ALL_REGS */          \
 }