This patch adds legitimize_address_displacement hook so that stack accesses...
commit491ec0603631fe65b326512c2c424bfb4581e9c8
authorWilco Dijkstra <wdijkstr@arm.com>
Thu, 1 Sep 2016 11:34:49 +0000 (1 11:34 +0000)
committerWilco Dijkstra <wilco@gcc.gnu.org>
Thu, 1 Sep 2016 11:34:49 +0000 (1 11:34 +0000)
treeb02de5909c79bd9673638eac207a1c2a2d817c11
parentf79d87865b55f24f8a7dda9e0c3bb139247d7d21
This patch adds legitimize_address_displacement hook so that stack accesses...

This patch adds legitimize_address_displacement hook so that stack accesses
with large offsets are split into a more efficient sequence.  Unaligned and
TI/TFmode use a 256-byte range, byte and halfword accesses use a 4KB range,
wider accesses use a 16KB range to maximise the available addressing range
and increase opportunities to share the base address.

int f(int x)
{
  int arr[8192];
  arr[4096] = 0;
  arr[6000] = 0;
  arr[7000] = 0;
  arr[8191] = 0;
  return arr[x];
}

Now generates:

  sub   sp, sp, #32768
  add   x1, sp, 16384
  str   wzr, [x1]
  str   wzr, [x1, 7616]
  str   wzr, [x1, 11616]
  str   wzr, [x1, 16380]
  ldr   w0, [sp, w0, sxtw 2]
  add   sp, sp, 32768
  ret

    gcc/
* config/aarch64/aarch64.c (aarch64_legitimize_address_displacement):
New function.
(TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT): Define.

From-SVN: r239923
gcc/ChangeLog
gcc/config/aarch64/aarch64.c