This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: m32c support for named addr spaces branch


DJ Delorie wrote:

> How do I tell gcc which registers are legal base registers for the
> __far addressing mode?  It tries $a1 and $r0, but only $a0 is allowed.
> 
> It works just fine without the "__far", and in fact chooses $a0
> although $a1 *would* work then.

As far as I can see, there's two things to consider:

- The legitimate_address target macro, when called in "strict" mode,
  must refuse addresses that use invalid base registers for the
  given address space.

- The base_reg_class and ok_for_base_p_1 routines in addresses.h should
  take the target address space into account.

The first should be easily doable with the current address-space-aware
variant of legitimate_address.

The second, however, seems to require additional changes:  the callers
of the base_reg_class / ok_for_base_p_1 routines need to be adapted to
pass the address space, and we need to define new target macros as
variants of MODE_CODE_BASE_REG_CLASS / REGNO_MODE_CODE_OK_FOR_BASE_P
that take an address space.

I probably missed this as on the spu, non-generic space addresses
never survive past "expand" in any case ...

Can you try implementing a change along those lines?  Or, if you prefer,
I can come up with a patch.

(As a work-around for now, you could just restrict the implementation of
the OK_FOR_BASE / BASE_REG_CLASS macros for your target to the set of
registers allowed for any address space.)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]