]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/m32r/m32r.c
Turn HARD_REGNO_MODE_OK into a target hook
[thirdparty/gcc.git] / gcc / config / m32r / m32r.c
index 56d1dbddb2d0f3b6f74328a3bfb73da3b59e0411..44736ed4b29fb24634db1d95615df2b37fb165c1 100644 (file)
@@ -102,6 +102,7 @@ static void m32r_conditional_register_usage (void);
 static void m32r_trampoline_init (rtx, tree, rtx);
 static bool m32r_legitimate_constant_p (machine_mode, rtx);
 static bool m32r_attribute_identifier (const_tree);
+static bool m32r_hard_regno_mode_ok (unsigned int, machine_mode);
 \f
 /* M32R specific attributes.  */
 
@@ -209,6 +210,9 @@ static const struct attribute_spec m32r_attribute_table[] =
 #undef TARGET_LEGITIMATE_CONSTANT_P
 #define TARGET_LEGITIMATE_CONSTANT_P m32r_legitimate_constant_p
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK m32r_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Called by m32r_option_override to initialize various things.  */
@@ -270,14 +274,14 @@ enum m32r_mode_class
 
 /* Value is 1 if register/mode pair is acceptable on arc.  */
 
-const unsigned int m32r_hard_regno_mode_ok[FIRST_PSEUDO_REGISTER] =
+static const unsigned int m32r_hard_regno_modes[FIRST_PSEUDO_REGISTER] =
 {
   T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES,
   T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, S_MODES, S_MODES, S_MODES,
   S_MODES, C_MODES, A_MODES, A_MODES
 };
 
-unsigned int m32r_mode_class [NUM_MACHINE_MODES];
+static unsigned int m32r_mode_class [NUM_MACHINE_MODES];
 
 enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
 
@@ -2747,6 +2751,14 @@ m32r_output_block_move (rtx insn ATTRIBUTE_UNUSED, rtx operands[])
     }
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+m32r_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return (m32r_hard_regno_modes[regno] & m32r_mode_class[mode]) != 0;
+}
+
 /* Return true if using NEW_REG in place of OLD_REG is ok.  */
 
 int