re PR middle-end/54635 (Add addr_space_t argument to TARGET_MODE_DEPENDENT_ADDRESS_P)
authorGeorg-Johann Lay <avr@gjlay.de>
Wed, 26 Sep 2012 13:46:29 +0000 (13:46 +0000)
committerGeorg-Johann Lay <gjl@gcc.gnu.org>
Wed, 26 Sep 2012 13:46:29 +0000 (13:46 +0000)
PR middle-end/54635
* doc/tm.texi.in (TARGET_MODE_DEPENDENT_ADDRESS_P): Document new
parameter addrspace.
* doc/tm.texi: Regenerate.
* target.def (mode_dependent_address_p): Add addr_space_t parameter.
* targhooks.h (default_mode_dependent_address_p): Ditto.
* targhooks.c (default_mode_dependent_address_p): Ditto.
* expr.c (convert_move): Pass address space to mode_dependent_address_p.
* combine.c (combine_simplify_rtx): Ditto.
(make_extraction): Ditto.
(simplify_shift_const_1): Ditto.
(gen_lowpart_for_combine): Ditto.
* lower-subreg.c (simple_move_operand): Ditto.
* recog.c (simplify_while_replacing): Ditto.
(offsettable_address_addr_space_p): Ditto.
(mode_dependent_address_p): Ditto.
* simplify-rtx.c (simplify_unary_operation_1): Ditto.
(simplify_subreg): Ditto.
* config/m68k/m68k.md: Ditto.
* config/vax/vax.md: Ditto.
* config/vax/constraints.md (Q): Ditto.
* config/vax/predicates.md (indexed_memory_operand): Ditto.
* config/alpha/alpha.c (alpha_mode_dependent_address_p): Add
unused addr_space_t parameter.
* config/avr/avr.c (avr_mode_dependent_address_p): Ditto.
* config/h8300/h8300.c (h8300_mode_dependent_address_p): Ditto.
* config/m32r/m32r.c (m32r_mode_dependent_address_p): Ditto.
* config/rs6000/rs6000.c (rs6000_mode_dependent_address_p): Ditto.
* config/rx/rx.c (rx_mode_dependent_address_p): Ditto.
* config/sparc/sparc.c (sparc_mode_dependent_address_p): Ditto.
* config/stormy16/stormy16.c (xstormy16_mode_dependent_address_p):
Ditto.
* config/vax/vax.c (vax_mode_dependent_address_p): Ditto.
* config/xtensa/xtensa.c (xtensa_mode_dependent_address_p): Ditto.

From-SVN: r191761

27 files changed:
gcc/ChangeLog
gcc/combine.c
gcc/config/alpha/alpha.c
gcc/config/avr/avr.c
gcc/config/avr/avr.md
gcc/config/h8300/h8300.c
gcc/config/m32r/m32r.c
gcc/config/m68k/m68k.md
gcc/config/rs6000/rs6000.c
gcc/config/rx/rx.c
gcc/config/sparc/sparc.c
gcc/config/stormy16/stormy16.c
gcc/config/vax/constraints.md
gcc/config/vax/predicates.md
gcc/config/vax/vax.c
gcc/config/vax/vax.md
gcc/config/xtensa/xtensa.c
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/expr.c
gcc/lower-subreg.c
gcc/recog.c
gcc/recog.h
gcc/simplify-rtx.c
gcc/target.def
gcc/targhooks.c
gcc/targhooks.h

