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] tree-*.c: Replace some TREE_OPERAND with COND_EXPR_*.


Hi,

Attached is a patch to replace some TREE_OPERAND with COND_EXPR_*.

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-11-14  Kazu Hirata  <kazu@cs.umass.edu>

	* tree-cfg.c (verify_expr): Replace TREE_OPERAND with
	COND_EXPR_COND.
	* tree-if-conv.c (tree_if_convert_cond_expr): Likewise.
	* tree-ssa-dom.c (thread_across_edge): Likewise.
	* tree-vectorizer.c (vect_transform_loop_bound): Replace
	TREE_OPERAND with COND_EXPR_COND, COND_EXPR_THEN, or
	COND_EXPR_ELSE.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.108
diff -u -d -p -r2.108 tree-cfg.c
--- tree-cfg.c	14 Nov 2004 04:08:04 -0000	2.108
+++ tree-cfg.c	14 Nov 2004 18:45:43 -0000
@@ -3224,7 +3224,7 @@ verify_expr (tree *tp, int *walk_subtree
       break;
 
     case COND_EXPR:
-      x = TREE_OPERAND (t, 0);
+      x = COND_EXPR_COND (t);
       if (TREE_CODE (TREE_TYPE (x)) != BOOLEAN_TYPE)
 	{
 	  error ("non-boolean used in condition");
Index: tree-if-conv.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-if-conv.c,v
retrieving revision 2.17
diff -u -d -p -r2.17 tree-if-conv.c
--- tree-if-conv.c	14 Nov 2004 04:08:05 -0000	2.17
+++ tree-if-conv.c	14 Nov 2004 18:45:44 -0000
@@ -277,7 +277,7 @@ tree_if_convert_cond_expr (struct loop *
 
   gcc_assert (TREE_CODE (stmt) == COND_EXPR);
 
-  c = TREE_OPERAND (stmt, 0);
+  c = COND_EXPR_COND (stmt);
 
   /* Create temp. for condition.  */
   if (!is_gimple_condexpr (c))
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
retrieving revision 2.66
diff -u -d -p -r2.66 tree-ssa-dom.c
--- tree-ssa-dom.c	10 Nov 2004 17:16:35 -0000	2.66
+++ tree-ssa-dom.c	14 Nov 2004 18:45:47 -0000
@@ -730,9 +730,9 @@ thread_across_edge (struct dom_walk_data
 	    }
 	  else
 	    {
-	      TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), cond_code);
-	      TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 0) = op0;
-	      TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 1) = op1;
+	      TREE_SET_CODE (COND_EXPR_COND (dummy_cond), cond_code);
+	      TREE_OPERAND (COND_EXPR_COND (dummy_cond), 0) = op0;
+	      TREE_OPERAND (COND_EXPR_COND (dummy_cond), 1) = op1;
 	    }
 
 	  /* If the conditional folds to an invariant, then we are done,
@@ -1805,9 +1805,9 @@ simplify_rhs_and_lookup_avail_expr (stru
 	    }
           else
 	    {
-	      TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), GT_EXPR);
-	      TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 0) = op;
-	      TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 1)
+	      TREE_SET_CODE (COND_EXPR_COND (dummy_cond), GT_EXPR);
+	      TREE_OPERAND (COND_EXPR_COND (dummy_cond), 0) = op;
+	      TREE_OPERAND (COND_EXPR_COND (dummy_cond), 1)
 		= integer_zero_node;
 	    }
 	  val = simplify_cond_and_lookup_avail_expr (dummy_cond, NULL, false);
@@ -1857,18 +1857,18 @@ simplify_rhs_and_lookup_avail_expr (stru
 	    }
 	  else
 	    {
-	      TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), LE_EXPR);
-	      TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 0) = op;
-	      TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 1)
+	      TREE_SET_CODE (COND_EXPR_COND (dummy_cond), LE_EXPR);
+	      TREE_OPERAND (COND_EXPR_COND (dummy_cond), 0) = op;
+	      TREE_OPERAND (COND_EXPR_COND (dummy_cond), 1)
 		= build_int_cst (type, 0);
 	    }
 	  val = simplify_cond_and_lookup_avail_expr (dummy_cond, NULL, false);
 
 	  if (!val)
 	    {
-	      TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), GE_EXPR);
-	      TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 0) = op;
-	      TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 1)
+	      TREE_SET_CODE (COND_EXPR_COND (dummy_cond), GE_EXPR);
+	      TREE_OPERAND (COND_EXPR_COND (dummy_cond), 0) = op;
+	      TREE_OPERAND (COND_EXPR_COND (dummy_cond), 1)
 		= build_int_cst (type, 0);
 
 	      val = simplify_cond_and_lookup_avail_expr (dummy_cond,
Index: tree-vectorizer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.c,v
retrieving revision 2.30
diff -u -d -p -r2.30 tree-vectorizer.c
--- tree-vectorizer.c	14 Nov 2004 18:30:36 -0000	2.30
+++ tree-vectorizer.c	14 Nov 2004 18:45:52 -0000
@@ -2860,7 +2860,7 @@ vect_transform_loop_bound (loop_vec_info
   gcc_assert (bsi_stmt (loop_exit_bsi) == orig_cond_expr);
 
   /* new loop exit test:  */
-  lb_type = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (orig_cond_expr, 0), 1));
+  lb_type = TREE_TYPE (TREE_OPERAND (COND_EXPR_COND (orig_cond_expr), 1));
   if (!symbol_niters)
     new_loop_bound = fold_convert (lb_type, 
 				   build_int_cst (unsigned_type_node, 
@@ -2876,7 +2876,8 @@ vect_transform_loop_bound (loop_vec_info
 		   indx_after_incr, new_loop_bound);
 
   cond_stmt = build3 (COND_EXPR, TREE_TYPE (orig_cond_expr), cond,
-	TREE_OPERAND (orig_cond_expr, 1), TREE_OPERAND (orig_cond_expr, 2));
+		      COND_EXPR_THEN (orig_cond_expr),
+		      COND_EXPR_ELSE (orig_cond_expr));
 
   bsi_insert_before (&loop_exit_bsi, cond_stmt, BSI_SAME_STMT);   
 


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