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]

REG_SETJMP instead of NOTE_INSN_SETJMP


Hi
current way of signalizing setjmp using INSN notes looks fragile. IMO much better
is to use REG_ note as we do with noreturn calls and friends.

Po srp  6 21:31:17 CEST 2001  Jan Hubicka  <jh@suse.cz>

	* calls.c (expand_call): Do not emit INSN_SETJMP note.
	(emit_library_call_value_1): Likewise.
	(emit_call_1): Emit REG_SETJMP note.
	* cse.c (cse_end_of_basic_block): Use REG_SETJMP instead
	of INSN_SETJMP
	* cselib.c (cselib_process_insn): Likewise.
	* flow.c (propagate_block): Likewise.
	* loop.c (find_and_verify_loops): Likewise.
	* reload.c (find_equiv_regs): Likewise.
	* reload1.c (reload): Likewise.
	* resource.c (mark_referenced_resources,
	mark_set_resources): Likewise.
	* sched-deps (sched_analyze_insn, sched_analyze): Likewise.
	* final.c (final_scan_insn): Remove NOTE_INSN_SETJMP.
	* haifa-sched.c (unlink_other_notes): Likewise.
	(reemit_notes): Likewise.
	* sched-ebb.c (sched_ebb): Likewise.
	* sched-rgc.c (sched_region): Likewise.
	* rtl.c (note_insn_name): Likewise.
	(reg_note_name): Add REG_SETJMP
	* rtl.h (reg_note): Add REG_SETJMP.
	(insn_note): Remove NOTE_INSN_SETJMP.

*** calls.c.setjmp	Mon Aug  6 20:26:02 2001
--- calls.c	Mon Aug  6 21:01:23 2001
*************** emit_call_1 (funexp, fndecl, funtype, st
*** 610,615 ****
--- 610,619 ----
      REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_NORETURN, const0_rtx,
  					       REG_NOTES (call_insn));
  
+   if (ecf_flags & ECF_RETURNS_TWICE)
+     REG_NOTES (call_insn) = gen_rtx_EXPR_LIST (REG_SETJMP, const0_rtx,
+ 					       REG_NOTES (call_insn));
+ 
    SIBLING_CALL_P (call_insn) = ((ecf_flags & ECF_SIBCALL) != 0);
  
    /* Restore this now, so that we do defer pops for this call's args
*************** expand_call (exp, target, ignore)
*** 3156,3164 ****
  	 if nonvolatile values are live.  For functions that cannot return,
  	 inform flow that control does not fall through.  */
  
!       if ((flags & (ECF_RETURNS_TWICE | ECF_NORETURN | ECF_LONGJMP)) || pass == 0)
  	{
! 	  /* The barrier or NOTE_INSN_SETJMP note must be emitted
  	     immediately after the CALL_INSN.  Some ports emit more
  	     than just a CALL_INSN above, so we must search for it here.  */
  
--- 3161,3169 ----
  	 if nonvolatile values are live.  For functions that cannot return,
  	 inform flow that control does not fall through.  */
  
!       if ((flags & (ECF_NORETURN | ECF_LONGJMP)) || pass == 0)
  	{
! 	  /* The barrier must be emitted
  	     immediately after the CALL_INSN.  Some ports emit more
  	     than just a CALL_INSN above, so we must search for it here.  */
  
*************** expand_call (exp, target, ignore)
*** 3171,3183 ****
  		abort ();
  	    }
  
! 	  if (flags & ECF_RETURNS_TWICE)
! 	    {
! 	      emit_note_after (NOTE_INSN_SETJMP, last);
! 	      current_function_calls_setjmp = 1;
! 	    }
! 	  else
! 	    emit_barrier_after (last);
  	}
  
        if (flags & ECF_LONGJMP)
--- 3176,3182 ----
  		abort ();
  	    }
  
! 	  emit_barrier_after (last);
  	}
  
        if (flags & ECF_LONGJMP)