index ce08fce..c2c072d 100644 (file)
@@ -1,3 +1,40 @@
+2012-09-26  Georg-Johann Lay  <avr@gjlay.de>
+
+       PR middle-end/54635
+       * doc/tm.texi.in (TARGET_MODE_DEPENDENT_ADDRESS_P): Document new
+       parameter addrspace.
+       * doc/tm.texi: Regenerate.
+       * target.def (mode_dependent_address_p): Add addr_space_t parameter.
+       * targhooks.h (default_mode_dependent_address_p): Ditto.
+       * targhooks.c (default_mode_dependent_address_p): Ditto.
+       * expr.c (convert_move): Pass address space to mode_dependent_address_p.
+       * combine.c (combine_simplify_rtx): Ditto.
+       (make_extraction): Ditto.
+       (simplify_shift_const_1): Ditto.
+       (gen_lowpart_for_combine): Ditto.
+       * lower-subreg.c (simple_move_operand): Ditto.
+       * recog.c (simplify_while_replacing): Ditto.
+       (offsettable_address_addr_space_p): Ditto.
+       (mode_dependent_address_p): Ditto.
+       * simplify-rtx.c (simplify_unary_operation_1): Ditto.
+       (simplify_subreg): Ditto.
+       * config/m68k/m68k.md: Ditto.
+       * config/vax/vax.md: Ditto.
+       * config/vax/constraints.md (Q): Ditto.
+       * config/vax/predicates.md (indexed_memory_operand): Ditto.
+       * config/alpha/alpha.c (alpha_mode_dependent_address_p): Add
+       unused addr_space_t parameter.
+       * config/avr/avr.c (avr_mode_dependent_address_p): Ditto.
+       * config/h8300/h8300.c (h8300_mode_dependent_address_p): Ditto.
+       * config/m32r/m32r.c (m32r_mode_dependent_address_p): Ditto.
+       * config/rs6000/rs6000.c (rs6000_mode_dependent_address_p): Ditto.
+       * config/rx/rx.c (rx_mode_dependent_address_p): Ditto.
+       * config/sparc/sparc.c (sparc_mode_dependent_address_p): Ditto.
+       * config/stormy16/stormy16.c (xstormy16_mode_dependent_address_p):
+       Ditto.
+       * config/vax/vax.c (vax_mode_dependent_address_p): Ditto.
+       * config/xtensa/xtensa.c (xtensa_mode_dependent_address_p): Ditto.
+
 2012-09-26  Christophe Lyon <christophe.lyon@linaro.org>
 
        * tree-ssa-math-opts.c (bswap_stats): Add found_16bit field.
