This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Record REG_POINTER in more cases
- From: law at redhat dot com
- To: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: gcc-patches at gcc dot gnu dot org, roger at eyesopen dot com, rakdver at atrey dot karlin dot mff dot cuni dot cz
- Date: Mon, 22 Mar 2004 09:47:13 -0700
- Subject: Re: [patch] Record REG_POINTER in more cases
- Reply-to: law at redhat dot com
In message <200403210433.i2L4XTVF019073@hiauly1.hia.nrc.ca>, "John David Anglin
>> 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):
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.