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]

Re: help with address reload


> I'm making nice progress on my i860 hacking: I seem to have big-endian
> working, and I'm getting somewhere with improving code generation. 
> However, I've run into a nasty problem cause by reload (prably by me not
> defining some #define correctly).
> 
> I convert
> 
> (set (reg:SI xx) 
>      (mem:SI (symbol_ref "sym")))
> 
> to
> 
> (set (reg:SI yy)
>      (high:SI (symbol_ref "sym)))
> (set (reg:SI xx)
>      (mem:SI (lo_sum:SI (reg:SI yy) (symbol_ref "sym))))
> 
> during the define_expand of "movsi".  This usually works extreamly well,
> with the first `set' being cse'd as appropriat.  The problem comes when
> reload runs out of registers (?? guessing here) and winds up converting
> the above sequence to
> 
> (set (reg:SI xx)
>      (mem:SI (lo_sum:SI (high:SI (symbol_ref "sym))
>                         (symbol_ref "sym))))

Presumably, you have a GO_IF_LEGITIMATE_ADDRESS definition that allows
this address.  If that is the case, I suggest fixing that.

> I've figured out that I may need to define LEGITIMIZE_RELOAD_ADDRESS,
> which I did to:

It shouldn't be necessary to define LEGITIMIZE_RELOAD_ADDRESS to get
correct code.

> However, this gives me an abort (I've read the comment at the abort, so
> I know I'm doing something wrong).

There is more than one abort in the gcc sources, therefore the above
sentence isn't helpful in describing your problem.

> What I want to get is 
> 
> (set (reg:SI 31)
>      (high:SI (symbol_ref "sym)))
> (set (reg:SI xx)
>      (mem:SI (lo_sum:SI (reg:SI 31) (symbol_ref "sym))))
> 
> (%r31 has been allocated as a scratch register in i860.h, probably just
> of this sort of occasion).  The question is: how do I (correctly) get
> reload to do this?  I take it that I should be able to without hacking
> reload*.c.

No, register 31 is a fixed register, therefore it can only be used by
explicit code in the machine description, i.e. hard-coding it in the
output templates.

> Actually, shouldn't reload detect (lo_sum (high ...) ...) on it's own
> and fix it by itself?

That depends on the definition of GO_IF_LEGITIMATE_ADDRESS.

> BTW, about 18 months ago, I sent in assignment forms to the FSF for my
> work on GNU Pascal.  Are they still valid and can they apply to gcc in
> general?  I don't think they have any email addresses on them, if they

That depends on the wording used on the form.  E.g. you you have specifically
assigned rights for only GNU pascal, the assignment is not general enough.


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