On 06/24/10 02:02, Revital1 Eres wrote:
Hello,
In the new target I'm working on there are branch regs and gprs.
The loads and store instructions are only to/from the gprs, so if a
branch reg needs to be spilled it first needs to be moved to a gpr and
then stored to memory. I've implemented mov pattern in the machine
description file for the gprs and a mov pattern between gprs and branch
regs; however I'm am not sure if I need to add more to model the behavior
described above and if so how to do it.
Secondary reloads is the answer.
This isn't a terribly uncommon situation. Handling of the shift
register (SAR) on the PA would be a good example. You can move the SAR
to/from a GPR, but SAR can not be stored directly to memory. Searches
for SAR in pa.c will get you a long way.
Jeff