This is the mail archive of the gcc@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: Limiting the use of pointer registers


Michael Hope <michaelh@juju.net.nz> writes:

> How can I prevent the register allocator from using these for anything
> but memory access?

Unfortunately, you can't.  You can make them the last registers the
allocator will use, but if you say that they can hold Pmode values then
the register allocator will use them.

> I suspect that I'll have to do the same as the accumulator and hide X
> and Y from the register allocator.  Pretend that any general register
> can access memory and then use post reload split to turn the patterns
> into X based patterns for the later phases to tidy up.

I agree.

>
> One more question.  The backing caches aren't coherent so X and Y
> can't read and write to the same 128 bytes of memory at the same time.
>  Does GCC have any other information about the location of a pointer
> that I could use?  Something like:
>  * Pointer is to text memory or read only data, so it is safe to read from
>  * Pointer 1 is in the stack and pointer 2 is in BSS, so they are
> definitely far apart
>  * Pointer 1 is to to one on stack item and pointer 2 is to a stack
> item at least 128 bytes apart
>  * The call stack is known and pointer 1 and pointer 2 point to different rows

Ouch.  You can get alias set information but I don't think it will help.
In some cases you can look in REG_ATTRS to at least get the original
decl that the register is associated with.  This information is not
always there, and it won't always be useful, but it may at least let you
distinguish between a function pointer and a data pointer.  After
reload, you need to look at ORIGINAL_REGNO to get the original register
number (if any) and look at regno_reg_rtx[orig_regno].

Ian


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