diff mbox

[ira-improv] patch implementing proposals from a reviewer

Message ID 4C63230D.3000801@redhat.com
State New
Headers show

Commit Message

Vladimir Makarov Aug. 11, 2010, 10:24 p.m. UTC
The following patch implements Jeff's proposals after his 1st round of 
branch changes reviews.

2010-08-11  Vladimir Makarov <vmakarov@redhat.com>

     * ira-color.c (allocnos_have_intersected_live_ranges_p): Rename to
     allocnos_conflict_by_live_ranges_p.
     (pseudos_have_intersected_live_ranges_p): Rename to
     pseudos_conflict_by_live_ranges_p.

     * ira-costs.c (record_reg_classes, scan_one_insn): Don't assign in
     if-stmts.

Comments

Jeff Law Oct. 18, 2010, 7:56 p.m. UTC | #1
On 08/11/10 16:24, Vladimir Makarov wrote:
>  The following patch implements Jeff's proposals after his 1st round 
> of branch changes reviews.
>
> 2010-08-11  Vladimir Makarov <vmakarov@redhat.com>
>
>     * ira-color.c (allocnos_have_intersected_live_ranges_p): Rename to
>     allocnos_conflict_by_live_ranges_p.
>     (pseudos_have_intersected_live_ranges_p): Rename to
>     pseudos_conflict_by_live_ranges_p.
>
>     * ira-costs.c (record_reg_classes, scan_one_insn): Don't assign in
>     if-stmts.
OK.
Jeff
diff mbox

Patch

