* 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
2009-05-14 Paolo Bonzini <bonzini@gnu.org>
+ * 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 <bonzini@gnu.org>
+
* config/arm/arm.h (PROMOTE_FUNCTION_MODE): Remove handling
of MODE_COMPLEX_INT.
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);
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
#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;
\f
#define REG_OK_FOR_BASE_P(X) NONSTRICT_REG_OK_FOR_BASE_P (X)
#endif
\f
-/* 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. */
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);
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);
#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;
\f
/* Obstack for minipool constant handling. */
/* 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);
}
/* 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;
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. */
}
}
+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;
}
/* 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);
#define REG_MODE_OK_FOR_REG_BASE_P(X, MODE) \
REG_OK_FOR_INDEX_P (X)
\f
-/* 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)
-
\f
/* Define this for compatibility reasons. */
#define HANDLE_PRAGMA_PACK_PUSH_POP
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
(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")
#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);
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);
#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;
\f
void
/* 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;
#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))
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);
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:
#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;
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
};
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);
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 */
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;
#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
/*****************************************************************************/
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);
/* 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);
#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) \
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)
`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;
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)
{
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
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);
}
\f
/* Return true if the bare return instruction can be used outside of the
{
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)
{
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
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);
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);
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);
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);
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.
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);
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))
#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
((C) == 'W')
\f
-#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
-\f
/* Go to LABEL if ADDR (a legitimate address expression)
has an effect that depends on the machine mode it is used for.
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);
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
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;
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);
+}
\f
/* Return a unique alias set for the GOT. */
}
}
- 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)
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)))
#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;
\f
#include "gt-i386.h"
#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.
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);
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
#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;
\f
/* Return nonzero if we split the address into high and low parts. */
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)
{
}
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;
#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)
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);
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);
/* 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))
#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
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);
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);
#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;
\f
int
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;
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;
debug_rtx (operand);
}
- result = go_if_legitimate_address_internal (operand, mode, strict);
+ result = m68hc11_legitimate_address_p_1 (mode, operand, strict);
if (debug_m6811)
{
(((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
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);
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 *);
#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 } */
#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)
-
\f
/* This address is OK as it stands. */
#define PIC_CASE_VECTOR_ADDRESS(index) index
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);
}
}
-/* 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;
#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;
\f
#include "gt-mips.h"
#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)
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);
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);
#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.
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 \
#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 \
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);
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);
#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;
\f
}
/* 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)))
\f
#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) \
&& 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)
-
\f
/* Nonzero if the constant value X is a legitimate general operand.
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 */
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,
#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
/* 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;
#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:
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);
\f
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);
#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;
\f
}
\f
-/* 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)
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,
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)
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
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
: (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)))
+
\f
/* Maximum number of registers that can appear in a valid memory address. */
&& 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)
-\f
-/* 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; \
-}
\f
/* Try a machine-dependent way of reloading an illegitimate address
operand. If we find one, push the reload and jump to WIN. This
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
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);
/* 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;
{
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
|| 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;
}
#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"
#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. */
#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 */
}
/* 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 ();
}
/* 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.
}
/* 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;
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);
}
/* 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;
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);
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);
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);
#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. */
/* 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;
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))
#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.
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,
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);
#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
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
#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)
\f
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,
&& 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;
#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"
#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
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);
#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);
#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;
\f
/* Set global variables as needed for the options enabled. */
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;
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. */
/* 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)
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
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,
#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;
\f
/* 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. */
@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.
@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
@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
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
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;
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,
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
}
\f
/* Like rtx_equal_p except that it allows a REG and a SUBREG to match
#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
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, \
/* 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);
#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)
{
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
+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);