aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/pdp11
diff options
context:
space:
mode:
authorPaul Koning <ni1d@arrl.net>2010-11-21 16:52:36 +0000
committerPaul Koning <ni1d@arrl.net>2010-11-21 16:52:36 +0000
commit6a71b8abf6cd718d499425ef4d457124d9adf7d7 (patch)
tree8f73668d4c3dcf13006f58e7c38f8146417b7e2f /gcc/config/pdp11
parent47cfa60c6093fac4e3c7bc74eb918f97e060a18d (diff)
* config/mips/pdp11.c (pdp11_legitimate_address_p): New function.
* config/mips/pdp11.h (GO_IF_LEGITIMATE_ADDRESS): Delete. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@167005 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/pdp11')
-rw-r--r--gcc/config/pdp11/pdp11.c114
-rw-r--r--gcc/config/pdp11/pdp11.h112
2 files changed, 113 insertions, 113 deletions
diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c
index 617a7f56080..0188dc01b16 100644
--- a/gcc/config/pdp11/pdp11.c
+++ b/gcc/config/pdp11/pdp11.c
@@ -227,6 +227,9 @@ static const struct default_options pdp11_option_optimization_table[] =
#undef TARGET_PREFERRED_OUTPUT_RELOAD_CLASS
#define TARGET_PREFERRED_OUTPUT_RELOAD_CLASS pdp11_preferred_output_reload_class
+
+#undef TARGET_LEGITIMATE_ADDRESS_P
+#define TARGET_LEGITIMATE_ADDRESS_P pdp11_legitimate_address_p
/* Implement TARGET_HANDLE_OPTION. */
@@ -1706,6 +1709,115 @@ pdp11_secondary_memory_needed (reg_class_t c1, reg_class_t c2,
return (fromfloat != tofloat);
}
+/* TARGET_LEGITIMATE_ADDRESS_P recognizes an RTL expression
+ that is a valid memory address for an instruction.
+ The MODE argument is the machine mode for the MEM expression
+ that wants to use this address.
+
+*/
+
+static bool
+pdp11_legitimate_address_p (enum machine_mode mode,
+ rtx operand, bool strict)
+{
+ rtx xfoob;
+
+ /* accept @#address */
+ if (CONSTANT_ADDRESS_P (operand))
+ return true;
+
+ switch (GET_CODE (operand))
+ {
+ case REG:
+ /* accept (R0) */
+ return !strict || REGNO_OK_FOR_BASE_P (REGNO (operand));
+
+ case PLUS:
+ /* accept X(R0) */
+ return GET_CODE (XEXP (operand, 0)) == REG
+ && (!strict || REGNO_OK_FOR_BASE_P (REGNO (XEXP (operand, 0))))
+ && CONSTANT_ADDRESS_P (XEXP (operand, 1));
+
+ case PRE_DEC:
+ /* accept -(R0) */
+ return GET_CODE (XEXP (operand, 0)) == REG
+ && (!strict || REGNO_OK_FOR_BASE_P (REGNO (XEXP (operand, 0))));
+
+ case POST_INC:
+ /* accept (R0)+ */
+ return GET_CODE (XEXP (operand, 0)) == REG
+ && (!strict || REGNO_OK_FOR_BASE_P (REGNO (XEXP (operand, 0))));
+
+ case PRE_MODIFY:
+ /* accept -(SP) -- which uses PRE_MODIFY for byte mode */
+ return GET_CODE (XEXP (operand, 0)) == REG
+ && REGNO (XEXP (operand, 0)) == STACK_POINTER_REGNUM
+ && GET_CODE ((xfoob = XEXP (operand, 1))) == PLUS
+ && GET_CODE (XEXP (xfoob, 0)) == REG
+ && REGNO (XEXP (xfoob, 0)) == STACK_POINTER_REGNUM
+ && CONSTANT_P (XEXP (xfoob, 1))
+ && INTVAL (XEXP (xfoob,1)) == -2;
+
+ case POST_MODIFY:
+ /* accept (SP)+ -- which uses POST_MODIFY for byte mode */
+ return GET_CODE (XEXP (operand, 0)) == REG
+ && REGNO (XEXP (operand, 0)) == STACK_POINTER_REGNUM
+ && GET_CODE ((xfoob = XEXP (operand, 1))) == PLUS
+ && GET_CODE (XEXP (xfoob, 0)) == REG
+ && REGNO (XEXP (xfoob, 0)) == STACK_POINTER_REGNUM
+ && CONSTANT_P (XEXP (xfoob, 1))
+ && INTVAL (XEXP (xfoob,1)) == 2;
+
+ case MEM:
+ /* handle another level of indirection ! */
+ xfoob = XEXP (operand, 0);
+
+ /* (MEM:xx (MEM:xx ())) is not valid for SI, DI and currently
+ also forbidden for float, because we have to handle this
+ in output_move_double and/or output_move_quad() - we could
+ do it, but currently it's not worth it!!!
+ now that DFmode cannot go into CPU register file,
+ maybe I should allow float ...
+ but then I have to handle memory-to-memory moves in movdf ?? */
+ if (GET_MODE_BITSIZE(mode) > 16)
+ return false;
+
+ /* accept @address */
+ if (CONSTANT_ADDRESS_P (xfoob))
+ return true;
+
+ switch (GET_CODE (xfoob))
+ {
+ case REG:
+ /* accept @(R0) - which is @0(R0) */
+ return !strict || REGNO_OK_FOR_BASE_P(REGNO (xfoob));
+
+ case PLUS:
+ /* accept @X(R0) */
+ return GET_CODE (XEXP (xfoob, 0)) == REG
+ && (!strict || REGNO_OK_FOR_BASE_P (REGNO (XEXP (xfoob, 0))))
+ && CONSTANT_ADDRESS_P (XEXP (xfoob, 1));
+
+ case PRE_DEC:
+ /* accept @-(R0) */
+ return GET_CODE (XEXP (xfoob, 0)) == REG
+ && (!strict || REGNO_OK_FOR_BASE_P (REGNO (XEXP (xfoob, 0))));
+
+ case POST_INC:
+ /* accept @(R0)+ */
+ return GET_CODE (XEXP (xfoob, 0)) == REG
+ && (!strict || REGNO_OK_FOR_BASE_P (REGNO (XEXP (xfoob, 0))));
+
+ default:
+ /* anything else is invalid */
+ return false;
+ }
+
+ default:
+ /* anything else is invalid */
+ return false;
+ }
+}
/* Return the class number of the smallest class containing
reg number REGNO. */
enum reg_class
@@ -1919,7 +2031,7 @@ pdp11_libcall_value (enum machine_mode mode,
static bool
pdp11_function_value_regno_p (const unsigned int regno)
{
- return (regno == 0) || (TARGET_AC0 && (regno == 8));
+ return (regno == RETVAL_REGNUM) || (TARGET_AC0 && (regno == AC0_REGNUM));
}
/* Worker function for TARGET_TRAMPOLINE_INIT.
diff --git a/gcc/config/pdp11/pdp11.h b/gcc/config/pdp11/pdp11.h
index 2d06b7d30a8..b5c644933c4 100644
--- a/gcc/config/pdp11/pdp11.h
+++ b/gcc/config/pdp11/pdp11.h
@@ -500,118 +500,6 @@ extern int may_call_alloca;
#endif
-/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression
- that is a valid memory address for an instruction.
- The MODE argument is the machine mode for the MEM expression
- that wants to use this address.
-
-*/
-
-#define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \
-{ \
- rtx xfoob; \
- \
- /* accept (R0) */ \
- if (GET_CODE (operand) == REG \
- && REG_OK_FOR_BASE_P(operand)) \
- goto ADDR; \
- \
- /* accept @#address */ \
- if (CONSTANT_ADDRESS_P (operand)) \
- goto ADDR; \
- \
- /* accept X(R0) */ \
- if (GET_CODE (operand) == PLUS \
- && GET_CODE (XEXP (operand, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (operand, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (operand, 1))) \
- goto ADDR; \
- \
- /* accept -(R0) */ \
- if (GET_CODE (operand) == PRE_DEC \
- && GET_CODE (XEXP (operand, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (operand, 0))) \
- goto ADDR; \
- \
- /* accept (R0)+ */ \
- if (GET_CODE (operand) == POST_INC \
- && GET_CODE (XEXP (operand, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (operand, 0))) \
- goto ADDR; \
- \
- /* accept -(SP) -- which uses PRE_MODIFY for byte mode */ \
- if (GET_CODE (operand) == PRE_MODIFY \
- && GET_CODE (XEXP (operand, 0)) == REG \
- && REGNO (XEXP (operand, 0)) == STACK_POINTER_REGNUM \
- && GET_CODE ((xfoob = XEXP (operand, 1))) == PLUS \
- && GET_CODE (XEXP (xfoob, 0)) == REG \
- && REGNO (XEXP (xfoob, 0)) == STACK_POINTER_REGNUM \
- && CONSTANT_P (XEXP (xfoob, 1)) \
- && INTVAL (XEXP (xfoob,1)) == -2) \
- goto ADDR; \
- \
- /* accept (SP)+ -- which uses POST_MODIFY for byte mode */ \
- if (GET_CODE (operand) == POST_MODIFY \
- && GET_CODE (XEXP (operand, 0)) == REG \
- && REGNO (XEXP (operand, 0)) == STACK_POINTER_REGNUM \
- && GET_CODE ((xfoob = XEXP (operand, 1))) == PLUS \
- && GET_CODE (XEXP (xfoob, 0)) == REG \
- && REGNO (XEXP (xfoob, 0)) == STACK_POINTER_REGNUM \
- && CONSTANT_P (XEXP (xfoob, 1)) \
- && INTVAL (XEXP (xfoob,1)) == 2) \
- goto ADDR; \
- \
- \
- /* handle another level of indirection ! */ \
- if (GET_CODE(operand) != MEM) \
- goto fail; \
- \
- xfoob = XEXP (operand, 0); \
- \
- /* (MEM:xx (MEM:xx ())) is not valid for SI, DI and currently */ \
- /* also forbidden for float, because we have to handle this */ \
- /* in output_move_double and/or output_move_quad() - we could */ \
- /* do it, but currently it's not worth it!!! */ \
- /* now that DFmode cannot go into CPU register file, */ \
- /* maybe I should allow float ... */ \
- /* but then I have to handle memory-to-memory moves in movdf ?? */ \
- \
- if (GET_MODE_BITSIZE(mode) > 16) \
- goto fail; \
- \
- /* accept @(R0) - which is @0(R0) */ \
- if (GET_CODE (xfoob) == REG \
- && REG_OK_FOR_BASE_P(xfoob)) \
- goto ADDR; \
- \
- /* accept @address */ \
- if (CONSTANT_ADDRESS_P (xfoob)) \
- goto ADDR; \
- \
- /* accept @X(R0) */ \
- if (GET_CODE (xfoob) == PLUS \
- && GET_CODE (XEXP (xfoob, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (xfoob, 0)) \
- && CONSTANT_ADDRESS_P (XEXP (xfoob, 1))) \
- goto ADDR; \
- \
- /* accept @-(R0) */ \
- if (GET_CODE (xfoob) == PRE_DEC \
- && GET_CODE (XEXP (xfoob, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (xfoob, 0))) \
- goto ADDR; \
- \
- /* accept @(R0)+ */ \
- if (GET_CODE (xfoob) == POST_INC \
- && GET_CODE (XEXP (xfoob, 0)) == REG \
- && REG_OK_FOR_BASE_P (XEXP (xfoob, 0))) \
- goto ADDR; \
- \
- /* anything else is invalid */ \
- fail: ; \
-}
-
-
/* Specify the machine mode that this machine uses
for the index in the tablejump instruction. */
#define CASE_VECTOR_MODE HImode