OSDN Git Service

* lib/target-supports.exp
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-reassoc.c
index 6f19408..477d8c8 100644 (file)
@@ -69,7 +69,7 @@ Boston, MA 02110-1301, USA.  */
 
     In order to promote the most redundancy elimination, you want
     binary expressions whose operands are the same rank (or
-    preferrably, the same value) exposed to the redundancy eliminator,
+    preferably, the same value) exposed to the redundancy eliminator,
     for possible elimination.
 
     So the way to do this if we really cared, is to build the new op
@@ -234,7 +234,6 @@ operand_entry_eq (const void *p1, const void *p2)
   return vr1->op == vr2->op;
 }
 
-
 /* Given an expression E, return the rank of the expression.  */
 
 static unsigned int
@@ -756,10 +755,10 @@ optimize_ops_list (enum tree_code opcode,
          && lang_hooks.types_compatible_p (TREE_TYPE (oelm1->op),
                                            TREE_TYPE (oelast->op)))
        {
-         tree folded = fold_build2 (opcode, TREE_TYPE (oelm1->op),
+         tree folded = fold_binary (opcode, TREE_TYPE (oelm1->op),
                                     oelm1->op, oelast->op);
 
-         if (is_gimple_min_invariant (folded))
+         if (folded && is_gimple_min_invariant (folded))
            {
              if (dump_file && (dump_flags & TDF_DETAILS))
                fprintf (dump_file, "Merging constants\n");
@@ -1033,7 +1032,7 @@ negate_value (tree tonegate, block_stmt_iterator *bsi)
   if (TREE_CODE (tonegate) == SSA_NAME
       && TREE_CODE (negatedef) == MODIFY_EXPR
       && TREE_CODE (TREE_OPERAND (negatedef, 0)) == SSA_NAME
-      && num_imm_uses (TREE_OPERAND (negatedef, 0)) == 1
+      && has_single_use (TREE_OPERAND (negatedef, 0))
       && TREE_CODE (TREE_OPERAND (negatedef, 1)) == PLUS_EXPR)
     {
       block_stmt_iterator bsi;
@@ -1332,7 +1331,7 @@ reassociate_bb (basic_block bb)
 
              /* There may be no immediate uses left by the time we
                 get here because we may have eliminated them all.  */
-             if (TREE_CODE (lhs) == SSA_NAME && num_imm_uses (lhs) == 0)
+             if (TREE_CODE (lhs) == SSA_NAME && has_zero_uses (lhs))
                continue;
 
              TREE_VISITED (stmt) = 1;
@@ -1416,7 +1415,7 @@ init_reassoc (void)
   int i;
   unsigned int rank = 2;
   tree param;
-  int *bbs = xmalloc ((last_basic_block + 1) * sizeof (int));
+  int *bbs = XNEWVEC (int, last_basic_block + 1);
 
   memset (&reassociate_stats, 0, sizeof (reassociate_stats));
 
@@ -1425,8 +1424,8 @@ init_reassoc (void)
 
   /* Reverse RPO (Reverse Post Order) will give us something where
      deeper loops come later.  */
-  flow_depth_first_order_compute (NULL, bbs);
-  bb_rank = xcalloc (last_basic_block + 1, sizeof (unsigned int));
+  pre_and_rev_post_order_compute (NULL, bbs, false);
+  bb_rank = XCNEWVEC (unsigned int, last_basic_block + 1);
   
   operand_rank = htab_create (511, operand_entry_hash,
                              operand_entry_eq, 0);
@@ -1452,7 +1451,7 @@ init_reassoc (void)
     }
 
   /* Set up rank for each BB  */
-  for (i = 0; i < n_basic_blocks; i++)
+  for (i = 0; i < n_basic_blocks - NUM_FIXED_BLOCKS; i++)
     bb_rank[bbs[i]] = ++rank  << 16;
 
   free (bbs);
@@ -1490,7 +1489,7 @@ fini_reassoc (void)
 
 /* Gate and execute functions for Reassociation.  */
 
-static void
+static unsigned int
 execute_reassoc (void)
 {
   init_reassoc ();
@@ -1499,6 +1498,7 @@ execute_reassoc (void)
   repropagate_negates ();
 
   fini_reassoc ();
+  return 0;
 }
 
 struct tree_opt_pass pass_reassoc =