This is the mail archive of the 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: readonly register

On Thu, 19 Jan 2012, BELBACHIR Selim wrote:

> In fact my final purpose is to replace $INP by a register bank
> in order to be able to read several inputs using pipelined
> instructions (and instruction scheduler). The fixed reg solution
> will prevent me from doing this. Is there another way to prevent
> the use of some registers during the reload pass without turning
> them into fixed register ?

I can't think of another way than to use different (narrower)
register constraints for the destination operand than the source
operands for the instructions which can take $INP as a source
operand, with the source operand register class to include the
register (sub)class for $INP, but this latter register class
must not be included in GENERAL_REGS nor of course the
destination register class.  (Though, the source register class
can be a superclass that includes GENERAL_REGS and the register
class for $INP, whatever applies.)

This wouldn't "prevent the use of some registers during the
reload pass" but that wasn't the original goal nor a reasonably
doable one AFAIK.

With reservations for possibly not understanding your problem.

> -----Message d'origine-----
> De?: Ian Lance Taylor []
> Envoyé?: jeudi 19 janvier 2012 00:17
> Cc?:
> Objet?: Re: readonly register
> BELBACHIR Selim <> writes:
> > I'm trying to support an 'in' instruction which reads a value on a peripheral and writes it into a $INP register.
> > The $INP register can be used in almost every insn as input operand (add, sub, mul ...).
> > I defined a builting to access the 'in' instruction.
> >
> > How should I express to gcc that the $INP register can only be 'read' and must never be written?
> >
> > For the moment, I encounter a problem during IRA pass where some of my 'classic' registers are reloaded into $INP (apparently because I have no register left).
> If you have a builtin to access the value, then you should be able to
> make it a fixed register.  The register allocator will never try to
> allocate a fixed register.

brgds, H-P

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