The secondary reload

Jeff Law law@redhat.com
Tue Dec 7 16:44:00 GMT 2010


On 12/07/10 09:30, Paulo J. Matos wrote:
> Jeff Law<law@redhat.com>  writes:
>
>> You're better off taking the time to understand how secondary reloads
>> work.  In addition to your port working better, the knowledge you gain
>> will help you with other maintenance burdens with your port.
> Yes, I think you're right. It seems to be a powerful tool that I have
> been underestimating. (actually I have been assuming that it is a
> workaround for when define_insn are not enough). :)
The best way to think about it is it's a way to get another register in 
cases where it wasn't apparent until reload that an additional register 
was necessary.

It's fairly complex and a source of numerous questions from people 
maintaining their own ports.  Even those of us who have done significant 
port work forget cases that need to be handled by the secondary reload 
mechanisms.  I believe most ports have secondary reloads of one form or 
another that you can refer to.  You might want to review

mn10300/mn10300.c::mn10300_secondary_reload_class
pa/pa.c::emit_move_sequence pa/pa.c::secondary_reload
i386/i386.c::ix86_secondary_reload
m68k/m68k.c::m68k_secondary_reload_class



Note that defining secondary reloads when none was necessary can lead to 
poor code generation; so do your best to define the precise set of 
circumstances when they're needed.

Jeff



More information about the Gcc mailing list