This is the mail archive of the gcc-patches@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]

patch for ia64 builtin setjmp



The following patch has been checked into mainline and gcc 3.0 branch 
which allows the builtin-setjmp testcases in c-torture to compile and 
execute on ia64. 

ia64 issues a call for a nonlocal goto, and expand_builtin_longjmp () 
would loop until it found a JUMP, and die when it hit the top of 
the insn chain.

The parameters to the library routine __ia64_nonlocal_goto were being
issued in the wrong order, causing an execution failure after
the builtins.c change stopped the compilation failure.

Bootstrapped on x86, Verified on ia64, and approved by rth for 
both mainline and 3.0 branch. 


Andrew



	* builtins.c (expand_builtin_longjmp): A longjmp can be a call too.
	* config/ia64/ia64.md (nonlocal_goto): Reverse label and frame pointer
	parameters to __ia64_nonlocal_goto. Flag as NO_RETURN.


Index: builtins.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/builtins.c,v
retrieving revision 1.26
diff -c -p -r1.26 builtins.c
*** builtins.c	2001/04/30 22:36:54	1.26
--- builtins.c	2001/05/16 13:38:05
*************** expand_builtin_longjmp (buf_addr, value)
*** 718,729 ****
       __builtin_setjmp target in the same function.  However, we've
       already cautioned the user that these functions are for
       internal exception handling use only.  */
!   for (insn = get_last_insn ();
!        GET_CODE (insn) != JUMP_INSN;
!        insn = PREV_INSN (insn))
!     continue;
!   REG_NOTES (insn) = alloc_EXPR_LIST (REG_NON_LOCAL_GOTO, const0_rtx,
! 				      REG_NOTES (insn));
  }
  
  /* Get a MEM rtx for expression EXP which is the address of an operand
--- 718,734 ----
       __builtin_setjmp target in the same function.  However, we've
       already cautioned the user that these functions are for
       internal exception handling use only.  */
!   for (insn = get_last_insn (); insn; insn = PREV_INSN (insn))
!     {
!       if (GET_CODE (insn) == JUMP_INSN)
! 	{
! 	  REG_NOTES (insn) = alloc_EXPR_LIST (REG_NON_LOCAL_GOTO, const0_rtx,
! 					      REG_NOTES (insn));
! 	  break;
! 	}
!       else if (GET_CODE (insn) == CALL_INSN)
!         break;
!     }
  }
  
  /* Get a MEM rtx for expression EXP which is the address of an operand
Index: config/ia64/ia64.md
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/config/ia64/ia64.md,v
retrieving revision 1.98
diff -c -p -r1.98 ia64.md
*** ia64.md	2001/05/15 01:31:32	1.98
--- ia64.md	2001/05/16 13:38:15
***************
*** 4971,4980 ****
    "
  {
    emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
! 		     0, VOIDmode, 3,
! 		     operands[1], Pmode,
  		     copy_to_reg (XEXP (operands[2], 0)), Pmode,
! 		     operands[3], Pmode);
    emit_barrier ();
    DONE;
  }")
--- 4971,4980 ----
    "
  {
    emit_library_call (gen_rtx_SYMBOL_REF (Pmode, \"__ia64_nonlocal_goto\"),
! 		     LCT_NORETURN, VOIDmode, 3,
! 		     operands[3], Pmode,
  		     copy_to_reg (XEXP (operands[2], 0)), Pmode,
! 		     operands[1], Pmode);
    emit_barrier ();
    DONE;
  }")


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