gcc/aarch64-Rename-hard_fp_offset-to-bytes_above_hard_fp.patch

142 lines
5.6 KiB
Diff
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From da0132a4cd2eb26ecaff20578bf2753b20014223 Mon Sep 17 00:00:00 2001
From: Richard Sandiford <richard.sandiford@arm.com>
Date: Tue, 27 Jun 2023 11:28:11 +0100
Subject: [PATCH] aarch64: Rename hard_fp_offset to bytes_above_hard_fp
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit
Similarly to the previous locals_offset patch, hard_fp_offset
was described as:
/* Offset from the base of the frame (incomming SP) to the
hard_frame_pointer. This value is always a multiple of
STACK_BOUNDARY. */
poly_int64 hard_fp_offset;
which again took an “upside-down” view: higher offsets meant lower
addresses. This patch renames the field to bytes_above_hard_fp instead.
gcc/
* config/aarch64/aarch64.h (aarch64_frame::hard_fp_offset): Rename
to...
(aarch64_frame::bytes_above_hard_fp): ...this.
* config/aarch64/aarch64.c (aarch64_layout_frame)
(aarch64_expand_prologue): Update accordingly.
(aarch64_initial_elimination_offset): Likewise.
---
gcc/config/aarch64/aarch64.c | 29 ++++++++++++++++-------------
gcc/config/aarch64/aarch64.h | 6 +++---
2 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 27dd3b7a62b..e3c36abb1e3 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -2881,12 +2881,12 @@ aarch64_layout_frame (void)
HOST_WIDE_INT varargs_and_saved_regs_size
= offset + cfun->machine->frame.saved_varargs_size;
- cfun->machine->frame.hard_fp_offset
+ cfun->machine->frame.bytes_above_hard_fp
= ROUND_UP (varargs_and_saved_regs_size + get_frame_size (),
STACK_BOUNDARY / BITS_PER_UNIT);
cfun->machine->frame.frame_size
- = ROUND_UP (cfun->machine->frame.hard_fp_offset
+ = ROUND_UP (cfun->machine->frame.bytes_above_hard_fp
+ cfun->machine->frame.bytes_below_hard_fp,
STACK_BOUNDARY / BITS_PER_UNIT);
@@ -2917,7 +2917,7 @@ aarch64_layout_frame (void)
else if ((cfun->machine->frame.bytes_below_hard_fp
+ cfun->machine->frame.saved_regs_size < 512)
&& !(cfun->calls_alloca
- && cfun->machine->frame.hard_fp_offset < max_push_offset))
+ && cfun->machine->frame.bytes_above_hard_fp < max_push_offset))
{
/* Frame with small area below the saved registers:
sub sp, sp, frame_size
@@ -2925,16 +2925,17 @@ aarch64_layout_frame (void)
stp reg3, reg4, [sp, bytes_below_hard_fp + 16] */
cfun->machine->frame.initial_adjust = cfun->machine->frame.frame_size;
cfun->machine->frame.callee_offset
- = cfun->machine->frame.frame_size - cfun->machine->frame.hard_fp_offset;
+ = cfun->machine->frame.frame_size - cfun->machine->frame.bytes_above_hard_fp;
}
- else if (cfun->machine->frame.hard_fp_offset < max_push_offset)
+ else if (cfun->machine->frame.bytes_above_hard_fp < max_push_offset)
{
/* Frame with large area below the saved registers, but with a
small area above:
- stp reg1, reg2, [sp, -hard_fp_offset]!
+ stp reg1, reg2, [sp, -bytes_above_hard_fp]!
stp reg3, reg4, [sp, 16]
sub sp, sp, bytes_below_hard_fp */
- cfun->machine->frame.callee_adjust = cfun->machine->frame.hard_fp_offset;
+ cfun->machine->frame.callee_adjust
+ = cfun->machine->frame.bytes_above_hard_fp;
cfun->machine->frame.final_adjust
= cfun->machine->frame.frame_size - cfun->machine->frame.callee_adjust;
}
@@ -2951,19 +2952,21 @@ aarch64_layout_frame (void)
= cfun->machine->frame.frame_size - cfun->machine->frame.callee_adjust;
cfun->machine->frame.bytes_below_hard_fp
= cfun->machine->frame.final_adjust;
- cfun->machine->frame.hard_fp_offset = cfun->machine->frame.callee_adjust;
+ cfun->machine->frame.bytes_above_hard_fp
+ = cfun->machine->frame.callee_adjust;
cfun->machine->frame.bytes_above_locals
- = cfun->machine->frame.hard_fp_offset;
+ = cfun->machine->frame.bytes_above_hard_fp;
}
else
{
/* General case:
- sub sp, sp, hard_fp_offset
+ sub sp, sp, bytes_above_hard_fp
stp x29, x30, [sp, 0]
add x29, sp, 0
stp reg3, reg4, [sp, 16]
sub sp, sp, bytes_below_hard_fp */
- cfun->machine->frame.initial_adjust = cfun->machine->frame.hard_fp_offset;
+ cfun->machine->frame.initial_adjust
+ = cfun->machine->frame.bytes_above_hard_fp;
cfun->machine->frame.final_adjust
= cfun->machine->frame.frame_size - cfun->machine->frame.initial_adjust;
}
@@ -5651,10 +5654,10 @@ aarch64_initial_elimination_offset (unsigned from, unsigned to)
if (to == HARD_FRAME_POINTER_REGNUM)
{
if (from == ARG_POINTER_REGNUM)
- return cfun->machine->frame.hard_fp_offset;
+ return cfun->machine->frame.bytes_above_hard_fp;
if (from == FRAME_POINTER_REGNUM)
- return cfun->machine->frame.hard_fp_offset
+ return cfun->machine->frame.bytes_above_hard_fp
- cfun->machine->frame.bytes_above_locals;
}
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 79af237ada6..35ba9681e03 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -570,10 +570,10 @@ struct GTY (()) aarch64_frame
STACK_BOUNDARY. */
HOST_WIDE_INT bytes_above_locals;
- /* Offset from the base of the frame (incomming SP) to the
- hard_frame_pointer. This value is always a multiple of
+ /* The number of bytes between the hard_frame_pointer and the top of
+ the frame (the incomming SP). This value is always a multiple of
STACK_BOUNDARY. */
- HOST_WIDE_INT hard_fp_offset;
+ HOST_WIDE_INT bytes_above_hard_fp;
/* The size of the frame. This value is the offset from base of the
* frame (incomming SP) to the stack_pointer. This value is always
--
2.39.3