diff options
Diffstat (limited to 'gcc/config/m32r')
-rw-r--r-- | gcc/config/m32r/m32r.c | 22 | ||||
-rw-r--r-- | gcc/config/m32r/m32r.h | 13 |
2 files changed, 22 insertions, 13 deletions
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index 86af3b3a8c9..1580f47edd1 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -99,6 +99,7 @@ static void m32r_function_arg_advance (CUMULATIVE_ARGS *, enum machine_mode, static bool m32r_can_eliminate (const int, const int); static void m32r_conditional_register_usage (void); static void m32r_trampoline_init (rtx, tree, rtx); +static bool m32r_legitimate_constant_p (enum machine_mode, rtx); /* M32R specific attributes. */ @@ -211,6 +212,9 @@ static const struct default_options m32r_option_optimization_table[] = #undef TARGET_TRAMPOLINE_INIT #define TARGET_TRAMPOLINE_INIT m32r_trampoline_init +#undef TARGET_LEGITIMATE_CONSTANT_P +#define TARGET_LEGITIMATE_CONSTANT_P m32r_legitimate_constant_p + #undef TARGET_EXCEPT_UNWIND_INFO #define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info @@ -2935,3 +2939,21 @@ m32r_conditional_register_usage (void) call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; } } + +/* Implement TARGET_LEGITIMATE_CONSTANT_P + + We don't allow (plus symbol large-constant) as the relocations can't + describe it. INTVAL > 32767 handles both 16-bit and 24-bit relocations. + We allow all CONST_DOUBLE's as the md file patterns will force the + constant to memory if they can't handle them. */ + +static bool +m32r_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x) +{ + return !(GET_CODE (x) == CONST + && GET_CODE (XEXP (x, 0)) == PLUS + && (GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF + || GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF) + && CONST_INT_P (XEXP (XEXP (x, 0), 1)) + && UINTVAL (XEXP (XEXP (x, 0), 1)) > 32767); +} diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 26d3ef978c4..50b5b2aa1a3 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -749,19 +749,6 @@ L2: .word STATIC || CONST_INT_P (X) \ || (GET_CODE (X) == CONST \ && ! (flag_pic && ! m32r_legitimate_pic_operand_p (X)))) - -/* Nonzero if the constant value X is a legitimate general operand. - We don't allow (plus symbol large-constant) as the relocations can't - describe it. INTVAL > 32767 handles both 16-bit and 24-bit relocations. - We allow all CONST_DOUBLE's as the md file patterns will force the - constant to memory if they can't handle them. */ - -#define LEGITIMATE_CONSTANT_P(X) \ - (! (GET_CODE (X) == CONST \ - && GET_CODE (XEXP (X, 0)) == PLUS \ - && (GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF || GET_CODE (XEXP (XEXP (X, 0), 0)) == LABEL_REF) \ - && CONST_INT_P (XEXP (XEXP (X, 0), 1)) \ - && (unsigned HOST_WIDE_INT) INTVAL (XEXP (XEXP (X, 0), 1)) > 32767)) /* Condition code usage. */ |