This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH updated] Hookize GO_IF_LEGITIMATE_ADDRESS


This is an updated version of the GO_IF_LEGITIMATE_ADDRESS hookization
patch, applying on top of current trunk and including the SPARC and MIPS
review by Eric and Richard S. respectively.

Paolo

2009-05-04  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.
	* targhooks.c (default_legitimate_address_p): New.
	* targhooks.h (default_legitimate_address_p): New.
	* ira-conflicts.c (get_dup_num): Use addres_operand.
	* 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.

Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(branch legitimate-address-p)
+++ gcc/doc/tm.texi	(working copy)
@@ -2504,8 +2504,8 @@ added to another register (as well as ad
 @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 
 @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}.
-
-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.
+@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}.
+
+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.
+
+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 che
 @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
@@ -6872,13 +6878,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
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c	(branch legitimate-address-p)
+++ gcc/targhooks.c	(working copy)
@@ -68,6 +68,22 @@ along with GCC; see the file COPYING3.  
 #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)
 {
Index: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h	(branch legitimate-address-p)
+++ gcc/targhooks.h	(working copy)
@@ -18,6 +18,8 @@ You should have received a copy of the G
 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);
 
Index: gcc/reload.c
===================================================================
--- gcc/reload.c	(branch legitimate-address-p)
+++ gcc/reload.c	(working copy)
@@ -2135,11 +2135,15 @@ hard_reg_set_here_p (unsigned int beg_re
 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
Index: gcc/recog.c
===================================================================
--- gcc/recog.c	(branch legitimate-address-p)
+++ gcc/recog.c	(working copy)
@@ -1253,11 +1253,15 @@ pop_operand (rtx op, enum machine_mode m
 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,
Index: gcc/target-def.h
===================================================================
--- gcc/target-def.h	(branch legitimate-address-p)
+++ gcc/target-def.h	(working copy)
@@ -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,			\
Index: gcc/config/alpha/alpha.h
===================================================================
--- gcc/config/alpha/alpha.h	(branch legitimate-address-p)
+++ gcc/config/alpha/alpha.h	(working copy)
@@ -992,23 +992,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.  */
Index: gcc/config/alpha/alpha.c
===================================================================
--- gcc/config/alpha/alpha.c	(branch legitimate-address-p)
+++ gcc/config/alpha/alpha.c	(working copy)
@@ -806,8 +806,8 @@ alpha_linkage_symbol_p (const char *symn
    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
@@ -10848,6 +10848,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;
 
 
Index: gcc/config/alpha/alpha-protos.h
===================================================================
--- gcc/config/alpha/alpha-protos.h	(branch legitimate-address-p)
+++ gcc/config/alpha/alpha-protos.h	(working copy)
@@ -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);
 
Index: gcc/config/frv/predicates.md
===================================================================
--- gcc/config/frv/predicates.md	(branch legitimate-address-p)
+++ gcc/config/frv/predicates.md	(working copy)
@@ -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.
Index: gcc/config/frv/frv.h
===================================================================
--- gcc/config/frv/frv.h	(branch legitimate-address-p)
+++ gcc/config/frv/frv.h	(working copy)
@@ -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
Index: gcc/config/frv/frv-protos.h
===================================================================
--- gcc/config/frv/frv-protos.h	(branch legitimate-address-p)
+++ gcc/config/frv/frv-protos.h	(working copy)
@@ -47,7 +47,7 @@ extern int frv_frame_pointer_required		(
 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);
 
Index: gcc/config/frv/frv.c
===================================================================
--- gcc/config/frv/frv.c	(branch legitimate-address-p)
+++ gcc/config/frv/frv.c	(working copy)
@@ -269,6 +269,7 @@ frv_cpu_t frv_cpu_type = CPU_TYPE;	/* va
 /* 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);
@@ -472,6 +473,9 @@ static bool frv_secondary_reload        
 #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) \
@@ -2537,7 +2541,7 @@ frv_return_addr_rtx (int count, rtx fram
    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)
@@ -3363,11 +3367,11 @@ frv_regno_ok_for_base_p (int regno, int 
    `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;
@@ -3494,6 +3498,12 @@ frv_legitimate_address_p (enum machine_m
   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)
@@ -3788,8 +3798,8 @@ frv_legitimate_memory_operand (rtx op, e
 {
   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
@@ -3949,7 +3959,7 @@ condexec_memory_operand (rtx op, enum ma
     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
@@ -5851,7 +5861,7 @@ frv_ifcvt_rewrite_mem (rtx mem, enum mac
 {
   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)
 	{
Index: gcc/config/s390/s390.h
===================================================================
--- gcc/config/s390/s390.h	(branch legitimate-address-p)
+++ gcc/config/s390/s390.h	(working copy)
@@ -746,24 +746,6 @@ legitimate_address_p.  The constraint le
 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.  */
Index: gcc/config/s390/s390.c
===================================================================
--- gcc/config/s390/s390.c	(branch legitimate-address-p)
+++ gcc/config/s390/s390.c	(working copy)
@@ -3085,8 +3085,8 @@ s390_expand_plus_operand (rtx target, rt
 /* 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;
 
@@ -3744,7 +3744,7 @@ s390_legitimize_address (rtx x, rtx oldx
     {
       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
@@ -3761,7 +3761,7 @@ s390_legitimize_address (rtx x, rtx oldx
                   || 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;
     }
 
@@ -9993,6 +9993,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"
Index: gcc/config/s390/constraints.md
===================================================================
--- gcc/config/s390/constraints.md	(branch legitimate-address-p)
+++ gcc/config/s390/constraints.md	(working copy)
@@ -398,7 +398,7 @@ level.  This constraint will never be us
 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
Index: gcc/config/s390/s390-protos.h
===================================================================
--- gcc/config/s390/s390-protos.h	(branch legitimate-address-p)
+++ gcc/config/s390/s390-protos.h	(working copy)
@@ -72,7 +72,6 @@ extern bool preferred_la_operand_p (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);
Index: gcc/config/m32c/m32c.h
===================================================================
--- gcc/config/m32c/m32c.h	(branch legitimate-address-p)
+++ gcc/config/m32c/m32c.h	(working copy)
@@ -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
 
Index: gcc/config/m32c/m32c.c
===================================================================
--- gcc/config/m32c/m32c.c	(branch legitimate-address-p)
+++ gcc/config/m32c/m32c.c	(working copy)
@@ -68,6 +68,7 @@ static int m32c_comp_type_attributes (co
 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);
@@ -1767,13 +1768,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))
Index: gcc/config/m32c/m32c-protos.h
===================================================================
--- gcc/config/m32c/m32c-protos.h	(branch legitimate-address-p)
+++ gcc/config/m32c/m32c-protos.h	(working copy)
@@ -77,7 +77,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);
Index: gcc/config/spu/spu.h
===================================================================
--- gcc/config/spu/spu.h	(branch legitimate-address-p)
+++ gcc/config/spu/spu.h	(working copy)
@@ -416,17 +416,6 @@ targetm.resolve_overloaded_builtin = spu
 
 #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)
 
 
Index: gcc/config/spu/spu.c
===================================================================
--- gcc/config/spu/spu.c	(branch legitimate-address-p)
+++ gcc/config/spu/spu.c	(working copy)
@@ -153,6 +153,7 @@ char regs_ever_allocated[FIRST_PSEUDO_RE
 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);
@@ -401,6 +402,9 @@ const struct attribute_spec spu_attribut
 #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
Index: gcc/config/spu/spu-protos.h
===================================================================
--- gcc/config/spu/spu-protos.h	(branch legitimate-address-p)
+++ gcc/config/spu/spu-protos.h	(working copy)
@@ -55,8 +55,6 @@ extern bool exp2_immediate_p (rtx op, en
 			      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,
Index: gcc/config/sparc/sparc.h
===================================================================
--- gcc/config/sparc/sparc.h	(branch legitimate-address-p)
+++ gcc/config/sparc/sparc.h	(working copy)
@@ -1881,20 +1881,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.
 
Index: gcc/config/sparc/sparc.c
===================================================================
--- gcc/config/sparc/sparc.c	(branch legitimate-address-p)
+++ gcc/config/sparc/sparc.c	(working copy)
@@ -361,6 +361,7 @@ static int hypersparc_adjust_cost (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);
@@ -592,6 +593,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.  */
@@ -2961,8 +2965,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;
 
@@ -3397,7 +3401,7 @@ sparc_legitimize_address (rtx x, rtx old
     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))
Index: gcc/config/sparc/sparc-protos.h
===================================================================
--- gcc/config/sparc/sparc-protos.h	(branch legitimate-address-p)
+++ gcc/config/sparc/sparc-protos.h	(working copy)
@@ -69,7 +69,6 @@ extern void sparc64_initialize_trampolin
 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);
Index: gcc/config/i386/i386.h
===================================================================
--- gcc/config/i386/i386.h	(branch legitimate-address-p)
+++ gcc/config/i386/i386.h	(working copy)
@@ -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.
 
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(branch legitimate-address-p)
+++ gcc/config/i386/i386.c	(working copy)
@@ -9091,13 +9091,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
@@ -9274,9 +9267,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;
@@ -9500,6 +9493,14 @@ legitimate_address_p (enum machine_mode 
  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.  */
 
@@ -10155,7 +10156,7 @@ ix86_legitimize_address (rtx x, rtx oldx
 	    }
 	}
 
-      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)
@@ -10181,7 +10182,7 @@ ix86_legitimize_address (rtx x, rtx oldx
 	  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)))
