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]
Other format: [Raw text]

Re: Using SCRATCH Register for a mov op,


You could look at SECONDARY_RELOAD_CLASS and its cousins, the
reload_inXX and reload_outXX patterns(section 17.6 of the manual).
I've used them in gcc-3.0.4 (and working on gcc-3.2) with great effect
to generate a scratch address register to hold the address of an
abolute symbol while trying to load/store a float/double (for the
ColdFire v4e architecture).

I lifted my code form the PA architecture(foind in
gcc/config/gcc/pa/pa.{h,c,md}) which has some severe restructicions on
its instructiions and addressing modes so it ends up(for some
cases)loading the resultant operand address into a register and then
dloing the load/store indirect from that(see emite_move_sequence for
the code).  I'll have to take the same approach for some of the
ColdFire load/store pairs since certain addressing modes are
not allowed in conjunction with other addressing modes.  For example:

	   move d8(Ax,Xi),Dy
	   move Dy,d8(Ax,Xi)

Are both allowed, but:

	   move d8(Ax,Xi),d8(Ay,Xj)

is not allowed.  And since GO_IF_LEGITIMATE_ADDRESS/LEGITIMIZE_ADDRESS
have no knowledge of the instruction its trying to validate/fix, nor
which side of the instruction(src/dst) its on, so in this case I will
have to force *everything* through the reload_in/reload_out patterns
and not use the scratch register that is proffered by the pattern if
it is not needed...

I hope this might shed some light on your problem...

-- 
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)


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