]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Rename locals_offset to bytes_above_locals
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 12 Sep 2023 15:05:07 +0000 (16:05 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 12 Sep 2023 15:05:07 +0000 (16:05 +0100)
commit28034dbb5e32711d5f4d655576f2499e6f57f854
tree445bfbff6189471a2138889f790613be692a1cb7
parentaa8b57ee0206e8e5ac7078692ee67fb6ead05645
aarch64: Rename locals_offset to bytes_above_locals

locals_offset was described as:

  /* Offset from the base of the frame (incomming SP) to the
     top of the locals area.  This value is always a multiple of
     STACK_BOUNDARY.  */

This is implicitly an “upside down” view of the frame: the incoming
SP is at offset 0, and anything N bytes below the incoming SP is at
offset N (rather than -N).

However, reg_offset instead uses a “right way up” view; that is,
it views offsets in address terms.  Something above X is at a
positive offset from X and something below X is at a negative
offset from X.

Also, even on FRAME_GROWS_DOWNWARD targets like AArch64,
target-independent code views offsets in address terms too:
locals are allocated at negative offsets to virtual_stack_vars.

It seems confusing to have *_offset fields of the same structure
using different polarities like this.  This patch tries to avoid
that by renaming locals_offset to bytes_above_locals.

gcc/
* config/aarch64/aarch64.h (aarch64_frame::locals_offset): Rename to...
(aarch64_frame::bytes_above_locals): ...this.
* config/aarch64/aarch64.cc (aarch64_layout_frame)
(aarch64_initial_elimination_offset): Update accordingly.
gcc/config/aarch64/aarch64.cc
gcc/config/aarch64/aarch64.h