This is the mail archive of the
mailing list for the GCC project.
Re: [Ping] [patch 0/3] New macro PREFERRED_RENAME_CLASS
On 11/08/2010 08:34 PM, Eric Botcazou wrote:
>> Done. Removed function pointer CMP, and use merge_sort_callback directly.
> +/* Comparison function of merge sort. Return true if A is less than
> + B, otherwise return false. */
> +static inline int
> +merge_sort_callback(const struct du_head *a,
> + const struct du_head *b)
> + return a->length < b->length;
> It isn't really a callback anymore. :-)
> There are trailing spaces after the "int" and the "*a,". There are more of
> them throughout the patch. Good editors have options to make them visible.
I noticed it when I installed whitespace.el in my emacs. :) Thanks for
your suggestions. I'll include my fixes as you pointed out in my next
>> Yeah, we should explain it a little bit in comments. I add this
>> paragraph below in comments, and ChangeLog will be updated accordingly.
>> "Registers from high to low is iterated here, in order to prefer
>> low registers. On some ports, low registers are better than high
>> registers in terms of final code size."
> This can be different on other ports so you cannot change it unilaterally.
Currently, we iterate registers from low to high, and resulting
"preferring" high registers in each iteration. Generally speaking, low
registers are "better", at least not worse, than high register, in terms
of code size or other metrics. Why can't we reverse the order of
iteration? I don't see any ports do something specific to this
iteration order. I run regression test on ARM, X86, X86_64, and don't
see any regressions if iteration order is reversed. So I assume that it
is not harmful to reverse the iteration order to all ports, and useful
to some ports, not only to ARM.
> Why do you need this for the ARM? Won't the hook already achieve this?
The goal of this piece of work is to assign low registers to mostly used
registers, so that code size can be reduced. There is similar feature
on X86_64, pointed out by HJ. In order to achieve this, we need 1) a
target hook to prefer low register class, 2) iterate registers from high
> On the other hand, the hook seems overly aggressive: IIUC, on the ARM, it will
> prevent non-LO_REGS from being renaming registers for GENERAL_REGS. Do we
> really want not to rename if all LO_REGS are already taken, instead of using
> an available non-LO_REGS reg?
Yes, the situation you described is correct, but this situation is *not*
popular, because we've sorted du_head linked list, and assign mostly
used registers to low registers. I can't give you a quantitative
measurements, but code size of some programs is reduced.
> Wouldn't it be better to add a more fine-grained hook, for example
> (unsigned int, reg_class_t),
> that would return the Nth preferred renaming (sub)class when passed an integer
> N (0 being the most preferred) and a class of registers?
I thought of target hook like this before, but this can't solve the
issue of iteration order. If different ports need different iteration
order, we have to provide a target hook for this.
(650) 331-3385 x739