public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Different classes for base registers
@ 2007-05-29 13:38 Tal Agmon
  2007-05-29 14:59 ` Rask Ingemann Lambertsen
  0 siblings, 1 reply; 2+ messages in thread
From: Tal Agmon @ 2007-05-29 13:38 UTC (permalink / raw)
  To: gcc

Hi,

I'm working on a new target port in which there are different base
registers 
allowed depending on the offset:
r0-r7 are allowed as base register only when the offset is zero.
r6-r7 are allowed as base register for every offset.

I'm wondering if gcc is prepared for such scenario, examine the code in 
find_reloads_address(), for the architecture I'm working on, it seems
the 
condition here should be true, because it might not be valid because the
base reg isn't r6-r7, not only because the disp is too large.
Yet it fails because of REG_MODE_OK_FOR_BASE_P (XEXP (ad, 0), mode).


  /* If we have address of a stack slot but it's not valid because the
     displacement is too large, compute the sum in a register.
     Handle all base registers here, not just fp/ap/sp, because on some
     targets (namely SH) we can also get too large displacements from
     big-endian corrections.  */
  else if (GET_CODE (ad) == PLUS
         && REG_P (XEXP (ad, 0))
         && REGNO (XEXP (ad, 0)) < FIRST_PSEUDO_REGISTER
         && REG_MODE_OK_FOR_BASE_P (XEXP (ad, 0), mode)
         && GET_CODE (XEXP (ad, 1)) == CONST_INT)
    {
      /* Unshare the MEM rtx so we can safely alter it.  */
      if (memrefloc)
      {
        *memrefloc = copy_rtx (*memrefloc);
        loc = &XEXP (*memrefloc, 0);

        if (removed_and)
          loc = &XEXP (*loc, 0);
      }
...
 
Is there any way to get along by defining r0-r7 as legal base regs and
deal 
with r6-r7 in GO_IF_LEGITIMATE_ADDRESS and in the constraint
definitions, 
or am I right with my assumption that gcc doesn't support that?

Does someone knows if there's a target with a similar behavior?

Thanks in advance,

Tal Agmon.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Different classes for base registers
  2007-05-29 13:38 Different classes for base registers Tal Agmon
@ 2007-05-29 14:59 ` Rask Ingemann Lambertsen
  0 siblings, 0 replies; 2+ messages in thread
From: Rask Ingemann Lambertsen @ 2007-05-29 14:59 UTC (permalink / raw)
  To: Tal Agmon; +Cc: gcc

On Tue, May 29, 2007 at 03:56:38PM +0300, Tal Agmon wrote:
> Hi,
> 
> I'm working on a new target port in which there are different base
> registers 
> allowed depending on the offset:
> r0-r7 are allowed as base register only when the offset is zero.
> r6-r7 are allowed as base register for every offset.

   I think a new macro along the lines of MODE_CODE_BASE_REG_CLASS might do
the trick.

   Perhaps this family of macros needs to be cleaned up, so you have:

RTX_BASE_REG_CLASS(x)
RTX_INDEX_REG_CLASS(x)

where x is the address expression as an RTX.

-- 
Rask Ingemann Lambertsen

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-05-29 14:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-29 13:38 Different classes for base registers Tal Agmon
2007-05-29 14:59 ` Rask Ingemann Lambertsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).