This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/4] aarch64: Tidy prologue local variables


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;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]