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: "return" expander


On 28 Jul 2002, Momchil Velikov wrote:

> The return insn on v850 is ``jmp [r31]''.  I have a case with a
> function where r31 is allocated and the jump at the end of the
> function jumps to nowhere.  I guess the ``return'' pattern should make
> ``r31'' live at the end so it is either saved/restored or not
> allocated. I've tried with
> 
> (define_expand "return"
>   [(parallel [(return)
>               (use (reg:SI 31))])]
>   "reload_completed && compute_frame_size (get_frame_size (), (long *)0) == 0"
>   "
> {
>   current_function_anonymous_args = 0;
>   v850_interrupt_cache_p = FALSE;
>   v850_interrupt_p = FALSE;
> }")
> 
> and got
> 
> $ v850-elf-gcc -da -S -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions 980716-1.c
> 980716-1.c: In function `stub':
> 980716-1.c:18: error: Too many outgoing branch edges from bb 18
> 980716-1.c:18: internal compiler error: verify_flow_info failed
> 
> because the above description generated ``insn'' instead of
> ``jump_insn''.

I had the same problem with a new port I'm about to contribute.  I've used
the following patch.  I'll be checking this in once I bootstrap it on
i686-linux.


Bernd

	* genemit.c (gen_expand): Recognize return insns even if the return
	appears in a parallel.

Index: genemit.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/genemit.c,v
retrieving revision 1.76
diff -c -p -r1.76 genemit.c
*** genemit.c	22 Jul 2002 14:20:20 -0000	1.76
--- genemit.c	29 Jul 2002 11:24:33 -0000
*************** gen_expand (expand)
*** 524,531 ****
        rtx next = XVECEXP (expand, 1, i);
        if ((GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC)
  	  || (GET_CODE (next) == PARALLEL
! 	      && GET_CODE (XVECEXP (next, 0, 0)) == SET
! 	      && GET_CODE (SET_DEST (XVECEXP (next, 0, 0))) == PC)
  	  || GET_CODE (next) == RETURN)
  	printf ("  emit_jump_insn (");
        else if ((GET_CODE (next) == SET && GET_CODE (SET_SRC (next)) == CALL)
--- 524,532 ----
        rtx next = XVECEXP (expand, 1, i);
        if ((GET_CODE (next) == SET && GET_CODE (SET_DEST (next)) == PC)
  	  || (GET_CODE (next) == PARALLEL
! 	      && ((GET_CODE (XVECEXP (next, 0, 0)) == SET
! 		   && GET_CODE (SET_DEST (XVECEXP (next, 0, 0))) == PC)
! 		  || GET_CODE (XVECEXP (next, 0, 0)) == RETURN))
  	  || GET_CODE (next) == RETURN)
  	printf ("  emit_jump_insn (");
        else if ((GET_CODE (next) == SET && GET_CODE (SET_SRC (next)) == CALL)


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