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: problem with call clobbered regs


On Fri, Feb 13, 2004 at 12:59:36PM +0100, Daniel Bayer wrote:
> In save_call_clobbered_regs() this RTL is generated:
> |  (set (mem:QI (plus:QI (reg/f:QI 8 fp)
> |              (const_int -4 [0xfffffffc])) [0 S1 A16])
> | 	         (reg:QI 2 p2))
> | 
> |  (set (reg:QI 2 p2)
> |      (mem:QI (plus:QI (reg/f:QI 8 fp)
> |                  (const_int -4 [0xfffffffc])) [0 S1 A16]))
> 
> After emit_reload_insns() subst_reloads() is called with the save-insn
> as argument. It is changed to
> | (insn 187 231 79 5 (nil) (set (mem:QI (reg:QI 3 p3) [0 S1 A16])
> |         (reg:QI 2 p2)) 4 {*movqi_register_speicher_insn} (nil)
> |     (nil))
> 
> But in this very moment it also changes the restore insn to
> | (insn 188 180 64 5 (nil) (set (reg:QI 2 p2)
> |         (mem:QI (reg:QI 3 p3) [0 S1 A16])) 2 {*movqi_speicher_register_insn} (nil)
> |     (nil))
> 
> I think this shouldn't happen because the comment to subst_reloads()
> says that it only changes the argument and insns "just made for
> reloading".

It seems that the plus-rtx in both insns is a pointer to the same
memory. I inserted a copy_rtx() in insert_restore() and insert_save()
and now it works. The patch is attached.

What do you think? Is there another way to fix this? I had a look at
emit_reload_insns but I couldn't find a check for stuff like this. So
it seems that the caller of reload_as_needed() has to make sure that
there are no insns with pointers to the same rtx if a reload for this
insn could be needed.


Daniel

Attachment: diff
Description: Text document


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