summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatoly Sokolov <aesok@post.ru>2011-12-18 13:19:51 +0400
committerAnatoly Sokolov <aesok@gcc.gnu.org>2011-12-18 13:19:51 +0400
commit903a9601cc5e966efee08007b7fdbde90b23d71b (patch)
treea683d5cee2d1476323669d9cd5932069efc38866
parent7ffbe288d7e300e55cde338148141f89ecde6ce3 (diff)
downloadgcc-903a9601cc5e966efee08007b7fdbde90b23d71b.tar.gz
ia64.h (REG_OK_FOR_BASE_P, [...]): Remove macros.
* 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
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/ia64/ia64.c65
-rw-r--r--gcc/config/ia64/ia64.h46
3 files changed, 75 insertions, 46 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e38ab91624f..1377d997243 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 64bd999bf53..b9706072ad6 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -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. */
diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h
index 134f5bef0d3..a3ccd6fe8a9 100644
--- a/gcc/config/ia64/ia64.h
+++ b/gcc/config/ia64/ia64.h
@@ -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)
/* Condition Code Status */