OSDN Git Service

* target.h (struct gcc_target): Add mode_dependent_address_p field.
authoraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 May 2010 19:08:31 +0000 (19:08 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:06:53 +0000 (14:06 +0900)
* target-def.h (TARGET_MODE_DEPENDENT_ADDRESS_P): New.
(TARGET_INITIALIZER): Use TARGET_MODE_DEPENDENT_ADDRESS_P.
* targhooks.c (default_mode_dependent_address_p): New function.
* targhooks.h (default_mode_dependent_address_p): Declare function.
* doc/tm.texi (TARGET_MODE_DEPENDENT_ADDRESS_P): New.
(GO_IF_MODE_DEPENDENT_ADDRESS): Update.
* recog.c: (mode_dependent_address_p): Call mode_dependent_address_p
target hook. Change return type to bool.
* recog.h: (mode_dependent_address_p): Change return type to bool.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159339 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/doc/tm.texi
gcc/target-def.h
gcc/target.h
gcc/targhooks.c

index 8fb04d5..43d9e9e 100644 (file)
@@ -1,3 +1,16 @@
+2010-05-12  Anatoly Sokolov  <aesok@post.ru>
+
+       * target.h (struct gcc_target): Add mode_dependent_address_p field.
+       * target-def.h (TARGET_MODE_DEPENDENT_ADDRESS_P): New.
+       (TARGET_INITIALIZER): Use TARGET_MODE_DEPENDENT_ADDRESS_P.
+       * targhooks.c (default_mode_dependent_address_p): New function.
+       * targhooks.h (default_mode_dependent_address_p): Declare function.
+       * doc/tm.texi (TARGET_MODE_DEPENDENT_ADDRESS_P): New.
+       (GO_IF_MODE_DEPENDENT_ADDRESS): Update.
+       * recog.c: (mode_dependent_address_p): Call mode_dependent_address_p
+       target hook. Change return type to bool.
+       * recog.h: (mode_dependent_address_p): Change return type to bool.
+
 2010-05-12  Kazu Hirata  <kazu@codesourcery.com>
            Nathan Froyd  <froydnj@codesourcery.com>
 
index 96fc62c..6a998ed 100644 (file)
@@ -5609,6 +5609,22 @@ It is not necessary for this macro to come up with a legitimate
 address;  but often a machine-dependent strategy can generate better code.
 @end defmac
 
+@deftypefn {Target Hook} bool TARGET_MODE_DEPENDENT_ADDRESS_P (const_rtx @var{addr})
+This hook returns @code{true} if memory address @var{addr} can have
+different meanings depending on the machine mode of the memory
+reference it is used for or if the address is valid for some modes
+but not others.
+
+Autoincrement and autodecrement addresses typically have mode-dependent
+effects because the amount of the increment or decrement is the size
+of the operand being addressed.  Some machines have other mode-dependent
+addresses.  Many RISC machines have no mode-dependent addresses.
+
+You may assume that @var{addr} is a valid address for the machine.
+
+The default version of this hook returns @code{false}.
+@end deftypefn
+
 @defmac GO_IF_MODE_DEPENDENT_ADDRESS (@var{addr}, @var{label})
 A C statement or compound statement with a conditional @code{goto
 @var{label};} executed if memory address @var{x} (an RTX) can have
@@ -5622,6 +5638,9 @@ of the operand being addressed.  Some machines have other mode-dependent
 addresses.  Many RISC machines have no mode-dependent addresses.
 
 You may assume that @var{addr} is a valid address for the machine.
+
+These are obsolete macros, replaced by the
+@code{TARGET_MODE_DEPENDENT_ADDRESS_P} target hook.
 @end defmac
 
 @defmac LEGITIMATE_CONSTANT_P (@var{x})
index 72cf930..3ead370 100644 (file)
 #define TARGET_IN_SMALL_DATA_P hook_bool_const_tree_false
 #endif
 
+#ifndef TARGET_MODE_DEPENDENT_ADDRESS_P
+#define TARGET_MODE_DEPENDENT_ADDRESS_P default_mode_dependent_address_p
+#endif
+
 #ifndef TARGET_MANGLE_DECL_ASSEMBLER_NAME
 #define TARGET_MANGLE_DECL_ASSEMBLER_NAME default_mangle_decl_assembler_name
 #endif
   TARGET_CANNOT_FORCE_CONST_MEM,               \
   TARGET_CANNOT_COPY_INSN_P,                   \
   TARGET_COMMUTATIVE_P,                                \
+  TARGET_MODE_DEPENDENT_ADDRESS_P,             \
   TARGET_LEGITIMIZE_ADDRESS,                   \
   TARGET_DELEGITIMIZE_ADDRESS,                 \
   TARGET_LEGITIMATE_ADDRESS_P,                 \
index 2c9ab85..29ec84f 100644 (file)
@@ -663,6 +663,10 @@ struct gcc_target
 
   /* True if X is considered to be commutative.  */
   bool (* commutative_p) (const_rtx, int);
+  
+  /* True if ADDR is an address-expression whose effect depends
+     on the mode of the memory reference it is used in.  */
+  bool (* mode_dependent_address_p) (const_rtx addr);
 
   /* Given an invalid address X for a given machine mode, try machine-specific
      ways to make it legitimate.  Return X or an invalid address on failure.  */
index da84019..5e1831c 100644 (file)
@@ -965,7 +965,7 @@ default_mode_dependent_address_p (const_rtx addr ATTRIBUTE_UNUSED)
 {
 #ifdef GO_IF_MODE_DEPENDENT_ADDRESS
 
-  GO_IF_MODE_DEPENDENT_ADDRESS (CONST_CAST_RTX (addr), win);
+  GO_IF_MODE_DEPENDENT_ADDRESS (addr, win);
   return false;
   /* Label `win' might (not) be used via GO_IF_MODE_DEPENDENT_ADDRESS.  */
  win: ATTRIBUTE_UNUSED_LABEL