index ad86f68..4e0a579 100644 (file)
@@ -5424,7 +5424,8 @@ combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest,
         of the address.  */
       if (MEM_P (SUBREG_REG (x))
          && (MEM_VOLATILE_P (SUBREG_REG (x))
-             || mode_dependent_address_p (XEXP (SUBREG_REG (x), 0))))
+             || mode_dependent_address_p (XEXP (SUBREG_REG (x), 0),
+                                          MEM_ADDR_SPACE (SUBREG_REG (x)))))
        return gen_rtx_CLOBBER (mode, const0_rtx);
 
       /* Note that we cannot do any narrowing for non-constants since
@@ -7054,7 +7055,8 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
                 may not be aligned, for one thing).  */
              && GET_MODE_PRECISION (inner_mode) >= GET_MODE_PRECISION (tmode)
              && (inner_mode == tmode
-                 || (! mode_dependent_address_p (XEXP (inner, 0))
+                 || (! mode_dependent_address_p (XEXP (inner, 0),
+                                                 MEM_ADDR_SPACE (inner))
                      && ! MEM_VOLATILE_P (inner))))))
     {
       /* If INNER is a MEM, make a new MEM that encompasses just the desired
@@ -7233,7 +7235,7 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
       /* If we have to change the mode of memory and cannot, the desired mode
         is EXTRACTION_MODE.  */
       if (inner_mode != wanted_inner_mode
-         && (mode_dependent_address_p (XEXP (inner, 0))
+         && (mode_dependent_address_p (XEXP (inner, 0), MEM_ADDR_SPACE (inner))
              || MEM_VOLATILE_P (inner)
              || pos_rtx))
        wanted_inner_mode = extraction_mode;
@@ -7271,7 +7273,7 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
       && ! pos_rtx
       && GET_MODE_SIZE (wanted_inner_mode) < GET_MODE_SIZE (is_mode)
       && MEM_P (inner)
-      && ! mode_dependent_address_p (XEXP (inner, 0))
+      && ! mode_dependent_address_p (XEXP (inner, 0), MEM_ADDR_SPACE (inner))
       && ! MEM_VOLATILE_P (inner))
     {
       int offset = 0;
@@ -9883,7 +9885,8 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode,
             minus the width of a smaller mode, we can do this with a
             SIGN_EXTEND or ZERO_EXTEND from the narrower memory location.  */
          if ((code == ASHIFTRT || code == LSHIFTRT)
-             && ! mode_dependent_address_p (XEXP (varop, 0))
+             && ! mode_dependent_address_p (XEXP (varop, 0),
+                                            MEM_ADDR_SPACE (varop))
              && ! MEM_VOLATILE_P (varop)
              && (tmode = mode_for_size (GET_MODE_BITSIZE (mode) - count,
                                         MODE_INT, 1)) != BLKmode)
@@ -10702,7 +10705,8 @@ gen_lowpart_for_combine (enum machine_mode omode, rtx x)
 
       /* Refuse to work on a volatile memory ref or one with a mode-dependent
         address.  */
-      if (MEM_VOLATILE_P (x) || mode_dependent_address_p (XEXP (x, 0)))
+      if (MEM_VOLATILE_P (x)
+         || mode_dependent_address_p (XEXP (x, 0), MEM_ADDR_SPACE (x)))
        goto fail;
 
       /* If we want to refer to something bigger than the original memref,
index 9aaa4f2..d726b5a 100644 (file)
@@ -1043,7 +1043,8 @@ alpha_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
    We can simplify the test since we know that the address must be valid.  */
 
 static bool
-alpha_mode_dependent_address_p (const_rtx addr)
+alpha_mode_dependent_address_p (const_rtx addr,
+                               addr_space_t as ATTRIBUTE_UNUSED)
 {
   return GET_CODE (addr) == AND;
 }
index f23a7e8..87ff531 100644 (file)
@@ -1633,7 +1633,7 @@ avr_cannot_modify_jumps_p (void)
       with mov<mode> expanders in avr.md.  */
 
 static bool
-avr_mode_dependent_address_p (const_rtx addr)
+avr_mode_dependent_address_p (const_rtx addr, addr_space_t as ATTRIBUTE_UNUSED)
 {
   return GET_MODE (addr) != Pmode;
 }
index d128770..b86f9b6 100644 (file)
 ;; "*addhq3" "*adduhq3"
 ;; "*addha3" "*adduha3"
 (define_insn "*add<mode>3"
-  [(set (match_operand:ALL2 0 "register_operand"                     "=r,d,!w    ,d")
+  [(set (match_operand:ALL2 0 "register_operand"                    "=?r,d,!w    ,d")
         (plus:ALL2 (match_operand:ALL2 1 "register_operand"          "%0,0,0     ,0")
                    (match_operand:ALL2 2 "nonmemory_or_const_operand" "r,s,IJ YIJ,n Ynn")))]
   ""
index 3dd071a..38a9228 100644 (file)
@@ -2166,7 +2166,8 @@ h8300_get_index (rtx x, enum machine_mode mode, int *size)
    (the amount of decrement or increment being the length of the operand).  */
 
 static bool
-h8300_mode_dependent_address_p (const_rtx addr)
+h8300_mode_dependent_address_p (const_rtx addr,
+                               addr_space_t as ATTRIBUTE_UNUSED)
 {
   if (GET_CODE (addr) == PLUS
       && h8300_get_index (XEXP (addr, 0), VOIDmode, 0) != XEXP (addr, 0))
index 4d89966..03360b6 100644 (file)
@@ -62,7 +62,7 @@ static void  block_move_call (rtx, rtx, rtx);
 static int   m32r_is_insn (rtx);
 static bool  m32r_legitimate_address_p (enum machine_mode, rtx, bool);
 static rtx   m32r_legitimize_address (rtx, rtx, enum machine_mode);
-static bool  m32r_mode_dependent_address_p (const_rtx);
+static bool  m32r_mode_dependent_address_p (const_rtx, addr_space_t);
 static tree  m32r_handle_model_attribute (tree *, tree, tree, int, bool *);
 static void  m32r_print_operand (FILE *, rtx, int);
 static void  m32r_print_operand_address (FILE *, rtx);
@@ -2011,7 +2011,7 @@ m32r_legitimize_address (rtx x, rtx orig_x ATTRIBUTE_UNUSED,
 /* Worker function for TARGET_MODE_DEPENDENT_ADDRESS_P.  */
 
 static bool
-m32r_mode_dependent_address_p (const_rtx addr)
+m32r_mode_dependent_address_p (const_rtx addr, addr_space_t as ATTRIBUTE_UNUSED)
 {
   if (GET_CODE (addr) == LO_SUM)
     return true;
index 00a69c7..82807d8 100644 (file)
        (match_operand:SI 2 "general_src_operand" "rmSi"))]
   "TARGET_68020 && TARGET_BITFIELD
    && (INTVAL (operands[1]) % 8) == 0
-   && ! mode_dependent_address_p (XEXP (operands[0], 0))"
+   && ! mode_dependent_address_p (XEXP (operands[0], 0),
+                                  MEM_ADDR_SPACE (operands[0]))"
 {
   operands[0]
     = adjust_address (operands[0], SImode, INTVAL (operands[1]) / 8);
    && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
    && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
    && (GET_CODE (operands[0]) == REG
-       || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[0], 0),
+                                      MEM_ADDR_SPACE (operands[0])))"
 {
   if (REG_P (operands[0]))
     {
                         (match_operand:SI 2 "const_int_operand" "n")))]
   "TARGET_68020 && TARGET_BITFIELD
    && (INTVAL (operands[2]) % 8) == 0
-   && ! mode_dependent_address_p (XEXP (operands[1], 0))"
+   && ! mode_dependent_address_p (XEXP (operands[1], 0),
+                                  MEM_ADDR_SPACE (operands[1]))"
 {
   operands[1]
     = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
    && (GET_CODE (operands[1]) == REG
-       || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[1], 0),
+                                      MEM_ADDR_SPACE (operands[1])))"
 {
   cc_status.flags |= CC_NOT_NEGATIVE;
   if (REG_P (operands[1]))
                         (match_operand:SI 2 "const_int_operand" "n")))]
   "TARGET_68020 && TARGET_BITFIELD
    && (INTVAL (operands[2]) % 8) == 0
-   && ! mode_dependent_address_p (XEXP (operands[1], 0))"
+   && ! mode_dependent_address_p (XEXP (operands[1], 0),
+                                  MEM_ADDR_SPACE (operands[1]))"
 {
   operands[1]
     = adjust_address (operands[1], SImode, INTVAL (operands[2]) / 8);
    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
    && (GET_CODE (operands[1]) == REG
-       || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[1], 0),
+                                      MEM_ADDR_SPACE (operands[1])))"
 {
   if (REG_P (operands[1]))
     {
index 211087b..96026bd 100644 (file)
@@ -6463,7 +6463,8 @@ rs6000_debug_legitimate_address_p (enum machine_mode mode, rtx x,
 /* Implement TARGET_MODE_DEPENDENT_ADDRESS_P.  */
 
 static bool
-rs6000_mode_dependent_address_p (const_rtx addr)
+rs6000_mode_dependent_address_p (const_rtx addr,
+                                addr_space_t as ATTRIBUTE_UNUSED)
 {
   return rs6000_mode_dependent_address_ptr (addr);
 }
index 472625e..43676d1 100644 (file)
@@ -318,7 +318,7 @@ rx_is_restricted_memory_address (rtx mem, enum machine_mode mode)
 /* Implement TARGET_MODE_DEPENDENT_ADDRESS_P.  */
 
 static bool
-rx_mode_dependent_address_p (const_rtx addr)
+rx_mode_dependent_address_p (const_rtx addr, addr_space_t as ATTRIBUTE_UNUSED)
 {
   if (GET_CODE (addr) == CONST)
     addr = XEXP (addr, 0);
index fa36901..32ac9f3 100644 (file)
@@ -567,7 +567,7 @@ static rtx sparc_legitimize_tls_address (rtx);
 static rtx sparc_legitimize_pic_address (rtx, rtx);
 static rtx sparc_legitimize_address (rtx, rtx, enum machine_mode);
 static rtx sparc_delegitimize_address (rtx);
-static bool sparc_mode_dependent_address_p (const_rtx);
+static bool sparc_mode_dependent_address_p (const_rtx, addr_space_t);
 static bool sparc_pass_by_reference (cumulative_args_t,
                                     enum machine_mode, const_tree, bool);
 static void sparc_function_arg_advance (cumulative_args_t,
@@ -4045,7 +4045,8 @@ sparc_legitimize_reload_address (rtx x, enum machine_mode mode,
 
 
 static bool
-sparc_mode_dependent_address_p (const_rtx addr)
+sparc_mode_dependent_address_p (const_rtx addr,
+                               addr_space_t as ATTRIBUTE_UNUSED)
 {
   if (flag_pic && GET_CODE (addr) == PLUS)
     {
index a6f2b54..782217c 100644 (file)
@@ -671,7 +671,8 @@ xstormy16_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
    or pre-decrement address.  */
 
 static bool
-xstormy16_mode_dependent_address_p (const_rtx x)
+xstormy16_mode_dependent_address_p (const_rtx x,
+                                   addr_space_t as ATTRIBUTE_UNUSED)
 {
   if (LEGITIMATE_ADDRESS_CONST_INT_P (x, 0)
       && ! LEGITIMATE_ADDRESS_CONST_INT_P (x, 6))
index e3266f6..6c0256b 100644 (file)
@@ -99,7 +99,8 @@
 (define_memory_constraint "Q"
    "operand is a MEM that does not have a mode-dependent address."
    (and (match_code "mem")
-       (match_test "!mode_dependent_address_p (XEXP (op, 0))")))
+       (match_test "!mode_dependent_address_p (XEXP (op, 0),
+                                               MEM_ADDR_SPACE (op))")))
 
 (define_memory_constraint "B"
     ""
index 775ddcd..b15c281 100644 (file)
@@ -79,9 +79,9 @@
 (define_predicate "indexed_memory_operand"
    (match_code "mem")
 {
-  op = XEXP (op, 0);
-  return GET_CODE (op) != PRE_DEC && GET_CODE (op) != POST_INC
-        && mode_dependent_address_p (op);
+  rtx addr = XEXP (op, 0);
+  return GET_CODE (addr) != PRE_DEC && GET_CODE (addr) != POST_INC
+        && mode_dependent_address_p (addr, MEM_ADDR_SPACE (op));
 })
 
 (define_predicate "illegal_blk_memory_operand"
index 239b82c..e13ad8e 100644 (file)
@@ -64,7 +64,7 @@ static rtx vax_builtin_setjmp_frame_value (void);
 static void vax_asm_trampoline_template (FILE *);
 static void vax_trampoline_init (rtx, tree, rtx);
 static int vax_return_pops_args (tree, tree, int);
-static bool vax_mode_dependent_address_p (const_rtx);
+static bool vax_mode_dependent_address_p (const_rtx, addr_space_t);
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -1839,7 +1839,7 @@ vax_legitimate_address_p (enum machine_mode mode, rtx x, bool strict)
    thus (because the index scale factor is the length of the operand).  */
 
 static bool
-vax_mode_dependent_address_p (const_rtx x)
+vax_mode_dependent_address_p (const_rtx x, addr_space_t as ATTRIBUTE_UNUSED)
 {
   rtx xfoo0, xfoo1;
 
index afc3129..342c0e1 100644 (file)
    "(INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
    && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
    && (REG_P (operands[0])
-       || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[0], 0),
+                                      MEM_ADDR_SPACE (operands[0])))"
   "*
 {
   if (REG_P (operands[0]))
   "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
    && (REG_P (operands[1])
-       || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[1], 0),
+                                     MEM_ADDR_SPACE (operands[1])))"
   "*
 {
   if (REG_P (operands[1]))
   "(INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
    && (REG_P (operands[1])
-       || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
+       || ! mode_dependent_address_p (XEXP (operands[1], 0),
+                                     MEM_ADDR_SPACE (operands[1])))"
   "*
 {
   if (REG_P (operands[1]))
       || INTVAL (operands[2]) + INTVAL (operands[3]) > 32
       || side_effects_p (operands[1])
       || (MEM_P (operands[1])
-         && mode_dependent_address_p (XEXP (operands[1], 0))))
+         && mode_dependent_address_p (XEXP (operands[1], 0),
+                                      MEM_ADDR_SPACE (operands[1]))))
     return \"extv %3,%2,%1,%0\";
   if (INTVAL (operands[2]) == 8)
     return \"rotl %R3,%1,%0\;cvtbl %0,%0\";
       || INTVAL (operands[2]) + INTVAL (operands[3]) > 32
       || side_effects_p (operands[1])
       || (MEM_P (operands[1])
-         && mode_dependent_address_p (XEXP (operands[1], 0))))
+         && mode_dependent_address_p (XEXP (operands[1], 0),
+                                      MEM_ADDR_SPACE (operands[1]))))
     return \"extzv %3,%2,%1,%0\";
   if (INTVAL (operands[2]) == 8)
     return \"rotl %R3,%1,%0\;movzbl %0,%0\";
index 987b6d7..83eab4b 100644 (file)
@@ -126,7 +126,7 @@ static rtx fixup_subreg_mem (rtx);
 static struct machine_function * xtensa_init_machine_status (void);
 static rtx xtensa_legitimize_tls_address (rtx);
 static rtx xtensa_legitimize_address (rtx, rtx, enum machine_mode);
-static bool xtensa_mode_dependent_address_p (const_rtx);
+static bool xtensa_mode_dependent_address_p (const_rtx, addr_space_t);
 static bool xtensa_return_in_msb (const_tree);
 static void printx (FILE *, signed int);
 static void xtensa_function_epilogue (FILE *, HOST_WIDE_INT);
@@ -1961,7 +1961,8 @@ xtensa_legitimize_address (rtx x,
    by default.  */
 
 static bool
-xtensa_mode_dependent_address_p (const_rtx addr)
+xtensa_mode_dependent_address_p (const_rtx addr,
+                                addr_space_t as ATTRIBUTE_UNUSED)
 {
   return constantpool_address_p (addr);
 }
index d268fd8..a14a4fc 100644 (file)
@@ -5611,8 +5611,9 @@ 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
+@deftypefn {Target Hook} bool TARGET_MODE_DEPENDENT_ADDRESS_P (const_rtx @var{addr}, addr_space_t @var{addrspace})
+This hook returns @code{true} if memory address @var{addr} in address
+space @var{addrspace} 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.
index 86c7f5d..a85fee1 100644 (file)
@@ -5536,7 +5536,8 @@ address;  but often a machine-dependent strategy can generate better code.
 @end defmac
 
 @hook TARGET_MODE_DEPENDENT_ADDRESS_P
-This hook returns @code{true} if memory address @var{addr} can have
+This hook returns @code{true} if memory address @var{addr} in address
+space @var{addrspace} 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.
index 9158b9f..c180e8d 100644 (file)
@@ -573,7 +573,8 @@ convert_move (rtx to, rtx from, int unsignedp)
       if (!((MEM_P (from)
             && ! MEM_VOLATILE_P (from)
             && direct_load[(int) to_mode]
-            && ! mode_dependent_address_p (XEXP (from, 0)))
+            && ! mode_dependent_address_p (XEXP (from, 0),
+                                           MEM_ADDR_SPACE (from)))
            || REG_P (from)
            || GET_CODE (from) == SUBREG))
        from = force_reg (from_mode, from);
@@ -591,7 +592,8 @@ convert_move (rtx to, rtx from, int unsignedp)
       if (!((MEM_P (from)
             && ! MEM_VOLATILE_P (from)
             && direct_load[(int) to_mode]
-            && ! mode_dependent_address_p (XEXP (from, 0)))
+            && ! mode_dependent_address_p (XEXP (from, 0),
+                                           MEM_ADDR_SPACE (from)))
            || REG_P (from)
            || GET_CODE (from) == SUBREG))
        from = force_reg (from_mode, from);
index dfc3954..4aaaa77 100644 (file)
@@ -299,7 +299,7 @@ simple_move_operand (rtx x)
 
   if (MEM_P (x)
       && (MEM_VOLATILE_P (x)
-         || mode_dependent_address_p (XEXP (x, 0))))
+         || mode_dependent_address_p (XEXP (x, 0), MEM_ADDR_SPACE (x))))
     return false;
 
   return true;
index 5058da2..f28b021 100644 (file)
@@ -629,7 +629,8 @@ simplify_while_replacing (rtx *loc, rtx to, rtx object,
       if (MEM_P (XEXP (x, 0))
          && CONST_INT_P (XEXP (x, 1))
          && CONST_INT_P (XEXP (x, 2))
-         && !mode_dependent_address_p (XEXP (XEXP (x, 0), 0))
+         && !mode_dependent_address_p (XEXP (XEXP (x, 0), 0),
+                                       MEM_ADDR_SPACE (XEXP (x, 0)))
          && !MEM_VOLATILE_P (XEXP (x, 0)))
        {
          enum machine_mode wanted_mode = VOIDmode;
@@ -1945,7 +1946,7 @@ offsettable_address_addr_space_p (int strictp, enum machine_mode mode, rtx y,
   /* Adjusting an offsettable address involves changing to a narrower mode.
      Make sure that's OK.  */
 
-  if (mode_dependent_address_p (y))
+  if (mode_dependent_address_p (y, as))
     return 0;
 
   /* ??? How much offset does an offsettable BLKmode reference need?
@@ -1998,11 +1999,13 @@ offsettable_address_addr_space_p (int strictp, enum machine_mode mode, rtx y,
 /* Return 1 if ADDR is an address-expression whose effect depends
    on the mode of the memory reference it is used in.
 
+   ADDRSPACE is the address space associated with the address.
+
    Autoincrement addressing is a typical example of mode-dependence
    because the amount of the increment depends on the mode.  */
 
 bool
-mode_dependent_address_p (rtx addr)
+mode_dependent_address_p (rtx addr, addr_space_t addrspace)
 {
   /* Auto-increment addressing with anything other than post_modify
      or pre_modify always introduces a mode dependency.  Catch such
@@ -2013,7 +2016,7 @@ mode_dependent_address_p (rtx addr)
       || GET_CODE (addr) == POST_DEC)
     return true;
 
-  return targetm.mode_dependent_address_p (addr);
+  return targetm.mode_dependent_address_p (addr, addrspace);
 }
 \f
 /* Like extract_insn, but save insn extracted and don't extract again, when
index 9fb3443..0e7d537 100644 (file)
@@ -114,7 +114,7 @@ extern int offsettable_address_addr_space_p (int, enum machine_mode, rtx,
 #define offsettable_address_p(strict,mode,addr) \
        offsettable_address_addr_space_p ((strict), (mode), (addr), \
                                          ADDR_SPACE_GENERIC)
-extern bool mode_dependent_address_p (rtx);
+extern bool mode_dependent_address_p (rtx, addr_space_t);
 
 extern int recog (rtx, rtx, int *);
 #ifndef GENERATOR_FILE
index 97a9330..6b4b9f0 100644 (file)
@@ -874,7 +874,7 @@ simplify_unary_operation_1 (enum rtx_code code, enum machine_mode mode, rtx op)
         if we are not changing the meaning of the address. */
       if (GET_CODE (op) == MEM
          && !MEM_VOLATILE_P (op)
-         && !mode_dependent_address_p (XEXP (op, 0)))
+         && !mode_dependent_address_p (XEXP (op, 0), MEM_ADDR_SPACE (op)))
        return rtl_hooks.gen_lowpart_no_emit (mode, op);
 
       break;
@@ -5615,7 +5615,7 @@ simplify_subreg (enum machine_mode outermode, rtx op,
      or if we would be widening it.  */
 
   if (MEM_P (op)
-      && ! mode_dependent_address_p (XEXP (op, 0))
+      && ! mode_dependent_address_p (XEXP (op, 0), MEM_ADDR_SPACE (op))
       /* Allow splitting of volatile memory references in case we don't
          have instruction to move the whole thing.  */
       && (! MEM_VOLATILE_P (op)
@@ -5773,7 +5773,8 @@ simplify_subreg (enum machine_mode outermode, rtx op,
       && (INTVAL (XEXP (op, 1)) % GET_MODE_BITSIZE (outermode)) == 0
       && INTVAL (XEXP (op, 1)) > 0
       && INTVAL (XEXP (op, 1)) < GET_MODE_BITSIZE (innermode)
-      && ! mode_dependent_address_p (XEXP (XEXP (op, 0), 0))
+      && ! mode_dependent_address_p (XEXP (XEXP (op, 0), 0),
+                                    MEM_ADDR_SPACE (XEXP (op, 0)))
       && ! MEM_VOLATILE_P (XEXP (op, 0))
       && byte == subreg_lowpart_offset (outermode, innermode)
       && (GET_MODE_SIZE (outermode) >= UNITS_PER_WORD
index 0d23c57..8922c78 100644 (file)
@@ -1413,7 +1413,7 @@ DEFHOOK
 DEFHOOK
 (mode_dependent_address_p,
  "",
- bool, (const_rtx addr),
+ bool, (const_rtx addr, addr_space_t addrspace),
  default_mode_dependent_address_p)
 
 /* Given an invalid address X for a given machine mode, try machine-specific
index 36f998a..265fc98 100644 (file)
@@ -1202,7 +1202,8 @@ default_hard_regno_scratch_ok (unsigned int regno ATTRIBUTE_UNUSED)
 /* The default implementation of TARGET_MODE_DEPENDENT_ADDRESS_P.  */
 
 bool
-default_mode_dependent_address_p (const_rtx addr ATTRIBUTE_UNUSED)
+default_mode_dependent_address_p (const_rtx addr ATTRIBUTE_UNUSED,
+                                 addr_space_t addrspace ATTRIBUTE_UNUSED)
 {
   return false;
 }
index aa8b3ba..e89f096 100644 (file)
@@ -142,7 +142,7 @@ extern tree default_mangle_decl_assembler_name (tree, tree);
 extern tree default_emutls_var_fields (tree, tree *);
 extern tree default_emutls_var_init (tree, tree, tree);
 extern bool default_hard_regno_scratch_ok (unsigned int);
-extern bool default_mode_dependent_address_p (const_rtx addr);
+extern bool default_mode_dependent_address_p (const_rtx, addr_space_t);
 extern bool default_target_option_valid_attribute_p (tree, tree, tree, int);
 extern bool default_target_option_pragma_parse (tree, tree);
 extern bool default_target_can_inline_p (tree, tree);