poly_int: adjust_mems

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
This commit is contained in:
Richard Sandiford 2018-01-03 07:18:21 +00:00 committed by Richard Sandiford
parent 7b4df2bf95
commit 0f5d092808
2 changed files with 15 additions and 11 deletions

View file

@ -1,3 +1,10 @@
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
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>

View 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);