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]
Other format: [Raw text]

Remove NOTE_INSN_FUNCTION_END


Hi,
this patch removes NOTE_INSN_FUNCTION_END and surrounding updating
infrastructure as it is never used for anyting.
I am keeping NOTE_INSN_FUNCTION_BEG as it is used to emit hints about
end of function prologue.  I will check if I can encode this more
reliably in locators.

Bootstrapped/regtested i686-linux, OK?
:ADDPATCH RTL:

Honza

	* cfgexpand.c (construct_exit_block): Don't disturb end of last BB.
	* rtl.texi (NOTE_INSN_FUNCTION_END): Remove.
	* final.c (final_scan_insn): Don't scan NOTE_INSN_FUNCTION_END.
	* insn-notes.def (FUNCTION_END): Remove.
	* jump.c (delete_related_insns): Don't worry about FUNCTION_END.
	(redicect_jump_2): Don't accept -1 parameter to remove FUNCTION_END
	note.
	* ifcvt.c (dead_or_predictable): Update call of redirect_jump_2.
	* function.c (expand_function_end): Don't emit NOTE_INSN_FUNCTION_END
	* cfglayout.c (duplicate_insn_chain): Don't worry about
	NOTE_FUNCTION_END.
Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 118584)
+++ cfgexpand.c	(working copy)
@@ -1465,6 +1467,7 @@ construct_exit_block (void)
   edge e, e2;
   unsigned ix;
   edge_iterator ei;
+  rtx orig_end = BB_END (EXIT_BLOCK_PTR->prev_bb);
 
   /* Make sure the locus is set to the end of the function, so that
      epilogue line numbers and warnings are set properly.  */
@@ -1484,6 +1487,9 @@ construct_exit_block (void)
   end = get_last_insn ();
   if (head == end)
     return;
