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]

[AArch64/GCC][15/N] Add two new frame fields


Add two new frame fields:

  * cfun->machine->frame.wb_candidate1
  * cfun->machine->frame.wb_candidate2
* wb_candidate1 to record the first reg index which
  could carry write-back.
* wb_candidate2 to record the second reg index which
  could form reg pair with
* wb_candidate1 to carry write-back when doing paired
  load/store.

They are useful in later pro/epi optimization.

*no functional change*

ok to install?

thanks.

gcc/
  * config/aarch64/aarch64.h (frame): New fields "wb_candidate1" and "wb_candidate2".
  * config/aarch64/aarch64.c (aarch64_layout_frame): Calcualte new added fields.
>From 1272a5bcbb7978452cef1d0da507500c459031c5 Mon Sep 17 00:00:00 2001
From: Jiong Wang <jiong.wang@arm.com>
Date: Tue, 17 Jun 2014 22:21:44 +0100
Subject: [PATCH 15/19] [AArch64/GCC][16/20] Add two new frame fields

Add two new frame fields:

  * cfun->machine->frame.wb_candidate1
  * cfun->machine->frame.wb_candidate2

wb_candidate1 to record the first reg index which could carry write-back.
wb_candidate2 to record the second reg index which could form reg pair with
wb_candidate1 to carry write-back when doing paired load/store.

They are useful in later pro/epi optimization.

*no functional change*

2014-06-16  Jiong Wang <jiong.wang@arm.com>
	    Marcus Shawcroft  <marcus.shawcroft@arm.com>

gcc/
  * config/aarch64/aarch64.h (frame): New fields "wb_candidate1" and
  "wb_candidate2".
  * config/aarch64/aarch64.c (aarch64_layout_frame): Calcualte new added fields.
---
 gcc/config/aarch64/aarch64.c |   14 ++++++++++++++
 gcc/config/aarch64/aarch64.h |    3 +++
 2 files changed, 17 insertions(+)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 65a84e8..a6b253a 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1815,6 +1815,9 @@ aarch64_layout_frame (void)
 #define SLOT_NOT_REQUIRED (-2)
 #define SLOT_REQUIRED     (-1)
 
+  cfun->machine->frame.wb_candidate1 = FIRST_PSEUDO_REGISTER;
+  cfun->machine->frame.wb_candidate2 = FIRST_PSEUDO_REGISTER;
+
   /* First mark all the registers that really need to be saved...  */
   for (regno = R0_REGNUM; regno <= R30_REGNUM; regno++)
     cfun->machine->frame.reg_offset[regno] = SLOT_NOT_REQUIRED;
@@ -1843,7 +1846,9 @@ aarch64_layout_frame (void)
     {
       /* FP and LR are placed in the linkage record.  */
       cfun->machine->frame.reg_offset[R29_REGNUM] = 0;
+      cfun->machine->frame.wb_candidate1 = R29_REGNUM;
       cfun->machine->frame.reg_offset[R30_REGNUM] = UNITS_PER_WORD;
+      cfun->machine->frame.wb_candidate2 = R30_REGNUM;
       cfun->machine->frame.hardfp_offset = 2 * UNITS_PER_WORD;
       offset += 2 * UNITS_PER_WORD;
     }
@@ -1853,6 +1858,10 @@ aarch64_layout_frame (void)
     if (cfun->machine->frame.reg_offset[regno] == SLOT_REQUIRED)
       {
 	cfun->machine->frame.reg_offset[regno] = offset;
+	if (cfun->machine->frame.wb_candidate1 == FIRST_PSEUDO_REGISTER)
+	  cfun->machine->frame.wb_candidate1 = regno;
+	else if (cfun->machine->frame.wb_candidate2 == FIRST_PSEUDO_REGISTER)
+	  cfun->machine->frame.wb_candidate2 = regno;
 	offset += UNITS_PER_WORD;
       }
 
@@ -1860,6 +1869,11 @@ aarch64_layout_frame (void)
     if (cfun->machine->frame.reg_offset[regno] == SLOT_REQUIRED)
       {
 	cfun->machine->frame.reg_offset[regno] = offset;
+	if (cfun->machine->frame.wb_candidate1 == FIRST_PSEUDO_REGISTER)
+	  cfun->machine->frame.wb_candidate1 = regno;
+	else if (cfun->machine->frame.wb_candidate2 == FIRST_PSEUDO_REGISTER
+		 && cfun->machine->frame.wb_candidate1 >= V0_REGNUM)
+	  cfun->machine->frame.wb_candidate2 = regno;
 	offset += UNITS_PER_WORD;
       }
 
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index b95365a..ee70a18 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -542,6 +542,9 @@ struct GTY (()) aarch64_frame
    * frame (incomming SP) to the stack_pointer.  This value is always
    * a multiple of STACK_BOUNDARY.  */
 
+  unsigned wb_candidate1;
+  unsigned wb_candidate2;
+
   HOST_WIDE_INT frame_size;
 
   bool laid_out;
-- 
1.7.9.5



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