*************** emit_library_call_value_1 (retval, orgfu
*** 4090,4098 ****
       if nonvolatile values are live.  For functions that cannot return,
       inform flow that control does not fall through.  */
  
!   if (flags & (ECF_RETURNS_TWICE | ECF_NORETURN | ECF_LONGJMP))
      {
!       /* The barrier or NOTE_INSN_SETJMP note must be emitted
  	 immediately after the CALL_INSN.  Some ports emit more than
  	 just a CALL_INSN above, so we must search for it here.  */
  
--- 4089,4097 ----
       if nonvolatile values are live.  For functions that cannot return,
       inform flow that control does not fall through.  */
  
!   if (flags & (ECF_NORETURN | ECF_LONGJMP))
      {
!       /* The barrier note must be emitted
  	 immediately after the CALL_INSN.  Some ports emit more than
  	 just a CALL_INSN above, so we must search for it here.  */
  
*************** emit_library_call_value_1 (retval, orgfu
*** 4105,4117 ****
  	    abort ();
  	}
  
!       if (flags & ECF_RETURNS_TWICE)
! 	{
! 	  emit_note_after (NOTE_INSN_SETJMP, last);
! 	  current_function_calls_setjmp = 1;
! 	}
!       else
! 	emit_barrier_after (last);
      }
  
    /* Now restore inhibit_defer_pop to its actual original value.  */
--- 4104,4110 ----
  	    abort ();
  	}
  
!       emit_barrier_after (last);
      }
  
    /* Now restore inhibit_defer_pop to its actual original value.  */
