This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: discouraging register use
Richard Henderson <rth@redhat.com> writes:
> On Thu, Dec 30, 2004 at 06:54:44PM -0500, DJ Delorie wrote:
> > Do I have to do something like this? If so, I'm going to have some
> > *really* long lines in my md file (for this chip). Or is there some
> > other way of changing gcc's register preferences, without precluding
> > the registers completely?
> >
> > [(set (match_operand:SI 0 "" "c,c,?m,?m")
> > (plus:SI (match_operand:SI 1 "" "0,0,0,0")
> > (match_operand:SI 1 "" "c,?m,c,?m")))]
>
> Yes, that looks plausible. The other way isn't going to work because
> you penalize c at the same time as m by using "?cm".
My suspicion is that that is not enough, because find_reg() in
global.c will allocate any ordinary register which appears in
REG_ALLOC_ORDER and for which the value passes HARD_REGNO_MODE_OK. So
the compiler will still allocate the expensive registers as soon as it
has used the cheap registers for something.
But it's not like I've tried it.
Ian