This is the mail archive of the
mailing list for the GCC project.
Re: IRA improvements 3/4
- From: Jeff Law <law at redhat dot com>
- To: Vladimir Makarov <vmakarov at redhat dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 15 Jul 2010 10:28:50 -0600
- Subject: Re: IRA improvements 3/4
- References: <4C3481BA.firstname.lastname@example.org>
On 07/07/10 07:31, Vladimir Makarov wrote:
The following patch speeds up IRA by decreasing number of processed
register classes for allocno. To decrease the number, classes
specific for given allocno is used. For example, if allocno of DIMode
and FLOAT_REGS can not hold such value, we should not try FLOAT_REGS
or if we decided that only floating point registers are profitable for
given allocno on the 1st pass, we most probably should not try general
registers on the 2nd pass.
Is the patch ok to commit the patch to the trunk?
2010-07-07 Vladimir Makarov <email@example.com>
* ira-costs.c (cost_classes, cost_classes_num): Remove.
(struct cost_classes, cost_classes_t, const_cost_classes_t,
regno_cost_classes, cost_classes_hash, cost_classes_eq,
cost_classes_del, cost_classes_htab, cost_classes_mode_cache,
setup_regno_cost_classes_by_mode, finish_regno_cost_classes): New.
(record_reg_classes): Use regno_cost_classes instead of
(record_address_regs, scan_one_insn): Ditto.
(print_allocno_costs, print_pseudo_costs): Ditto.
(find_costs_and_classes): Set up cost classes for each registers.
Use also their mode for this. Use regno_cost_classes instead of
(setup_allocno_class_and_costs): Use regno_cost_classes instead of
(free_ira_costs, ira_init_costs): Don't use cost_classes.
(ira_costs, ira_set_pseudo_classes): Call
initiate_regno_cost_classes and finish_regno_cost_classes.
Presumably you made this change to improve the performance of the loop
(and others like it) and presumably the loop body is too complex for
GCC's loop reversal to apply automatically and LICM couldn't remove the
memory reference cost_classes_ptr->num from each iteration of the loop?
- for (k = 0; k < cost_classes_num; k++)
+ for (k = cost_classes_ptr->num - 1; k >= 0; k--)
- if (REG_P (ops[i]) && REGNO (ops[i]) >= FIRST_PSEUDO_REGISTER)You seem to introduce this style of code in several places. I've never
been a big fan as I think it makes the code harder to read and more
prone to silly operator precedence errors (particularly when someone
else changes things later). If we can cleanly avoid such code, let's
do so. If this style is the cleanest way to express the conditional,
then I'm not going to get terribly bent out of shape about it.
+ if (REG_P (ops[i]) && (regno = REGNO (ops[i])) >=
Based on your description, I'm assuming this patch is primarily designed
to help compile-time after removal of cover classes, right? From my
reading, it may still be applicable to IRA in the mainline today, though
perhaps without providing real compile-time benefts. If so, I wouldn't
object to this going into the mainline after separate test/bootstrap
cycle if you wanted to reduce the divergence of your ira-improv branch.