Make more use of in_hard_reg_set_p
authorRichard Sandiford <richard.sandiford@linaro.org>
Tue, 12 Sep 2017 13:28:37 +0000 (13:28 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 12 Sep 2017 13:28:37 +0000 (13:28 +0000)
An upcoming patch will convert hard_regno_nregs into an inline
function, which in turn allows hard_regno_nregs to be used as the
name of a targetm field.  This patch rewrites a use that can use
in_hard_reg_set_p instead.

2017-09-12  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
* ira-costs.c (record_operand_costs): Use in_hard_reg_set_p
instead of hard_regno_nregs.

From-SVN: r252013

gcc/ChangeLog
gcc/ira-costs.c

index 1652e723e60a68a62e818d4c2f9d40a1cfbeb0b4..cc2e3ee73472d2462c19c3c52331e8e33b6b050a 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-12  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * ira-costs.c (record_operand_costs): Use in_hard_reg_set_p
+       instead of hard_regno_nregs.
+
 2017-09-12  Richard Sandiford  <richard.sandiford@linaro.org>
 
        * config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Use
index 187802f35fa178fb0a0271cf6773c4d1cd716d53..714bdbd8c708a8fd1e39e040e108581686340b91 100644 (file)
@@ -1386,7 +1386,7 @@ record_operand_costs (rtx_insn *insn, enum reg_class *pref)
          cost_classes_t cost_classes_ptr = regno_cost_classes[regno];
          enum reg_class *cost_classes = cost_classes_ptr->classes;
          reg_class_t rclass;
-         int k, nr;
+         int k;
 
          i = regno == (int) REGNO (src) ? 1 : 0;
          for (k = cost_classes_ptr->num - 1; k >= 0; k--)
@@ -1398,18 +1398,9 @@ record_operand_costs (rtx_insn *insn, enum reg_class *pref)
                {
                  if (reg_class_size[rclass] == 1)
                    op_costs[i]->cost[k] = -frequency;
-                 else
-                   {
-                     for (nr = 0;
-                          nr < hard_regno_nregs[other_regno][mode];
-                          nr++)
-                       if (! TEST_HARD_REG_BIT (reg_class_contents[rclass],
-                                                other_regno + nr))
-                         break;
-                     
-                     if (nr == hard_regno_nregs[other_regno][mode])
-                       op_costs[i]->cost[k] = -frequency;
-                   }
+                 else if (in_hard_reg_set_p (reg_class_contents[rclass],
+                                             mode, other_regno))
+                   op_costs[i]->cost[k] = -frequency;
                }
            }
        }