poly_int: adjust_mems
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 3 Jan 2018 07:18:21 +0000 (07:18 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 3 Jan 2018 07:18:21 +0000 (07:18 +0000)
This patch makes the var-tracking.c handling of autoinc addresses
cope with polynomial mode sizes.

2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* var-tracking.c (adjust_mems): Treat mode sizes as polynomial.
Use plus_constant instead of gen_rtx_PLUS.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r256156

gcc/ChangeLog
gcc/var-tracking.c

index d9428fe..fb3d07d 100644 (file)
@@ -2,6 +2,13 @@
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
 
+       * var-tracking.c (adjust_mems): Treat mode sizes as polynomial.
+       Use plus_constant instead of gen_rtx_PLUS.
+
+2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
        * config/cr16/cr16-protos.h (cr16_push_rounding): Declare.
        * config/cr16/cr16.h (PUSH_ROUNDING): Move implementation to...
        * config/cr16/cr16.c (cr16_push_rounding): ...this new function.
index 77281fb..af1afc2 100644 (file)
@@ -1016,6 +1016,7 @@ adjust_mems (rtx loc, const_rtx old_rtx, void *data)
   machine_mode mem_mode_save;
   bool store_save;
   scalar_int_mode tem_mode, tem_subreg_mode;
+  poly_int64 size;
   switch (GET_CODE (loc))
     {
     case REG:
@@ -1060,11 +1061,9 @@ adjust_mems (rtx loc, const_rtx old_rtx, void *data)
       return mem;
     case PRE_INC:
     case PRE_DEC:
-      addr = gen_rtx_PLUS (GET_MODE (loc), XEXP (loc, 0),
-                          gen_int_mode (GET_CODE (loc) == PRE_INC
-                                        ? GET_MODE_SIZE (amd->mem_mode)
-                                        : -GET_MODE_SIZE (amd->mem_mode),
-                                        GET_MODE (loc)));
+      size = GET_MODE_SIZE (amd->mem_mode);
+      addr = plus_constant (GET_MODE (loc), XEXP (loc, 0),
+                           GET_CODE (loc) == PRE_INC ? size : -size);
       /* FALLTHRU */
     case POST_INC:
     case POST_DEC:
@@ -1072,12 +1071,10 @@ adjust_mems (rtx loc, const_rtx old_rtx, void *data)
        addr = XEXP (loc, 0);
       gcc_assert (amd->mem_mode != VOIDmode && amd->mem_mode != BLKmode);
       addr = simplify_replace_fn_rtx (addr, old_rtx, adjust_mems, data);
-      tem = gen_rtx_PLUS (GET_MODE (loc), XEXP (loc, 0),
-                         gen_int_mode ((GET_CODE (loc) == PRE_INC
-                                        || GET_CODE (loc) == POST_INC)
-                                       ? GET_MODE_SIZE (amd->mem_mode)
-                                       : -GET_MODE_SIZE (amd->mem_mode),
-                                       GET_MODE (loc)));
+      size = GET_MODE_SIZE (amd->mem_mode);
+      tem = plus_constant (GET_MODE (loc), XEXP (loc, 0),
+                          (GET_CODE (loc) == PRE_INC
+                           || GET_CODE (loc) == POST_INC) ? size : -size);
       store_save = amd->store;
       amd->store = false;
       tem = simplify_replace_fn_rtx (tem, old_rtx, adjust_mems, data);