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: [PING] Move costs, allocno costs, and per-register costs


Vladimir Makarov wrote:
> Richard Sandiford wrote:
> In
> 
> http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00325.html
> 
> you wrote
> 
>  In summary, I think ira-costs.c:record_reg_classes should not add
>  ira_may_move_out_cost and ira_memory_cost for unused output operands.
>  I'd like to test that at some point, but I've got a lot on my plate
>  and probably won't find time.  (An agreement in principle might
>  add a bit of incentive though.)
> 
> I think it would be interesting to see the results.  Another would be
> interesting code is to check dealing with equiv memory.  The code
> quality is very sensitive to changes in ira-costs.c.

Do you have something like the patch below in mind?  I tested this
against Richard's patches for a Blackfin target, with inconclusive
results.  It did seem to help with the testcase Richard found that had a
regression; other than that there weren't too many differences in code
quality that I could find.


Bernd
-- 
This footer brought to you by insane German lawmakers.
Analog Devices GmbH      Wilhelm-Wagenfeld-Str. 6      80807 Muenchen
Sitz der Gesellschaft Muenchen, Registergericht Muenchen HRB 40368
Geschaeftsfuehrer Thomas Wessel, William A. Martin, Margaret Seif
Index: ira-costs.c
===================================================================
--- ira-costs.c	(revision 141547)
+++ ira-costs.c	(working copy)
@@ -285,14 +285,17 @@ record_reg_classes (int n_alts, int n_op
 		    {
 		      rclass = cost_classes[k];
 		      pp->cost[k]
-			= ((recog_data.operand_type[i] != OP_OUT
-			    ? ira_may_move_in_cost[mode][rclass]
-			      [classes[i]] * frequency : 0)
-			   + (recog_data.operand_type[i] != OP_IN
-			      ? ira_may_move_out_cost[mode][classes[i]]
-			        [rclass] * frequency : 0));
+			= (recog_data.operand_type[i] != OP_OUT
+			   ? ira_may_move_in_cost[mode][rclass]
+			   [classes[i]] * frequency : 0);
+		      if (recog_data.operand_type[i] != OP_IN)
+			{
+			  if (!find_reg_note (insn, REG_UNUSED, op))
+			    pp->cost[k]
+			      += (ira_may_move_out_cost[mode][classes[i]][rclass]
+				  * frequency);
+			}
 		    }
-
 		  /* If the alternative actually allows memory, make
 		     things a bit cheaper since we won't need an extra
 		     insn to load it.  */
@@ -530,12 +533,16 @@ record_reg_classes (int n_alts, int n_op
 		    {
 		      rclass = cost_classes[k];
 		      pp->cost[k]
-			= ((recog_data.operand_type[i] != OP_OUT
-			    ? ira_may_move_in_cost[mode][rclass]
-			      [classes[i]] * frequency : 0)
-			   + (recog_data.operand_type[i] != OP_IN
-			      ? ira_may_move_out_cost[mode][classes[i]]
-			        [rclass] * frequency : 0));
+			= (recog_data.operand_type[i] != OP_OUT
+			   ? ira_may_move_in_cost[mode][rclass]
+			   [classes[i]] * frequency : 0);
+		      if (recog_data.operand_type[i] != OP_IN)
+			{
+			  if (!find_reg_note (insn, REG_UNUSED, op))
+			    pp->cost[k]
+			      += (ira_may_move_out_cost[mode][classes[i]][rclass]
+				  * frequency);
+			}
 		    }
 
 		  /* If the alternative actually allows memory, make

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