ia64.h (REG_OK_FOR_BASE_P, [...]): Remove macros.
authorAnatoly Sokolov <aesok@post.ru>
Sun, 18 Dec 2011 09:19:51 +0000 (13:19 +0400)
committerAnatoly Sokolov <aesok@gcc.gnu.org>
Sun, 18 Dec 2011 09:19:51 +0000 (13:19 +0400)
* config/ia64/ia64.h (REG_OK_FOR_BASE_P, REG_OK_FOR_INDEX_P,
LEGITIMATE_ADDRESS_REG, LEGITIMATE_ADDRESS_DISP,
GO_IF_LEGITIMATE_ADDRESS): Remove macros.
* config/ia64/ia64.c (TARGET_LEGITIMATE_ADDRESS_P): Define.
(ia64_reg_ok_for_base_p, ia64_legitimate_address_reg,
ia64_legitimate_address_disp, ia64_legitimate_address_p): New
functions.

From-SVN: r182456

gcc/ChangeLog
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.h

index e38ab91624f16f245e038b28b9ca615fad4c84db..1377d9972435b1169a09a771205e139f1a38f4e1 100644 (file)
@@ -1,3 +1,13 @@
+2011-12-18  Anatoly Sokolov  <aesok@post.ru>
+
+       * config/ia64/ia64.h (REG_OK_FOR_BASE_P, REG_OK_FOR_INDEX_P,
+       LEGITIMATE_ADDRESS_REG, LEGITIMATE_ADDRESS_DISP,
+       GO_IF_LEGITIMATE_ADDRESS): Remove macros.
+       * config/ia64/ia64.c (TARGET_LEGITIMATE_ADDRESS_P): Define.
+       (ia64_reg_ok_for_base_p, ia64_legitimate_address_reg,
+       ia64_legitimate_address_disp, ia64_legitimate_address_p): New
+       functions.
+
 2011-12-17  Tom de Vries  <tom@codesourcery.com>
 
        PR tree-optimization/51491
index 64bd999bf53f41a5b29ed69decfb43a4427835d9..b9706072ad6d7e97c4cc7f60e7ad37322b6f4183 100644 (file)
@@ -309,6 +309,7 @@ static tree ia64_gimplify_va_arg (tree, tree, gimple_seq *, gimple_seq *);
 static bool ia64_scalar_mode_supported_p (enum machine_mode mode);
 static bool ia64_vector_mode_supported_p (enum machine_mode mode);
 static bool ia64_legitimate_constant_p (enum machine_mode, rtx);
+static bool ia64_legitimate_address_p (enum machine_mode, rtx, bool);
 static bool ia64_cannot_force_const_mem (enum machine_mode, rtx);
 static const char *ia64_mangle_type (const_tree);
 static const char *ia64_invalid_conversion (const_tree, const_tree);
@@ -583,6 +584,8 @@ static const struct attribute_spec ia64_attribute_table[] =
 
 #undef TARGET_LEGITIMATE_CONSTANT_P
 #define TARGET_LEGITIMATE_CONSTANT_P ia64_legitimate_constant_p
+#undef TARGET_LEGITIMATE_ADDRESS_P
+#define TARGET_LEGITIMATE_ADDRESS_P ia64_legitimate_address_p
 
 #undef TARGET_CANNOT_FORCE_CONST_MEM
 #define TARGET_CANNOT_FORCE_CONST_MEM ia64_cannot_force_const_mem
@@ -937,6 +940,68 @@ tls_symbolic_operand_type (rtx addr)
   return tls_kind;
 }
 
