Joern RENNECKE <[EMAIL PROTECTED]> wrote:
>>[.expand after the patch]
>>(set (reg/f:SI 160) (const:SI (unspec [(symbol_ref:SI ("baz"))] 7)))
>>(set (reg:SI 161) (plus:SI (reg:SI 12 r12) (reg/f:SI 160)))
>>(set (reg/f:SI 159) (mem/u/c:SI (reg:SI 161)))
>>(set (reg:SI 0 r0) (call (mem:SI (symbol_ref:SI ("bar")))))
>>(set (mem/c/i:SI (reg/f:SI 159)) (reg:SI 0 r0)))
>>  
>>
> The last insn is invalid.  Before reload, a return value in a 
> CLASS_LIKELY_SPILLED
> hard reg cannot be used in arbitrary instructions, but has to be copied 
> to a plain register
> first.

Thanks for pointing it out.  Now I'm testing the patch below.
How does it look like?

Regards,
        kaz
--
--- ORIG/trunk/gcc/calls.c      2005-10-29 06:52:11.000000000 +0900
+++ LOCAL/trunk/gcc/calls.c     2005-11-03 09:15:47.000000000 +0900
@@ -2774,6 +2774,17 @@ expand_call (tree exp, rtx target, int i
          emit_insn (insns);
          valreg = temp;
        }
+      /* We have to copy a return value in a CLASS_LIKELY_SPILLED hard
+        reg to a plain register, even for pure functions.  */
+      else if (pass && (flags & ECF_PURE)
+              && REGNO (valreg) < FIRST_PSEUDO_REGISTER
+              && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (valreg))))
+       {
+         rtx temp = gen_reg_rtx (GET_MODE (valreg));
+
+         emit_move_insn (temp, valreg);
+         valreg = temp;
+       }
 
       /* For calls to `setjmp', etc., inform flow.c it should complain
         if nonvolatile values are live.  For functions that cannot return,

Reply via email to