This is the mail archive of the gcc@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]

IRA : Changes in the cost of putting allocno into memory.


Hello Vladimir:

 We have made the changes in the ira-color.c in ira_loop_edge_freq and move_spill_restore. The main motivation 
behind the change is to reduce the memory instruction with respect to the Loops. The changes are done to not to 
consider the back edge frequency if there are no references of the allocno inside the loop even though the allocno
are live out at the exit of the Loop and Live In at the entry of the Loop.  This will reduce the calculation of the cost of
putting allocno into memory. If we reduce the cost of putting allocno into memory, then there are chances of getting
color in the simplification phase of the gcc IRA register allocator. Enabling this, there are chances of putting the allocno 
in the register and the splitting phase will split the live range across the Loop boundary. This will beneficial with respect 
to reducing memory instruction inside the Loop. Other changes is done to enable some of the allocno to allocate in
memory if the cost is less than equal to zero.

This is the first phase of the change in the IRA core register module, I would like to get your feedbacks on this change
based on this the actual patch is sent. The changes are accompanied with the patch created for the change which will
be easier for you to review the change.

We have tested the changes for Microblaze target for MIBENCH and EEMBC benchmarks and there are no degradation 
in the Geomean and some of the Mibench and EEMBC benchmarks is benefitted with this change.
Please review the changes and let me know your feedbacks and other steps needs to be done to incorporate the 
changes in the Upstream". We would like to get this change for Microblaze, Please also let us know if the changes are
required  to be enabled with any switch flag.

Changes are given below.

From 758ee2227e9dde946ac35b772bee99279b1bf996 Mon Sep 17 00:00:00 2001
From: Ajit Kumar Agarwal <ajitkum@xhdspdgnu.(none)>
Date: Tue, 6 Jan 2015 19:42:16 +0530
Subject: [PATCH] IRA : Changes in the cost of putting allocno into memory.

Changes are made to not consider the back edge frequency for cost calculation
if the allocno is live out at the exit of the Loop and Live in at the entry of the
Loop and there are no references inside the Loop. Further changes are made to enable
some of the allocnos into memory if the costs is less than equal to 0.

ChangeLog:
2015-01-06  Ajit Agarwal  <ajitkum@xilinx.com>

	* ira-color.c (move_spill_restore): Add the check cost less than
	equal to 0.
	(ira_loop_edge_freq): Add to ignore the loop edge frequence if
	there are no reference of allocno inside the loop.

Signed-off-by:Ajit Agarwal ajitkum@xilinx.com
---
 gcc/ira-color.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/gcc/ira-color.c b/gcc/ira-color.c
index 39387c8..d180e86 100644
--- a/gcc/ira-color.c
+++ b/gcc/ira-color.c
@@ -2409,6 +2409,8 @@ int
 ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p)
 {
   int freq, i;
+  bitmap_iterator bi;
+  unsigned int j;
   edge_iterator ei;
   edge e;
   vec<edge> edges;
@@ -2423,7 +2425,14 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p)
 	    && (regno < 0
 		|| (bitmap_bit_p (df_get_live_out (e->src), regno)
 		    && bitmap_bit_p (df_get_live_in (e->dest), regno))))
-	  freq += EDGE_FREQUENCY (e);
+           {
+             EXECUTE_IF_SET_IN_BITMAP (loop_node->all_allocnos, 0, j, bi)
+             {
+               if(regno ==  ALLOCNO_REGNO (ira_allocnos[j]))
+                 if (ALLOCNO_NREFS (ira_allocnos[j]) != 0)
+                   freq += EDGE_FREQUENCY (e);
+             }
+           }
     }
   else
     {
@@ -2432,7 +2441,14 @@ ira_loop_edge_freq (ira_loop_tree_node_t loop_node, int regno, bool exit_p)
 	if (regno < 0
 	    || (bitmap_bit_p (df_get_live_out (e->src), regno)
 		&& bitmap_bit_p (df_get_live_in (e->dest), regno)))
-	  freq += EDGE_FREQUENCY (e);
+          {
+            EXECUTE_IF_SET_IN_BITMAP (loop_node->all_allocnos, 0, j, bi)
+            {
+              if(regno ==  ALLOCNO_REGNO (ira_allocnos[j]))
+                if(ALLOCNO_NREFS (ira_allocnos[j]) != 0)
+                  freq += EDGE_FREQUENCY (e);
+             }
+          }
       edges.release ();
     }
 
@@ -3441,7 +3457,7 @@ move_spill_restore (void)
 			     * (exit_freq + enter_freq));
 		}
 	    }
-	  if (cost < 0)
+	  if (cost <= 0)
 	    {
 	      ALLOCNO_HARD_REGNO (a) = -1;
 	      if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
-- 
1.7.1

Thanks & Regards
Ajit


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