* config/cris/cris.c (cris_preferred_reload_class): New function.
authoraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 Oct 2011 16:39:26 +0000 (16:39 +0000)
committeraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 Oct 2011 16:39:26 +0000 (16:39 +0000)
(TARGET_PREFERRED_RELOAD_CLASS): Define.
* config/cris/cris.h (PREFERRED_RELOAD_CLASS): Remove.

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

gcc/ChangeLog
gcc/config/cris/cris.c
gcc/config/cris/cris.h

index 358c557..5dc6680 100644 (file)
@@ -1,3 +1,9 @@
+2011-10-10  Anatoly Sokolov  <aesok@post.ru>
+
+       * config/cris/cris.c (cris_preferred_reload_class): New function.
+       (TARGET_PREFERRED_RELOAD_CLASS): Define.
+       * config/cris/cris.h (PREFERRED_RELOAD_CLASS): Remove.
+
 2011-10-10  Georg-Johann Lay  <avr@gjlay.de>
 
        * config/avr/avr.md (*tablejump_rjmp): Change insn condition to
index b74bbd3..35ecaa8 100644 (file)
@@ -123,6 +123,8 @@ static void cris_asm_output_mi_thunk
 static void cris_file_start (void);
 static void cris_init_libfuncs (void);
 
+static reg_class_t cris_preferred_reload_class (rtx, reg_class_t);
+
 static int cris_register_move_cost (enum machine_mode, reg_class_t, reg_class_t);
 static int cris_memory_move_cost (enum machine_mode, reg_class_t, bool);
 static bool cris_rtx_costs (rtx, int, int, int, int *, bool);
@@ -198,6 +200,9 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
 #undef TARGET_INIT_LIBFUNCS
 #define TARGET_INIT_LIBFUNCS cris_init_libfuncs
 
+#undef TARGET_PREFERRED_RELOAD_CLASS
+#define TARGET_PREFERRED_RELOAD_CLASS cris_preferred_reload_class
+
 #undef TARGET_REGISTER_MOVE_COST
 #define TARGET_REGISTER_MOVE_COST cris_register_move_cost
 #undef TARGET_MEMORY_MOVE_COST
@@ -1342,6 +1347,31 @@ cris_reload_address_legitimized (rtx x,
   return false;
 }
 
+
+/* Worker function for TARGET_PREFERRED_RELOAD_CLASS.
+
+   It seems like gcc (2.7.2 and 2.9x of 2000-03-22) may send "NO_REGS" as
+   the class for a constant (testcase: __Mul in arit.c).  To avoid forcing
+   out a constant into the constant pool, we will trap this case and
+   return something a bit more sane.  FIXME: Check if this is a bug.
+   Beware that we must not "override" classes that can be specified as
+   constraint letters, or else asm operands using them will fail when
+   they need to be reloaded.  FIXME: Investigate whether that constitutes
+   a bug.  */
+
+static reg_class_t
+cris_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, reg_class_t rclass)
+{
+  if (rclass != ACR_REGS
+      && rclass != MOF_REGS
+      && rclass != SRP_REGS
+      && rclass != CC0_REGS
+      && rclass != SPECIAL_REGS)
+    return GENERAL_REGS;
+
+  return rclass;
+}
+
 /* Worker function for TARGET_REGISTER_MOVE_COST.  */
 
 static int
index a18b14e..4c28e45 100644 (file)
@@ -583,22 +583,6 @@ enum reg_class
 /* See REGNO_OK_FOR_BASE_P.  */
 #define REGNO_OK_FOR_INDEX_P(REGNO) REGNO_OK_FOR_BASE_P(REGNO)
 
-/* It seems like gcc (2.7.2 and 2.9x of 2000-03-22) may send "NO_REGS" as
-   the class for a constant (testcase: __Mul in arit.c).  To avoid forcing
-   out a constant into the constant pool, we will trap this case and
-   return something a bit more sane.  FIXME: Check if this is a bug.
-   Beware that we must not "override" classes that can be specified as
-   constraint letters, or else asm operands using them will fail when
-   they need to be reloaded.  FIXME: Investigate whether that constitutes
-   a bug.  */
-#define PREFERRED_RELOAD_CLASS(X, CLASS)       \
- ((CLASS) != ACR_REGS                          \
-  && (CLASS) != MOF_REGS                       \
-  && (CLASS) != SRP_REGS                       \
-  && (CLASS) != CC0_REGS                       \
-  && (CLASS) != SPECIAL_REGS                   \
-  ? GENERAL_REGS : (CLASS))
-
 /* We can't move special registers to and from memory in smaller than
    word_mode.  We also can't move between special registers.  Luckily,
    -1, as returned by true_regnum for non-sub/registers, is valid as a