*** cse.c.setjmp	Mon Aug  6 20:25:33 2001
--- cse.c	Mon Aug  6 20:29:12 2001
*************** cse_end_of_basic_block (insn, data, foll
*** 6855,6862 ****
        /* Don't cse over a call to setjmp; on some machines (eg VAX)
  	 the regs restored by the longjmp come from
  	 a later time than the setjmp.  */
!       if (GET_CODE (p) == NOTE
! 	  && NOTE_LINE_NUMBER (p) == NOTE_INSN_SETJMP)
  	break;
  
        /* A PARALLEL can have lots of SETs in it,
--- 6855,6862 ----
        /* Don't cse over a call to setjmp; on some machines (eg VAX)
  	 the regs restored by the longjmp come from
  	 a later time than the setjmp.  */
!       if (PREV_INSN (p) && GET_CODE (PREV_INSN (p)) == CALL_INSN
! 	  && find_reg_note (PREV_INSN (p), REG_SETJMP, NULL))
  	break;
  
        /* A PARALLEL can have lots of SETs in it,
*************** cse_end_of_basic_block (insn, data, foll
*** 6906,6912 ****
  	  for (q = PREV_INSN (JUMP_LABEL (p)); q; q = PREV_INSN (q))
  	    if ((GET_CODE (q) != NOTE
  		 || NOTE_LINE_NUMBER (q) == NOTE_INSN_LOOP_END
! 		 || NOTE_LINE_NUMBER (q) == NOTE_INSN_SETJMP)
  		&& (GET_CODE (q) != CODE_LABEL || LABEL_NUSES (q) != 0))
  	      break;
  
--- 6906,6913 ----
  	  for (q = PREV_INSN (JUMP_LABEL (p)); q; q = PREV_INSN (q))
  	    if ((GET_CODE (q) != NOTE
  		 || NOTE_LINE_NUMBER (q) == NOTE_INSN_LOOP_END
! 		 || (PREV_INSN (q) && GET_CODE (PREV_INSN (q)) == CALL_INSN
! 		     && find_reg_note (PREV_INSN (q), REG_SETJMP, NULL)))
  		&& (GET_CODE (q) != CODE_LABEL || LABEL_NUSES (q) != 0))
  	      break;
  
*** cselib.c.setjmp	Mon Aug  6 20:30:29 2001
--- cselib.c	Mon Aug  6 20:30:02 2001
*************** cselib_process_insn (insn)
*** 1254,1261 ****
  
    /* Forget everything at a CODE_LABEL, a volatile asm, or a setjmp.  */
    if (GET_CODE (insn) == CODE_LABEL
!       || (GET_CODE (insn) == NOTE
! 	  && NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
        || (GET_CODE (insn) == INSN
  	  && GET_CODE (PATTERN (insn)) == ASM_OPERANDS
  	  && MEM_VOLATILE_P (PATTERN (insn))))
--- 1254,1261 ----
  
    /* Forget everything at a CODE_LABEL, a volatile asm, or a setjmp.  */
    if (GET_CODE (insn) == CODE_LABEL
!       || (GET_CODE (insn) == CALL
! 	  && find_reg_note (insn, REG_SETJMP, NULL))
        || (GET_CODE (insn) == INSN
  	  && GET_CODE (PATTERN (insn)) == ASM_OPERANDS
  	  && MEM_VOLATILE_P (PATTERN (insn))))
*** final.c.setjmp	Mon Aug  6 20:31:14 2001
--- final.c	Mon Aug  6 20:31:16 2001
*************** final_scan_insn (insn, file, optimize, p
*** 2011,2017 ****
  	case NOTE_INSN_LOOP_CONT:
  	case NOTE_INSN_LOOP_VTOP:
  	case NOTE_INSN_FUNCTION_END:
- 	case NOTE_INSN_SETJMP:
  	case NOTE_INSN_REPEATED_LINE_NUMBER:
  	case NOTE_INSN_RANGE_BEG:
  	case NOTE_INSN_RANGE_END:
--- 2011,2016 ----
*** flow.c.setjmp	Mon Aug  6 20:31:34 2001
--- flow.c	Mon Aug  6 21:04:27 2001
*************** propagate_block (bb, live, local_set, co
*** 5705,5712 ****
        /* If this is a call to `setjmp' et al, warn if any
  	 non-volatile datum is live.  */
        if ((flags & PROP_REG_INFO)
! 	  && GET_CODE (insn) == NOTE
! 	  && NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
  	IOR_REG_SET (regs_live_at_setjmp, pbi->reg_live);
  
        prev = propagate_one_insn (pbi, insn);
--- 5705,5712 ----
        /* If this is a call to `setjmp' et al, warn if any
  	 non-volatile datum is live.  */
        if ((flags & PROP_REG_INFO)
! 	  && GET_CODE (insn) == CALL
! 	  && find_reg_note (insn, REG_SETJMP, NULL))
  	IOR_REG_SET (regs_live_at_setjmp, pbi->reg_live);
  
        prev = propagate_one_insn (pbi, insn);
*** haifa-sched.c.setjmp	Mon Aug  6 20:35:32 2001
--- haifa-sched.c	Mon Aug  6 20:35:36 2001
*************** unlink_other_notes (insn, tail)
*** 1071,1078 ****
  	PREV_INSN (next) = prev;
  
        /* See sched_analyze to see how these are handled.  */
!       if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_SETJMP
! 	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_BEG
  	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_END
  	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_RANGE_BEG
  	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_RANGE_END
--- 1071,1077 ----
  	PREV_INSN (next) = prev;
  
        /* See sched_analyze to see how these are handled.  */
!       if (NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_BEG
  	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_END
  	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_RANGE_BEG
  	  && NOTE_LINE_NUMBER (insn) != NOTE_INSN_RANGE_END
*************** move_insn1 (insn, last)
*** 1537,1543 ****
    return insn;
  }
  
! /* Search INSN for REG_SAVE_NOTE note pairs for NOTE_INSN_SETJMP,
     NOTE_INSN_{LOOP,EHREGION}_{BEG,END}; and convert them back into
     NOTEs.  The REG_SAVE_NOTE note following first one is contains the
     saved value for NOTE_BLOCK_NUMBER which is useful for
--- 1536,1542 ----
    return insn;
  }
  
! /* Search INSN for REG_SAVE_NOTE note pairs for
     NOTE_INSN_{LOOP,EHREGION}_{BEG,END}; and convert them back into
     NOTEs.  The REG_SAVE_NOTE note following first one is contains the
     saved value for NOTE_BLOCK_NUMBER which is useful for
*************** reemit_notes (insn, last)
*** 1558,1572 ****
  	{
  	  enum insn_note note_type = INTVAL (XEXP (note, 0));
  
! 	  if (note_type == NOTE_INSN_SETJMP)
! 	    {
! 	      retval = emit_note_after (NOTE_INSN_SETJMP, insn);
! 	      CONST_CALL_P (retval) = CONST_CALL_P (note);
! 	      remove_note (insn, note);
! 	      note = XEXP (note, 1);
! 	    }
! 	  else if (note_type == NOTE_INSN_RANGE_BEG
!                    || note_type == NOTE_INSN_RANGE_END)
  	    {
  	      last = emit_note_before (note_type, last);
  	      remove_note (insn, note);
--- 1557,1564 ----
  	{
  	  enum insn_note note_type = INTVAL (XEXP (note, 0));
  
! 	  if (note_type == NOTE_INSN_RANGE_BEG
!               || note_type == NOTE_INSN_RANGE_END)
  	    {
  	      last = emit_note_before (note_type, last);
  	      remove_note (insn, note);
*** loop.c.setjmp	Mon Aug  6 20:36:00 2001
--- loop.c	Mon Aug  6 20:36:58 2001
*************** find_and_verify_loops (f, loops)
*** 2512,2530 ****
  	    current_loop = next_loop;
  	    break;
  
- 	  case NOTE_INSN_SETJMP:
- 	    /* In this case, we must invalidate our current loop and any
- 	       enclosing loop.  */
- 	    for (loop = current_loop; loop; loop = loop->outer)
- 	      {
- 		loop->invalid = 1;
- 		if (loop_dump_stream)
- 		  fprintf (loop_dump_stream,
- 			   "\nLoop at %d ignored due to setjmp.\n",
- 			   INSN_UID (loop->start));
- 	      }
- 	    break;
- 
  	  case NOTE_INSN_LOOP_CONT:
  	    current_loop->cont = insn;
  	    break;
--- 2512,2517 ----
*************** find_and_verify_loops (f, loops)
*** 2544,2549 ****
--- 2531,2551 ----
  	  default:
  	    break;
  	  }
+ 
+       if (GET_CODE (insn) == CALL
+ 	  && find_reg_note (insn, REG_SETJMP, NULL))
+ 	{
+ 	  /* In this case, we must invalidate our current loop and any
+ 	     enclosing loop.  */
+ 	  for (loop = current_loop; loop; loop = loop->outer)
+ 	    {
+ 	      loop->invalid = 1;
+ 	      if (loop_dump_stream)
+ 		fprintf (loop_dump_stream,
+ 			 "\nLoop at %d ignored due to setjmp.\n",
+ 			 INSN_UID (loop->start));
+ 	    }
+ 	}
  
        /* Note that this will mark the NOTE_INSN_LOOP_END note as being in the
  	 enclosing loop, but this doesn't matter.  */
*** reload.c.setjmp	Mon Aug  6 20:37:04 2001
--- reload.c	Mon Aug  6 20:41:15 2001
*************** find_equiv_reg (goal, insn, class, other
*** 6461,6473 ****
  	    for (i = 0; i < valuenregs; ++i)
  	      if (call_used_regs[valueno + i])
  		return 0;
- 	}
- 
  #ifdef NON_SAVING_SETJMP
!       if (NON_SAVING_SETJMP && GET_CODE (p) == NOTE
! 	  && NOTE_LINE_NUMBER (p) == NOTE_INSN_SETJMP)
! 	return 0;
  #endif
  
        if (INSN_P (p))
  	{
--- 6461,6471 ----
  	    for (i = 0; i < valuenregs; ++i)
  	      if (call_used_regs[valueno + i])
  		return 0;
  #ifdef NON_SAVING_SETJMP
! 	  if (NON_SAVING_SETJMP && find_reg_note (p, REG_SETJMP, NULL))
! 	    return 0;
  #endif
+ 	}
  
        if (INSN_P (p))
  	{
*** reload1.c.setjmp	Mon Aug  6 20:41:20 2001
--- reload1.c	Mon Aug  6 20:43:38 2001
*************** reload (first, global)
*** 754,760 ****
       Also find all paradoxical subregs and find largest such for each pseudo.
       On machines with small register classes, record hard registers that
       are used for user variables.  These can never be used for spills.
!      Also look for a "constant" NOTE_INSN_SETJMP.  This means that all
       caller-saved registers must be marked live.  */
  
    num_eliminable_invariants = 0;
--- 754,760 ----
       Also find all paradoxical subregs and find largest such for each pseudo.
       On machines with small register classes, record hard registers that
       are used for user variables.  These can never be used for spills.
!      Also look for a "constant" REG_SETJMP.  This means that all
       caller-saved registers must be marked live.  */
  
    num_eliminable_invariants = 0;
*************** reload (first, global)
*** 762,769 ****
      {
        rtx set = single_set (insn);
  
!       if (GET_CODE (insn) == NOTE && CONST_CALL_P (insn)
! 	  && NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP)
  	for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
  	  if (! call_used_regs[i])
  	    regs_ever_live[i] = 1;
--- 762,768 ----
      {
        rtx set = single_set (insn);
  
!       if (GET_CODE (insn) == CALL && find_reg_note (insn, REG_SETJMP, NULL))
  	for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
  	  if (! call_used_regs[i])
  	    regs_ever_live[i] = 1;
*** resource.c.setjmp	Mon Aug  6 20:45:33 2001
--- resource.c	Mon Aug  6 21:15:55 2001
*************** mark_referenced_resources (x, res, inclu
*** 326,338 ****
  	  rtx insn = PREV_INSN (x);
  	  rtx sequence = 0;
  	  int seq_size = 0;
- 	  rtx next = NEXT_INSN (x);
  	  int i;
  
  	  /* If we are part of a delay slot sequence, point at the SEQUENCE.  */
  	  if (NEXT_INSN (insn) != x)
  	    {
- 	      next = NEXT_INSN (NEXT_INSN (insn));
  	      sequence = PATTERN (NEXT_INSN (insn));
  	      seq_size = XVECLEN (sequence, 0);
  	      if (GET_CODE (sequence) != SEQUENCE)
--- 326,336 ----
*************** mark_referenced_resources (x, res, inclu
*** 353,359 ****
  	    if (global_regs[i])
  	      SET_HARD_REG_BIT (res->regs, i);
  
! 	  /* Check for a NOTE_INSN_SETJMP.  If it exists, then we must
  	     assume that this call can need any register.
  
  	     This is done to be more conservative about how we handle setjmp.
--- 351,357 ----
  	    if (global_regs[i])
  	      SET_HARD_REG_BIT (res->regs, i);
  
! 	  /* Check for a REG_SETJMP.  If it exists, then we must
  	     assume that this call can need any register.
  
  	     This is done to be more conservative about how we handle setjmp.
*************** mark_referenced_resources (x, res, inclu
*** 361,368 ****
  	     registers ensures that a register will not be considered dead
  	     just because it crosses a setjmp call.  A register should be
  	     considered dead only if the setjmp call returns non-zero.  */
! 	  if (next && GET_CODE (next) == NOTE
! 	      && NOTE_LINE_NUMBER (next) == NOTE_INSN_SETJMP)
  	    SET_HARD_REG_SET (res->regs);
  
  	  {
--- 359,365 ----
  	     registers ensures that a register will not be considered dead
  	     just because it crosses a setjmp call.  A register should be
  	     considered dead only if the setjmp call returns non-zero.  */
! 	  if (find_reg_note (x, REG_SETJMP, NULL))
  	    SET_HARD_REG_SET (res->regs);
  
  	  {
*************** mark_set_resources (x, res, in_dest, mar
*** 667,674 ****
  
        if (mark_type == MARK_SRC_DEST_CALL)
  	{
- 	  rtx next = NEXT_INSN (x);
- 	  rtx prev = PREV_INSN (x);
  	  rtx link;
  
  	  res->cc = res->memory = 1;
--- 664,669 ----
*************** mark_set_resources (x, res, in_dest, mar
*** 676,696 ****
  	    if (call_used_regs[r] || global_regs[r])
  	      SET_HARD_REG_BIT (res->regs, r);
  
- 	  /* If X is part of a delay slot sequence, then NEXT should be
- 	     the first insn after the sequence.  */
- 	  if (NEXT_INSN (prev) != x)
- 	    next = NEXT_INSN (NEXT_INSN (prev));
- 
  	  for (link = CALL_INSN_FUNCTION_USAGE (x);
  	       link; link = XEXP (link, 1))
  	    if (GET_CODE (XEXP (link, 0)) == CLOBBER)
  	      mark_set_resources (SET_DEST (XEXP (link, 0)), res, 1,
  				  MARK_SRC_DEST);
  
! 	  /* Check for a NOTE_INSN_SETJMP.  If it exists, then we must
  	     assume that this call can clobber any register.  */
! 	  if (next && GET_CODE (next) == NOTE
! 	      && NOTE_LINE_NUMBER (next) == NOTE_INSN_SETJMP)
  	    SET_HARD_REG_SET (res->regs);
  	}
  
--- 671,685 ----
  	    if (call_used_regs[r] || global_regs[r])
  	      SET_HARD_REG_BIT (res->regs, r);
  
  	  for (link = CALL_INSN_FUNCTION_USAGE (x);
  	       link; link = XEXP (link, 1))
  	    if (GET_CODE (XEXP (link, 0)) == CLOBBER)
  	      mark_set_resources (SET_DEST (XEXP (link, 0)), res, 1,
  				  MARK_SRC_DEST);
  
! 	  /* Check for a REG_SETJMP.  If it exists, then we must
  	     assume that this call can clobber any register.  */
! 	  if (find_reg_note (x, REG_SETJMP, NULL))
  	    SET_HARD_REG_SET (res->regs);
  	}
  
*** rtl.c.setjmp	Mon Aug  6 20:49:42 2001
--- rtl.c	Mon Aug  6 20:49:52 2001
*************** const char * const note_insn_name[NOTE_I
*** 263,269 ****
    "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END",
    "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END",
    "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP",
!   "NOTE_INSN_FUNCTION_END", "NOTE_INSN_SETJMP",
    "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG",
    "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG",
    "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END",
--- 263,269 ----
    "NOTE_INSN_BLOCK_BEG", "NOTE_INSN_BLOCK_END",
    "NOTE_INSN_LOOP_BEG", "NOTE_INSN_LOOP_END",
    "NOTE_INSN_LOOP_CONT", "NOTE_INSN_LOOP_VTOP",
!   "NOTE_INSN_FUNCTION_END",
    "NOTE_INSN_PROLOGUE_END", "NOTE_INSN_EPILOGUE_BEG",
    "NOTE_INSN_DELETED_LABEL", "NOTE_INSN_FUNCTION_BEG",
    "NOTE_INSN_EH_REGION_BEG", "NOTE_INSN_EH_REGION_END",
*************** const char * const reg_note_name[] =
*** 281,287 ****
    "REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA", "REG_BR_PRED",
    "REG_FRAME_RELATED_EXPR", "REG_EH_CONTEXT", "REG_EH_REGION",
    "REG_EH_RETHROW", "REG_SAVE_NOTE", "REG_MAYBE_DEAD", "REG_NORETURN",
!   "REG_NON_LOCAL_GOTO"
  };
  
  
--- 281,287 ----
    "REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA", "REG_BR_PRED",
    "REG_FRAME_RELATED_EXPR", "REG_EH_CONTEXT", "REG_EH_REGION",
    "REG_EH_RETHROW", "REG_SAVE_NOTE", "REG_MAYBE_DEAD", "REG_NORETURN",
!   "REG_NON_LOCAL_GOTO", "REG_SETJMP"
  };
  
  
*** rtl.h.setjmp	Mon Aug  6 20:18:49 2001
--- rtl.h	Mon Aug  6 20:56:07 2001
*************** enum reg_note
*** 562,568 ****
  
    /* Indicates that an indirect jump is a non-local goto instead of a 
       computed goto.  */
!   REG_NON_LOCAL_GOTO
  };
  
  /* The base value for branch probability notes.  */
--- 562,572 ----
  
    /* Indicates that an indirect jump is a non-local goto instead of a 
       computed goto.  */
!   REG_NON_LOCAL_GOTO,
! 
!   /* This kind of note is generated at each to `setjmp',
!      and similar functions that can return twice.  */
!   REG_SETJMP
  };
  
  /* The base value for branch probability notes.  */
*************** enum insn_note
*** 659,668 ****
       enabling that optimizer to determine whether control can fall
       off the end of the function body without a return statement.  */
    NOTE_INSN_FUNCTION_END,
- 
-   /* This kind of note is generated just after each call to `setjmp',
-      and similar functions that can return twice.  */
-   NOTE_INSN_SETJMP,
  
    /* This marks the point immediately after the last prologue insn.  */
    NOTE_INSN_PROLOGUE_END,
--- 663,668 ----
*** sched-deps.c.setjmp	Mon Aug  6 20:51:34 2001
--- sched-deps.c	Mon Aug  6 21:17:43 2001
*************** sched_analyze_insn (deps, x, insn, loop_
*** 1017,1029 ****
  
    /* Mark registers CLOBBERED or used by called function.  */
    if (GET_CODE (insn) == CALL_INSN)
!     for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
!       {
! 	if (GET_CODE (XEXP (link, 0)) == CLOBBER)
! 	  sched_analyze_1 (deps, XEXP (link, 0), insn);
! 	else
! 	  sched_analyze_2 (deps, XEXP (link, 0), insn);
!       }
  
    if (GET_CODE (insn) == JUMP_INSN)
      {
--- 1017,1033 ----
  
    /* Mark registers CLOBBERED or used by called function.  */
    if (GET_CODE (insn) == CALL_INSN)
!     {
!       for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1))
! 	{
! 	  if (GET_CODE (XEXP (link, 0)) == CLOBBER)
! 	    sched_analyze_1 (deps, XEXP (link, 0), insn);
! 	  else
! 	    sched_analyze_2 (deps, XEXP (link, 0), insn);
! 	}
!       if (find_reg_note (insn, REG_SETJMP, NULL))
! 	schedule_barrier_found = 1;
!     }
  
    if (GET_CODE (insn) == JUMP_INSN)
      {
*************** sched_analyze_insn (deps, x, insn, loop_
*** 1094,1101 ****
  	  if (INTVAL (XEXP (link, 0)) == NOTE_INSN_LOOP_BEG
  	      || INTVAL (XEXP (link, 0)) == NOTE_INSN_LOOP_END
  	      || INTVAL (XEXP (link, 0)) == NOTE_INSN_EH_REGION_BEG
! 	      || INTVAL (XEXP (link, 0)) == NOTE_INSN_EH_REGION_END
! 	      || INTVAL (XEXP (link, 0)) == NOTE_INSN_SETJMP)
  	    schedule_barrier_found = 1;
  
  	  link = XEXP (link, 1);
--- 1098,1104 ----
  	  if (INTVAL (XEXP (link, 0)) == NOTE_INSN_LOOP_BEG
  	      || INTVAL (XEXP (link, 0)) == NOTE_INSN_LOOP_END
  	      || INTVAL (XEXP (link, 0)) == NOTE_INSN_EH_REGION_BEG
! 	      || INTVAL (XEXP (link, 0)) == NOTE_INSN_EH_REGION_END)
  	    schedule_barrier_found = 1;
  
  	  link = XEXP (link, 1);
*************** sched_analyze (deps, head, tail)
*** 1277,1291 ****
  	     past a void call (i.e. it does not explicitly set the hard
  	     return reg).  */
  
! 	  /* If this call is followed by a NOTE_INSN_SETJMP, then assume that
  	     all registers, not just hard registers, may be clobbered by this
  	     call.  */
  
  	  /* Insn, being a CALL_INSN, magically depends on
  	     `last_function_call' already.  */
  
! 	  if (NEXT_INSN (insn) && GET_CODE (NEXT_INSN (insn)) == NOTE
! 	      && NOTE_LINE_NUMBER (NEXT_INSN (insn)) == NOTE_INSN_SETJMP)
  	    {
  	      for (i = 0; i < deps->max_reg; i++)
  		{
--- 1280,1293 ----
  	     past a void call (i.e. it does not explicitly set the hard
  	     return reg).  */
  
! 	  /* If this call has REG_SETJMP, then assume that
  	     all registers, not just hard registers, may be clobbered by this
  	     call.  */
  
  	  /* Insn, being a CALL_INSN, magically depends on
  	     `last_function_call' already.  */
  
! 	  if (find_reg_note (insn, REG_SETJMP, NULL))
  	    {
  	      for (i = 0; i < deps->max_reg; i++)
  		{
*************** sched_analyze (deps, head, tail)
*** 1301,1316 ****
  		  free_INSN_LIST_list (&reg_last->uses);
  		}
  	      reg_pending_sets_all = 1;
- 
- 	      /* Add a pair of REG_SAVE_NOTEs which we will later
- 		 convert back into a NOTE_INSN_SETJMP note.  See
- 		 reemit_notes for why we use a pair of NOTEs.  */
- 	      REG_NOTES (insn) = alloc_EXPR_LIST (REG_SAVE_NOTE,
- 						  GEN_INT (0),
- 						  REG_NOTES (insn));
- 	      REG_NOTES (insn) = alloc_EXPR_LIST (REG_SAVE_NOTE,
- 						  GEN_INT (NOTE_INSN_SETJMP),
- 						  REG_NOTES (insn));
  	    }
  	  else
  	    {
--- 1303,1308 ----
*************** sched_analyze (deps, head, tail)
*** 1375,1383 ****
  	       && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
  		   || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END
  		   || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
! 		   || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END
! 		   || (NOTE_LINE_NUMBER (insn) == NOTE_INSN_SETJMP
! 		       && GET_CODE (PREV_INSN (insn)) != CALL_INSN)))
  	{
  	  rtx rtx_region;
  
--- 1367,1373 ----
  	       && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
  		   || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_END
  		   || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
! 		   || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END))
  	{
  	  rtx rtx_region;
  
*** sched-ebb.c.setjmp	Mon Aug  6 20:52:42 2001
--- sched-ebb.c	Mon Aug  6 20:52:55 2001
*************** schedule_ebb (head, tail)
*** 236,245 ****
       or after the last real insn of the block.  So if the first insn
       has a REG_SAVE_NOTE which would otherwise be emitted before the
       insn, it is redundant with the note before the start of the
!      block, and so we have to take it out.
! 
!      FIXME: Probably the same thing should be done with REG_SAVE_NOTEs
!      referencing NOTE_INSN_SETJMP at the end of the block.  */
    if (INSN_P (head))
      {
        rtx note;
--- 236,242 ----
       or after the last real insn of the block.  So if the first insn
       has a REG_SAVE_NOTE which would otherwise be emitted before the
       insn, it is redundant with the note before the start of the
!      block, and so we have to take it out.  */
    if (INSN_P (head))
      {
        rtx note;
*************** schedule_ebb (head, tail)
*** 247,260 ****
        for (note = REG_NOTES (head); note; note = XEXP (note, 1))
  	if (REG_NOTE_KIND (note) == REG_SAVE_NOTE)
  	  {
! 	    if (INTVAL (XEXP (note, 0)) != NOTE_INSN_SETJMP)
! 	      {
! 		remove_note (head, note);
! 		note = XEXP (note, 1);
! 		remove_note (head, note);
! 	      }
! 	    else
! 	      note = XEXP (note, 1);
  	  }
      }
  
--- 244,252 ----
        for (note = REG_NOTES (head); note; note = XEXP (note, 1))
  	if (REG_NOTE_KIND (note) == REG_SAVE_NOTE)
  	  {
! 	    remove_note (head, note);
! 	    note = XEXP (note, 1);
! 	    remove_note (head, note);
  	  }
      }
  
*** sched-rgn.c.setjmp	Mon Aug  6 20:53:08 2001
--- sched-rgn.c	Mon Aug  6 20:53:17 2001
*************** schedule_region (rgn)
*** 2809,2818 ****
   	 or after the last real insn of the block.  So if the first insn
  	 has a REG_SAVE_NOTE which would otherwise be emitted before the
  	 insn, it is redundant with the note before the start of the
! 	 block, and so we have to take it out.
! 
! 	 FIXME: Probably the same thing should be done with REG_SAVE_NOTEs
! 	 referencing NOTE_INSN_SETJMP at the end of the block.  */
        if (INSN_P (head))
  	{
  	  rtx note;
--- 2809,2815 ----
   	 or after the last real insn of the block.  So if the first insn
  	 has a REG_SAVE_NOTE which would otherwise be emitted before the
  	 insn, it is redundant with the note before the start of the
! 	 block, and so we have to take it out.  */
        if (INSN_P (head))
  	{
  	  rtx note;
*************** schedule_region (rgn)
*** 2820,2833 ****
  	  for (note = REG_NOTES (head); note; note = XEXP (note, 1))
  	    if (REG_NOTE_KIND (note) == REG_SAVE_NOTE)
  	      {
! 		if (INTVAL (XEXP (note, 0)) != NOTE_INSN_SETJMP)
! 		  {
! 		    remove_note (head, note);
! 		    note = XEXP (note, 1);
! 		    remove_note (head, note);
! 		  }
! 		else
! 		  note = XEXP (note, 1);
  	      }
  	}
  
--- 2817,2825 ----
  	  for (note = REG_NOTES (head); note; note = XEXP (note, 1))
  	    if (REG_NOTE_KIND (note) == REG_SAVE_NOTE)
  	      {
! 		remove_note (head, note);
! 		note = XEXP (note, 1);
! 		remove_note (head, note);
  	      }
  	}
  


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