This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Make more use of in_hard_reg_set_p
- From: Richard Sandiford <richard dot sandiford at linaro dot org>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 11 Sep 2017 18:16:44 +0100
- Subject: Make more use of in_hard_reg_set_p
- Authentication-results: sourceware.org; auth=none
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.
Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
Also tested by comparing the testsuite assembly output on at least one
target per CPU directory. OK to install?
Richard
2017-09-11 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* ira-costs.c (record_operand_costs): Use in_hard_reg_set_p
instead of hard_regno_nregs.
Index: gcc/ira-costs.c
===================================================================
--- gcc/ira-costs.c 2017-09-04 11:48:57.531552460 +0100
+++ gcc/ira-costs.c 2017-09-11 17:21:26.382315018 +0100
@@ -1386,7 +1386,7 @@ record_operand_costs (rtx_insn *insn, en
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, en
{
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;
}
}
}