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: [patch] Record REG_POINTER in more cases

In message <>, "John David Anglin
" writes:
 >> This is OK for mainline.
 >> I've heard complaints that the middle-end should be doing a better job
 >> of preserving/propagating REG_POINTER, so any further follow-up patches
 >> would be very much appreciated.
 >I'm probably the bad guy as preserving/propagating REG_POINTER is
 >very important on the PA because the base register in index instructions
 >has to be in the right space.
Even more important is to make sure it set in a safe way.  ie, if REG_POINTER
is set on a register which does not point into the proper object, then
we can get incorrect code.  However, marking more pointers is likely to 
generate better code for the PA as we can take more advantage of its 
index addressing modes.

Some folks might ask how you can have a "pointer" which does not point to
a valid object.  Simple -- it's not terribly uncommon for the compiler to
internally create a "pointer" which points outside its target object, then
use reg + disp or reg + index addressing modes so that the final memory
location referenced is within the object.  Think of it like this (this is
invalid C, but is roughly what the compiler does internally):

 int a[10];

 x = &a[-20]
 *(x + 20) = blah

That works on most architectures -- but the PA's braindamaged notion that
segment selection should be from the base register only rather than the
effective address means that such code would be unsafe.  One of the mn10x
targets had this insanity as well IIRC. 


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