From fd50b07156169d60752d44d21da9d80169ff089f Mon Sep 17 00:00:00 2001 From: bonzini Date: Thu, 14 May 2009 13:42:45 +0000 Subject: [PATCH] 2009-05-14 Paolo Bonzini * doc/tm.texi (TARGET_LEGITIMATE_ADDRESS_P): Refer mainly to this in the former documentation of... (GO_IF_LEGITIMATE_ADDRESS): ... this. * ira-conflicts.c (get_dup_num): Use address_operand. * targhooks.c (default_legitimate_address_p): New. * targhooks.h (default_legitimate_address_p): New. * reload.c (strict_memory_address_p) [!GO_IF_LEGITIMATE_ADDRESS]: Call hook. * recog.c (memory_address_p) [!GO_IF_LEGITIMATE_ADDRESS]: Call hook. * target.h (struct target): Add legitimate_address_p. * target-def.h (TARGET_LEGITIMATE_ADDRESS_P): New. (TARGET_INITIALIZER): Include it. * config/alpha/alpha.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/alpha/alpha-protos.h (alpha_legitimate_address_p): Remove. * config/alpha/alpha.c (alpha_legitimate_address_p): Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/frv/frv.h (GO_IF_LEGITIMATE_ADDRESS): Delete. (REG_OK_STRICT_P): Delete. * config/frv/frv-protos.h (frv_legitimate_address_p): Rename to... (frv_legitimate_address_p_1): ... this. * config/frv/frv.c (frv_legitimate_address_p): Forward to... (frv_legitimate_address_p_1): ... the renamed old frv_legitimate_address_p. * config/frv/predicates.md: Adjust calls to frv_legitimate_address_p. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/s390/s390.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/s390/s390-protos.h (legitimate_address_p): Remove. * config/s390/s390.c (legitimate_address_p): Rename to... (s390_legitimate_address_p): ... this, make static. (legitimize_address): Adjust call. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/s390/constraints.md ("e"): Call strict_memory_address_p. * config/m32c/m32c.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/m32c/m32c-protos.h (m32c_legitimate_address_p): Remove. * config/m32c/m32c.c (m32c_legitimate_address_p): Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/spu/spu.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/spu/spu-protos.h (spu_legitimate_address): Remove. * config/spu/spu.c (spu_legitimate_address): Rename to... (spu_legitimate_address_p): ... this, make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/sparc/sparc.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/sparc/sparc-protos.h (legitimate_address_p): Remove. * config/sparc/sparc.c (legitimate_address_p): Rename to... (sparc_legitimate_address_p): ... this, make static and return bool. (legitimize_address): Adjust call. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/i386/i386.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/i386/i386-protos.h (legitimate_address_p): Remove. * config/i386/i386.c (legitimate_address_p): Rename to... (ix86_legitimate_address_p): ... this, make static. (constant_address_p): Move after it, adjust call. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/avr/avr.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/avr/avr-protos.h (legitimate_address_p): Remove. * config/avr/avr.c (legitimate_address_p): Rename to... (avr_legitimate_address_p): ... this, make static. (legitimize_address): Adjust call. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/crx/crx.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/crx/crx-protos.h (crx_legitimate_address_p): Remove. * config/crx/crx.c (crx_legitimate_address_p): Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/xtensa/xtensa.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/xtensa/xtensa-protos.h (xtensa_legitimate_address_p): Remove. * config/xtensa/xtensa.c (xtensa_legitimate_address_p): Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/stormy16/stormy16.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/stormy16/stormy16-protos.h (xstormy16_legitimate_address_p): Remove. * config/stormy16/stormy16.c (xstormy16_legitimate_address_p): Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/m68hc11/m68hc11.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/m68hc11/m68hc11-protos.h (m68hc11_go_if_legitimate_address): Remove. * config/m68hc11/m68hc11.c (m68hc11_go_if_legitimate_address): Rename to... (m68hc11_legitimate_address_p): ... this, make static. (go_if_legitimate_address_internal): Rename to... (m68hc11_legitimate_address_p_1): ... this. (legitimize_address): Adjust call. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/iq2000/iq2000.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/iq2000/iq2000-protos.h (iq2000_legitimate_address_p): Remove. * config/iq2000/iq2000.c (iq2000_legitimate_address_p): Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/mn10300/mn10300.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/mn10300/mn10300-protos.h (legitimate_address_p): Remove. * config/mn10300/mn10300.c (legitimate_address_p): Rename to... (mn10300_legitimate_address_p): ... this, make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/m68k/m68k.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/m68k/m68k-protos.h (m68k_legitimate_address_p): Remove. * config/m68k/m68k.c (m68k_legitimate_address_p): Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/rs6000/rs6000.h (GO_IF_LEGITIMATE_ADDRESS): Delete. (REG_OK_STRICT_FLAG, REG_OK_FOR_BASE_P, REG_OK_FOR_INDEX_P): Delete. (INT_REG_OK_FOR_BASE_P, INT_REG_OK_FOR_INDEX_P): Move above. * config/rs6000/rs6000.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/rs6000/rs6000-protos.h (rs6000_legitimate_address): Remove. * config/rs6000/rs6000.c (rs6000_legitimate_address): Rename to... (rs6000_legitimate_address_p): ... this, make static. (TARGET_LEGITIMATE_ADDRESS_P): New. (REG_MODE_OK_FOR_BASE_P): Delete. (rs6000_legitimize_reload_address): Use INT_REG_OK_FOR_BASE_P. * config/picochip/picochip.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/picochip/picochip-protos.h (picochip_legitimate_address_p): Delete. * config/picochip/picochip.c (picochip_legitimate_address_p): Make static, adjust types. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/score/score.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/score/score.c (score_address_p): Rename to... (score_legitimate_address_p): ... this. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/score/score3.c (score3_address_p): Rename to... (score3_legitimate_address_p): ... this. * config/score/score7.c (score7_address_p): Rename to... (score7_legitimate_address_p): ... this. * config/arm/arm.h (ARM_GO_IF_LEGITIMATE_ADDRESS, THUMB2_GO_IF_LEGITIMATE_ADDRESS, THUMB1_GO_IF_LEGITIMATE_ADDRESS, GO_IF_LEGITIMATE_ADDRESS): Delete. * config/arm/arm-protos.h (thumb1_legitimate_address_p, thumb2_legitimate_address_p): Delete. (arm_legitimate_address_p): Rename to... (arm_legitimate_address_outer_p): ... this. * config/arm/constraints.md ("Uq"): Adjust call. * config/arm/predicates.md (arm_extendqisi_mem_op): Likewise. * config/arm/arm.c (arm_legitimate_address_p): New, rename old one to... (arm_legitimate_address_outer_p): ... this. (thumb1_legitimate_address_p, thumb2_legitimate_address_p): Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/mips/mips.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/mips/mips-protos.h (mips_legitimate_address_p): Remove. * config/mips/mips.c (mips_legitimate_address_p): ... Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/vax/vax.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/vax/vax-protos.h (legitimate_address_p): Remove. * config/vax/vax.c (legitimate_address_p): Rename to... (vax_legitimate_address_p): ... this, make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/h8300/h8300.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/h8300/h8300-protos.h (h8300_legitimate_address_p): Remove. * config/h8300/h8300.c (h8300_legitimate_address_p): ... Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/mmix/mmix.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/mmix/mmix-protos.h (mmix_legitimize_address): Remove. * config/mmix/mmix.c (mmix_legitimate_address): Rename to... (mmix_legitimate_address_p): ... this, make static. (TARGET_LEGITIMATE_ADDRESS_P): New. * config/bfin/bfin.h (GO_IF_LEGITIMATE_ADDRESS): Delete. * config/bfin/bfin-protos.h (bfin_legitimate_address_p): Remove. * config/bfin/bfin.c (bfin_legitimate_address_p): ... Make static. (TARGET_LEGITIMATE_ADDRESS_P): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147534 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 184 ++++++++++++++++++++++++++++++++++ gcc/config/alpha/alpha-protos.h | 1 - gcc/config/alpha/alpha.c | 7 +- gcc/config/alpha/alpha.h | 17 ---- gcc/config/arm/arm-protos.h | 4 +- gcc/config/arm/arm.c | 25 ++++- gcc/config/arm/arm.h | 32 ------ gcc/config/arm/constraints.md | 4 +- gcc/config/arm/predicates.md | 4 +- gcc/config/avr/avr-protos.h | 1 - gcc/config/avr/avr.c | 8 +- gcc/config/avr/avr.h | 14 --- gcc/config/bfin/bfin-protos.h | 1 - gcc/config/bfin/bfin.c | 25 ++++- gcc/config/bfin/bfin.h | 33 ------ gcc/config/crx/crx-protos.h | 1 - gcc/config/crx/crx.c | 12 ++- gcc/config/crx/crx.h | 14 --- gcc/config/frv/frv-protos.h | 2 +- gcc/config/frv/frv.c | 30 ++++-- gcc/config/frv/frv.h | 71 ------------- gcc/config/frv/predicates.md | 18 ++-- gcc/config/h8300/h8300-protos.h | 1 - gcc/config/h8300/h8300.c | 7 +- gcc/config/h8300/h8300.h | 18 ---- gcc/config/i386/i386-protos.h | 1 - gcc/config/i386/i386.c | 28 +++--- gcc/config/i386/i386.h | 16 --- gcc/config/iq2000/iq2000-protos.h | 1 - gcc/config/iq2000/iq2000.c | 10 +- gcc/config/iq2000/iq2000.h | 14 --- gcc/config/m32c/m32c-protos.h | 1 - gcc/config/m32c/m32c.c | 16 +-- gcc/config/m32c/m32c.h | 4 - gcc/config/m68hc11/m68hc11-protos.h | 2 - gcc/config/m68hc11/m68hc11.c | 20 ++-- gcc/config/m68hc11/m68hc11.h | 13 --- gcc/config/m68k/m68k-protos.h | 1 - gcc/config/m68k/m68k.c | 4 + gcc/config/m68k/m68k.h | 8 -- gcc/config/mips/mips-protos.h | 1 - gcc/config/mips/mips.c | 8 +- gcc/config/mips/mips.h | 16 +-- gcc/config/mmix/mmix-protos.h | 1 - gcc/config/mmix/mmix.c | 15 +-- gcc/config/mmix/mmix.h | 4 - gcc/config/mn10300/mn10300-protos.h | 1 - gcc/config/mn10300/mn10300.c | 20 +++- gcc/config/mn10300/mn10300.h | 28 ------ gcc/config/picochip/picochip-protos.h | 1 - gcc/config/picochip/picochip.c | 8 +- gcc/config/picochip/picochip.h | 12 --- gcc/config/rs6000/rs6000-protos.h | 1 - gcc/config/rs6000/rs6000.c | 21 ++-- gcc/config/rs6000/rs6000.h | 69 +++---------- gcc/config/s390/constraints.md | 2 +- gcc/config/s390/s390-protos.h | 1 - gcc/config/s390/s390.c | 11 +- gcc/config/s390/s390.h | 26 +---- gcc/config/score/score.c | 11 +- gcc/config/score/score.h | 10 -- gcc/config/score/score3.c | 4 +- gcc/config/score/score3.h | 3 +- gcc/config/score/score7.c | 4 +- gcc/config/score/score7.h | 3 +- gcc/config/sparc/sparc-protos.h | 1 - gcc/config/sparc/sparc.c | 10 +- gcc/config/sparc/sparc.h | 14 --- gcc/config/spu/spu-protos.h | 2 - gcc/config/spu/spu.c | 10 +- gcc/config/spu/spu.h | 11 -- gcc/config/stormy16/stormy16-protos.h | 1 - gcc/config/stormy16/stormy16.c | 7 +- gcc/config/stormy16/stormy16.h | 14 --- gcc/config/vax/vax-protos.h | 8 +- gcc/config/vax/vax.c | 6 +- gcc/config/vax/vax.h | 10 -- gcc/config/xtensa/xtensa-protos.h | 1 - gcc/config/xtensa/xtensa.c | 4 + gcc/config/xtensa/xtensa.h | 7 -- gcc/doc/tm.texi | 81 ++++++++------- gcc/ira-conflicts.c | 8 +- gcc/recog.c | 4 + gcc/reload.c | 4 + gcc/target-def.h | 2 + gcc/target.h | 3 + gcc/targhooks.c | 16 +++ gcc/targhooks.h | 2 + 88 files changed, 533 insertions(+), 647 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 74a7376..36e48a2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,189 @@ 2009-05-14 Paolo Bonzini + * doc/tm.texi (TARGET_LEGITIMATE_ADDRESS_P): Refer mainly to this + in the former documentation of... + (GO_IF_LEGITIMATE_ADDRESS): ... this. + * ira-conflicts.c (get_dup_num): Use address_operand. + * targhooks.c (default_legitimate_address_p): New. + * targhooks.h (default_legitimate_address_p): New. + * reload.c (strict_memory_address_p) [!GO_IF_LEGITIMATE_ADDRESS]: + Call hook. + * recog.c (memory_address_p) [!GO_IF_LEGITIMATE_ADDRESS]: Call hook. + * target.h (struct target): Add legitimate_address_p. + * target-def.h (TARGET_LEGITIMATE_ADDRESS_P): New. + (TARGET_INITIALIZER): Include it. + + * config/alpha/alpha.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/alpha/alpha-protos.h (alpha_legitimate_address_p): Remove. + * config/alpha/alpha.c (alpha_legitimate_address_p): Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/frv/frv.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + (REG_OK_STRICT_P): Delete. + * config/frv/frv-protos.h (frv_legitimate_address_p): Rename to... + (frv_legitimate_address_p_1): ... this. + * config/frv/frv.c (frv_legitimate_address_p): Forward to... + (frv_legitimate_address_p_1): ... the renamed old + frv_legitimate_address_p. + * config/frv/predicates.md: Adjust calls to frv_legitimate_address_p. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/s390/s390.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/s390/s390-protos.h (legitimate_address_p): Remove. + * config/s390/s390.c (legitimate_address_p): Rename to... + (s390_legitimate_address_p): ... this, make static. + (legitimize_address): Adjust call. + (TARGET_LEGITIMATE_ADDRESS_P): New. + * config/s390/constraints.md ("e"): Call strict_memory_address_p. + + * config/m32c/m32c.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/m32c/m32c-protos.h (m32c_legitimate_address_p): Remove. + * config/m32c/m32c.c (m32c_legitimate_address_p): Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/spu/spu.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/spu/spu-protos.h (spu_legitimate_address): Remove. + * config/spu/spu.c (spu_legitimate_address): Rename to... + (spu_legitimate_address_p): ... this, make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/sparc/sparc.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/sparc/sparc-protos.h (legitimate_address_p): Remove. + * config/sparc/sparc.c (legitimate_address_p): Rename to... + (sparc_legitimate_address_p): ... this, make static and return bool. + (legitimize_address): Adjust call. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/i386/i386.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/i386/i386-protos.h (legitimate_address_p): Remove. + * config/i386/i386.c (legitimate_address_p): Rename to... + (ix86_legitimate_address_p): ... this, make static. + (constant_address_p): Move after it, adjust call. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/avr/avr.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/avr/avr-protos.h (legitimate_address_p): Remove. + * config/avr/avr.c (legitimate_address_p): Rename to... + (avr_legitimate_address_p): ... this, make static. + (legitimize_address): Adjust call. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/crx/crx.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/crx/crx-protos.h (crx_legitimate_address_p): Remove. + * config/crx/crx.c (crx_legitimate_address_p): Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/xtensa/xtensa.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/xtensa/xtensa-protos.h (xtensa_legitimate_address_p): Remove. + * config/xtensa/xtensa.c (xtensa_legitimate_address_p): Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/stormy16/stormy16.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/stormy16/stormy16-protos.h (xstormy16_legitimate_address_p): + Remove. + * config/stormy16/stormy16.c (xstormy16_legitimate_address_p): + Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/m68hc11/m68hc11.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/m68hc11/m68hc11-protos.h (m68hc11_go_if_legitimate_address): + Remove. + * config/m68hc11/m68hc11.c (m68hc11_go_if_legitimate_address): + Rename to... + (m68hc11_legitimate_address_p): ... this, make static. + (go_if_legitimate_address_internal): Rename to... + (m68hc11_legitimate_address_p_1): ... this. + (legitimize_address): Adjust call. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/iq2000/iq2000.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/iq2000/iq2000-protos.h (iq2000_legitimate_address_p): + Remove. + * config/iq2000/iq2000.c (iq2000_legitimate_address_p): + Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/mn10300/mn10300.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/mn10300/mn10300-protos.h (legitimate_address_p): Remove. + * config/mn10300/mn10300.c (legitimate_address_p): Rename to... + (mn10300_legitimate_address_p): ... this, make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/m68k/m68k.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/m68k/m68k-protos.h (m68k_legitimate_address_p): Remove. + * config/m68k/m68k.c (m68k_legitimate_address_p): Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/rs6000/rs6000.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + (REG_OK_STRICT_FLAG, REG_OK_FOR_BASE_P, REG_OK_FOR_INDEX_P): Delete. + (INT_REG_OK_FOR_BASE_P, INT_REG_OK_FOR_INDEX_P): Move above. + * config/rs6000/rs6000.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/rs6000/rs6000-protos.h (rs6000_legitimate_address): Remove. + * config/rs6000/rs6000.c (rs6000_legitimate_address): Rename to... + (rs6000_legitimate_address_p): ... this, make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + (REG_MODE_OK_FOR_BASE_P): Delete. + (rs6000_legitimize_reload_address): Use INT_REG_OK_FOR_BASE_P. + + * config/picochip/picochip.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/picochip/picochip-protos.h (picochip_legitimate_address_p): + Delete. + * config/picochip/picochip.c (picochip_legitimate_address_p): Make + static, adjust types. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/score/score.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/score/score.c (score_address_p): Rename to... + (score_legitimate_address_p): ... this. + (TARGET_LEGITIMATE_ADDRESS_P): New. + * config/score/score3.c (score3_address_p): Rename to... + (score3_legitimate_address_p): ... this. + * config/score/score7.c (score7_address_p): Rename to... + (score7_legitimate_address_p): ... this. + + * config/arm/arm.h (ARM_GO_IF_LEGITIMATE_ADDRESS, + THUMB2_GO_IF_LEGITIMATE_ADDRESS, THUMB1_GO_IF_LEGITIMATE_ADDRESS, + GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/arm/arm-protos.h (thumb1_legitimate_address_p, + thumb2_legitimate_address_p): Delete. + (arm_legitimate_address_p): Rename to... + (arm_legitimate_address_outer_p): ... this. + * config/arm/constraints.md ("Uq"): Adjust call. + * config/arm/predicates.md (arm_extendqisi_mem_op): Likewise. + * config/arm/arm.c (arm_legitimate_address_p): New, rename old one to... + (arm_legitimate_address_outer_p): ... this. + (thumb1_legitimate_address_p, thumb2_legitimate_address_p): Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/mips/mips.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/mips/mips-protos.h (mips_legitimate_address_p): Remove. + * config/mips/mips.c (mips_legitimate_address_p): ... Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/vax/vax.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/vax/vax-protos.h (legitimate_address_p): Remove. + * config/vax/vax.c (legitimate_address_p): Rename to... + (vax_legitimate_address_p): ... this, make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/h8300/h8300.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/h8300/h8300-protos.h (h8300_legitimate_address_p): Remove. + * config/h8300/h8300.c (h8300_legitimate_address_p): ... Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/mmix/mmix.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/mmix/mmix-protos.h (mmix_legitimize_address): Remove. + * config/mmix/mmix.c (mmix_legitimate_address): Rename to... + (mmix_legitimate_address_p): ... this, make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + + * config/bfin/bfin.h (GO_IF_LEGITIMATE_ADDRESS): Delete. + * config/bfin/bfin-protos.h (bfin_legitimate_address_p): Remove. + * config/bfin/bfin.c (bfin_legitimate_address_p): ... Make static. + (TARGET_LEGITIMATE_ADDRESS_P): New. + +2009-05-14 Paolo Bonzini + * config/arm/arm.h (PROMOTE_FUNCTION_MODE): Remove handling of MODE_COMPLEX_INT. diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h index 7a12d49..80c1e4f 100644 --- a/gcc/config/alpha/alpha-protos.h +++ b/gcc/config/alpha/alpha-protos.h @@ -38,7 +38,6 @@ extern rtx alpha_tablejump_addr_vec (rtx); extern rtx alpha_tablejump_best_label (rtx); extern bool alpha_legitimate_constant_p (rtx); -extern bool alpha_legitimate_address_p (enum machine_mode, rtx, int); extern rtx alpha_legitimize_reload_address (rtx, enum machine_mode, int, int, int); diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index a9b12a8..368ef50 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -801,8 +801,8 @@ alpha_linkage_symbol_p (const char *symname) any of those forms can be surrounded with an AND that clear the low-order three bits; this is an "unaligned" access. */ -bool -alpha_legitimate_address_p (enum machine_mode mode, rtx x, int strict) +static bool +alpha_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { /* If this is an ldq_u type address, discard the outer AND. */ if (mode == DImode @@ -10839,6 +10839,9 @@ alpha_init_libfuncs (void) #define TARGET_MANGLE_TYPE alpha_mangle_type #endif +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P alpha_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index ed9bd74..3bfbd50 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -974,23 +974,6 @@ do { \ #define REG_OK_FOR_BASE_P(X) NONSTRICT_REG_OK_FOR_BASE_P (X) #endif -/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression that is a - valid memory address for an instruction. */ - -#ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \ -do { \ - if (alpha_legitimate_address_p (MODE, X, 1)) \ - goto WIN; \ -} while (0) -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \ -do { \ - if (alpha_legitimate_address_p (MODE, X, 0)) \ - goto WIN; \ -} while (0) -#endif - /* Try a machine-dependent way of reloading an illegitimate address operand. If we find one, push the reload and jump to WIN. This macro is used in only one place: `find_reloads_address' in reload.c. */ diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 34d266b..3b7ba79 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -54,9 +54,7 @@ extern RTX_CODE arm_canonicalize_comparison (RTX_CODE, enum machine_mode, extern int legitimate_pic_operand_p (rtx); extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx); extern rtx legitimize_tls_address (rtx, rtx); -extern int arm_legitimate_address_p (enum machine_mode, rtx, RTX_CODE, int); -extern int thumb1_legitimate_address_p (enum machine_mode, rtx, int); -extern int thumb2_legitimate_address_p (enum machine_mode, rtx, int); +extern int arm_legitimate_address_outer_p (enum machine_mode, rtx, RTX_CODE, int); extern int thumb_legitimate_offset_p (enum machine_mode, HOST_WIDE_INT); extern rtx thumb_legitimize_reload_address (rtx *, enum machine_mode, int, int, int); diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 18e009d..464bba5 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -76,6 +76,7 @@ static int thumb1_base_register_rtx_p (rtx, enum machine_mode, int); static rtx arm_legitimize_address (rtx, rtx, enum machine_mode); static rtx thumb_legitimize_address (rtx, rtx, enum machine_mode); inline static int thumb1_index_register_rtx_p (rtx, int); +static bool arm_legitimate_address_p (enum machine_mode, rtx, bool); static int thumb_far_jump_used_p (void); static bool thumb_force_lr_save (void); static int const_ok_for_op (HOST_WIDE_INT, enum rtx_code); @@ -403,6 +404,9 @@ static bool arm_allocate_stack_slots_for_args (void); #define TARGET_ASM_OUTPUT_DWARF_DTPREL arm_output_dwarf_dtprel #endif +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P arm_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; /* Obstack for minipool constant handling. */ @@ -3914,8 +3918,8 @@ pcrel_constant_p (rtx x) /* Return nonzero if X is a valid ARM state address operand. */ int -arm_legitimate_address_p (enum machine_mode mode, rtx x, RTX_CODE outer, - int strict_p) +arm_legitimate_address_outer_p (enum machine_mode mode, rtx x, RTX_CODE outer, + int strict_p) { bool use_ldrd; enum rtx_code code = GET_CODE (x); @@ -3999,7 +4003,7 @@ arm_legitimate_address_p (enum machine_mode mode, rtx x, RTX_CODE outer, } /* Return nonzero if X is a valid Thumb-2 address operand. */ -int +static int thumb2_legitimate_address_p (enum machine_mode mode, rtx x, int strict_p) { bool use_ldrd; @@ -4305,7 +4309,7 @@ thumb1_index_register_rtx_p (rtx x, int strict_p) addresses based on the frame pointer or arg pointer until the reload pass starts. This is so that eliminating such addresses into stack based ones won't produce impossible code. */ -int +static int thumb1_legitimate_address_p (enum machine_mode mode, rtx x, int strict_p) { /* ??? Not clear if this is right. Experiment. */ @@ -4419,6 +4423,17 @@ thumb_legitimate_offset_p (enum machine_mode mode, HOST_WIDE_INT val) } } +bool +arm_legitimate_address_p (enum machine_mode mode, rtx x, bool strict_p) +{ + if (TARGET_ARM) + return arm_legitimate_address_outer_p (mode, x, SET, strict_p); + else if (TARGET_THUMB2) + return thumb2_legitimate_address_p (mode, x, strict_p); + else /* if (TARGET_THUMB1) */ + return thumb1_legitimate_address_p (mode, x, strict_p); +} + /* Build the SYMBOL_REF for __tls_get_addr. */ static GTY(()) rtx tls_get_addr_libfunc; @@ -4654,7 +4669,7 @@ arm_legitimize_address (rtx x, rtx orig_x, enum machine_mode mode) } /* XXX We don't allow MINUS any more -- see comment in - arm_legitimate_address_p (). */ + arm_legitimate_address_outer_p (). */ else if (GET_CODE (x) == MINUS) { rtx xop0 = XEXP (x, 0); diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 56d1a33..ee0eee6 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2161,43 +2161,11 @@ typedef struct #define REG_MODE_OK_FOR_REG_BASE_P(X, MODE) \ REG_OK_FOR_INDEX_P (X) -/* 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 ARM_BASE_REGISTER_RTX_P(X) \ (GET_CODE (X) == REG && ARM_REG_OK_FOR_BASE_P (X)) #define ARM_INDEX_REGISTER_RTX_P(X) \ (GET_CODE (X) == REG && ARM_REG_OK_FOR_INDEX_P (X)) - -#define ARM_GO_IF_LEGITIMATE_ADDRESS(MODE,X,WIN) \ - { \ - if (arm_legitimate_address_p (MODE, X, SET, REG_STRICT_P)) \ - goto WIN; \ - } - -#define THUMB2_GO_IF_LEGITIMATE_ADDRESS(MODE,X,WIN) \ - { \ - if (thumb2_legitimate_address_p (MODE, X, REG_STRICT_P)) \ - goto WIN; \ - } - -#define THUMB1_GO_IF_LEGITIMATE_ADDRESS(MODE,X,WIN) \ - { \ - if (thumb1_legitimate_address_p (MODE, X, REG_STRICT_P)) \ - goto WIN; \ - } - -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \ - if (TARGET_ARM) \ - ARM_GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN) \ - else if (TARGET_THUMB2) \ - THUMB2_GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN) \ - else /* if (TARGET_THUMB1) */ \ - THUMB1_GO_IF_LEGITIMATE_ADDRESS (MODE, X, WIN) - /* Define this for compatibility reasons. */ #define HANDLE_PRAGMA_PACK_PUSH_POP diff --git a/gcc/config/arm/constraints.md b/gcc/config/arm/constraints.md index 0c8fa73..b5ade5c 100644 --- a/gcc/config/arm/constraints.md +++ b/gcc/config/arm/constraints.md @@ -231,8 +231,8 @@ In ARM state an address valid in ldrsb instructions." (and (match_code "mem") (match_test "TARGET_ARM - && arm_legitimate_address_p (GET_MODE (op), XEXP (op, 0), - SIGN_EXTEND, 0)"))) + && arm_legitimate_address_outer_p (GET_MODE (op), XEXP (op, 0), + SIGN_EXTEND, 0)"))) (define_memory_constraint "Q" "@internal diff --git a/gcc/config/arm/predicates.md b/gcc/config/arm/predicates.md index b45faf4..7997cc9 100644 --- a/gcc/config/arm/predicates.md +++ b/gcc/config/arm/predicates.md @@ -235,8 +235,8 @@ (define_special_predicate "arm_extendqisi_mem_op" (and (match_operand 0 "memory_operand") - (match_test "arm_legitimate_address_p (mode, XEXP (op, 0), SIGN_EXTEND, - 0)"))) + (match_test "arm_legitimate_address_outer_p (mode, XEXP (op, 0), + SIGN_EXTEND, 0)"))) (define_special_predicate "arm_reg_or_extendqisi_mem_op" (ior (match_operand 0 "arm_extendqisi_mem_op") diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index f4d2119..03b84c0 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -61,7 +61,6 @@ extern void function_arg_advance (CUMULATIVE_ARGS *cum, #ifdef RTX_CODE extern void asm_output_external_libcall (FILE *file, rtx symref); -extern int legitimate_address_p (enum machine_mode mode, rtx x, int strict); extern int compare_diff_p (rtx insn); extern const char *output_movqi (rtx insn, rtx operands[], int *l); extern const char *output_movhi (rtx insn, rtx operands[], int *l); diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 4811b92..ed668b6 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -71,6 +71,7 @@ const struct attribute_spec avr_attribute_table[]; static bool avr_assemble_integer (rtx, unsigned int, int); static void avr_file_start (void); static void avr_file_end (void); +static bool avr_legitimate_address_p (enum machine_mode, rtx, bool); static void avr_asm_function_end_prologue (FILE *); static void avr_asm_function_begin_epilogue (FILE *); static rtx avr_function_value (const_tree, const_tree, bool); @@ -367,6 +368,9 @@ static const struct mcu_type_s avr_mcu_types[] = { #undef TARGET_CASE_VALUES_THRESHOLD #define TARGET_CASE_VALUES_THRESHOLD avr_case_values_threshold +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P avr_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; void @@ -1099,8 +1103,8 @@ avr_asm_function_begin_epilogue (FILE *file) /* Return nonzero if X (an RTX) is a legitimate memory address on the target machine for a memory operand of mode MODE. */ -int -legitimate_address_p (enum machine_mode mode, rtx x, int strict) +bool +avr_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { enum reg_class r = NO_REGS; diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 79d81b9..d431790 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -408,20 +408,6 @@ extern int avr_reg_order[]; #define MAX_REGS_PER_ADDRESS 1 -#ifdef REG_OK_STRICT -# define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \ -{ \ - if (legitimate_address_p (mode, operand, 1)) \ - goto ADDR; \ -} -# else -# define GO_IF_LEGITIMATE_ADDRESS(mode, operand, ADDR) \ -{ \ - if (legitimate_address_p (mode, operand, 0)) \ - goto ADDR; \ -} -#endif - #define REG_OK_FOR_BASE_NOSTRICT_P(X) \ (REGNO (X) >= FIRST_PSEUDO_REGISTER || REG_OK_FOR_BASE_STRICT_P(X)) diff --git a/gcc/config/bfin/bfin-protos.h b/gcc/config/bfin/bfin-protos.h index 33de846..1354241 100644 --- a/gcc/config/bfin/bfin-protos.h +++ b/gcc/config/bfin/bfin-protos.h @@ -146,7 +146,6 @@ extern rtx bfin_gen_compare (rtx, Mmode); extern int bfin_local_alignment (tree, int); extern void initialize_trampoline (rtx, rtx, rtx); -extern bool bfin_legitimate_address_p (Mmode, rtx, int); extern rtx bfin_va_arg (tree, tree); extern void bfin_expand_prologue (void); diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index ac237d7..f4a8c4d 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -2895,8 +2895,26 @@ bfin_valid_reg_p (unsigned int regno, int strict, enum machine_mode mode, return REGNO_OK_FOR_BASE_NONSTRICT_P (regno, mode, outer_code, SCRATCH); } -bool -bfin_legitimate_address_p (enum machine_mode mode, rtx x, int strict) +/* Recognize 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. + + Blackfin addressing modes are as follows: + + [preg] + [preg + imm16] + + B [ Preg + uimm15 ] + W [ Preg + uimm16m2 ] + [ Preg + uimm17m4 ] + + [preg++] + [preg--] + [--sp] +*/ + +static bool +bfin_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { switch (GET_CODE (x)) { case REG: @@ -6318,4 +6336,7 @@ bfin_expand_builtin (tree exp, rtx target ATTRIBUTE_UNUSED, #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY bfin_return_in_memory +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P bfin_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h index 352f4b4..7cd6756 100644 --- a/gcc/config/bfin/bfin.h +++ b/gcc/config/bfin/bfin.h @@ -912,42 +912,9 @@ typedef struct { would ever accept. */ #define MAX_REGS_PER_ADDRESS 1 -/* 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. - - Blackfin addressing modes are as follows: - - [preg] - [preg + imm16] - - B [ Preg + uimm15 ] - W [ Preg + uimm16m2 ] - [ Preg + uimm17m4 ] - - [preg++] - [preg--] - [--sp] -*/ - #define LEGITIMATE_MODE_FOR_AUTOINC_P(MODE) \ (GET_MODE_SIZE (MODE) <= 4 || (MODE) == PDImode) -#ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \ - do { \ - if (bfin_legitimate_address_p (MODE, X, 1)) \ - goto WIN; \ - } while (0); -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, WIN) \ - do { \ - if (bfin_legitimate_address_p (MODE, X, 0)) \ - goto WIN; \ - } while (0); -#endif - #define HAVE_POST_INCREMENT 1 #define HAVE_POST_DECREMENT 1 #define HAVE_PRE_DECREMENT 1 diff --git a/gcc/config/crx/crx-protos.h b/gcc/config/crx/crx-protos.h index 386fab9..b35051d 100644 --- a/gcc/config/crx/crx-protos.h +++ b/gcc/config/crx/crx-protos.h @@ -53,7 +53,6 @@ enum crx_addrtype }; extern enum crx_addrtype crx_decompose_address (rtx addr, struct crx_address *out); -extern int crx_legitimate_address_p (enum machine_mode, rtx, int); extern int crx_const_double_ok (rtx op); diff --git a/gcc/config/crx/crx.c b/gcc/config/crx/crx.c index cc3248f..c45189e 100644 --- a/gcc/config/crx/crx.c +++ b/gcc/config/crx/crx.c @@ -133,6 +133,14 @@ static rtx crx_struct_value_rtx (tree fntype ATTRIBUTE_UNUSED, int incoming ATTRIBUTE_UNUSED); static bool crx_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED); static int crx_address_cost (rtx, bool); +static bool crx_legitimate_address_p (enum machine_mode, rtx, bool); + +/*****************************************************************************/ +/* RTL VALIDITY */ +/*****************************************************************************/ + +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P crx_legitimate_address_p /*****************************************************************************/ /* STACK LAYOUT AND CALLING CONVENTIONS */ @@ -722,9 +730,9 @@ crx_decompose_address (rtx addr, struct crx_address *out) return retval; } -int +bool crx_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, - rtx addr, int strict) + rtx addr, bool strict) { enum crx_addrtype addrtype; struct crx_address address; diff --git a/gcc/config/crx/crx.h b/gcc/config/crx/crx.h index cac4657..d22db7d 100644 --- a/gcc/config/crx/crx.h +++ b/gcc/config/crx/crx.h @@ -404,20 +404,6 @@ struct cumulative_args #define REG_OK_FOR_INDEX_P(X) 1 #endif /* REG_OK_STRICT */ -#ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ -{ \ - if (crx_legitimate_address_p (MODE, X, 1)) \ - goto LABEL; \ -} -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ -{ \ - if (crx_legitimate_address_p (MODE, X, 0)) \ - goto LABEL; \ -} -#endif /* REG_OK_STRICT */ - #define LEGITIMATE_CONSTANT_P(X) 1 /*****************************************************************************/ diff --git a/gcc/config/frv/frv-protos.h b/gcc/config/frv/frv-protos.h index 98ada22..56f4243 100644 --- a/gcc/config/frv/frv-protos.h +++ b/gcc/config/frv/frv-protos.h @@ -47,7 +47,7 @@ extern int frv_frame_pointer_required (void); extern int frv_initial_elimination_offset (int, int); #ifdef RTX_CODE -extern int frv_legitimate_address_p (enum machine_mode, rtx, +extern int frv_legitimate_address_p_1 (enum machine_mode, rtx, int, int, int); extern rtx frv_find_base_term (rtx); diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c index e547652..1db3496 100644 --- a/gcc/config/frv/frv.c +++ b/gcc/config/frv/frv.c @@ -264,6 +264,7 @@ frv_cpu_t frv_cpu_type = CPU_TYPE; /* value of -mcpu= */ /* Forward references */ static bool frv_handle_option (size_t, const char *, int); +static bool frv_legitimate_address_p (enum machine_mode, rtx, bool); static int frv_default_flags_for_cpu (void); static int frv_string_begins_with (const_tree, const char *); static FRV_INLINE bool frv_small_data_reloc_p (rtx, int); @@ -467,6 +468,9 @@ static bool frv_secondary_reload (bool, rtx, enum reg_class, #undef TARGET_SECONDARY_RELOAD #define TARGET_SECONDARY_RELOAD frv_secondary_reload +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P frv_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; #define FRV_SYMBOL_REF_TLS_P(RTX) \ @@ -2532,7 +2536,7 @@ frv_return_addr_rtx (int count, rtx frame) MEMREF has already happened. MEMREF must be a legitimate operand for modes larger than SImode. - GO_IF_LEGITIMATE_ADDRESS forbids register+register addresses, which + frv_legitimate_address_p forbids register+register addresses, which this function cannot handle. */ rtx frv_index_memory (rtx memref, enum machine_mode mode, int index) @@ -3358,11 +3362,11 @@ frv_regno_ok_for_base_p (int regno, int strict_p) `PRINT_OPERAND_ADDRESS'. */ int -frv_legitimate_address_p (enum machine_mode mode, - rtx x, - int strict_p, - int condexec_p, - int allow_double_reg_p) +frv_legitimate_address_p_1 (enum machine_mode mode, + rtx x, + int strict_p, + int condexec_p, + int allow_double_reg_p) { rtx x0, x1; int ret = 0; @@ -3489,6 +3493,12 @@ frv_legitimate_address_p (enum machine_mode mode, return ret; } +bool +frv_legitimate_address_p (enum machine_mode mode, rtx x, bool strict_p) +{ + return frv_legitimate_address_p_1 (mode, x, strict_p, FALSE, FALSE); +} + /* Given an ADDR, generate code to inline the PLT. */ static rtx gen_inlined_tls_plt (rtx addr) @@ -3783,8 +3793,8 @@ frv_legitimate_memory_operand (rtx op, enum machine_mode mode, int condexec_p) { return ((GET_MODE (op) == mode || mode == VOIDmode) && GET_CODE (op) == MEM - && frv_legitimate_address_p (mode, XEXP (op, 0), - reload_completed, condexec_p, FALSE)); + && frv_legitimate_address_p_1 (mode, XEXP (op, 0), + reload_completed, condexec_p, FALSE)); } void @@ -3944,7 +3954,7 @@ condexec_memory_operand (rtx op, enum machine_mode mode) return FALSE; addr = XEXP (op, 0); - return frv_legitimate_address_p (mode, addr, reload_completed, TRUE, FALSE); + return frv_legitimate_address_p_1 (mode, addr, reload_completed, TRUE, FALSE); } /* Return true if the bare return instruction can be used outside of the @@ -5846,7 +5856,7 @@ frv_ifcvt_rewrite_mem (rtx mem, enum machine_mode mode, rtx insn) { rtx addr = XEXP (mem, 0); - if (!frv_legitimate_address_p (mode, addr, reload_completed, TRUE, FALSE)) + if (!frv_legitimate_address_p_1 (mode, addr, reload_completed, TRUE, FALSE)) { if (GET_CODE (addr) == PLUS) { diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index e510de0..e605bb2 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -2025,77 +2025,6 @@ __asm__("\n" \ number that `GO_IF_LEGITIMATE_ADDRESS' would ever accept. */ #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. - - It usually pays to define several simpler macros to serve as subroutines for - this one. Otherwise it may be too complicated to understand. - - This macro must exist in two variants: a strict variant and a non-strict - one. The strict variant is used in the reload pass. It must be defined so - that any pseudo-register that has not been allocated a hard register is - considered a memory reference. In contexts where some kind of register is - required, a pseudo-register with no hard register must be rejected. - - The non-strict variant is used in other passes. It must be defined to - accept all pseudo-registers in every context where some kind of register is - required. - - Compiler source files that want to use the strict variant of this macro - define the macro `REG_OK_STRICT'. You should use an `#ifdef REG_OK_STRICT' - conditional to define the strict variant in that case and the non-strict - variant otherwise. - - Subroutines to check for acceptable registers for various purposes (one for - base registers, one for index registers, and so on) are typically among the - subroutines used to define `GO_IF_LEGITIMATE_ADDRESS'. Then only these - subroutine macros need have two variants; the higher levels of macros may be - the same whether strict or not. - - Normally, constant addresses which are the sum of a `symbol_ref' and an - integer are stored inside a `const' RTX to mark them as constant. - Therefore, there is no need to recognize such sums specifically as - legitimate addresses. Normally you would simply recognize any `const' as - legitimate. - - Usually `PRINT_OPERAND_ADDRESS' is not prepared to handle constant sums that - are not marked with `const'. It assumes that a naked `plus' indicates - indexing. If so, then you *must* reject such naked constant sums as - illegitimate addresses, so that none of them will be given to - `PRINT_OPERAND_ADDRESS'. - - On some machines, whether a symbolic address is legitimate depends on the - section that the address refers to. On these machines, define the macro - `ENCODE_SECTION_INFO' to store the information into the `symbol_ref', and - then check for it here. When you see a `const', you will have to look - inside it to find the `symbol_ref' in order to determine the section. - - The best way to modify the name string is by adding text to the beginning, - with suitable punctuation to prevent any ambiguity. Allocate the new name - in `saveable_obstack'. You will have to modify `ASM_OUTPUT_LABELREF' to - remove and decode the added text and output the name accordingly, and define - `(* targetm.strip_name_encoding)' to access the original name string. - - You can check the information stored here into the `symbol_ref' in the - definitions of the macros `GO_IF_LEGITIMATE_ADDRESS' and - `PRINT_OPERAND_ADDRESS'. */ - -#ifdef REG_OK_STRICT -#define REG_OK_STRICT_P 1 -#else -#define REG_OK_STRICT_P 0 -#endif - -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ - do \ - { \ - if (frv_legitimate_address_p (MODE, X, REG_OK_STRICT_P, \ - FALSE, FALSE)) \ - 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. For hard registers, it should always accept those which the hardware permits and reject the others. Whether the macro accepts diff --git a/gcc/config/frv/predicates.md b/gcc/config/frv/predicates.md index 5f7ef4e..4ecfa9a 100644 --- a/gcc/config/frv/predicates.md +++ b/gcc/config/frv/predicates.md @@ -239,8 +239,8 @@ subreg = SUBREG_REG (op); code = GET_CODE (subreg); if (code == MEM) - return frv_legitimate_address_p (mode, XEXP (subreg, 0), - reload_completed, FALSE, FALSE); + return frv_legitimate_address_p_1 (mode, XEXP (subreg, 0), + reload_completed, FALSE, FALSE); return (code == REG); @@ -278,8 +278,8 @@ subreg = SUBREG_REG (op); code = GET_CODE (subreg); if (code == MEM) - return frv_legitimate_address_p (mode, XEXP (subreg, 0), - reload_completed, FALSE, FALSE); + return frv_legitimate_address_p_1 (mode, XEXP (subreg, 0), + reload_completed, FALSE, FALSE); return (code == REG); @@ -334,8 +334,8 @@ subreg = SUBREG_REG (op); code = GET_CODE (subreg); if (code == MEM) - return frv_legitimate_address_p (mode, XEXP (subreg, 0), - reload_completed, TRUE, FALSE); + return frv_legitimate_address_p_1 (mode, XEXP (subreg, 0), + reload_completed, TRUE, FALSE); return (code == REG); @@ -373,8 +373,8 @@ subreg = SUBREG_REG (op); code = GET_CODE (subreg); if (code == MEM) - return frv_legitimate_address_p (mode, XEXP (subreg, 0), - reload_completed, TRUE, FALSE); + return frv_legitimate_address_p_1 (mode, XEXP (subreg, 0), + reload_completed, TRUE, FALSE); return (code == REG); @@ -599,7 +599,7 @@ if (GET_MODE (op) != mode && GET_MODE (op) != VOIDmode) return FALSE; - return frv_legitimate_address_p (DImode, op, reload_completed, FALSE, TRUE); + return frv_legitimate_address_p_1 (DImode, op, reload_completed, FALSE, TRUE); }) ;; TODO: Add a comment here. diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index 4a0b647..35023c6 100644 --- a/gcc/config/h8300/h8300-protos.h +++ b/gcc/config/h8300/h8300-protos.h @@ -60,7 +60,6 @@ extern int same_cmp_preceding_p (rtx); extern int same_cmp_following_p (rtx); extern int h8300_legitimate_constant_p (rtx); -extern int h8300_legitimate_address_p (enum machine_mode, rtx, int); /* Used in builtins.c */ extern rtx h8300_return_addr_rtx (int, rtx); diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 9946d28..8630823 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -5686,8 +5686,8 @@ h8300_rtx_ok_for_base_p (rtx x, int strict) legitimate address has the form REG, REG+CONSTANT_ADDRESS or CONSTANT_ADDRESS. */ -int -h8300_legitimate_address_p (enum machine_mode mode, rtx x, int strict) +static bool +h8300_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { /* The register indirect addresses like @er0 is always valid. */ if (h8300_rtx_ok_for_base_p (x, strict)) @@ -5795,6 +5795,9 @@ h8300_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) #undef TARGET_HARD_REGNO_SCRATCH_OK #define TARGET_HARD_REGNO_SCRATCH_OK h8300_hard_regno_scratch_ok +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P h8300_legitimate_address_p + #undef TARGET_DEFAULT_TARGET_FLAGS #define TARGET_DEFAULT_TARGET_FLAGS TARGET_DEFAULT diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 7e37113..dd95ed7 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -921,24 +921,6 @@ struct cum_arg ((C) == 'W') -#ifndef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ - do \ - { \ - if (h8300_legitimate_address_p ((MODE), (X), 0)) \ - goto ADDR; \ - } \ - while (0) -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ - do \ - { \ - if (h8300_legitimate_address_p ((MODE), (X), 1)) \ - goto ADDR; \ - } \ - while (0) -#endif - /* Go to LABEL if ADDR (a legitimate address expression) has an effect that depends on the machine mode it is used for. diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index 9452d2a..8ae5bd6 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -56,7 +56,6 @@ extern bool legitimate_constant_p (rtx); extern bool constant_address_p (rtx); extern bool legitimate_pic_operand_p (rtx); extern int legitimate_pic_address_disp_p (rtx); -extern int legitimate_address_p (enum machine_mode, rtx, int); extern void print_reg (rtx, int, FILE*); extern void print_operand (FILE*, rtx, int); diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index bb013a1..593ea84 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -9090,13 +9090,6 @@ ix86_cannot_force_const_mem (rtx x) return !legitimate_constant_p (x); } -/* Determine if a given RTX is a valid constant address. */ - -bool -constant_address_p (rtx x) -{ - return CONSTANT_P (x) && legitimate_address_p (Pmode, x, 1); -} /* Nonzero if the constant value X is a legitimate general operand when generating PIC code. It is given that flag_pic is on and @@ -9273,9 +9266,9 @@ legitimate_pic_address_disp_p (rtx disp) convert common non-canonical forms to canonical form so that they will be recognized. */ -int -legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, - rtx addr, int strict) +static bool +ix86_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, + rtx addr, bool strict) { struct ix86_address parts; rtx base, index, disp; @@ -9499,6 +9492,14 @@ legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, report_error: return FALSE; } + +/* Determine if a given RTX is a valid constant address. */ + +bool +constant_address_p (rtx x) +{ + return CONSTANT_P (x) && ix86_legitimate_address_p (Pmode, x, 1); +} /* Return a unique alias set for the GOT. */ @@ -10154,7 +10155,7 @@ ix86_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, } } - if (changed && legitimate_address_p (mode, x, FALSE)) + if (changed && ix86_legitimate_address_p (mode, x, FALSE)) return x; if (GET_CODE (XEXP (x, 0)) == MULT) @@ -10180,7 +10181,7 @@ ix86_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, x = legitimize_pic_address (x, 0); } - if (changed && legitimate_address_p (mode, x, FALSE)) + if (changed && ix86_legitimate_address_p (mode, x, FALSE)) return x; if (REG_P (XEXP (x, 0))) @@ -30267,6 +30268,9 @@ ix86_enum_va_list (int idx, const char **pname, tree *ptree) #undef TARGET_EXPAND_TO_RTL_HOOK #define TARGET_EXPAND_TO_RTL_HOOK ix86_maybe_switch_abi +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P ix86_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-i386.h" diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 4aafd9c..0a9e8a6 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1823,22 +1823,6 @@ typedef struct ix86_args { #define LEGITIMATE_CONSTANT_P(X) legitimate_constant_p (X) -#ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -do { \ - if (legitimate_address_p ((MODE), (X), 1)) \ - goto ADDR; \ -} while (0) - -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -do { \ - if (legitimate_address_p ((MODE), (X), 0)) \ - goto ADDR; \ -} while (0) - -#endif - /* If defined, a C expression to determine the base term of address X. This macro is used in only one place: `find_base_term' in alias.c. diff --git a/gcc/config/iq2000/iq2000-protos.h b/gcc/config/iq2000/iq2000-protos.h index a927452..0e4dba7 100644 --- a/gcc/config/iq2000/iq2000-protos.h +++ b/gcc/config/iq2000/iq2000-protos.h @@ -22,7 +22,6 @@ extern int iq2000_check_split (rtx, enum machine_mode); extern int iq2000_reg_mode_ok_for_base_p (rtx, enum machine_mode, int); -extern int iq2000_legitimate_address_p (enum machine_mode, rtx, int); extern const char * iq2000_fill_delay_slot (const char *, enum delay_type, rtx *, rtx); extern const char * iq2000_move_1word (rtx *, rtx, int); extern void override_options (void); diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c index 28bb7a8..d61ec3f 100644 --- a/gcc/config/iq2000/iq2000.c +++ b/gcc/config/iq2000/iq2000.c @@ -164,6 +164,7 @@ static bool iq2000_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode, static int iq2000_arg_partial_bytes (CUMULATIVE_ARGS *, enum machine_mode, tree, bool); static void iq2000_va_start (tree, rtx); +static bool iq2000_legitimate_address_p (enum machine_mode, rtx, bool); #undef TARGET_INIT_BUILTINS #define TARGET_INIT_BUILTINS iq2000_init_builtins @@ -212,6 +213,9 @@ static void iq2000_va_start (tree, rtx); #undef TARGET_EXPAND_BUILTIN_VA_START #define TARGET_EXPAND_BUILTIN_VA_START iq2000_va_start +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P iq2000_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; /* Return nonzero if we split the address into high and low parts. */ @@ -249,8 +253,8 @@ iq2000_reg_mode_ok_for_base_p (rtx reg, memory operand of the indicated MODE. STRICT is nonzero if this function is called during reload. */ -int -iq2000_legitimate_address_p (enum machine_mode mode, rtx xinsn, int strict) +bool +iq2000_legitimate_address_p (enum machine_mode mode, rtx xinsn, bool strict) { if (TARGET_DEBUG_A_MODE) { @@ -311,7 +315,7 @@ iq2000_legitimate_address_p (enum machine_mode mode, rtx xinsn, int strict) } if (TARGET_DEBUG_A_MODE) - GO_PRINTF ("Not a legitimate address\n"); + GO_PRINTF ("Not a enum machine_mode mode, legitimate address\n"); /* The address was not legitimate. */ return 0; diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h index 0664f51..c1506a4 100644 --- a/gcc/config/iq2000/iq2000.h +++ b/gcc/config/iq2000/iq2000.h @@ -528,20 +528,6 @@ typedef struct iq2000_args #define MAX_REGS_PER_ADDRESS 1 -#ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ - { \ - if (iq2000_legitimate_address_p (MODE, X, 1)) \ - goto ADDR; \ - } -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ - { \ - if (iq2000_legitimate_address_p (MODE, X, 0)) \ - goto ADDR; \ - } -#endif - #define REG_OK_FOR_INDEX_P(X) 0 #define LEGITIMATE_CONSTANT_P(X) (1) diff --git a/gcc/config/m32c/m32c-protos.h b/gcc/config/m32c/m32c-protos.h index ef85727..d332475 100644 --- a/gcc/config/m32c/m32c-protos.h +++ b/gcc/config/m32c/m32c-protos.h @@ -74,7 +74,6 @@ bool m32c_illegal_subreg_p (rtx); bool m32c_immd_dbl_mov (rtx *, MM); rtx m32c_incoming_return_addr_rtx (void); void m32c_initialize_trampoline (rtx, rtx, rtx); -int m32c_legitimate_address_p (MM, rtx, int); int m32c_legitimate_constant_p (rtx); int m32c_legitimize_reload_address (rtx *, MM, int, int, int); rtx m32c_libcall_value (MM); diff --git a/gcc/config/m32c/m32c.c b/gcc/config/m32c/m32c.c index 17d5dd3..989f823 100644 --- a/gcc/config/m32c/m32c.c +++ b/gcc/config/m32c/m32c.c @@ -68,6 +68,7 @@ static int m32c_comp_type_attributes (const_tree, const_tree); static bool m32c_fixed_condition_code_regs (unsigned int *, unsigned int *); static struct machine_function *m32c_init_machine_status (void); static void m32c_insert_attributes (tree, tree *); +static bool m32c_legitimate_address_p (enum machine_mode, rtx, bool); static bool m32c_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode, const_tree, bool); static bool m32c_promote_prototypes (const_tree); @@ -1760,13 +1761,14 @@ m32c_init_libfuncs (void) /* Addressing Modes */ -/* Used by GO_IF_LEGITIMATE_ADDRESS. The r8c/m32c family supports a - wide range of non-orthogonal addressing modes, including the - ability to double-indirect on *some* of them. Not all insns - support all modes, either, but we rely on predicates and - constraints to deal with that. */ -int -m32c_legitimate_address_p (enum machine_mode mode, rtx x, int strict) +/* The r8c/m32c family supports a wide range of non-orthogonal + addressing modes, including the ability to double-indirect on *some* + of them. Not all insns support all modes, either, but we rely on + predicates and constraints to deal with that. */ +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P m32c_legitimate_address_p +bool +m32c_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { int mode_adjust; if (CONSTANT_P (x)) diff --git a/gcc/config/m32c/m32c.h b/gcc/config/m32c/m32c.h index cb2b8be..5c31305 100644 --- a/gcc/config/m32c/m32c.h +++ b/gcc/config/m32c/m32c.h @@ -578,10 +578,6 @@ typedef struct m32c_cumulative_args #define REG_OK_STRICT_V 0 #endif -#define GO_IF_LEGITIMATE_ADDRESS(MODE,X,LABEL) \ - if (m32c_legitimate_address_p (MODE, X, REG_OK_STRICT_V)) \ - goto LABEL; - #define REG_OK_FOR_BASE_P(X) m32c_reg_ok_for_base_p (X, REG_OK_STRICT_V) #define REG_OK_FOR_INDEX_P(X) 0 diff --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h index 5412e1d..2f138c7 100644 --- a/gcc/config/m68hc11/m68hc11-protos.h +++ b/gcc/config/m68hc11/m68hc11-protos.h @@ -48,8 +48,6 @@ extern void m68hc11_initialize_trampoline (rtx, rtx, rtx); extern rtx m68hc11_expand_compare_and_branch (enum rtx_code, rtx, rtx, rtx); extern enum reg_class preferred_reload_class (rtx, enum reg_class); -extern int m68hc11_go_if_legitimate_address (rtx, enum machine_mode, int); - extern void m68hc11_notice_update_cc (rtx, rtx); extern void m68hc11_notice_keep_cc (rtx); diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 024e55d..ae4f705 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -64,7 +64,8 @@ static void emit_move_after_reload (rtx, rtx, rtx); static rtx simplify_logical (enum machine_mode, int, rtx, rtx *); static void m68hc11_emit_logical (enum machine_mode, int, rtx *); static void m68hc11_reorg (void); -static int go_if_legitimate_address_internal (rtx, enum machine_mode, int); +static bool m68hc11_legitimate_address_p_1 (enum machine_mode, rtx, bool); +static bool m68hc11_legitimate_address_p (enum machine_mode, rtx, bool); static rtx m68hc11_expand_compare (enum rtx_code, rtx, rtx); static int must_parenthesize (rtx); static int m68hc11_address_cost (rtx, bool); @@ -260,6 +261,9 @@ static const struct processor_costs m6812_cost = { #undef TARGET_STRIP_NAME_ENCODING #define TARGET_STRIP_NAME_ENCODING m68hc11_strip_name_encoding +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P m68hc11_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; int @@ -721,9 +725,9 @@ m68hc11_register_indirect_p (rtx operand, enum machine_mode mode) return m68hc11_valid_addressing_p (operand, mode, addr_mode); } -static int -go_if_legitimate_address_internal (rtx operand, enum machine_mode mode, - int strict) +static bool +m68hc11_legitimate_address_p_1 (enum machine_mode mode, rtx operand, + bool strict) { int addr_mode; @@ -752,9 +756,9 @@ go_if_legitimate_address_internal (rtx operand, enum machine_mode mode, return 0; } -int -m68hc11_go_if_legitimate_address (rtx operand, enum machine_mode mode, - int strict) +bool +m68hc11_legitimate_address_p (enum machine_mode mode, rtx operand, + bool strict) { int result; @@ -765,7 +769,7 @@ m68hc11_go_if_legitimate_address (rtx operand, enum machine_mode mode, debug_rtx (operand); } - result = go_if_legitimate_address_internal (operand, mode, strict); + result = m68hc11_legitimate_address_p_1 (mode, operand, strict); if (debug_m6811) { diff --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index 29d998d..a394403 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -1169,19 +1169,6 @@ extern unsigned char m68hc11_reg_valid_for_index[FIRST_PSEUDO_REGISTER]; (((GET_CODE (X) == PRE_DEC) || (GET_CODE (X) == POST_INC)) \ && SP_REG_P (XEXP (X, 0))) -/* Go to ADDR if X is a valid address. */ -#ifndef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ \ - if (m68hc11_go_if_legitimate_address ((X), (MODE), 0)) goto ADDR; \ -} -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ \ - if (m68hc11_go_if_legitimate_address ((X), (MODE), 1)) goto ADDR; \ -} -#endif - /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check its validity for a certain class. We have two alternate definitions for each of them. The usual definition accepts all pseudo regs; the other rejects diff --git a/gcc/config/m68k/m68k-protos.h b/gcc/config/m68k/m68k-protos.h index 43a457f..1b91709 100644 --- a/gcc/config/m68k/m68k-protos.h +++ b/gcc/config/m68k/m68k-protos.h @@ -56,7 +56,6 @@ extern void notice_update_cc (rtx, rtx); extern bool m68k_legitimate_base_reg_p (rtx, bool); extern bool m68k_legitimate_index_reg_p (rtx, bool); extern bool m68k_illegitimate_symbolic_constant_p (rtx); -extern bool m68k_legitimate_address_p (enum machine_mode, rtx, bool); extern bool m68k_matches_q_p (rtx); extern bool m68k_matches_u_p (rtx); extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx); diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index 1b5c83b..ce028a0 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -131,6 +131,7 @@ static void m68k_sched_dfa_pre_advance_cycle (void); static void m68k_sched_dfa_post_advance_cycle (void); static int m68k_sched_first_cycle_multipass_dfa_lookahead (void); +static bool m68k_legitimate_address_p (enum machine_mode, rtx, bool); static bool m68k_handle_option (size_t, const char *, int); static rtx find_addr_reg (rtx); static const char *singlemove_string (rtx *); @@ -248,6 +249,9 @@ const char *m68k_library_id_string = "_current_shared_library_a5_offset_"; #define TARGET_RETURN_IN_MEMORY m68k_return_in_memory #endif +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P m68k_legitimate_address_p + static const struct attribute_spec m68k_attribute_table[] = { /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */ diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h index a30cd47..e91ab00 100644 --- a/gcc/config/m68k/m68k.h +++ b/gcc/config/m68k/m68k.h @@ -758,14 +758,6 @@ __transfer_from_trampoline () \ #define REG_OK_FOR_INDEX_P(X) \ m68k_legitimate_index_reg_p (X, REG_STRICT_P) -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ - do \ - { \ - if (m68k_legitimate_address_p (MODE, X, REG_STRICT_P)) \ - goto ADDR; \ - } \ - while (0) - /* This address is OK as it stands. */ #define PIC_CASE_VECTOR_ADDRESS(index) index diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index f2c67b8..bbae18a 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -184,7 +184,6 @@ enum mips_call_type { extern bool mips_symbolic_constant_p (rtx, enum mips_symbol_context, enum mips_symbol_type *); extern int mips_regno_mode_ok_for_base_p (int, enum machine_mode, bool); -extern bool mips_legitimate_address_p (enum machine_mode, rtx, bool); extern bool mips_stack_address_p (rtx, enum machine_mode); extern int mips_address_insns (rtx, enum machine_mode, bool); extern int mips_const_insns (rtx); diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index d8686dd..36521ca 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -2116,10 +2116,9 @@ mips_classify_address (struct mips_address_info *info, rtx x, } } -/* Return true if X is a legitimate address for a memory operand of mode - MODE. STRICT_P is true if REG_OK_STRICT is in effect. */ +/* Implement TARGET_LEGITIMATE_ADDRESS_P. */ -bool +static bool mips_legitimate_address_p (enum machine_mode mode, rtx x, bool strict_p) { struct mips_address_info addr; @@ -14915,6 +14914,9 @@ mips_final_postscan_insn (FILE *file, rtx insn, rtx *opvec, int noperands) #undef TARGET_ASM_FINAL_POSTSCAN_INSN #define TARGET_ASM_FINAL_POSTSCAN_INSN mips_final_postscan_insn +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P mips_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-mips.h" diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index 301a26e..5b64346 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -2504,25 +2504,11 @@ typedef struct mips_args { #define MAX_REGS_PER_ADDRESS 1 -#ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ \ - if (mips_legitimate_address_p (MODE, X, 1)) \ - goto ADDR; \ -} -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ \ - if (mips_legitimate_address_p (MODE, X, 0)) \ - goto ADDR; \ -} -#endif - /* Check for constness inline but use mips_legitimate_address_p to check whether a constant really is an address. */ #define CONSTANT_ADDRESS_P(X) \ - (CONSTANT_P (X) && mips_legitimate_address_p (SImode, X, 0)) + (CONSTANT_P (X) && memory_address_p (SImode, X)) #define LEGITIMATE_CONSTANT_P(X) (mips_const_insns (X) > 0) diff --git a/gcc/config/mmix/mmix-protos.h b/gcc/config/mmix/mmix-protos.h index d294d8f..e839d86 100644 --- a/gcc/config/mmix/mmix-protos.h +++ b/gcc/config/mmix/mmix-protos.h @@ -82,7 +82,6 @@ extern rtx mmix_eh_return_stackadj_rtx (void); extern rtx mmix_eh_return_handler_rtx (void); extern void mmix_initialize_trampoline (rtx, rtx, rtx); extern int mmix_constant_address_p (rtx); -extern int mmix_legitimate_address (enum machine_mode, rtx, int); extern int mmix_legitimate_constant_p (rtx); extern void mmix_print_operand (FILE *, rtx, int); extern void mmix_print_operand_address (FILE *, rtx); diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c index 6ced05c..d2115a5 100644 --- a/gcc/config/mmix/mmix.c +++ b/gcc/config/mmix/mmix.c @@ -125,6 +125,7 @@ static void mmix_emit_sp_add (HOST_WIDE_INT offset); static void mmix_target_asm_function_prologue (FILE *, HOST_WIDE_INT); static void mmix_target_asm_function_end_prologue (FILE *); static void mmix_target_asm_function_epilogue (FILE *, HOST_WIDE_INT); +static bool mmix_legitimate_address_p (enum machine_mode, rtx, bool); static void mmix_reorg (void); static void mmix_asm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); @@ -206,6 +207,9 @@ static bool mmix_pass_by_reference (CUMULATIVE_ARGS *, #undef TARGET_DEFAULT_TARGET_FLAGS #define TARGET_DEFAULT_TARGET_FLAGS TARGET_DEFAULT +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P mmix_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; /* Functions that are expansions for target macros. @@ -985,13 +989,12 @@ mmix_constant_address_p (rtx x) return constant_ok || (addend & 3) == 0; } -/* Return 1 if the address is OK, otherwise 0. - Used by GO_IF_LEGITIMATE_ADDRESS. */ +/* Return 1 if the address is OK, otherwise 0. */ -int -mmix_legitimate_address (enum machine_mode mode ATTRIBUTE_UNUSED, - rtx x, - int strict_checking) +bool +mmix_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, + rtx x, + bool strict_checking) { #define MMIX_REG_OK(X) \ ((strict_checking \ diff --git a/gcc/config/mmix/mmix.h b/gcc/config/mmix/mmix.h index 5a0582d..fb3d301 100644 --- a/gcc/config/mmix/mmix.h +++ b/gcc/config/mmix/mmix.h @@ -690,10 +690,6 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS; #define MAX_REGS_PER_ADDRESS 2 -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ - if (mmix_legitimate_address (MODE, X, MMIX_REG_OK_STRICT)) \ - goto LABEL - #ifndef REG_OK_STRICT # define REG_OK_FOR_BASE_P(X) \ (REGNO (X) <= MMIX_LAST_GENERAL_REGISTER \ diff --git a/gcc/config/mn10300/mn10300-protos.h b/gcc/config/mn10300/mn10300-protos.h index 935cb8f..ae4728a 100644 --- a/gcc/config/mn10300/mn10300-protos.h +++ b/gcc/config/mn10300/mn10300-protos.h @@ -23,7 +23,6 @@ along with GCC; see the file COPYING3. If not see extern void mn10300_override_options (void); extern rtx legitimize_pic_address (rtx, rtx); extern int legitimate_pic_operand_p (rtx); -extern bool legitimate_address_p (enum machine_mode, rtx, int); extern void print_operand (FILE *, rtx, int); extern void print_operand_address (FILE *, rtx); extern void mn10300_print_reg_list (FILE *, int); diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c index 47fd5cb..e32f376 100644 --- a/gcc/config/mn10300/mn10300.c +++ b/gcc/config/mn10300/mn10300.c @@ -69,6 +69,7 @@ enum processor_type mn10300_processor = PROCESSOR_DEFAULT; static bool mn10300_handle_option (size_t, const char *, int); +static bool mn10300_legitimate_address_p (enum machine_mode, rtx, bool); static int mn10300_address_cost_1 (rtx, int *); static int mn10300_address_cost (rtx, bool); static bool mn10300_rtx_costs (rtx, int, int, int *, bool); @@ -127,6 +128,9 @@ static unsigned int mn10300_case_values_threshold (void); #undef TARGET_CASE_VALUES_THRESHOLD #define TARGET_CASE_VALUES_THRESHOLD mn10300_case_values_threshold +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P mn10300_legitimate_address_p + static void mn10300_encode_section_info (tree, rtx, int); struct gcc_target targetm = TARGET_INITIALIZER; @@ -1900,9 +1904,21 @@ legitimate_pic_operand_p (rtx x) } /* Return TRUE if the address X, taken from a (MEM:MODE X) rtx, is - legitimate, and FALSE otherwise. */ + legitimate, and FALSE otherwise. + + On the mn10300, the value in the address register must be + in the same memory space/segment as the effective address. + + This is problematical for reload since it does not understand + that base+index != index+base in a memory reference. + + Note it is still possible to use reg+reg addressing modes, + it's just much more difficult. For a discussion of a possible + workaround and solution, see the comments in pa.c before the + function record_unscaled_index_insn_codes. */ + bool -legitimate_address_p (enum machine_mode mode, rtx x, int strict) +mn10300_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { if (CONSTANT_ADDRESS_P (x) && (! flag_pic || legitimate_pic_operand_p (x))) diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h index b358944..77be996 100644 --- a/gcc/config/mn10300/mn10300.h +++ b/gcc/config/mn10300/mn10300.h @@ -655,26 +655,6 @@ struct cum_arg {int nbytes; }; #define HAVE_POST_INCREMENT (TARGET_AM33) -/* 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. - - The other macros defined here are used only in GO_IF_LEGITIMATE_ADDRESS, - except for CONSTANT_ADDRESS_P which is actually - machine-independent. - - On the mn10300, the value in the address register must be - in the same memory space/segment as the effective address. - - This is problematical for reload since it does not understand - that base+index != index+base in a memory reference. - - Note it is still possible to use reg+reg addressing modes, - it's just much more difficult. For a discussion of a possible - workaround and solution, see the comments in pa.c before the - function record_unscaled_index_insn_codes. */ - /* Accept either REG or SUBREG where a register is valid. */ #define RTX_OK_FOR_BASE_P(X, strict) \ @@ -684,14 +664,6 @@ struct cum_arg {int nbytes; }; && REGNO_STRICT_OK_FOR_BASE_P (REGNO (SUBREG_REG (X)), \ (strict)))) -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -do \ - { \ - if (legitimate_address_p ((MODE), (X), REG_STRICT)) \ - goto ADDR; \ - } \ -while (0) - /* Nonzero if the constant value X is a legitimate general operand. diff --git a/gcc/config/picochip/picochip-protos.h b/gcc/config/picochip/picochip-protos.h index 9b2c824..7a2a07b 100644 --- a/gcc/config/picochip/picochip-protos.h +++ b/gcc/config/picochip/picochip-protos.h @@ -26,7 +26,6 @@ extern void picochip_function_prologue (FILE *, HOST_WIDE_INT); extern void picochip_function_epilogue (FILE *, HOST_WIDE_INT); extern enum reg_class picochip_reg_class_from_letter (unsigned); -extern int picochip_legitimate_address_p (int, struct rtx_def *, unsigned); extern int picochip_const_ok_for_letter_p (unsigned HOST_WIDE_INT value, unsigned c); #ifdef RTX_CODE /* inside TREE_CODE */ diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c index e9b6156..56c58a8 100644 --- a/gcc/config/picochip/picochip.c +++ b/gcc/config/picochip/picochip.c @@ -95,6 +95,7 @@ rtx picochip_expand_builtin (tree, rtx, rtx, enum machine_mode, int); bool picochip_rtx_costs (rtx x, int code, int outer_code, int* total); bool picochip_return_in_memory(const_tree type, const_tree fntype ATTRIBUTE_UNUSED); +bool picochip_legitimate_address_p (enum machine_mode, rtx, bool); rtx picochip_struct_value_rtx(tree fntype ATTRIBUTE_UNUSED, int incoming ATTRIBUTE_UNUSED); rtx picochip_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED, @@ -275,6 +276,9 @@ static char picochip_get_vliw_alu_id (void); #define TARGET_LIBGCC_CMP_RETURN_MODE picochip_libgcc_cmp_return_mode */ +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P picochip_legitimate_address_p + /* Loading and storing QImode values to and from memory usually requires a scratch register. */ #undef TARGET_SECONDARY_RELOAD @@ -1249,8 +1253,8 @@ picochip_const_ok_for_base (enum machine_mode mode, int regno, int offset) /* Determine whether a given rtx is a legitimate address for machine_mode MODE. STRICT is non-zero if we're being strict - any pseudo that is not a hard register must be a memory reference. */ -int -picochip_legitimate_address_p (int mode, rtx x, unsigned strict) +bool +picochip_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { int valid = 0; diff --git a/gcc/config/picochip/picochip.h b/gcc/config/picochip/picochip.h index a3263d0..0440001 100644 --- a/gcc/config/picochip/picochip.h +++ b/gcc/config/picochip/picochip.h @@ -492,18 +492,6 @@ extern const enum reg_class picochip_regno_reg_class[FIRST_PSEUDO_REGISTER]; #define MAX_REGS_PER_ADDRESS 1 -#ifdef REG_OK_STRICT - -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ - if (picochip_legitimate_address_p (MODE, X, 1)) goto LABEL; - -#else /* REG_OK_STRICT */ - -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ - if (picochip_legitimate_address_p (MODE, X, 0)) goto LABEL; - -#endif /* !REG_OK_STRICT */ - /* Legitimize reload address tries machine dependent means of reloading addresses. There seems to be a strange error in gcc, which necessitates this macro. Consider: diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index f40adab..c080e60 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -109,7 +109,6 @@ extern void rs6000_emit_move (rtx, rtx, enum machine_mode); extern rtx rs6000_secondary_memory_needed_rtx (enum machine_mode); extern rtx rs6000_legitimize_reload_address (rtx, enum machine_mode, int, int, int, int *); -extern int rs6000_legitimate_address (enum machine_mode, rtx, int); extern bool rs6000_legitimate_offset_address_p (enum machine_mode, rtx, int); extern bool rs6000_mode_dependent_address (rtx); extern rtx rs6000_find_base_term (rtx); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index b14eecc..a308731 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -747,6 +747,7 @@ struct processor_costs power6_cost = { static bool rs6000_function_ok_for_sibcall (tree, tree); static const char *rs6000_invalid_within_doloop (const_rtx); +static bool rs6000_legitimate_address_p (enum machine_mode, rtx, bool); static rtx rs6000_generate_compare (rtx, enum machine_mode); static void rs6000_emit_stack_tie (void); static void rs6000_frame_related (rtx, rtx, HOST_WIDE_INT, rtx, rtx); @@ -1291,6 +1292,9 @@ static const char alt_reg_names[][8] = #undef TARGET_INSTANTIATE_DECLS #define TARGET_INSTANTIATE_DECLS rs6000_instantiate_decls +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P rs6000_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; @@ -3556,7 +3560,7 @@ gpr_or_gpr_p (rtx op0, rtx op1) } -/* Subroutines of rs6000_legitimize_address and rs6000_legitimate_address. */ +/* Subroutines of rs6000_legitimize_address and rs6000_legitimate_address_p. */ static bool constant_pool_expr_p (rtx op) @@ -4208,13 +4212,6 @@ rs6000_tls_symbol_ref_1 (rtx *x, void *data ATTRIBUTE_UNUSED) return RS6000_SYMBOL_REF_TLS_P (*x); } -/* The convention appears to be to define this wherever it is used. - With legitimize_reload_address now defined here, REG_MODE_OK_FOR_BASE_P - is now used here. */ -#ifndef REG_MODE_OK_FOR_BASE_P -#define REG_MODE_OK_FOR_BASE_P(REGNO, MODE) REG_OK_FOR_BASE_P (REGNO) -#endif - /* Our implementation of LEGITIMIZE_RELOAD_ADDRESS. Returns a value to replace the input X, or the original X if no replacement is called for. The output parameter *WIN is 1 if the calling macro should goto WIN, @@ -4271,7 +4268,7 @@ rs6000_legitimize_reload_address (rtx x, enum machine_mode mode, if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 0)) == REG && REGNO (XEXP (x, 0)) < 32 - && REG_MODE_OK_FOR_BASE_P (XEXP (x, 0), mode) + && INT_REG_OK_FOR_BASE_P (XEXP (x, 0), 1) && GET_CODE (XEXP (x, 1)) == CONST_INT && (INTVAL (XEXP (x, 1)) & 3) != 0 && !ALTIVEC_VECTOR_MODE (mode) @@ -4289,7 +4286,7 @@ rs6000_legitimize_reload_address (rtx x, enum machine_mode mode, if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 0)) == REG && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER - && REG_MODE_OK_FOR_BASE_P (XEXP (x, 0), mode) + && INT_REG_OK_FOR_BASE_P (XEXP (x, 0), 1) && GET_CODE (XEXP (x, 1)) == CONST_INT && !SPE_VECTOR_MODE (mode) && !(TARGET_E500_DOUBLE && (mode == DFmode || mode == TFmode @@ -4410,8 +4407,8 @@ rs6000_legitimize_reload_address (rtx x, enum machine_mode mode, 32-bit DImode, TImode, TFmode, TDmode), indexed addressing cannot be used because adjacent memory cells are accessed by adding word-sized offsets during assembly output. */ -int -rs6000_legitimate_address (enum machine_mode mode, rtx x, int reg_ok_strict) +bool +rs6000_legitimate_address_p (enum machine_mode mode, rtx x, bool reg_ok_strict) { /* If this is an unaligned stvx/ldvx type address, discard the outer AND. */ if (TARGET_ALTIVEC diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index e65bf5d..c500600 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -1722,6 +1722,19 @@ typedef struct rs6000_args : (reg_renumber[REGNO] > 0 \ && (reg_renumber[REGNO] <= 31 || reg_renumber[REGNO] == 67 \ || reg_renumber[REGNO] == FRAME_POINTER_REGNUM))) + +/* Nonzero if X is a hard reg that can be used as an index + or if it is a pseudo reg in the non-strict case. */ +#define INT_REG_OK_FOR_INDEX_P(X, STRICT) \ + ((!(STRICT) && REGNO (X) >= FIRST_PSEUDO_REGISTER) \ + || REGNO_OK_FOR_INDEX_P (REGNO (X))) + +/* Nonzero if X is a hard reg that can be used as a base reg + or if it is a pseudo reg in the non-strict case. */ +#define INT_REG_OK_FOR_BASE_P(X, STRICT) \ + ((!(STRICT) && REGNO (X) >= FIRST_PSEUDO_REGISTER) \ + || REGNO_OK_FOR_BASE_P (REGNO (X))) + /* Maximum number of registers that can appear in a valid memory address. */ @@ -1755,62 +1768,6 @@ typedef struct rs6000_args && EASY_VECTOR_15((n) >> 1) \ && ((n) & 1) == 0) -/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx - and check its validity for a certain class. - We have two alternate definitions for each of them. - The usual definition accepts all pseudo regs; the other rejects - them unless they have been allocated suitable hard regs. - The symbol REG_OK_STRICT causes the latter definition to be used. - - Most source files want to accept pseudo regs in the hope that - they will get allocated to the class that the insn wants them to be in. - Source files for reload pass need to be strict. - After reload, it makes no difference, since pseudo regs have - been eliminated by then. */ - -#ifdef REG_OK_STRICT -# define REG_OK_STRICT_FLAG 1 -#else -# define REG_OK_STRICT_FLAG 0 -#endif - -/* Nonzero if X is a hard reg that can be used as an index - or if it is a pseudo reg in the non-strict case. */ -#define INT_REG_OK_FOR_INDEX_P(X, STRICT) \ - ((!(STRICT) && REGNO (X) >= FIRST_PSEUDO_REGISTER) \ - || REGNO_OK_FOR_INDEX_P (REGNO (X))) - -/* Nonzero if X is a hard reg that can be used as a base reg - or if it is a pseudo reg in the non-strict case. */ -#define INT_REG_OK_FOR_BASE_P(X, STRICT) \ - ((!(STRICT) && REGNO (X) >= FIRST_PSEUDO_REGISTER) \ - || REGNO_OK_FOR_BASE_P (REGNO (X))) - -#define REG_OK_FOR_INDEX_P(X) INT_REG_OK_FOR_INDEX_P (X, REG_OK_STRICT_FLAG) -#define REG_OK_FOR_BASE_P(X) INT_REG_OK_FOR_BASE_P (X, REG_OK_STRICT_FLAG) - -/* 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. - - On the RS/6000, there are four valid addresses: a SYMBOL_REF that - refers to a constant pool entry of an address (or the sum of it - plus a constant), a short (16-bit signed) constant plus a register, - the sum of two registers, or a register indirect, possibly with an - auto-increment. For DFmode, DDmode and DImode with a constant plus - register, we must ensure that both words are addressable or PowerPC64 - with offset word aligned. - - For modes spanning multiple registers (DFmode and DDmode in 32-bit GPRs, - 32-bit DImode, TImode), indexed addressing cannot be used because - adjacent memory cells are accessed by adding word-sized offsets - during assembly output. */ - -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ if (rs6000_legitimate_address (MODE, X, REG_OK_STRICT_FLAG)) \ - goto ADDR; \ -} /* Try a machine-dependent way of reloading an illegitimate address operand. If we find one, push the reload and jump to WIN. This diff --git a/gcc/config/s390/constraints.md b/gcc/config/s390/constraints.md index 4d37094..6cc33d1 100644 --- a/gcc/config/s390/constraints.md +++ b/gcc/config/s390/constraints.md @@ -398,7 +398,7 @@ level. This constraint will never be used and using it in an inline assembly is *always* a bug since there is no instruction accepting all those addresses. It just serves as a placeholder for a generic memory constraint." - (match_test "legitimate_address_p (GET_MODE (op), op, 1)")) + (match_test "strict_memory_address_p (GET_MODE (op), op)")) ; This defines 'm' as normal memory constraint. This is only possible ; since the standard memory constraint is re-defined in s390.h using diff --git a/gcc/config/s390/s390-protos.h b/gcc/config/s390/s390-protos.h index 3bde1c1..b410de5 100644 --- a/gcc/config/s390/s390-protos.h +++ b/gcc/config/s390/s390-protos.h @@ -72,7 +72,6 @@ extern bool preferred_la_operand_p (rtx, rtx); extern int legitimate_pic_operand_p (rtx); extern int legitimate_constant_p (rtx); extern bool legitimate_reload_constant_p (rtx); -extern bool legitimate_address_p (enum machine_mode, rtx, int); extern rtx legitimize_pic_address (rtx, rtx); extern rtx legitimize_reload_address (rtx, enum machine_mode, int, int); extern enum reg_class s390_preferred_reload_class (rtx, enum reg_class); diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 17891c6..7f9dd13 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -3080,8 +3080,8 @@ s390_expand_plus_operand (rtx target, rtx src, /* Return true if ADDR is a valid memory address. STRICT specifies whether strict register checking applies. */ -bool -legitimate_address_p (enum machine_mode mode, rtx addr, int strict) +static bool +s390_legitimate_address_p (enum machine_mode mode, rtx addr, bool strict) { struct s390_address ad; @@ -3739,7 +3739,7 @@ s390_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, { x = legitimize_tls_address (x, 0); - if (legitimate_address_p (mode, x, FALSE)) + if (s390_legitimate_address_p (mode, x, FALSE)) return x; } else if (GET_CODE (x) == PLUS @@ -3756,7 +3756,7 @@ s390_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, || SYMBOLIC_CONST (XEXP (x, 1))))) x = legitimize_pic_address (x, 0); - if (legitimate_address_p (mode, x, FALSE)) + if (s390_legitimate_address_p (mode, x, FALSE)) return x; } @@ -9984,6 +9984,9 @@ s390_reorg (void) #undef TARGET_LIBGCC_SHIFT_COUNT_MODE #define TARGET_LIBGCC_SHIFT_COUNT_MODE s390_libgcc_shift_count_mode +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P s390_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-s390.h" diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index b254185..26bdd9e 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -740,30 +740,12 @@ CUMULATIVE_ARGS; #define MAX_REGS_PER_ADDRESS 2 /* This definition replaces the formerly used 'm' constraint with a -different constraint letter in order to avoid changing semantics of -the 'm' constraint when accepting new address formats in -legitimate_address_p. The constraint letter defined here must not be -used in insn definitions or inline assemblies. */ + different constraint letter in order to avoid changing semantics of + the 'm' constraint when accepting new address formats in + TARGET_LEGITIMATE_ADDRESS_P. The constraint letter defined here + must not be used in insn definitions or inline assemblies. */ #define TARGET_MEM_CONSTRAINT 'e' -/* 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. */ -#ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ \ - if (legitimate_address_p (MODE, X, 1)) \ - goto ADDR; \ -} -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ \ - if (legitimate_address_p (MODE, X, 0)) \ - goto ADDR; \ -} -#endif - /* Try a machine-dependent way of reloading an illegitimate address operand. If we find one, push the reload and jump to WIN. This macro is used in only one place: `find_reloads_address' in reload.c. */ diff --git a/gcc/config/score/score.c b/gcc/config/score/score.c index e517eeb..0b73745 100644 --- a/gcc/config/score/score.c +++ b/gcc/config/score/score.c @@ -116,6 +116,9 @@ #undef TARGET_ADDRESS_COST #define TARGET_ADDRESS_COST score_address_cost +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P score_legitimate_address_p + struct extern_list *extern_head = 0; /* default 0 = NO_REGS */ @@ -531,13 +534,13 @@ score_regno_mode_ok_for_base_p (int regno, int strict) } /* Implement GO_IF_LEGITIMATE_ADDRESS macro. */ -int -score_address_p (enum machine_mode mode, rtx x, int strict) +bool +score_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { if (TARGET_SCORE5 || TARGET_SCORE5U || TARGET_SCORE7 || TARGET_SCORE7D) - return score7_address_p (mode, x, strict); + return score7_legitimate_address_p (mode, x, strict); else if (TARGET_SCORE3) - return score3_address_p (mode, x, strict); + return score3_legitimate_address_p (mode, x, strict); gcc_unreachable (); } diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h index d9fe8e6..e6c8b75 100644 --- a/gcc/config/score/score.h +++ b/gcc/config/score/score.h @@ -748,16 +748,6 @@ typedef struct score_args /* Maximum number of registers that can appear in a valid memory address. */ #define MAX_REGS_PER_ADDRESS 1 -#ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ - if (score_address_p (MODE, X, 1)) \ - goto LABEL; -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ - if (score_address_p (MODE, X, 0)) \ - goto LABEL; -#endif - /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check its validity for a certain class. We have two alternate definitions for each of them. diff --git a/gcc/config/score/score3.c b/gcc/config/score/score3.c index 3ddc3b8..4ac7e60 100644 --- a/gcc/config/score/score3.c +++ b/gcc/config/score/score3.c @@ -911,8 +911,8 @@ score3_regno_mode_ok_for_base_p (int regno, int strict) } /* Implement GO_IF_LEGITIMATE_ADDRESS macro. */ -int -score3_address_p (enum machine_mode mode, rtx x, int strict) +bool +score3_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { struct score3_address_info addr; diff --git a/gcc/config/score/score3.h b/gcc/config/score/score3.h index d718d12..001b2f0 100644 --- a/gcc/config/score/score3.h +++ b/gcc/config/score/score3.h @@ -122,7 +122,8 @@ extern rtx score3_function_value (tree valtype, enum machine_mode mode); extern void score3_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN); extern int score3_regno_mode_ok_for_base_p (int regno, int strict); -extern int score3_address_p (enum machine_mode mode, rtx x, int strict); +extern bool score3_legitimate_address_p (enum machine_mode mode, rtx x, + bool strict); extern int score3_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED, enum reg_class from, enum reg_class to); diff --git a/gcc/config/score/score7.c b/gcc/config/score/score7.c index 661cae7..c18d03b 100644 --- a/gcc/config/score/score7.c +++ b/gcc/config/score/score7.c @@ -902,8 +902,8 @@ score7_regno_mode_ok_for_base_p (int regno, int strict) } /* Implement GO_IF_LEGITIMATE_ADDRESS macro. */ -int -score7_address_p (enum machine_mode mode, rtx x, int strict) +bool +score7_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { struct score7_address_info addr; diff --git a/gcc/config/score/score7.h b/gcc/config/score/score7.h index 0c0a3b2..ae3f4e8 100644 --- a/gcc/config/score/score7.h +++ b/gcc/config/score/score7.h @@ -122,7 +122,8 @@ extern rtx score7_function_value (tree valtype, enum machine_mode mode); extern void score7_initialize_trampoline (rtx ADDR, rtx FUNC, rtx CHAIN); extern int score7_regno_mode_ok_for_base_p (int regno, int strict); -extern int score7_address_p (enum machine_mode mode, rtx x, int strict); +extern bool score7_legitimate_address_p (enum machine_mode mode, rtx x, + bool strict); extern int score7_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED, enum reg_class from, enum reg_class to); diff --git a/gcc/config/sparc/sparc-protos.h b/gcc/config/sparc/sparc-protos.h index fd388dd..8b3547a 100644 --- a/gcc/config/sparc/sparc-protos.h +++ b/gcc/config/sparc/sparc-protos.h @@ -67,7 +67,6 @@ extern void sparc64_initialize_trampoline (rtx, rtx, rtx); extern bool legitimate_constant_p (rtx); extern bool constant_address_p (rtx); extern bool legitimate_pic_operand_p (rtx); -extern int legitimate_address_p (enum machine_mode, rtx, int); extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx); extern rtx legitimize_tls_address (rtx); extern void sparc_emit_call_insn (rtx, rtx); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 330c2c0..d6467bd 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -357,6 +357,7 @@ static int hypersparc_adjust_cost (rtx, rtx, rtx, int); static void sparc_output_addr_vec (rtx); static void sparc_output_addr_diff_vec (rtx); static void sparc_output_deferred_case_vectors (void); +static bool sparc_legitimate_address_p (enum machine_mode, rtx, bool); static rtx sparc_builtin_saveregs (void); static int epilogue_renumber (rtx *, int); static bool sparc_assemble_integer (rtx, unsigned int, int); @@ -588,6 +589,9 @@ static bool fpu_option_set = false; #define TARGET_MANGLE_TYPE sparc_mangle_type #endif +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P sparc_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; /* Implement TARGET_HANDLE_OPTION. */ @@ -3067,8 +3071,8 @@ legitimate_pic_operand_p (rtx x) /* Return nonzero if ADDR is a valid memory address. STRICT specifies whether strict register checking applies. */ -int -legitimate_address_p (enum machine_mode mode, rtx addr, int strict) +static bool +sparc_legitimate_address_p (enum machine_mode mode, rtx addr, bool strict) { rtx rs1 = NULL, rs2 = NULL, imm1 = NULL; @@ -3503,7 +3507,7 @@ sparc_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED, x = gen_rtx_PLUS (Pmode, XEXP (x, 0), force_operand (XEXP (x, 1), NULL_RTX)); - if (x != orig_x && legitimate_address_p (mode, x, FALSE)) + if (x != orig_x && sparc_legitimate_address_p (mode, x, FALSE)) return x; if (SPARC_SYMBOL_REF_TLS_P (x)) diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 2800362..1aef109 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -1875,20 +1875,6 @@ do { \ #define RTX_OK_FOR_OLO10_P(X) \ (GET_CODE (X) == CONST_INT && INTVAL (X) >= -0x1000 && INTVAL (X) < 0xc00 - 8) -#ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ \ - if (legitimate_address_p (MODE, X, 1)) \ - goto ADDR; \ -} -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ -{ \ - if (legitimate_address_p (MODE, X, 0)) \ - goto ADDR; \ -} -#endif - /* Go to LABEL if ADDR (a legitimate address expression) has an effect that depends on the machine mode it is used for. diff --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h index 3e2600b..33951d7 100644 --- a/gcc/config/spu/spu-protos.h +++ b/gcc/config/spu/spu-protos.h @@ -54,8 +54,6 @@ extern bool exp2_immediate_p (rtx op, enum machine_mode mode, int low, int high); extern int spu_constant_address_p (rtx x); extern int spu_legitimate_constant_p (rtx x); -extern int spu_legitimate_address (enum machine_mode mode, rtx x, - int reg_ok_strict); extern int spu_initial_elimination_offset (int from, int to); extern rtx spu_function_value (const_tree type, const_tree func); extern rtx spu_function_arg (int cum, enum machine_mode mode, tree type, diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c index f73bb21..b8e08c8 100644 --- a/gcc/config/spu/spu.c +++ b/gcc/config/spu/spu.c @@ -152,6 +152,7 @@ char regs_ever_allocated[FIRST_PSEUDO_REGISTER]; static void spu_init_builtins (void); static unsigned char spu_scalar_mode_supported_p (enum machine_mode mode); static unsigned char spu_vector_mode_supported_p (enum machine_mode mode); +static bool spu_legitimate_address_p (enum machine_mode, rtx, bool); static rtx adjust_operand (rtx op, HOST_WIDE_INT * start); static rtx get_pic_reg (void); static int need_to_save_reg (int regno, int saving); @@ -399,6 +400,9 @@ const struct attribute_spec spu_attribute_table[]; #undef TARGET_SECTION_TYPE_FLAGS #define TARGET_SECTION_TYPE_FLAGS spu_section_type_flags +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P spu_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; void @@ -3612,9 +3616,9 @@ spu_legitimate_constant_p (rtx x) The alignment matters in the reg+const case because lqd and stqd ignore the 4 least significant bits of the const. (TODO: It might be preferable to allow any alignment and fix it up when splitting.) */ -int -spu_legitimate_address (enum machine_mode mode ATTRIBUTE_UNUSED, - rtx x, int reg_ok_strict) +bool +spu_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, + rtx x, bool reg_ok_strict) { if (mode == TImode && GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT diff --git a/gcc/config/spu/spu.h b/gcc/config/spu/spu.h index ddd464a..f994f37 100644 --- a/gcc/config/spu/spu.h +++ b/gcc/config/spu/spu.h @@ -416,17 +416,6 @@ targetm.resolve_overloaded_builtin = spu_resolve_overloaded_builtin; \ #define MAX_REGS_PER_ADDRESS 2 -#ifdef REG_OK_STRICT -# define REG_OK_STRICT_FLAG 1 -#else -# define REG_OK_STRICT_FLAG 0 -#endif - -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ - { if (spu_legitimate_address (MODE, X, REG_OK_STRICT_FLAG)) \ - goto ADDR; \ - } - #define LEGITIMATE_CONSTANT_P(X) spu_legitimate_constant_p(X) diff --git a/gcc/config/stormy16/stormy16-protos.h b/gcc/config/stormy16/stormy16-protos.h index bde411b..e6fe4c0 100644 --- a/gcc/config/stormy16/stormy16-protos.h +++ b/gcc/config/stormy16/stormy16-protos.h @@ -71,7 +71,6 @@ extern int nonimmediate_nonstack_operand (rtx, enum machine_mode); extern enum reg_class xstormy16_secondary_reload_class (enum reg_class, enum machine_mode, rtx); extern enum reg_class xstormy16_preferred_reload_class (rtx, enum reg_class); -extern int xstormy16_legitimate_address_p (enum machine_mode, rtx, int); extern void xstormy16_split_move (enum machine_mode, rtx, rtx); extern void xstormy16_expand_move (enum machine_mode, rtx, rtx); extern void xstormy16_expand_arith (enum machine_mode, enum rtx_code, diff --git a/gcc/config/stormy16/stormy16.c b/gcc/config/stormy16/stormy16.c index 4d04cae..16814ab 100644 --- a/gcc/config/stormy16/stormy16.c +++ b/gcc/config/stormy16/stormy16.c @@ -613,9 +613,9 @@ xstormy16_expand_andqi3 (rtx *operands) && INTVAL (X) + (OFFSET) < 0x8000 \ && (INTVAL (X) + (OFFSET) < 0x100 || INTVAL (X) + (OFFSET) >= 0x7F00)) -int +static bool xstormy16_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, - rtx x, int strict) + rtx x, bool strict) { if (LEGITIMATE_ADDRESS_CONST_INT_P (x, 0)) return 1; @@ -2650,6 +2650,9 @@ xstormy16_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) #undef TARGET_MACHINE_DEPENDENT_REORG #define TARGET_MACHINE_DEPENDENT_REORG xstormy16_reorg +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P xstormy16_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-stormy16.h" diff --git a/gcc/config/stormy16/stormy16.h b/gcc/config/stormy16/stormy16.h index d626edf..cb35a13 100644 --- a/gcc/config/stormy16/stormy16.h +++ b/gcc/config/stormy16/stormy16.h @@ -537,20 +537,6 @@ enum reg_class #define MAX_REGS_PER_ADDRESS 1 #ifdef REG_OK_STRICT -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ -do { \ - if (xstormy16_legitimate_address_p (MODE, X, 1)) \ - goto LABEL; \ -} while (0) -#else -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, LABEL) \ -do { \ - if (xstormy16_legitimate_address_p (MODE, X, 0)) \ - goto LABEL; \ -} while (0) -#endif - -#ifdef REG_OK_STRICT #define REG_OK_FOR_BASE_P(X) \ (REGNO_OK_FOR_BASE_P (REGNO (X)) && (REGNO (X) < FIRST_PSEUDO_REGISTER)) #else diff --git a/gcc/config/vax/vax-protos.h b/gcc/config/vax/vax-protos.h index c038b30..86feccd 100644 --- a/gcc/config/vax/vax-protos.h +++ b/gcc/config/vax/vax-protos.h @@ -19,11 +19,9 @@ along with GCC; see the file COPYING3. If not see extern void override_options (void); -extern bool legitimate_constant_address_p (rtx); -extern bool legitimate_constant_p (rtx); -extern bool legitimate_pic_operand_p (rtx); -extern bool legitimate_address_p (enum machine_mode, rtx, bool); -extern bool vax_mode_dependent_address_p (rtx); +extern int legitimate_constant_address_p (rtx); +extern int legitimate_constant_p (rtx); +extern int vax_mode_dependent_address_p (rtx); #ifdef RTX_CODE extern const char *cond_name (rtx); diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c index cd66bb4..f0f6a93 100644 --- a/gcc/config/vax/vax.c +++ b/gcc/config/vax/vax.c @@ -46,6 +46,7 @@ along with GCC; see the file COPYING3. If not see #include "target.h" #include "target-def.h" +static bool vax_legitimate_address_p (enum machine_mode, rtx, bool); static void vax_output_function_prologue (FILE *, HOST_WIDE_INT); static void vax_file_start (void); static void vax_init_libfuncs (void); @@ -94,6 +95,9 @@ static rtx vax_builtin_setjmp_frame_value (void); #undef TARGET_BUILTIN_SETJMP_FRAME_VALUE #define TARGET_BUILTIN_SETJMP_FRAME_VALUE vax_builtin_setjmp_frame_value +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P vax_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; /* Set global variables as needed for the options enabled. */ @@ -1731,7 +1735,7 @@ indexable_address_p (rtx xfoo0, rtx xfoo1, enum machine_mode mode, bool strict) The MODE argument is the machine mode for the MEM expression that wants to use this address. */ bool -legitimate_address_p (enum machine_mode mode, rtx x, bool strict) +vax_legitimate_address_p (enum machine_mode mode, rtx x, bool strict) { rtx xfoo0, xfoo1; diff --git a/gcc/config/vax/vax.h b/gcc/config/vax/vax.h index 7fa2fbb..e22fbd7 100644 --- a/gcc/config/vax/vax.h +++ b/gcc/config/vax/vax.h @@ -540,11 +540,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES }; or if it is a pseudo reg. */ #define REG_OK_FOR_BASE_P(X) 1 -/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression - that is a valid memory address for an instruction. */ -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ - { if (legitimate_address_p ((MODE), (X), 0)) goto ADDR; } - #else /* Nonzero if X is a hard reg that can be used as an index. */ @@ -553,11 +548,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_REG_CLASSES }; /* Nonzero if X is a hard reg that can be used as a base reg. */ #define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) -/* GO_IF_LEGITIMATE_ADDRESS recognizes an RTL expression - that is a valid memory address for an instruction. */ -#define GO_IF_LEGITIMATE_ADDRESS(MODE, X, ADDR) \ - { if (legitimate_address_p ((MODE), (X), 1)) goto ADDR; } - #endif /* Go to LABEL if ADDR (a legitimate address expression) diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h index 76f1017..c60917f 100644 --- a/gcc/config/xtensa/xtensa-protos.h +++ b/gcc/config/xtensa/xtensa-protos.h @@ -54,7 +54,6 @@ extern char *xtensa_emit_branch (bool, bool, rtx *); extern char *xtensa_emit_bit_branch (bool, bool, rtx *); extern char *xtensa_emit_movcc (bool, bool, bool, rtx *); extern char *xtensa_emit_call (int, rtx *); -extern bool xtensa_legitimate_address_p (enum machine_mode, rtx, bool); extern bool xtensa_tls_referenced_p (rtx); #ifdef TREE_CODE diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 35e399f..9bdedc1 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -130,6 +130,7 @@ static bool xtensa_return_in_msb (const_tree); static void printx (FILE *, signed int); static void xtensa_function_epilogue (FILE *, HOST_WIDE_INT); static rtx xtensa_builtin_saveregs (void); +static bool xtensa_legitimate_address_p (enum machine_mode, rtx, bool); static unsigned int xtensa_multibss_section_type_flags (tree, const char *, int) ATTRIBUTE_UNUSED; static section *xtensa_select_rtx_section (enum machine_mode, rtx, @@ -223,6 +224,9 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] = #undef TARGET_CANNOT_FORCE_CONST_MEM #define TARGET_CANNOT_FORCE_CONST_MEM xtensa_tls_referenced_p +#undef TARGET_LEGITIMATE_ADDRESS_P +#define TARGET_LEGITIMATE_ADDRESS_P xtensa_legitimate_address_p + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index c01a778..ec5dde1 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -771,13 +771,6 @@ typedef struct xtensa_args /* Maximum number of registers that can appear in a valid memory address. */ #define MAX_REGS_PER_ADDRESS 1 -/* Identify valid Xtensa addresses. */ -#define GO_IF_LEGITIMATE_ADDRESS(MODE, ADDR, LABEL) \ - do { \ - if (xtensa_legitimate_address_p (MODE, ADDR, REG_OK_STRICT_FLAG)) \ - goto LABEL; \ - } while (0) - /* A C expression that is 1 if the RTX X is a constant which is a valid address. This is defined to be the same as 'CONSTANT_P (X)', but rejecting CONST_DOUBLE. */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 05e0476..7f8a5d6 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -2504,8 +2504,8 @@ added to another register (as well as added to a displacement). @defmac REGNO_OK_FOR_BASE_P (@var{num}) A C expression which is nonzero if register number @var{num} is suitable for use as a base register in operand addresses. -Like @code{GO_IF_LEGITIMATE_ADDRESS}, this macro should also -exist in strict or non-strict variants. Both variants behave +Like @code{TARGET_LEGITIMATE_ADDRESS_P}, this macro should also +define a strict and a non-strict variant. Both variants behave the same for hard register; for pseudos, the strict variant will pass only those that have been allocated to a valid hard registers, while the non-strict variant will pass all pseudos. @@ -5361,42 +5361,31 @@ expressions and @code{const} arithmetic expressions, in addition to @defmac MAX_REGS_PER_ADDRESS A number, the maximum number of registers that can appear in a valid memory address. Note that it is up to you to specify a value equal to -the maximum number that @code{GO_IF_LEGITIMATE_ADDRESS} would ever +the maximum number that @code{TARGET_LEGITIMATE_ADDRESS_P} would ever accept. @end defmac -@defmac GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label}) -A C compound statement with a conditional @code{goto @var{label};} -executed if @var{x} (an RTX) is a legitimate memory address on the -target machine for a memory operand of mode @var{mode}. +@deftypefn {Target Hook} TARGET_LEGITIMATE_ADDRESS_P (enum machine_mode @var{mode}, rtx @var{x}, bool @var{strict}) +A function that returns whether @var{x} (an RTX) is a legitimate memory +address on the target machine for a memory operand of mode @var{mode}. -It usually pays to define several simpler macros to serve as -subroutines for this one. Otherwise it may be too complicated to -understand. +Legitimate addresses are defined in two variants: a strict variant and a +non-strict one. The @code{strict} parameter chooses which variant is +desired by the caller. -This macro must exist in two variants: a strict variant and a -non-strict one. The strict variant is used in the reload pass. It -must be defined so that any pseudo-register that has not been -allocated a hard register is considered a memory reference. In -contexts where some kind of register is required, a pseudo-register -with no hard register must be rejected. +The strict variant is used in the reload pass. It must be defined so +that any pseudo-register that has not been allocated a hard register is +considered a memory reference. This is because in contexts where some +kind of register is required, a pseudo-register with no hard register +must be rejected. For non-hard registers, the strict variant should look +up the @code{reg_renumber} array; it should then proceed using the hard +register number in the array, or treat the pseudo as a memory reference +if the array holds @code{-1}. The non-strict variant is used in other passes. It must be defined to accept all pseudo-registers in every context where some kind of register is required. -@findex REG_OK_STRICT -Compiler source files that want to use the strict variant of this -macro define the macro @code{REG_OK_STRICT}. You should use an -@code{#ifdef REG_OK_STRICT} conditional to define the strict variant -in that case and the non-strict variant otherwise. - -Subroutines to check for acceptable registers for various purposes (one -for base registers, one for index registers, and so on) are typically -among the subroutines used to define @code{GO_IF_LEGITIMATE_ADDRESS}. -Then only these subroutine macros need have two variants; the higher -levels of macros may be the same whether strict or not. - Normally, constant addresses which are the sum of a @code{symbol_ref} and an integer are stored inside a @code{const} RTX to mark them as constant. Therefore, there is no need to recognize such sums @@ -5417,13 +5406,30 @@ into the @code{symbol_ref}, and then check for it here. When you see a @code{const}, you will have to look inside it to find the @code{symbol_ref} in order to determine the section. @xref{Assembler Format}. -@end defmac + +@cindex @code{GO_IF_LEGITIMATE_ADDRESS} +Some ports are still using a deprecated legacy substitute for +this hook, the @code{GO_IF_LEGITIMATE_ADDRESS} macro. This macro +has this syntax: + +@example +#define GO_IF_LEGITIMATE_ADDRESS (@var{mode}, @var{x}, @var{label}) +@end example + +@noindent +and should @code{goto @var{label}} if the address @var{x} is a valid +address on the target machine for a memory operand of mode @var{mode}. +Whether the strict or non-strict variants are desired is defined by +the @code{REG_OK_STRICT} macro introduced earlier in this section. +Using the hook is usually simpler because it limits the number of +files that are recompiled when changes are made. +@end deftypefn @defmac TARGET_MEM_CONSTRAINT A single character to be used instead of the default @code{'m'} character for general memory addresses. This defines the constraint letter which matches the memory addresses accepted by -@code{GO_IF_LEGITIMATE_ADDRESS_P}. Define this macro if you want to +@code{TARGET_LEGITIMATE_ADDRESS_P}. Define this macro if you want to support new address formats in your back end without changing the semantics of the @code{'m'} constraint. This is necessary in order to preserve functionality of inline assembly constructs using the @@ -6957,13 +6963,14 @@ The default value is false. This section describes macros that help implement generation of position independent code. Simply defining these macros is not enough to -generate valid PIC; you must also add support to the macros -@code{GO_IF_LEGITIMATE_ADDRESS} and @code{PRINT_OPERAND_ADDRESS}, as -well as @code{LEGITIMIZE_ADDRESS}. You must modify the definition of -@samp{movsi} to do something appropriate when the source operand -contains a symbolic address. You may also need to alter the handling of -switch statements so that they use relative addresses. -@c i rearranged the order of the macros above to try to force one of +generate valid PIC; you must also add support to the hook +@code{TARGET_LEGITIMATE_ADDRESS_P} and to the macro +@code{PRINT_OPERAND_ADDRESS}, as well as @code{LEGITIMIZE_ADDRESS}. You +must modify the definition of @samp{movsi} to do something appropriate +when the source operand contains a symbolic address. You may also +need to alter the handling of switch statements so that they use +relative addresses. +@c i rearranged the order of the macros above to try to force one of @c them to the next line, to eliminate an overfull hbox. --mew 10feb93 @defmac PIC_OFFSET_TABLE_REGNUM diff --git a/gcc/ira-conflicts.c b/gcc/ira-conflicts.c index 29c77c9..56be23b 100644 --- a/gcc/ira-conflicts.c +++ b/gcc/ira-conflicts.c @@ -248,12 +248,10 @@ get_dup_num (int op_num, bool use_commut_op_p) break; case 'p': - GO_IF_LEGITIMATE_ADDRESS (VOIDmode, op, win_p); + if (address_operand (op, VOIDmode)) + return -1; break; - - win_p: - return -1; - + case 'g': return -1; diff --git a/gcc/recog.c b/gcc/recog.c index baad154..70b0967 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -1253,11 +1253,15 @@ pop_operand (rtx op, enum machine_mode mode) int memory_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx addr) { +#ifdef GO_IF_LEGITIMATE_ADDRESS GO_IF_LEGITIMATE_ADDRESS (mode, addr, win); return 0; win: return 1; +#else + return targetm.legitimate_address_p (mode, addr, 0); +#endif } /* Return 1 if OP is a valid memory reference with mode MODE, diff --git a/gcc/reload.c b/gcc/reload.c index fb87a158..55d0094 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -2135,11 +2135,15 @@ hard_reg_set_here_p (unsigned int beg_regno, unsigned int end_regno, rtx x) int strict_memory_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx addr) { +#ifdef GO_IF_LEGITIMATE_ADDRESS GO_IF_LEGITIMATE_ADDRESS (mode, addr, win); return 0; win: return 1; +#else + return targetm.legitimate_address_p (mode, addr, 1); +#endif } /* Like rtx_equal_p except that it allows a REG and a SUBREG to match diff --git a/gcc/target-def.h b/gcc/target-def.h index 0039f9a..99c74e4 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -488,6 +488,7 @@ #define TARGET_COMMUTATIVE_P hook_bool_const_rtx_commutative_p #define TARGET_LEGITIMIZE_ADDRESS default_legitimize_address #define TARGET_DELEGITIMIZE_ADDRESS hook_rtx_rtx_identity +#define TARGET_LEGITIMATE_ADDRESS_P default_legitimate_address_p #define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_const_rtx_false #define TARGET_MIN_ANCHOR_OFFSET 0 #define TARGET_MAX_ANCHOR_OFFSET 0 @@ -872,6 +873,7 @@ TARGET_COMMUTATIVE_P, \ TARGET_LEGITIMIZE_ADDRESS, \ TARGET_DELEGITIMIZE_ADDRESS, \ + TARGET_LEGITIMATE_ADDRESS_P, \ TARGET_USE_BLOCKS_FOR_CONSTANT_P, \ TARGET_MIN_ANCHOR_OFFSET, \ TARGET_MAX_ANCHOR_OFFSET, \ diff --git a/gcc/target.h b/gcc/target.h index b693526..43bdfc4 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -616,6 +616,9 @@ struct gcc_target /* Given an address RTX, undo the effects of LEGITIMIZE_ADDRESS. */ rtx (* delegitimize_address) (rtx); + /* Given an address RTX, say whether it is valid. */ + bool (* legitimate_address_p) (enum machine_mode, rtx, bool); + /* True if the given constant can be put into an object_block. */ bool (* use_blocks_for_constant_p) (enum machine_mode, const_rtx); diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 1dd6c7c..d5c80c2 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -68,6 +68,22 @@ along with GCC; see the file COPYING3. If not see #include "recog.h" +bool +default_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, + rtx addr ATTRIBUTE_UNUSED, + bool strict ATTRIBUTE_UNUSED) +{ +#ifdef GO_IF_LEGITIMATE_ADDRESS + /* Defer to the old implementation using a goto. */ + if (strict) + return strict_memory_address_p (mode, addr); + else + return memory_address_p (mode, addr); +#else + gcc_unreachable (); +#endif +} + void default_external_libcall (rtx fun ATTRIBUTE_UNUSED) { diff --git a/gcc/targhooks.h b/gcc/targhooks.h index 19b78cb..42764f3 100644 --- a/gcc/targhooks.h +++ b/gcc/targhooks.h @@ -18,6 +18,8 @@ You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see . */ +extern bool default_legitimate_address_p (enum machine_mode, rtx, bool); + extern void default_external_libcall (rtx); extern rtx default_legitimize_address (rtx, rtx, enum machine_mode); -- 2.7.4