OSDN Git Service

* ltconfig (osf[345]): Append $major to soname_spec.
[pf3gnuchains/gcc-fork.git] / gcc / ifcvt.c
index 3ce996f..42c5fb5 100644 (file)
@@ -224,7 +224,7 @@ block_fallthru (bb)
 
 static int
 cond_exec_process_insns (ce_info, start, end, test, prob_val, mod_ok)
-     ce_if_block_t *ce_info  /* if block information */
+     ce_if_block_t *ce_info ATTRIBUTE_UNUSED;  /* if block information */
      rtx start;                        /* first insn to look at */
      rtx end;                  /* last insn to look at */
      rtx test;                 /* conditional execution test */
@@ -343,7 +343,7 @@ cond_exec_get_condition (jump)
 
 /* Given a simple IF-THEN or IF-THEN-ELSE block, attempt to convert it
    to conditional execution.  Return TRUE if we were successful at
-   converting the the block.  */
+   converting the block.  */
 
 static int
 cond_exec_process_if_block (ce_info, do_multiple_p)
@@ -358,7 +358,7 @@ cond_exec_process_if_block (ce_info, do_multiple_p)
   rtx then_end;                        /* last insn + 1 in THEN block */
   rtx else_start = NULL_RTX;   /* first insn in ELSE block or NULL */
   rtx else_end = NULL_RTX;     /* last insn + 1 in ELSE block */
-  int max;                     /* max # of insns to convert. */
+  int max;                     /* max # of insns to convert.  */
   int then_mod_ok;             /* whether conditional mods are ok in THEN */
   rtx true_expr;               /* test for else block insns */
   rtx false_expr;              /* test for then block insns */
@@ -1368,7 +1368,7 @@ noce_get_alt_condition (if_info, target, earliest)
 
   /* X may not be mentioned in the range (cond_earliest, jump].  */
   for (insn = if_info->jump; insn != *earliest; insn = PREV_INSN (insn))
-    if (INSN_P (insn) && reg_mentioned_p (if_info->x, insn))
+    if (INSN_P (insn) && reg_overlap_mentioned_p (if_info->x, PATTERN (insn)))
       return NULL;
 
   /* A and B may not be modified in the range [cond_earliest, jump).  */
@@ -1687,7 +1687,7 @@ noce_operand_ok (op)
 
 /* Given a simple IF-THEN or IF-THEN-ELSE block, attempt to convert it
    without using conditional execution.  Return TRUE if we were
-   successful at converting the the block.  */
+   successful at converting the block.  */
 
 static int
 noce_process_if_block (ce_info)
@@ -1700,7 +1700,7 @@ noce_process_if_block (ce_info)
   rtx insn_a, insn_b;
   rtx set_a, set_b;
   rtx orig_x, x, a, b;
-  rtx jump, cond, insn;
+  rtx jump, cond;
 
   /* We're looking for patterns of the form
 
@@ -1774,24 +1774,14 @@ noce_process_if_block (ce_info)
          || GET_CODE (insn_b) != INSN
          || (set_b = single_set (insn_b)) == NULL_RTX
          || ! rtx_equal_p (x, SET_DEST (set_b))
-         || reg_mentioned_p (x, cond)
-         || reg_mentioned_p (x, a)
-         || reg_mentioned_p (x, SET_SRC (set_b)))
+         || reg_overlap_mentioned_p (x, cond)
+         || reg_overlap_mentioned_p (x, a)
+         || reg_overlap_mentioned_p (x, SET_SRC (set_b))
+         || modified_between_p (x, if_info.cond_earliest, NEXT_INSN (jump)))
        insn_b = set_b = NULL_RTX;
     }
   b = (set_b ? SET_SRC (set_b) : x);
 
-  /* X may not be mentioned in the range (cond_earliest, jump].  */
-  for (insn = jump; insn != if_info.cond_earliest; insn = PREV_INSN (insn))
-    if (INSN_P (insn) && reg_mentioned_p (x, insn))
-      return FALSE;
-
-  /* A and B may not be modified in the range [cond_earliest, jump).  */
-  for (insn = if_info.cond_earliest; insn != jump; insn = NEXT_INSN (insn))
-    if (INSN_P (insn)
-       && (modified_in_p (a, insn) || modified_in_p (b, insn)))
-      return FALSE;
-
   /* Only operate on register destinations, and even then avoid extending
      the lifetime of hard registers on small register class machines.  */
   orig_x = x;
@@ -1837,7 +1827,7 @@ noce_process_if_block (ce_info)
 
          if (else_bb && insn_b == else_bb->end)
            else_bb->end = PREV_INSN (insn_b);
-         reorder_insns (insn_b, insn_b, PREV_INSN (if_info.cond_earliest));
+         reorder_insns (insn_b, insn_b, PREV_INSN (jump));
 
          /* If there was a REG_EQUAL note, delete it since it may have been
             true due to this insn being after a jump.  */
@@ -1892,9 +1882,9 @@ noce_process_if_block (ce_info)
   if (insn_b && else_bb)
     delete_insn (insn_b);
 
-  /* The new insns will have been inserted before cond_earliest.  We should
-     be able to remove the jump with impunity, but the condition itself may
-     have been modified by gcse to be shared across basic blocks.  */
+  /* The new insns will have been inserted immediately before the jump.  We
+     should be able to remove the jump with impunity, but the condition itself
+     may have been modified by gcse to be shared across basic blocks.  */
   delete_insn (jump);
 
   /* If we used a temporary, fix it up now.  */
@@ -2228,7 +2218,7 @@ block_jumps_and_fallthru_p (cur_bb, target_bb)
 
 /* Determine if a given basic block heads a simple IF-THEN or IF-THEN-ELSE
    block.  If so, we'll try to convert the insns to not require the branch.
-   Return TRUE if we were successful at converting the the block.  */
+   Return TRUE if we were successful at converting the block.  */
 
 static int
 find_if_block (ce_info)
@@ -2578,7 +2568,7 @@ block_has_only_trap (bb)
    transformable, but not necessarily the other.  There need be no
    JOIN block.
 
-   Return TRUE if we were successful at converting the the block.
+   Return TRUE if we were successful at converting the block.
 
    Cases we'd like to look at:
 
@@ -2767,7 +2757,7 @@ find_if_case_2 (test_bb, then_edge, else_edge)
             test_bb->index, else_bb->index);
 
   /* ELSE is small.  */
-  if (count_bb_insns (then_bb) > BRANCH_COST)
+  if (count_bb_insns (else_bb) > BRANCH_COST)
     return FALSE;
 
   /* Registers set are dead, or are predicable.  */
@@ -3113,8 +3103,8 @@ if_convert (x_life_data_ok)
 
       FOR_EACH_BB (bb)
        {
-         basic_block new_bb = find_if_header (bb, pass);
-         if (new_bb)
+         basic_block new_bb;
+         while ((new_bb = find_if_header (bb, pass)))
            bb = new_bb;
        }