From: Richard Henderson Date: Wed, 21 Oct 2015 20:34:47 +0000 (-0700) Subject: Relax ADDR_SPACE_GENERIC_P checks for default address space hooks X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f16c5729bfc4a9939578feb7e319f41c7dd9b41;p=gcc.git Relax ADDR_SPACE_GENERIC_P checks for default address space hooks If all address spaces use the same modes and forms, we would be forced to replicate these hooks in the backend. Which would then require the creation of a new hook to replace target_default_pointer_address_modes_p. * targhooks.c (default_addr_space_pointer_mode): Remove check for generic address space. (default_addr_space_address_mode): Likewise. (default_addr_space_valid_pointer_mode): Likewise. (default_addr_space_legitimate_address_p): Likewise. (default_addr_space_legitimize_address): Likewise. From-SVN: r229143 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ec60f845bb7..d5d304dcbf9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2015-10-21 Richard Henderson + * targhooks.c (default_addr_space_pointer_mode): Remove check + for generic address space. + (default_addr_space_address_mode): Likewise. + (default_addr_space_valid_pointer_mode): Likewise. + (default_addr_space_legitimate_address_p): Likewise. + (default_addr_space_legitimize_address): Likewise. + * expr.c (expand_expr_real_2): Use convert_modes on disjoint address spaces. diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 01aaed07e69..c39f266f21c 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -1195,35 +1195,31 @@ default_ref_may_alias_errno (ao_ref *ref) return false; } -/* Return the mode for a pointer to a given ADDRSPACE, defaulting to ptr_mode - for the generic address space only. */ +/* Return the mode for a pointer to a given ADDRSPACE, + defaulting to ptr_mode for all address spaces. */ machine_mode default_addr_space_pointer_mode (addr_space_t addrspace ATTRIBUTE_UNUSED) { - gcc_assert (ADDR_SPACE_GENERIC_P (addrspace)); return ptr_mode; } -/* Return the mode for an address in a given ADDRSPACE, defaulting to Pmode - for the generic address space only. */ +/* Return the mode for an address in a given ADDRSPACE, + defaulting to Pmode for all address spaces. */ machine_mode default_addr_space_address_mode (addr_space_t addrspace ATTRIBUTE_UNUSED) { - gcc_assert (ADDR_SPACE_GENERIC_P (addrspace)); return Pmode; } -/* Named address space version of valid_pointer_mode. */ +/* Named address space version of valid_pointer_mode. + To match the above, the same modes apply to all address spaces. */ bool -default_addr_space_valid_pointer_mode (machine_mode mode, addr_space_t as) +default_addr_space_valid_pointer_mode (machine_mode mode, + addr_space_t as ATTRIBUTE_UNUSED) { - if (!ADDR_SPACE_GENERIC_P (as)) - return (mode == targetm.addr_space.pointer_mode (as) - || mode == targetm.addr_space.address_mode (as)); - return targetm.valid_pointer_mode (mode); } @@ -1243,27 +1239,24 @@ target_default_pointer_address_modes_p (void) return true; } -/* Named address space version of legitimate_address_p. */ +/* Named address space version of legitimate_address_p. + By default, all address spaces have the same form. */ bool default_addr_space_legitimate_address_p (machine_mode mode, rtx mem, - bool strict, addr_space_t as) + bool strict, + addr_space_t as ATTRIBUTE_UNUSED) { - if (!ADDR_SPACE_GENERIC_P (as)) - gcc_unreachable (); - return targetm.legitimate_address_p (mode, mem, strict); } -/* Named address space version of LEGITIMIZE_ADDRESS. */ +/* Named address space version of LEGITIMIZE_ADDRESS. + By default, all address spaces have the same form. */ rtx -default_addr_space_legitimize_address (rtx x, rtx oldx, - machine_mode mode, addr_space_t as) +default_addr_space_legitimize_address (rtx x, rtx oldx, machine_mode mode, + addr_space_t as ATTRIBUTE_UNUSED) { - if (!ADDR_SPACE_GENERIC_P (as)) - return x; - return targetm.legitimize_address (x, oldx, mode); }