daniel tian wrote:
You mean before LEGITIMIZE_RELOAD_ADDRESS, cc1 must generate the
correct RTL code, regardless of whether efficient or not.
The compiler should work with or without defining
LEGITIMIZE_RELOAD_ADDRESS. It's often difficult to write a correct
LEGITIMIZE_RELOAD_ADDRESS without knowing the internals of how reload
works. Therefore, I strongly recommend first writing the port without
LEGITIMIZE_RELOAD_ADDRESS -- after the port is working correctly you can
go back and add LEGITIMIZE_RELOAD_ADDRESS to generate more efficient code.
Take the immediate load for instance, should I generate the the right
code in "movm" expander? I mean ,first the larger immediate data will
move into a pseduo register, then I insert a RTL code, first move to
R0, then R0 move to the pseduo register. Right?
I'm not familiar with your port. So I would have to start with a question.
Does your target require the constant to be loaded into r0, or is r0 a
scratch register necessary to synthesize the constant into some other
register? The difference is subtle, but important for reload. For the
former, you will have a secondary reload that is a intermediate
register, for the latter, the secondary reload will be a scratch register.
Now I just force the larger immedate into a register, and let the
reload to move the immediate into R0 register.
It is generally better to force the large constant into a pseudo rather
than expose R0 early in RTL generation, so you're doing the right thing
in this regard. I think the problem is you haven't defined your
secondary reloads yet.
jeff