Index: ira-color.c
===================================================================
--- ira-color.c	(revision 163090)
+++ ira-color.c	(working copy)
@@ -3145,7 +3145,7 @@  ira_reassign_conflict_allocnos (int star
    used to find a conflict for new allocnos or allocnos with the
    different allocno classes.  */
 static bool
-allocnos_have_intersected_live_ranges_p (ira_allocno_t a1, ira_allocno_t a2)
+allocnos_conflict_by_live_ranges_p (ira_allocno_t a1, ira_allocno_t a2)
 {
   rtx reg1, reg2;
   int i, j;
@@ -3182,7 +3182,7 @@  allocnos_have_intersected_live_ranges_p 
    intersect.  This should be used when there is only one region.
    Currently this is used during reload.  */
 static bool
-pseudos_have_intersected_live_ranges_p (int regno1, int regno2)
+conflict_by_live_ranges_p (int regno1, int regno2)
 {
   ira_allocno_t a1, a2;
 
@@ -3193,7 +3193,7 @@  pseudos_have_intersected_live_ranges_p (
   if ((a1 = ira_loop_tree_root->regno_allocno_map[regno1]) == NULL
       || (a2 = ira_loop_tree_root->regno_allocno_map[regno2]) == NULL)
     return false;
-  return allocnos_have_intersected_live_ranges_p (a1, a2);
+  return allocnos_conflict_by_live_ranges_p (a1, a2);
 }
 
 #endif
@@ -3307,7 +3307,7 @@  coalesced_allocno_conflict_p (ira_allocn
       for (conflict_a = ALLOCNO_COALESCE_DATA (a1)->next;;
 	   conflict_a = ALLOCNO_COALESCE_DATA (conflict_a)->next)
 	{
-	  if (allocnos_have_intersected_live_ranges_p (a, conflict_a))
+	  if (allocnos_conflict_by_live_ranges_p (a, conflict_a))
 	    return true;
 	  if (conflict_a == a1)
 	    break;
@@ -4068,8 +4068,8 @@  ira_reuse_stack_slot (int regno, unsigne
 				    FIRST_PSEUDO_REGISTER, i, bi)
 	    {
 	      another_allocno = ira_regno_allocno_map[i];
-	      if (allocnos_have_intersected_live_ranges_p (allocno,
-							   another_allocno))
+	      if (allocnos_conflict_by_live_ranges_p (allocno,
+						      another_allocno))
 		goto cont;
 	    }
 	  for (cost = 0, cp = ALLOCNO_COPIES (allocno);
@@ -4118,7 +4118,7 @@  ira_reuse_stack_slot (int regno, unsigne
       EXECUTE_IF_SET_IN_BITMAP (&slot->spilled_regs,
 				FIRST_PSEUDO_REGISTER, i, bi)
 	{
-	  ira_assert (! pseudos_have_intersected_live_ranges_p (regno, i));
+	  ira_assert (! conflict_by_live_ranges_p (regno, i));
 	}
 #endif
       SET_REGNO_REG_SET (&slot->spilled_regs, regno);
Index: ira-costs.c
===================================================================
--- ira-costs.c	(revision 163090)
+++ ira-costs.c	(working copy)
@@ -382,7 +382,7 @@  record_reg_classes (int n_alts, int n_op
 		    rtx insn, enum reg_class *pref)
 {
   int alt;
-  int i, j, k, regno, other_regno;
+  int i, j, k;
   rtx set;
   int insn_allows_mem[MAX_RECOG_OPERANDS];
 
@@ -465,7 +465,7 @@  record_reg_classes (int n_alts, int n_op
 		    }
 		}
 	      else if (! REG_P (ops[j])
-		       || (regno = REGNO (ops[j])) < FIRST_PSEUDO_REGISTER)
+		       || REGNO (ops[j]) < FIRST_PSEUDO_REGISTER)
 		{
 		  /* This op is an allocno but the one it matches is
 		     not.  */
@@ -740,7 +740,7 @@  record_reg_classes (int n_alts, int n_op
 	     allocated for register preferencing.  If some register
 	     class is valid, compute the costs of moving the allocno
 	     into that class.  */
-	  if (REG_P (op) && (regno = REGNO (op)) >= FIRST_PSEUDO_REGISTER)
+	  if (REG_P (op) && REGNO (op) >= FIRST_PSEUDO_REGISTER)
 	    {
 	      if (classes[i] == NO_REGS)
 		{
@@ -754,6 +754,7 @@  record_reg_classes (int n_alts, int n_op
 		}
 	      else
 		{
+		  unsigned int regno = REGNO (op);
 		  struct costs *pp = this_op_costs[i];
 		  int *pp_costs = pp->cost;
 		  cost_classes_t cost_classes_ptr = regno_cost_classes[regno];
@@ -863,12 +864,13 @@  record_reg_classes (int n_alts, int n_op
       /* Finally, update the costs with the information we've
 	 calculated about this alternative.  */
       for (i = 0; i < n_ops; i++)
-	if (REG_P (ops[i]) && (regno = REGNO (ops[i])) >= FIRST_PSEUDO_REGISTER)
+	if (REG_P (ops[i]) && REGNO (ops[i]) >= FIRST_PSEUDO_REGISTER)
 	  {
 	    struct costs *pp = op_costs[i], *qq = this_op_costs[i];
 	    int *pp_costs = pp->cost, *qq_costs = qq->cost;
 	    int scale = 1 + (recog_data.operand_type[i] == OP_INOUT);
-	    cost_classes_t cost_classes_ptr = regno_cost_classes[regno];
+	    cost_classes_t cost_classes_ptr
+	      = regno_cost_classes[REGNO (ops[i])];
 
 	    pp->mem_cost = MIN (pp->mem_cost,
 				(qq->mem_cost + op_cost_add) * scale);
@@ -911,9 +913,11 @@  record_reg_classes (int n_alts, int n_op
       && REG_P (ops[0]) && REG_P (ops[1])
       && find_regno_note (insn, REG_DEAD, REGNO (ops[1])))
     for (i = 0; i <= 1; i++)
-      if ((regno = REGNO (ops[i])) >= FIRST_PSEUDO_REGISTER
-	  && (other_regno = REGNO (ops[!i])) < FIRST_PSEUDO_REGISTER)
+      if (REGNO (ops[i]) >= FIRST_PSEUDO_REGISTER
+	  && REGNO (ops[!i]) < FIRST_PSEUDO_REGISTER)
 	{
+	  unsigned int regno = REGNO (ops[i]);
+	  unsigned int other_regno = REGNO (ops[!i]);
 	  enum machine_mode mode = GET_MODE (ops[!i]);
 	  cost_classes_t cost_classes_ptr = regno_cost_classes[regno];
 	  enum reg_class *cost_classes = cost_classes_ptr->classes;
@@ -1136,9 +1140,10 @@  record_address_regs (enum machine_mode m
 	enum reg_class *cost_classes;
 	move_table *move_in_cost;
 
-	if ((regno = REGNO (x)) < FIRST_PSEUDO_REGISTER)
+	if (REGNO (x) < FIRST_PSEUDO_REGISTER)
 	  break;
 
+	regno = REGNO (x);
 	if (allocno_p)
 	  ALLOCNO_BAD_SPILL_P (ira_curr_regno_allocno_map[regno]) = true;
 	pp = COSTS (costs, COST_INDEX (regno));
@@ -1250,7 +1255,7 @@  scan_one_insn (rtx insn)
 {
   enum rtx_code pat_code;
   rtx set, note;
-  int i, k, regno;
+  int i, k;
 
   if (!NONDEBUG_INSN_P (insn))
     return insn;
@@ -1286,8 +1291,9 @@  scan_one_insn (rtx insn)
      allocno.  */
   for (i = 0; i < recog_data.n_operands; i++)
     if (REG_P (recog_data.operand[i])
-	&& (regno = REGNO (recog_data.operand[i])) >= FIRST_PSEUDO_REGISTER)
+	&& REGNO (recog_data.operand[i]) >= FIRST_PSEUDO_REGISTER)
       {
+	int regno = REGNO (recog_data.operand[i]);
 	struct costs *p = COSTS (costs, COST_INDEX (regno));
 	struct costs *q = op_costs[i];
 	int *p_costs = p->cost, *q_costs = q->cost;