This patch restructures the callee slave slot allocation code to handle X29 and X30 consistently with the other core registers. The patch also ensures that the offset recorded for X30 is accurate.

Committed.

/Marcus

2014-06-05  Marcus Shawcroft  <marcus.shawcr...@arm.com>
            Jiong Wang  <jiong.w...@arm.com>

        * config/aarch64/aarch64.c (aarch64_layout_frame): Correct
        initialization of R30 offset.  Update offset.  Iterate core
        regisers upto X30.  Remove X29, X30 specific code.
From 4063c0f8ee2914a07001072b60da397a0bdbaa6e Mon Sep 17 00:00:00 2001
From: Marcus Shawcroft <marcus.shawcr...@arm.com>
Date: Tue, 22 Apr 2014 18:12:53 +0100
Subject: [PATCH 4/8] [AArch64] Handle FP/LR slot allocation cleanly.

Rebase of Jiong's patch.
---
 gcc/config/aarch64/aarch64.c |   18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 15ac880..6d9fe4d 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1841,13 +1841,15 @@ aarch64_layout_frame (void)
 
   if (frame_pointer_needed)
     {
-      cfun->machine->frame.reg_offset[R30_REGNUM] = 0;
+      /* FP and LR are placed in the linkage record.  */
       cfun->machine->frame.reg_offset[R29_REGNUM] = 0;
+      cfun->machine->frame.reg_offset[R30_REGNUM] = UNITS_PER_WORD;
       cfun->machine->frame.hardfp_offset = 2 * UNITS_PER_WORD;
+      offset += 2 * UNITS_PER_WORD;
     }
 
   /* Now assign stack slots for them.  */
-  for (regno = R0_REGNUM; regno <= R28_REGNUM; regno++)
+  for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++)
     if (cfun->machine->frame.reg_offset[regno] == SLOT_REQUIRED)
       {
 	cfun->machine->frame.reg_offset[regno] = offset;
@@ -1861,18 +1863,6 @@ aarch64_layout_frame (void)
 	offset += UNITS_PER_WORD;
       }
 
-  if (frame_pointer_needed)
-    {
-      cfun->machine->frame.reg_offset[R29_REGNUM] = offset;
-      offset += UNITS_PER_WORD;
-    }
-
-  if (cfun->machine->frame.reg_offset[R30_REGNUM] == SLOT_REQUIRED)
-    {
-      cfun->machine->frame.reg_offset[R30_REGNUM] = offset;
-      offset += UNITS_PER_WORD;
-    }
-
   cfun->machine->frame.padding0 =
     (AARCH64_ROUND_UP (offset, STACK_BOUNDARY / BITS_PER_UNIT) - offset);
   offset = AARCH64_ROUND_UP (offset, STACK_BOUNDARY / BITS_PER_UNIT);
-- 
1.7.9.5

Reply via email to