OSDN Git Service

PR middle-end/16585
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Jan 2005 17:26:33 +0000 (17:26 +0000)
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Jan 2005 17:26:33 +0000 (17:26 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94269 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cfgbuild.c
gcc/function.h
gcc/sched-rgn.c

index a7b83b8..51b273e 100644 (file)
@@ -1,3 +1,13 @@
+2005-01-26  Steven Bosscher  <stevenb@suse.de>
+
+       PR middle-end/16585
+       * 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.
+
 2005-01-26  Richard Henderson  <rth@redhat.com>
 
        PR middle-end/19515
index fdfbcca..7f3e72b 100644 (file)
@@ -227,18 +227,6 @@ make_edges (basic_block min, basic_block max, int update_p)
   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 max, int update_p)
             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 1c32c9f..1284bec 100644 (file)
@@ -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 f4f73f8..d5004e4 100644 (file)
@@ -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