From 47292958bc6815a762bffb42afdd9fdb5a44cc52 Mon Sep 17 00:00:00 2001 From: rsandifo Date: Tue, 12 Sep 2017 13:28:37 +0000 Subject: [PATCH] Make more use of in_hard_reg_set_p 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 gcc/ * ira-costs.c (record_operand_costs): Use in_hard_reg_set_p instead of hard_regno_nregs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252013 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/ira-costs.c | 17 ++++------------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1652e723e60..cc2e3ee7347 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2017-09-12 Richard Sandiford + * ira-costs.c (record_operand_costs): Use in_hard_reg_set_p + instead of hard_regno_nregs. + +2017-09-12 Richard Sandiford + * config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Use end_hard_regno instead of hard_regno_nregs. * config/s390/s390.c (s390_reg_clobbered_rtx): Likewise. diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c index 187802f35fa..714bdbd8c70 100644 --- a/gcc/ira-costs.c +++ b/gcc/ira-costs.c @@ -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; } } } -- 2.11.4.GIT