On Thu, 2006-07-06 at 15:08 -0700, Ian Lance Taylor wrote:
> "Matt Lee" <[EMAIL PROTECTED]> writes:
> 
> > Is it possible for me to write a backend that accepts certain
> > addressing modes for loads, while rejecting them for stores? I am not
> > sure how to do this with the GO_IF_LEGITIMATE_ADDRESS macro. I know
> > that this is not very sane, but the situation has arisen neverthless.
> > I want to allow only indexed addressing on stores, while allowing
> > immediate forms of addressing with loads.
> 
> As far as I know there is no good way to do with the current
> infrastructure.  Certainly GO_IF_LEGITIMATE_ADDRESS won't help.
Correct.


> The best I know how to do is use different constraint characters for
> loads and stores, and recognize them differently in the insn patterns.
> You will want the movsi (or whatever) expander to pick the right
> forms.  The main drawback with this approach is that you can land in
> reload hell, from which I believe the only escape is to implement
> appropriate secondary reloads for hideous screwed up conditions.  I
> was able to get something similar working for a DSP backend I
> implemented,
You might want to look at the PA backend.

Some of its addressing mode quirks:

  1. Integer indexed loads, but no integer indexed stores.

  2. FP indexed loads and stores.

  3. Integer reg+d addresses allow a larger "d" than FP
     reg+d addresses.

  4. Segmented adress space where the segment is selected
     using bits in the base register only (not the effective
     address).  This implies you must distinguish between the
     base and index register in unscaled indexing address
     modes (if you get it wrong, then you get a segfault for
     accessing the wrong segment).


And finally, the PA implementes integer multiplication in FP
registers, so it is fairly common to have SI/DImode memory
operations to/from FP registers.  So legitimacy of an address
can't 100% reliably be keyed to the mode of the memory op.

It was a living hell trying to get good code from GCC with such
a mucked up addressing model.

jeff

Reply via email to