@@ -30266,6 +30267,9 @@ ix86_enum_va_list (int idx, const char *
 #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"
Index: gcc/config/i386/i386-protos.h
===================================================================
--- gcc/config/i386/i386-protos.h	(branch legitimate-address-p)
+++ gcc/config/i386/i386-protos.h	(working copy)
@@ -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);
Index: gcc/config/avr/avr.h
===================================================================
--- gcc/config/avr/avr.h	(branch legitimate-address-p)
+++ gcc/config/avr/avr.h	(working copy)
@@ -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))
 
Index: gcc/config/avr/avr.c
===================================================================
--- gcc/config/avr/avr.c	(branch legitimate-address-p)
+++ gcc/config/avr/avr.c	(working copy)
@@ -71,6 +71,7 @@ const struct attribute_spec avr_attribut
 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_t
 #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 *f
 /* 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;
   
Index: gcc/config/avr/avr-protos.h
===================================================================
--- gcc/config/avr/avr-protos.h	(branch legitimate-address-p)
+++ gcc/config/avr/avr-protos.h	(working copy)
@@ -61,7 +61,6 @@ extern void function_arg_advance (CUMULA
 
 #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);
Index: gcc/config/crx/crx.h
===================================================================
--- gcc/config/crx/crx.h	(branch legitimate-address-p)
+++ gcc/config/crx/crx.h	(working copy)
@@ -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
 
 /*****************************************************************************/