+/* Returns true if REG (assumed to be a `reg' RTX) is valid for use
+   as a base register.  */
+
+static inline bool
+ia64_reg_ok_for_base_p (const_rtx reg, bool strict)
+{
+  if (strict
+      && REGNO_OK_FOR_BASE_P (REGNO (reg)))
+    return true;
+  else if (!strict
+          && (GENERAL_REGNO_P (REGNO (reg))
+              || !HARD_REGISTER_P (reg)))
+    return true;
+  else
+    return false;
+}
+
+static bool
+ia64_legitimate_address_reg (const_rtx reg, bool strict)
+{
+  if ((REG_P (reg) && ia64_reg_ok_for_base_p (reg, strict))
+      || (GET_CODE (reg) == SUBREG && REG_P (XEXP (reg, 0))
+         && ia64_reg_ok_for_base_p (XEXP (reg, 0), strict)))
+    return true;
+
+  return false;
+}
+
+static bool
+ia64_legitimate_address_disp (const_rtx reg, const_rtx disp, bool strict)
+{
+  if (GET_CODE (disp) == PLUS
+      && rtx_equal_p (reg, XEXP (disp, 0))
+      && (ia64_legitimate_address_reg (XEXP (disp, 1), strict)
+         || (CONST_INT_P (XEXP (disp, 1))
+             && IN_RANGE (INTVAL (XEXP (disp, 1)), -256, 255))))
+    return true;
+
+  return false;
+}
+
+/* Implement TARGET_LEGITIMATE_ADDRESS_P.  */
+
+static bool
+ia64_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
+                          rtx x, bool strict)
+{
+  if (ia64_legitimate_address_reg (x, strict))
+    return true;
+  else if ((GET_CODE (x) == POST_INC || GET_CODE (x) == POST_DEC)
+          && ia64_legitimate_address_reg (XEXP (x, 0), strict)
+          && XEXP (x, 0) != arg_pointer_rtx) 
+    return true;
+  else if (GET_CODE (x) == POST_MODIFY
+          && ia64_legitimate_address_reg (XEXP (x, 0), strict)
+          && XEXP (x, 0) != arg_pointer_rtx
+          && ia64_legitimate_address_disp (XEXP (x, 0), XEXP (x, 1), strict))
+    return true;
+  else
+    return false;
+}
+
 /* Return true if X is a constant that is valid for some immediate
    field in an instruction.  */
 
index 134f5bef0d33518ce1722f0c441a676a53290320..a3ccd6fe8a95eccd73f577bbfd41590ad13aec4e 100644 (file)
@@ -1154,52 +1154,6 @@ do {                                                                     \
 
 #define MAX_REGS_PER_ADDRESS 2
 
-/* A C compound statement with a conditional `goto LABEL;' executed if X (an
-   RTX) is a legitimate memory address on the target machine for a memory
-   operand of mode MODE.  */
-
-#define LEGITIMATE_ADDRESS_REG(X)                                      \
-  ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))                      \
-   || (GET_CODE (X) == SUBREG && GET_CODE (XEXP (X, 0)) == REG         \
-       && REG_OK_FOR_BASE_P (XEXP (X, 0))))
-
-#define LEGITIMATE_ADDRESS_DISP(R, X)                                  \
-  (GET_CODE (X) == PLUS                                                        \
-   && rtx_equal_p (R, XEXP (X, 0))                                     \
-   && (LEGITIMATE_ADDRESS_REG (XEXP (X, 1))                            \
-       || (GET_CODE (XEXP (X, 1)) == CONST_INT                         \
-          && INTVAL (XEXP (X, 1)) >= -256                              \
-          && INTVAL (XEXP (X, 1)) < 256)))
-
-#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL)                       \
-do {                                                                   \
-  if (LEGITIMATE_ADDRESS_REG (X))                                      \
-    goto LABEL;                                                                \
-  else if ((GET_CODE (X) == POST_INC || GET_CODE (X) == POST_DEC)      \
-          && LEGITIMATE_ADDRESS_REG (XEXP (X, 0))                      \
-          && XEXP (X, 0) != arg_pointer_rtx)                           \
-    goto LABEL;                                                                \
-  else if (GET_CODE (X) == POST_MODIFY                                 \
-          && LEGITIMATE_ADDRESS_REG (XEXP (X, 0))                      \
-          && XEXP (X, 0) != arg_pointer_rtx                            \
-          && LEGITIMATE_ADDRESS_DISP (XEXP (X, 0), XEXP (X, 1)))       \
-    goto LABEL;                                                                \
-} while (0)
-
-/* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
-   use as a base register.  */
-
-#ifdef REG_OK_STRICT
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-#else
-#define REG_OK_FOR_BASE_P(X) \
-  (GENERAL_REGNO_P (REGNO (X)) || (REGNO (X) >= FIRST_PSEUDO_REGISTER))
-#endif
-
-/* A C expression that is nonzero if X (assumed to be a `reg' RTX) is valid for
-   use as an index register.  This is needed for POST_MODIFY.  */
-
-#define REG_OK_FOR_INDEX_P(X) REG_OK_FOR_BASE_P (X)
 \f
 /* Condition Code Status */