This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 3/4] aarch64: Tidy prologue local variables
- From: Jiong Wang <jiong dot wang at arm dot com>
- To: Richard Henderson <rth at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>
- Date: Tue, 26 Aug 2014 13:58:41 +0100
- Subject: Re: [PATCH 3/4] aarch64: Tidy prologue local variables
- Authentication-results: sourceware.org; auth=none
- References: <1408745131-24297-1-git-send-email-rth at redhat dot com> <1408745131-24297-4-git-send-email-rth at redhat dot com>
On 22/08/14 23:05, Richard Henderson wrote:
Don't continually re-read data from cfun->machine.
* config/aarch64/aarch64.c (aarch64_expand_prologue): Load
cfun->machine->frame.hard_fp_offset into a local variable.
---
gcc/config/aarch64/aarch64.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index dcca446..c890773 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -2194,18 +2194,18 @@ aarch64_expand_prologue (void)
*/
HOST_WIDE_INT frame_size, offset;
HOST_WIDE_INT fp_offset; /* Offset from hard FP to SP. */
+ HOST_WIDE_INT hard_fp_offset;
rtx insn;
aarch64_layout_frame ();
- if (flag_stack_usage_info)
- current_function_static_stack_size = cfun->machine->frame.frame_size;
-
frame_size = cfun->machine->frame.frame_size;
- offset = cfun->machine->frame.frame_size;
+ hard_fp_offset = cfun->machine->frame.hard_fp_offset;
+ offset = frame_size;
+ fp_offset = frame_size - hard_fp_offset;
there is a field "hardfp_offset" in aarch64_frame, and I think that field is
not used and not initialized correctly.
how about hoisting the calculation to aarch64_layout_frame to avoid duplicated
calcuation here and there, something like:
cfun->machine->frame.hardfp_offset = (cfun->machine->frame.frame_size-
cfun->machine->frame.hard_fp_offset);
then use it directly in expand_epilogue:
fp_offset = cfun->machine->frame.hardfp_offset;
-- Jiong
- fp_offset = cfun->machine->frame.frame_size
- - cfun->machine->frame.hard_fp_offset;
+ if (flag_stack_usage_info)
+ current_function_static_stack_size = frame_size;
/* Store pairs and load pairs have a range only -512 to 504. */
if (offset >= 512)
@@ -2216,7 +2216,7 @@ aarch64_expand_prologue (void)
register area. This will allow the pre-index write-back
store pair instructions to be used for setting up the stack frame
efficiently. */
- offset = cfun->machine->frame.hard_fp_offset;
+ offset = hard_fp_offset;
if (offset >= 512)
offset = cfun->machine->frame.saved_regs_size;