]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/ia64/ia64.c
Turn HARD_REGNO_MODE_OK into a target hook
[thirdparty/gcc.git] / gcc / config / ia64 / ia64.c
index 1326877b26a18e6bab90c887f19bf8640d04d511..583614f1709825da0ca3c93677de89744281b4d1 100644 (file)
@@ -335,6 +335,8 @@ static section * ia64_hpux_function_section (tree, enum node_frequency,
 static bool ia64_vectorize_vec_perm_const_ok (machine_mode vmode,
                                              const unsigned char *sel);
 
+static bool ia64_hard_regno_mode_ok (unsigned int, machine_mode);
+
 #define MAX_VECT_LEN   8
 
 struct expand_vec_perm_d
@@ -653,6 +655,9 @@ static const struct attribute_spec ia64_attribute_table[] =
 #undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS
 #define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 0
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK ia64_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Returns TRUE iff the target attribute indicated by ATTR_ID takes a plain
@@ -4251,6 +4256,31 @@ ia64_hard_regno_rename_ok (int from, int to)
   return 1;
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+ia64_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  if (FR_REGNO_P (regno))
+    return (GET_MODE_CLASS (mode) != MODE_CC
+           && mode != BImode
+           && mode != TFmode);
+
+  if (PR_REGNO_P (regno))
+    return mode == BImode || GET_MODE_CLASS (mode) == MODE_CC;
+
+  if (GR_REGNO_P (regno))
+    return mode != XFmode && mode != XCmode && mode != RFmode;
+
+  if (AR_REGNO_P (regno))
+    return mode == DImode;
+
+  if (BR_REGNO_P (regno))
+    return mode == DImode;
+
+  return false;
+}
+
 /* Target hook for assembling integer objects.  Handle word-sized
    aligned objects and detect the cases when @fptr is needed.  */