[Installed] Patch to sh64 trampolines

Richard Sandiford rsandifo@redhat.com
Mon Nov 18 04:27:00 GMT 2002


The sh.md initialize_trampoline expander introduces references
to r0.  This can cause spill failures if reload needs r0 for
some other instruction between the set of r0 and the call itself.

There doesn't seem to be any need to introduce r0 so early:
the relevant insn operand has a 'z' constraint, so reload
should do the right thing.

Tested on sh64-elf, fixes many -fpic and -fPIC failures for
-m5-compact.  Approved by Alex off-list.

Richard


	* config/sh/sh.md (initialize_trampoline): Do not force the
	trampoline address into R0_REGS here.

Index: config/sh/sh.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.md,v
retrieving revision 1.125
diff -c -d -p -F^[(a-zA-Z0-9_^#] -r1.125 sh.md
*** config/sh/sh.md	31 Oct 2002 12:53:06 -0000	1.125
--- config/sh/sh.md	15 Nov 2002 11:03:27 -0000
*************** (define_expand "initialize_trampoline"
*** 3572,3580 ****
  {
    rtx sfun, tramp;
  
    sfun = force_reg (Pmode, gen_rtx_SYMBOL_REF (Pmode, \"__init_trampoline\"));
-   tramp = gen_rtx_REG (SImode, R0_REG);
-   emit_move_insn (tramp, operands[0]);
    emit_move_insn (gen_rtx_REG (SImode, R2_REG), operands[1]);
    emit_move_insn (gen_rtx_REG (SImode, R3_REG), operands[2]);
  
--- 3566,3573 ----
  {
    rtx sfun, tramp;
  
+   tramp = force_reg (Pmode, operands[0]);
    sfun = force_reg (Pmode, gen_rtx_SYMBOL_REF (Pmode, \"__init_trampoline\"));
    emit_move_insn (gen_rtx_REG (SImode, R2_REG), operands[1]);
    emit_move_insn (gen_rtx_REG (SImode, R3_REG), operands[2]);
  



More information about the Gcc-patches mailing list