Index: gcc/config/crx/crx.c
===================================================================
--- gcc/config/crx/crx.c	(branch legitimate-address-p)
+++ gcc/config/crx/crx.c	(working copy)
@@ -137,6 +137,14 @@ static rtx crx_struct_value_rtx (tree fn
 				 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					     */
@@ -726,9 +734,9 @@ crx_decompose_address (rtx addr, struct 
   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;
Index: gcc/config/crx/crx-protos.h
===================================================================
--- gcc/config/crx/crx-protos.h	(branch legitimate-address-p)
+++ gcc/config/crx/crx-protos.h	(working copy)
@@ -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);
 
Index: gcc/config/xtensa/xtensa.h
===================================================================
--- gcc/config/xtensa/xtensa.h	(branch legitimate-address-p)
+++ gcc/config/xtensa/xtensa.h	(working copy)
@@ -782,13 +782,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.  */
Index: gcc/config/xtensa/xtensa.c
===================================================================
--- gcc/config/xtensa/xtensa.c	(branch legitimate-address-p)
+++ gcc/config/xtensa/xtensa.c	(working copy)
@@ -137,6 +137,7 @@ static bool xtensa_return_in_msb (const_
 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,
@@ -230,6 +231,9 @@ static const int reg_nonleaf_alloc_order
 #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;
 
 
Index: gcc/config/xtensa/xtensa-protos.h
===================================================================
--- gcc/config/xtensa/xtensa-protos.h	(branch legitimate-address-p)
+++ gcc/config/xtensa/xtensa-protos.h	(working copy)
@@ -54,7 +54,6 @@ extern char *xtensa_emit_branch (bool, b
 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
Index: gcc/config/stormy16/stormy16.h
===================================================================
--- gcc/config/stormy16/stormy16.h	(branch legitimate-address-p)
+++ gcc/config/stormy16/stormy16.h	(working copy)
@@ -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
Index: gcc/config/stormy16/stormy16.c
===================================================================
--- gcc/config/stormy16/stormy16.c	(branch legitimate-address-p)
+++ gcc/config/stormy16/stormy16.c	(working copy)
@@ -619,9 +619,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;
@@ -2656,6 +2656,9 @@ xstormy16_return_in_memory (const_tree t
 #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"
Index: gcc/config/stormy16/stormy16-protos.h
===================================================================
--- gcc/config/stormy16/stormy16-protos.h	(branch legitimate-address-p)
+++ gcc/config/stormy16/stormy16-protos.h	(working copy)
@@ -71,7 +71,6 @@ extern int  nonimmediate_nonstack_operan
 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, 
Index: gcc/config/m68hc11/m68hc11.h
===================================================================
--- gcc/config/m68hc11/m68hc11.h	(branch legitimate-address-p)
+++ gcc/config/m68hc11/m68hc11.h	(working copy)
@@ -1169,19 +1169,6 @@ extern unsigned char m68hc11_reg_valid_f
   (((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
Index: gcc/config/m68hc11/m68hc11.c
===================================================================
--- gcc/config/m68hc11/m68hc11.c	(branch legitimate-address-p)
+++ gcc/config/m68hc11/m68hc11.c	(working copy)
@@ -64,7 +64,8 @@ static void emit_move_after_reload (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);
@@ -264,6 +265,9 @@ static const struct processor_costs m681
 #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
@@ -725,9 +729,9 @@ m68hc11_register_indirect_p (rtx operand
   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;
 
@@ -756,9 +760,9 @@ go_if_legitimate_address_internal (rtx o
   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;
 
@@ -769,7 +773,7 @@ m68hc11_go_if_legitimate_address (rtx op
       debug_rtx (operand);
     }
 
-  result = go_if_legitimate_address_internal (operand, mode, strict);
+  result = m68hc11_legitimate_address_p_1 (mode, operand, strict);
 
   if (debug_m6811)
     {
Index: gcc/config/m68hc11/m68hc11-protos.h
===================================================================
--- gcc/config/m68hc11/m68hc11-protos.h	(branch legitimate-address-p)
+++ gcc/config/m68hc11/m68hc11-protos.h	(working copy)
@@ -48,8 +48,6 @@ extern void m68hc11_initialize_trampolin
 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);
 
Index: gcc/config/iq2000/iq2000.h
===================================================================
--- gcc/config/iq2000/iq2000.h	(branch legitimate-address-p)
+++ gcc/config/iq2000/iq2000.h	(working copy)
@@ -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)
Index: gcc/config/iq2000/iq2000.c
===================================================================
--- gcc/config/iq2000/iq2000.c	(branch legitimate-address-p)
+++ gcc/config/iq2000/iq2000.c	(working copy)
@@ -171,6 +171,7 @@ static bool iq2000_pass_by_reference  (C
 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
@@ -219,6 +220,9 @@ static void iq2000_va_start	      (tree,
 #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.  */
@@ -256,8 +260,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)
     {
@@ -318,7 +322,7 @@ iq2000_legitimate_address_p (enum machin
     }
 
   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;
Index: gcc/config/iq2000/iq2000-protos.h
===================================================================
--- gcc/config/iq2000/iq2000-protos.h	(branch legitimate-address-p)
+++ gcc/config/iq2000/iq2000-protos.h	(working copy)
@@ -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);
Index: gcc/config/mn10300/mn10300.c
===================================================================
--- gcc/config/mn10300/mn10300.c	(branch legitimate-address-p)
+++ gcc/config/mn10300/mn10300.c	(working copy)
@@ -69,6 +69,7 @@ enum processor_type mn10300_processor = 
 
 
 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_
 #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;
 
@@ -1902,7 +1906,7 @@ legitimate_pic_operand_p (rtx x)
 /* Return TRUE if the address X, taken from a (MEM:MODE X) rtx, is
    legitimate, and FALSE otherwise.  */
 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)))
Index: gcc/config/mn10300/mn10300-protos.h
===================================================================
--- gcc/config/mn10300/mn10300-protos.h	(branch legitimate-address-p)
+++ gcc/config/mn10300/mn10300-protos.h	(working copy)
@@ -23,7 +23,6 @@ along with GCC; see the file COPYING3.  
 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);
Index: gcc/config/m68k/m68k.h
===================================================================
--- gcc/config/m68k/m68k.h	(branch legitimate-address-p)
+++ gcc/config/m68k/m68k.h	(working copy)
@@ -757,14 +757,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
Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc/config/m68k/m68k.c	(branch legitimate-address-p)
+++ gcc/config/m68k/m68k.c	(working copy)
@@ -131,6 +131,7 @@ static void m68k_sched_dfa_pre_advance_c
 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 *);
@@ -253,6 +254,9 @@ int m68k_last_compare_had_fp_operands;
 #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 } */
Index: gcc/config/m68k/m68k-protos.h
===================================================================
--- gcc/config/m68k/m68k-protos.h	(branch legitimate-address-p)
+++ gcc/config/m68k/m68k-protos.h	(working copy)
@@ -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);
Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h	(branch legitimate-address-p)
+++ gcc/config/rs6000/rs6000.h	(working copy)
@@ -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
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(branch legitimate-address-p)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -752,6 +752,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 (enum rtx_code);
 static void rs6000_emit_stack_tie (void);
 static void rs6000_frame_related (rtx, rtx, HOST_WIDE_INT, rtx, rtx);
@@ -1296,6 +1297,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;
 
 
@@ -3561,7 +3565,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)
@@ -4213,13 +4217,6 @@ rs6000_tls_symbol_ref_1 (rtx *x, void *d
   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,
@@ -4276,7 +4273,7 @@ rs6000_legitimize_reload_address (rtx x,
   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)
@@ -4294,7 +4291,7 @@ rs6000_legitimize_reload_address (rtx x,
   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
@@ -4415,8 +4412,8 @@ rs6000_legitimize_reload_address (rtx x,
    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
Index: gcc/config/rs6000/rs6000-protos.h
===================================================================
--- gcc/config/rs6000/rs6000-protos.h	(branch legitimate-address-p)
+++ gcc/config/rs6000/rs6000-protos.h	(working copy)
@@ -109,7 +109,6 @@ extern void rs6000_emit_move (rtx, rtx, 
 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);
Index: gcc/config/picochip/picochip.h
===================================================================
--- gcc/config/picochip/picochip.h	(branch legitimate-address-p)
+++ gcc/config/picochip/picochip.h	(working copy)
@@ -492,18 +492,6 @@ extern const enum reg_class picochip_reg
 
 #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:
Index: gcc/config/picochip/picochip.c
===================================================================
--- gcc/config/picochip/picochip.c	(branch legitimate-address-p)
+++ gcc/config/picochip/picochip.c	(working copy)
@@ -95,6 +95,7 @@ rtx picochip_expand_builtin (tree, rtx, 
 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 (vo
 #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
 /* 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;
 
Index: gcc/config/picochip/picochip-protos.h
===================================================================
--- gcc/config/picochip/picochip-protos.h	(branch legitimate-address-p)
+++ gcc/config/picochip/picochip-protos.h	(working copy)
@@ -26,7 +26,6 @@ extern void picochip_function_prologue (
 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 */
Index: gcc/config/score/score.h
===================================================================
--- gcc/config/score/score.h	(branch legitimate-address-p)
+++ gcc/config/score/score.h	(working copy)
@@ -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.
Index: gcc/config/score/score3.c
===================================================================
--- gcc/config/score/score3.c	(branch legitimate-address-p)
+++ gcc/config/score/score3.c	(working copy)
@@ -914,8 +914,8 @@ score3_regno_mode_ok_for_base_p (int reg
 }
 
 /* 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;
 
Index: gcc/config/score/score7.c
===================================================================
--- gcc/config/score/score7.c	(branch legitimate-address-p)
+++ gcc/config/score/score7.c	(working copy)
@@ -905,8 +905,8 @@ score7_regno_mode_ok_for_base_p (int reg
 }
 
 /* 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;
 
Index: gcc/config/score/score3.h
===================================================================
--- gcc/config/score/score3.h	(branch legitimate-address-p)
+++ gcc/config/score/score3.h	(working copy)
@@ -122,7 +122,8 @@ extern rtx score3_function_value (tree v
                                   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);
Index: gcc/config/score/score7.h
===================================================================
--- gcc/config/score/score7.h	(branch legitimate-address-p)
+++ gcc/config/score/score7.h	(working copy)
@@ -122,7 +122,8 @@ extern rtx score7_function_value (tree v
                                   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);
Index: gcc/config/score/score.c
===================================================================
--- gcc/config/score/score.c	(branch legitimate-address-p)
+++ gcc/config/score/score.c	(working copy)
@@ -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;
 rtx cmp_op0, cmp_op1;
 
@@ -532,13 +535,13 @@ score_regno_mode_ok_for_base_p (int regn
 }
 
 /* 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 ();
 }
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c	(branch legitimate-address-p)
+++ gcc/config/arm/arm.c	(working copy)
@@ -76,6 +76,7 @@ static int thumb1_base_register_rtx_p (r
 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
 #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_m
 }
 
 /* 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 
    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_
     }
 }
 
+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_
     }
 
   /* 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);
Index: gcc/config/arm/arm.h
===================================================================
--- gcc/config/arm/arm.h	(branch legitimate-address-p)
+++ gcc/config/arm/arm.h	(working copy)
@@ -2166,43 +2166,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
Index: gcc/config/arm/arm-protos.h
===================================================================
--- gcc/config/arm/arm-protos.h	(branch legitimate-address-p)
+++ gcc/config/arm/arm-protos.h	(working copy)
@@ -54,9 +54,7 @@ extern RTX_CODE arm_canonicalize_compari
 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);
Index: gcc/config/arm/constraints.md
===================================================================
--- gcc/config/arm/constraints.md	(branch legitimate-address-p)
+++ gcc/config/arm/constraints.md	(working copy)
@@ -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
Index: gcc/config/arm/predicates.md
===================================================================
--- gcc/config/arm/predicates.md	(branch legitimate-address-p)
+++ gcc/config/arm/predicates.md	(working copy)
@@ -231,8 +231,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")
Index: gcc/config/mips/mips.h
===================================================================
--- gcc/config/mips/mips.h	(branch legitimate-address-p)
+++ gcc/config/mips/mips.h	(working copy)
@@ -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)
 
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	(branch legitimate-address-p)
+++ gcc/config/mips/mips.c	(working copy)
@@ -2119,10 +2119,9 @@ mips_classify_address (struct mips_addre
     }
 }
 
-/* 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;
@@ -14909,6 +14908,9 @@ mips_final_postscan_insn (FILE *file, rt
 #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"
Index: gcc/config/mips/mips-protos.h
===================================================================
--- gcc/config/mips/mips-protos.h	(branch legitimate-address-p)
+++ gcc/config/mips/mips-protos.h	(working copy)
@@ -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);
Index: gcc/config/vax/vax.h
===================================================================
--- gcc/config/vax/vax.h	(branch legitimate-address-p)
+++ gcc/config/vax/vax.h	(working copy)
@@ -540,11 +540,6 @@ enum reg_class { NO_REGS, ALL_REGS, LIM_
    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_
 /* 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)
Index: gcc/config/vax/vax.c
===================================================================
--- gcc/config/vax/vax.c	(branch legitimate-address-p)
+++ gcc/config/vax/vax.c	(working copy)
@@ -46,6 +46,7 @@ along with GCC; see the file COPYING3.  
 #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_valu
 #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.  */
@@ -1719,7 +1723,7 @@ indexable_address_p (rtx xfoo0, rtx xfoo
    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;
 
Index: gcc/config/vax/vax-protos.h
===================================================================
--- gcc/config/vax/vax-protos.h	(branch legitimate-address-p)
+++ gcc/config/vax/vax-protos.h	(working copy)
@@ -19,11 +19,9 @@ along with GCC; see the file COPYING3.  
 
 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 bool adjacent_operands_p (rtx, rtx, enum machine_mode);
Index: gcc/config/h8300/h8300.h
===================================================================
--- gcc/config/h8300/h8300.h	(branch legitimate-address-p)
+++ gcc/config/h8300/h8300.h	(working copy)
@@ -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.
 
Index: gcc/config/h8300/h8300.c
===================================================================
--- gcc/config/h8300/h8300.c	(branch legitimate-address-p)
+++ gcc/config/h8300/h8300.c	(working copy)
@@ -5655,8 +5655,8 @@ h8300_rtx_ok_for_base_p (rtx x, int stri
    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))
@@ -5764,6 +5764,9 @@ h8300_return_in_memory (const_tree type,
 #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
 
Index: gcc/config/h8300/h8300-protos.h
===================================================================
--- gcc/config/h8300/h8300-protos.h	(branch legitimate-address-p)
+++ gcc/config/h8300/h8300-protos.h	(working copy)
@@ -59,7 +59,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);
Index: gcc/config/mmix/mmix.h
===================================================================
--- gcc/config/mmix/mmix.h	(branch legitimate-address-p)
+++ gcc/config/mmix/mmix.h	(working copy)
@@ -695,10 +695,6 @@ typedef struct { int regs; int lib; } CU
 
 #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	\
Index: gcc/config/mmix/mmix.c
===================================================================
--- gcc/config/mmix/mmix.c	(branch legitimate-address-p)
+++ gcc/config/mmix/mmix.c	(working copy)
@@ -125,6 +125,7 @@ static void mmix_emit_sp_add (HOST_WIDE_
 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 (CUMU
 #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							\
Index: gcc/config/mmix/mmix-protos.h
===================================================================
--- gcc/config/mmix/mmix-protos.h	(branch legitimate-address-p)
+++ gcc/config/mmix/mmix-protos.h	(working copy)
@@ -82,7 +82,6 @@ extern rtx mmix_eh_return_stackadj_rtx (
 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);
Index: gcc/config/bfin/bfin.c
===================================================================
--- gcc/config/bfin/bfin.c	(branch legitimate-address-p)
+++ gcc/config/bfin/bfin.c	(working copy)
@@ -2899,8 +2899,26 @@ bfin_valid_reg_p (unsigned int regno, in
     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:
@@ -6322,4 +6340,7 @@ bfin_expand_builtin (tree exp, rtx targe
 #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;
Index: gcc/config/bfin/bfin.h
===================================================================
--- gcc/config/bfin/bfin.h	(branch legitimate-address-p)
+++ gcc/config/bfin/bfin.h	(working copy)
@@ -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
Index: gcc/config/bfin/bfin-protos.h
===================================================================
--- gcc/config/bfin/bfin-protos.h	(branch legitimate-address-p)
+++ gcc/config/bfin/bfin-protos.h	(working copy)
@@ -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);
Index: gcc/target.h
===================================================================
--- gcc/target.h	(branch legitimate-address-p)
+++ gcc/target.h	(working copy)
@@ -610,6 +610,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);
 
Index: gcc/ira-conflicts.c
===================================================================
--- gcc/ira-conflicts.c	(branch legitimate-address-p)
+++ gcc/ira-conflicts.c	(working copy)
@@ -248,12 +248,10 @@ get_dup_num (int op_num, bool use_commut
 	    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;
 	    


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]