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]

[patch] PR16585 - remove current_function_has_computed_jump


Hi,

The flag current_function_has_computed_jump is incorrectly cleared
and updated in make_edges, but there really is no reason to have the
flag in the first place.  The attached patch removes it.

Bootstrapped on x86_64-suse-linux-gnu.  Bootstrap ongoing on ia64
and ppc, to make sure the sched-rgn.c changes are good.

OK for mainline?

Gr.
Steven

	* cfgbuild.c (make_edges): Do not clear or set
	current_function_has_computed_jump.
	* function.h (struct function): Remove the has_computed_jump field.
	(current_function_has_computed_jump): Do not define.
	* sched-rgn.c (is_cfg_nonregular): Return true if a basic block ends
	in a computed jump.  Ignore current_function_has_computed_jump.

Index: cfgbuild.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgbuild.c,v
retrieving revision 1.59
diff -u -3 -p -r1.59 cfgbuild.c
--- cfgbuild.c	18 Jan 2005 11:36:00 -0000	1.59
+++ cfgbuild.c	26 Jan 2005 14:57:10 -0000
@@ -227,18 +227,6 @@ make_edges (basic_block min, basic_block
   basic_block bb;
   sbitmap *edge_cache = NULL;
 
-  /* Assume no computed jump; revise as we create edges.  */
-  current_function_has_computed_jump = 0;
-
-  /* If we are partitioning hot and cold basic blocks into separate
-     sections, we cannot assume there is no computed jump (partitioning
-     sometimes requires the use of indirect jumps; see comments about
-     partitioning at the top of bb-reorder.c:partition_hot_cold_basic_blocks 
-     for complete details).  */
-
-  if (flag_reorder_blocks_and_partition)
-    current_function_has_computed_jump = 1;
-
   /* Heavy use of computed goto in machine-generated code can lead to
      nearly fully-connected CFGs.  In that case we spend a significant
      amount of time searching the edge lists for duplicates.  */
@@ -325,8 +313,6 @@ make_edges (basic_block min, basic_block
 	     everything on the forced_labels list.  */
 	  else if (computed_jump_p (insn))
 	    {
-	      current_function_has_computed_jump = 1;
-
 	      for (x = forced_labels; x; x = XEXP (x, 1))
 		make_label_edge (edge_cache, bb, XEXP (x, 0), EDGE_ABNORMAL);
 	    }
Index: function.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.h,v
retrieving revision 1.137
diff -u -3 -p -r1.137 function.h
--- function.h	23 Nov 2004 19:55:15 -0000	1.137
+++ function.h	26 Jan 2005 14:57:10 -0000
@@ -375,9 +375,6 @@ struct function GTY(())
   /* Nonzero if function being compiled contains nested functions.  */
   unsigned int contains_functions : 1;
 
-  /* Nonzero if the function being compiled issues a computed jump.  */
-  unsigned int has_computed_jump : 1;
-
   /* Nonzero if the current function is a thunk, i.e., a lightweight
      function implemented by the output_mi_thunk hook) that just
      adjusts one of its arguments and forwards to another
@@ -447,7 +444,6 @@ extern int trampolines_created;
 #define current_function_calls_setjmp (cfun->calls_setjmp)
 #define current_function_calls_alloca (cfun->calls_alloca)
 #define current_function_calls_eh_return (cfun->calls_eh_return)
-#define current_function_has_computed_jump (cfun->has_computed_jump)
 #define current_function_contains_functions (cfun->contains_functions)
 #define current_function_is_thunk (cfun->is_thunk)
 #define current_function_args_info (cfun->args_info)
Index: sched-rgn.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-rgn.c,v
retrieving revision 1.91
diff -u -3 -p -r1.91 sched-rgn.c
--- sched-rgn.c	18 Jan 2005 11:36:20 -0000	1.91
+++ sched-rgn.c	26 Jan 2005 14:57:10 -0000
@@ -291,7 +291,6 @@ is_cfg_nonregular (void)
 {
   basic_block b;
   rtx insn;
-  RTX_CODE code;
 
   /* If we have a label that could be the target of a nonlocal goto, then
      the cfg is not well structured.  */
@@ -302,11 +301,6 @@ is_cfg_nonregular (void)
   if (forced_labels)
     return 1;
 
-  /* If this function has a computed jump, then we consider the cfg
-     not well structured.  */
-  if (current_function_has_computed_jump)
-    return 1;
-
   /* If we have exception handlers, then we consider the cfg not well
      structured.  ?!?  We should be able to handle this now that flow.c
      computes an accurate cfg for EH.  */
@@ -315,24 +309,23 @@ is_cfg_nonregular (void)
 
   /* If we have non-jumping insns which refer to labels, then we consider
      the cfg not well structured.  */
-  /* Check for labels referred to other thn by jumps.  */
   FOR_EACH_BB (b)
-    for (insn = BB_HEAD (b); ; insn = NEXT_INSN (insn))
+    FOR_BB_INSNS (b, insn)
       {
-	code = GET_CODE (insn);
-	if (INSN_P (insn) && code != JUMP_INSN)
+	/* Check for labels referred by non-jump insns.  */
+	if (NONJUMP_INSN_P (insn) || CALL_P (insn))
 	  {
 	    rtx note = find_reg_note (insn, REG_LABEL, NULL_RTX);
-
 	    if (note
 		&& ! (JUMP_P (NEXT_INSN (insn))
 		      && find_reg_note (NEXT_INSN (insn), REG_LABEL,
 					XEXP (note, 0))))
 	      return 1;
 	  }
-
-	if (insn == BB_END (b))
-	  break;
+	/* If this function has a computed jump, then we consider the cfg
+	   not well structured.  */
+	else if (JUMP_P (insn) && computed_jump_p (insn))
+	  return 1;
       }
 
   /* Unreachable loops with more than one basic block are detected


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