This is the mail archive of the gcc-help@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: reload in incompatible constraints


Aurelien Buhrig <aurelien.buhrig.gcc@gmail.com> writes:

> My main problem is when defining a *movhi insn whose
> constraints/predicates only support r registers, GCC may reload some r
> register into A subreg:HI register, and complains because the insn
> *movhi does not satisfy its constraints (r). How to prevent this ?

I assume that the register can in principle hold the value, so changing
HARD_REGNO_MODE_OK would not be appropriate.  What you want here is
REGISTER_MOVE_COST.  However, gcc will try to use all available
registers in some cases, so if you can't move values between the
register classes easily you will need to define TARGET_SECONDARY_RELOAD.


> BTW, to handle movhi from subreg:HI A to subreg:HI A, which is not
> supported by the target: should I define a define_expand movhi whose
> predicates supports such an operation, and then, provide a
> define_split to froce passing through a r reg ? Is there a more
> efficient way to do this ?

This is what TARGET_SECONDARY_RELOAD is for.

Ian


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