diff options
author | aesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-07 19:46:14 +0000 |
---|---|---|
committer | aesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-07-07 19:46:14 +0000 |
commit | 45cfc5147dd073bd68dcdb1a35692005f2b4b337 (patch) | |
tree | 826f0474d32bdd3c7692de95ba18f41d9596e111 /gcc/config/moxie | |
parent | d0278351a2f98b0b6b76531c342462a84d6d9c19 (diff) | |
download | gcc-45cfc5147dd073bd68dcdb1a35692005f2b4b337.tar.gz |
[MOXIE] Hookize GO_IF_LEGITIMATE_ADDRESS
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225524 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/moxie')
-rw-r--r-- | gcc/config/moxie/moxie.c | 41 | ||||
-rw-r--r-- | gcc/config/moxie/moxie.h | 24 |
2 files changed, 41 insertions, 24 deletions
diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c index e79182901fa..7a80f77bde3 100644 --- a/gcc/config/moxie/moxie.c +++ b/gcc/config/moxie/moxie.c @@ -595,6 +595,45 @@ moxie_offset_address_p (rtx x) return 0; } +/* Helper function for `moxie_legitimate_address_p'. */ + +static bool +moxie_reg_ok_for_base_p (const_rtx reg, bool strict_p) +{ + int regno = REGNO (reg); + + if (strict_p) + return HARD_REGNO_OK_FOR_BASE_P (regno) + || HARD_REGNO_OK_FOR_BASE_P (reg_renumber[regno]); + else + return !HARD_REGISTER_NUM_P (regno) + || HARD_REGNO_OK_FOR_BASE_P (regno); +} + +/* Worker function for TARGET_LEGITIMATE_ADDRESS_P. */ + +static bool +moxie_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED, + rtx x, bool strict_p, + addr_space_t as) +{ + gcc_assert (ADDR_SPACE_GENERIC_P (as)); + + if (GET_CODE(x) == PLUS + && REG_P (XEXP (x, 0)) + && moxie_reg_ok_for_base_p (XEXP (x, 0), strict_p) + && CONST_INT_P (XEXP (x, 1)) + && IN_RANGE (INTVAL (XEXP (x, 1)), -32768, 32767)) + return true; + if (REG_P (x) && moxie_reg_ok_for_base_p (x, strict_p)) + return true; + if (GET_CODE (x) == SYMBOL_REF + || GET_CODE (x) == LABEL_REF + || GET_CODE (x) == CONST) + return true; + return false; +} + /* The Global `targetm' Variable. */ /* Initialize the GCC target structure. */ @@ -615,6 +654,8 @@ moxie_offset_address_p (rtx x) #undef TARGET_FUNCTION_ARG_ADVANCE #define TARGET_FUNCTION_ARG_ADVANCE moxie_function_arg_advance +#undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P +#define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P moxie_legitimate_address_p #undef TARGET_SETUP_INCOMING_VARARGS #define TARGET_SETUP_INCOMING_VARARGS moxie_setup_incoming_varargs diff --git a/gcc/config/moxie/moxie.h b/gcc/config/moxie/moxie.h index d20d2140778..d8ab936feac 100644 --- a/gcc/config/moxie/moxie.h +++ b/gcc/config/moxie/moxie.h @@ -451,30 +451,6 @@ enum reg_class elements of a jump-table should have. */ #define CASE_VECTOR_MODE SImode -/* 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 GO_IF_LEGITIMATE_ADDRESS(MODE,X,LABEL) \ - do { \ - if (GET_CODE(X) == PLUS) \ - { \ - rtx op1,op2; \ - op1 = XEXP(X,0); \ - op2 = XEXP(X,1); \ - if (GET_CODE(op1) == REG \ - && GET_CODE(op2) == CONST_INT \ - && IN_RANGE (INTVAL (op2), -32768, 32767) \ - && REGNO_OK_FOR_BASE_P(REGNO(op1))) \ - goto LABEL; \ - } \ - if (REG_P (X) && REGNO_OK_FOR_BASE_P (REGNO (X))) \ - goto LABEL; \ - if (GET_CODE (X) == SYMBOL_REF \ - || GET_CODE (X) == LABEL_REF \ - || GET_CODE (X) == CONST) \ - goto LABEL; \ - } while (0) - /* Run-time Target Specification */ #define TARGET_CPU_CPP_BUILTINS() \ |