OSDN Git Service

2005-05-06 Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua>
[pf3gnuchains/gcc-fork.git] / gcc / tree-ssa-propagate.c
index a4c764a..9f9fef1 100644 (file)
@@ -143,7 +143,7 @@ static sbitmap bb_in_list;
    definition has changed.  SSA edges are def-use edges in the SSA
    web.  For each D-U edge, we store the target statement or PHI node
    U.  */
-static GTY(()) VEC(tree) *interesting_ssa_edges;
+static GTY(()) VEC(tree,gc) *interesting_ssa_edges;
 
 /* Identical to INTERESTING_SSA_EDGES.  For performance reasons, the
    list of SSA edges is split into two.  One contains all SSA edges
@@ -159,7 +159,7 @@ static GTY(()) VEC(tree) *interesting_ssa_edges;
    don't use a separate worklist for VARYING edges, we end up with
    situations where lattice values move from
    UNDEFINED->INTERESTING->VARYING instead of UNDEFINED->VARYING.  */
-static GTY(()) VEC(tree) *varying_ssa_edges;
+static GTY(()) VEC(tree,gc) *varying_ssa_edges;
 
 
 /* Return true if the block worklist empty.  */
@@ -244,9 +244,9 @@ add_ssa_edge (tree var, bool is_varying)
        {
          STMT_IN_SSA_EDGE_WORKLIST (use_stmt) = 1;
          if (is_varying)
-           VEC_safe_push (tree, varying_ssa_edges, use_stmt);
+           VEC_safe_push (tree, gc, varying_ssa_edges, use_stmt);
          else
-           VEC_safe_push (tree, interesting_ssa_edges, use_stmt);
+           VEC_safe_push (tree, gc, interesting_ssa_edges, use_stmt);
        }
     }
 }
@@ -342,7 +342,7 @@ simulate_stmt (tree stmt)
    SSA edge is added to it in simulate_stmt.  */
 
 static void
-process_ssa_edge_worklist (VEC(tree) **worklist)
+process_ssa_edge_worklist (VEC(tree,gc) **worklist)
 {
   /* Drain the entire worklist.  */
   while (VEC_length (tree, *worklist) > 0)
@@ -462,8 +462,8 @@ ssa_prop_init (void)
   size_t i;
 
   /* Worklists of SSA edges.  */
-  interesting_ssa_edges = VEC_alloc (tree, 20);
-  varying_ssa_edges = VEC_alloc (tree, 20);
+  interesting_ssa_edges = VEC_alloc (tree, gc, 20);
+  varying_ssa_edges = VEC_alloc (tree, gc, 20);
 
   executable_blocks = sbitmap_alloc (last_basic_block);
   sbitmap_zero (executable_blocks);
@@ -506,8 +506,8 @@ ssa_prop_init (void)
 static void
 ssa_prop_fini (void)
 {
-  VEC_free (tree, interesting_ssa_edges);
-  VEC_free (tree, varying_ssa_edges);
+  VEC_free (tree, gc, interesting_ssa_edges);
+  VEC_free (tree, gc, varying_ssa_edges);
   cfg_blocks = NULL;
   sbitmap_free (bb_in_list);
   sbitmap_free (executable_blocks);
@@ -678,12 +678,14 @@ ssa_propagate (ssa_prop_visit_stmt_fn visit_stmt,
 tree
 first_vdef (tree stmt)
 {
-  if (NUM_V_MAY_DEFS (STMT_V_MAY_DEF_OPS (stmt)) > 0)
-    return V_MAY_DEF_RESULT (STMT_V_MAY_DEF_OPS (stmt), 0);
-  else if (NUM_V_MUST_DEFS (STMT_V_MUST_DEF_OPS (stmt)) > 0)
-    return V_MUST_DEF_RESULT (STMT_V_MUST_DEF_OPS (stmt), 0);
-  else
-    gcc_unreachable ();
+  ssa_op_iter iter;
+  tree op;
+
+  /* Simply return the first operand we arrive at.  */
+  FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_VIRTUAL_DEFS)
+    return (op);
+
+  gcc_unreachable ();
 }
 
 
@@ -700,8 +702,7 @@ stmt_makes_single_load (tree stmt)
   if (TREE_CODE (stmt) != MODIFY_EXPR)
     return false;
 
-  if (NUM_V_MAY_DEFS (STMT_V_MAY_DEF_OPS (stmt)) == 0
-      && NUM_VUSES (STMT_VUSE_OPS (stmt)) == 0)
+  if (ZERO_SSA_OPERANDS (stmt, SSA_OP_VMAYDEF|SSA_OP_VUSE))
     return false;
 
   rhs = TREE_OPERAND (stmt, 1);
@@ -709,7 +710,7 @@ stmt_makes_single_load (tree stmt)
 
   return (!TREE_THIS_VOLATILE (rhs)
          && (DECL_P (rhs)
-             || TREE_CODE_CLASS (TREE_CODE (rhs)) == tcc_reference));
+             || REFERENCE_CLASS_P (rhs)));
 }
 
 
@@ -726,8 +727,7 @@ stmt_makes_single_store (tree stmt)
   if (TREE_CODE (stmt) != MODIFY_EXPR)
     return false;
 
-  if (NUM_V_MAY_DEFS (STMT_V_MAY_DEF_OPS (stmt)) == 0
-      && NUM_V_MUST_DEFS (STMT_V_MUST_DEF_OPS (stmt)) == 0)
+  if (ZERO_SSA_OPERANDS (stmt, SSA_OP_VMAYDEF|SSA_OP_VMUSTDEF))
     return false;
 
   lhs = TREE_OPERAND (stmt, 0);
@@ -735,7 +735,7 @@ stmt_makes_single_store (tree stmt)
 
   return (!TREE_THIS_VOLATILE (lhs)
           && (DECL_P (lhs)
-             || TREE_CODE_CLASS (TREE_CODE (lhs)) == tcc_reference));
+             || REFERENCE_CLASS_P (lhs)));
 }
 
 
@@ -1032,8 +1032,6 @@ substitute_and_fold (prop_value_t *prop_value)
           bool replaced_address, did_replace;
          tree stmt = bsi_stmt (i);
 
-         get_stmt_operands (stmt);
-
          /* Replace the statement with its folded version and mark it
             folded.  */
          if (dump_file && (dump_flags & TDF_DETAILS))