+  /* While emitting the function end we could move end of the last basic block.
+   */
+  BB_END (EXIT_BLOCK_PTR->prev_bb) = orig_end;
   while (NEXT_INSN (head) && NOTE_P (NEXT_INSN (head)))
     head = NEXT_INSN (head);
   exit_block = create_basic_block (NEXT_INSN (head), end,
Index: doc/rtl.texi
===================================================================
--- doc/rtl.texi	(revision 118618)
+++ doc/rtl.texi	(working copy)
@@ -3178,13 +3178,6 @@ invariants.
 Appears at the start of the function body, after the function
 prologue.
 
-@findex NOTE_INSN_FUNCTION_END
-@item NOTE_INSN_FUNCTION_END
-Appears near the end of the function body, just before the label that
-@code{return} statements jump to (on machine where a single instruction
-does not suffice for returning).  This note may be deleted by jump
-optimization.
-
 @end table
 
 These codes are printed symbolically when they appear in debugging dumps.
Index: final.c
===================================================================
--- final.c	(revision 118618)
+++ final.c	(working copy)
@@ -1697,7 +1697,6 @@ final_scan_insn (rtx insn, FILE *file, i
       switch (NOTE_LINE_NUMBER (insn))
 	{
 	case NOTE_INSN_DELETED:
-	case NOTE_INSN_FUNCTION_END:
 	case NOTE_INSN_REPEATED_LINE_NUMBER:
 	case NOTE_INSN_EXPECTED_VALUE:
 	  break;
Index: insn-notes.def
===================================================================
--- insn-notes.def	(revision 118618)
+++ insn-notes.def	(working copy)
@@ -52,13 +52,6 @@ INSN_NOTE (LOOP_END)
    their homes, etc.  */
 INSN_NOTE (FUNCTION_BEG)
 
-/* This kind of note is generated at the end of the function body,
-   just before the return insn or return label.  In an optimizing
-   compilation it is deleted by the first jump optimization, after
-   enabling that optimizer to determine whether control can fall
-   off the end of the function body without a return statement.  */
-INSN_NOTE (FUNCTION_END)
-
 /* This marks the point immediately after the last prologue insn.  */
 INSN_NOTE (PROLOGUE_END)
 
Index: jump.c
===================================================================
--- jump.c	(revision 118618)
+++ jump.c	(working copy)
@@ -1498,8 +1498,7 @@ delete_related_insns (rtx insn)
       while (next)
 	{
 	  code = GET_CODE (next);
-	  if (code == NOTE
-	      && NOTE_LINE_NUMBER (next) != NOTE_INSN_FUNCTION_END)
+	  if (code == NOTE)
 	    next = NEXT_INSN (next);
 	  /* Keep going past other deleted labels to delete what follows.  */
 	  else if (code == CODE_LABEL && INSN_DELETED_P (next))
@@ -1662,8 +1661,7 @@ redirect_jump (rtx jump, rtx nlabel, int
 }
 
 /* Fix up JUMP_LABEL and label ref counts after OLABEL has been replaced with
-   NLABEL in JUMP.  If DELETE_UNUSED is non-negative, copy a
-   NOTE_INSN_FUNCTION_END found after OLABEL to the place after NLABEL.
+   NLABEL in JUMP.  
    If DELETE_UNUSED is positive, delete related insn to OLABEL if its ref
    count has dropped to zero.  */
 void
@@ -1672,6 +1670,10 @@ redirect_jump_2 (rtx jump, rtx olabel, r
 {
   rtx note;
 
+  /* negative DELETE_UNUSED used to be used to signalize behaviour on
+     moving FUNCTION_END note.  Just sanity check that no user still worry
+     about this.  */
+  gcc_assert (delete_unused >= 0);
   JUMP_LABEL (jump) = nlabel;
   if (nlabel)
     ++LABEL_NUSES (nlabel);
@@ -1688,15 +1690,6 @@ redirect_jump_2 (rtx jump, rtx olabel, r
 	}
     }
 
-  /* If we're eliding the jump over exception cleanups at the end of a
-     function, move the function end note so that -Wreturn-type works.  */
-  if (olabel && nlabel
-      && NEXT_INSN (olabel)
-      && NOTE_P (NEXT_INSN (olabel))
-      && NOTE_LINE_NUMBER (NEXT_INSN (olabel)) == NOTE_INSN_FUNCTION_END
-      && delete_unused >= 0)
-    emit_note_after (NOTE_INSN_FUNCTION_END, nlabel);
-
   if (olabel && --LABEL_NUSES (olabel) == 0 && delete_unused > 0
       /* Undefined labels will remain outside the insn stream.  */
       && INSN_UID (olabel))
Index: ifcvt.c
===================================================================
--- ifcvt.c	(revision 118618)
+++ ifcvt.c	(working copy)
@@ -3771,7 +3771,7 @@ dead_or_predicable (basic_block test_bb,
 
   if (other_bb != new_dest)
     {
-      redirect_jump_2 (jump, old_dest, new_label, -1, reversep);
+      redirect_jump_2 (jump, old_dest, new_label, 0, reversep);
 
       redirect_edge_succ (BRANCH_EDGE (test_bb), new_dest);
       if (reversep)
Index: function.c
===================================================================
--- function.c	(revision 118618)
+++ function.c	(working copy)
@@ -4335,11 +4335,6 @@ expand_function_end (void)
   clear_pending_stack_adjust ();
   do_pending_stack_adjust ();
 
-  /* Mark the end of the function body.
-     If control reaches this insn, the function can drop through
-     without returning a value.  */
-  emit_note (NOTE_INSN_FUNCTION_END);
-
   /* Must mark the last line number note in the function, so that the test
      coverage code can avoid counting the last line twice.  This just tells
      the code to ignore the immediately following line note, since there
@@ -5359,7 +5354,7 @@ epilogue_done:
 
       /* Similarly, move any line notes that appear after the epilogue.
          There is no need, however, to be quite so anal about the existence
-	 of such a note.  Also move the NOTE_INSN_FUNCTION_END and (possibly)
+	 of such a note.  Also possibly move
 	 NOTE_INSN_FUNCTION_BEG notes, as those can be relevant for debug
 	 info generation.  */
       for (insn = epilogue_end; insn; insn = next)
@@ -5367,8 +5362,7 @@ epilogue_done:
 	  next = NEXT_INSN (insn);
 	  if (NOTE_P (insn) 
 	      && (NOTE_LINE_NUMBER (insn) > 0
-		  || NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG
-		  || NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_END))
+		  || NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG))
 	    reorder_insns (insn, insn, PREV_INSN (epilogue_end));
 	}
     }
Index: cfglayout.c
===================================================================
--- cfglayout.c	(revision 118618)
+++ cfglayout.c	(working copy)
@@ -986,7 +987,6 @@ duplicate_insn_chain (rtx from, rtx to)
 	    case NOTE_INSN_DELETED_LABEL:
 	      /* No problem to strip these.  */
 	    case NOTE_INSN_EPILOGUE_BEG:
-	    case NOTE_INSN_FUNCTION_END:
 	      /* Debug code expect these notes to exist just once.
 		 Keep them in the master copy.
 		 ??? It probably makes more sense to duplicate them for each


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