[PATCH 2/2]: Merging meaning of CONVERT_EXPR and NOP_EXPR

Tomas Bily tbily@suse.cz
Wed Jun 11 17:06:00 GMT 2008


Hi,

 this patch replaces all building of CONVERT_EXPRs by building
NOP_EXPRs. Next serie of patches rename NOP_EXPR onto CONVERT_EXPR and
remove NOP_EXPR.

Bootstraped and tested on x86_64-linux, i686-linux, ia64-linux.

Ok ?

Greetings
Tomas

2008-06-10  Tomas Bily  <tbily@suse.cz>

	* convert.c (convert_to_pointer, convert_to_integer): Use NOP_EXPR
	insteed CONVERT_EXPR.
	* matrix-reorg.c (transform_access_sites): Likewise.
	* stmt.c (emit_case_nodes): Likewise.
	* ada/utils.c (convert): Likewise.
	* cp/cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
	* cp/typeck.c (cp_build_unary_op): Likewise.
	* fortran/convert.c (convert): Likewise.
	* java/expr.c (build_jni_stub): Likewise.
	* java/typeck.c (convert): Likewise.

Index: gcc/java/typeck.c
===================================================================
--- gcc/java/typeck.c	(revision 136584)
+++ gcc/java/typeck.c	(working copy)
@@ -123,7 +123,7 @@ convert (tree type, tree expr)
   if (TREE_CODE (TREE_TYPE (expr)) == ERROR_MARK)
     return error_mark_node;
   if (code == VOID_TYPE)
-    return build1 (CONVERT_EXPR, type, expr);
+    return build1 (NOP_EXPR, type, expr);
   if (code == BOOLEAN_TYPE)
     return fold_convert (type, expr);
   if (code == INTEGER_TYPE)
Index: gcc/java/expr.c
===================================================================
--- gcc/java/expr.c	(revision 136584)
+++ gcc/java/expr.c	(working copy)
@@ -2788,7 +2788,7 @@ build_jni_stub (tree method)
 	 it might be promoted.  */
       drt = TREE_TYPE (DECL_RESULT (method));
       if (drt != TREE_TYPE (res_var))
-	res_var = build1 (CONVERT_EXPR, drt, res_var);
+	res_var = build1 (NOP_EXPR, drt, res_var);
       res_var = build2 (MODIFY_EXPR, drt, DECL_RESULT (method), res_var);
       TREE_SIDE_EFFECTS (res_var) = 1;
     }
Index: gcc/cp/typeck.c
===================================================================
--- gcc/cp/typeck.c	(revision 136584)
+++ gcc/cp/typeck.c	(working copy)
@@ -4563,7 +4563,7 @@ cp_build_unary_op (enum tree_code code, 
       if (TREE_CODE (argtype) == REFERENCE_TYPE)
 	{
 	  tree type = build_pointer_type (TREE_TYPE (argtype));
-	  arg = build1 (CONVERT_EXPR, type, arg);
+	  arg = build1 (NOP_EXPR, type, arg);
 	  return arg;
 	}
       else if (pedantic && DECL_MAIN_P (arg))
@@ -4587,7 +4587,7 @@ cp_build_unary_op (enum tree_code code, 
 	  if (TREE_CODE (TREE_TYPE (arg)) == REFERENCE_TYPE)
 	    {
 	      tree type = build_pointer_type (TREE_TYPE (TREE_TYPE (arg)));
-	      arg = build1 (CONVERT_EXPR, type, arg);
+	      arg = build1 (NOP_EXPR, type, arg);
 	    }
 	  else
 	    /* Don't let this be an lvalue.  */
Index: gcc/cp/cvt.c
===================================================================
--- gcc/cp/cvt.c	(revision 136584)
+++ gcc/cp/cvt.c	(working copy)
@@ -221,7 +221,7 @@ cp_convert_to_pointer (tree type, tree e
   if (INTEGRAL_CODE_P (form))
     {
       if (TYPE_PRECISION (intype) == POINTER_SIZE)
-	return build1 (CONVERT_EXPR, type, expr);
+	return build1 (NOP_EXPR, type, expr);
       expr = cp_convert (c_common_type_for_size (POINTER_SIZE, 0), expr);
       /* Modes may be different but sizes should be the same.  There
 	 is supposed to be some integral type that is the same width
@@ -967,7 +969,7 @@ convert_to_void (tree expr, const char *
 		warning (OPT_Wunused_value, "value computed is not used");
 	    }
 	}
-      expr = build1 (CONVERT_EXPR, void_type_node, expr);
+      expr = build1 (NOP_EXPR, void_type_node, expr);
     }
   if (! TREE_SIDE_EFFECTS (expr))
     expr = void_zero_node;
Index: gcc/ada/utils.c
===================================================================
--- gcc/ada/utils.c	(revision 136584)
+++ gcc/ada/utils.c	(working copy)
@@ -3669,7 +3669,7 @@ convert (tree type, tree expr)
   switch (code)
     {
     case VOID_TYPE:
-      return fold_build1 (CONVERT_EXPR, type, expr);
+      return fold_build1 (NOP_EXPR, type, expr);
 
     case BOOLEAN_TYPE:
       return fold_convert (type, gnat_truthvalue_conversion (expr));
Index: gcc/matrix-reorg.c
===================================================================
--- gcc/matrix-reorg.c	(revision 136584)
+++ gcc/matrix-reorg.c	(working copy)
@@ -1761,7 +1761,7 @@ transform_access_sites (void **slot, voi
 
 		    /* Emit convert statement to convert to type of use.  */
 		    conv =
-		      fold_build1 (CONVERT_EXPR,
+		      fold_build1 (NOP_EXPR,
 				   TREE_TYPE (GIMPLE_STMT_OPERAND
 					      (acc_info->stmt, 0)),
 				   TREE_OPERAND (GIMPLE_STMT_OPERAND
Index: gcc/fortran/convert.c
===================================================================
--- gcc/fortran/convert.c	(revision 136584)
+++ gcc/fortran/convert.c	(working copy)
@@ -89,7 +89,7 @@ convert (tree type, tree expr)
       return error_mark_node;
     }
   if (code == VOID_TYPE)
-    return fold_build1 (CONVERT_EXPR, type, e);
+    return fold_build1 (NOP_EXPR, type, e);
 #if 0
   /* This is incorrect.  A truncation can't be stripped this way.
      Extensions will be stripped by the use of get_unwidened.  */
Index: gcc/stmt.c
===================================================================
--- gcc/stmt.c	(revision 136584)
+++ gcc/stmt.c	(working copy)
@@ -3291,8 +3291,8 @@ emit_case_nodes (rtx index, case_node_pt
 	    {
 	      /* Widen LOW and HIGH to the same width as INDEX.  */
 	      tree type = lang_hooks.types.type_for_mode (mode, unsignedp);
-	      tree low = build1 (CONVERT_EXPR, type, node->low);
-	      tree high = build1 (CONVERT_EXPR, type, node->high);
+	      tree low = build1 (NOP_EXPR, type, node->low);
+	      tree high = build1 (NOP_EXPR, type, node->high);
 	      rtx low_rtx, new_index, new_bound;
 
 	      /* Instead of doing two branches, emit one unsigned branch for
Index: gcc/convert.c
===================================================================
--- gcc/convert.c	(revision 136584)
+++ gcc/convert.c	(working copy)
@@ -62,7 +62,7 @@ convert_to_pointer (tree type, tree expr
 	expr = fold_build1 (NOP_EXPR,
                             lang_hooks.types.type_for_size (POINTER_SIZE, 0),
 			    expr);
-      return fold_build1 (CONVERT_EXPR, type, expr);
+      return fold_build1 (NOP_EXPR, type, expr);
 
 
     default:
@@ -453,7 +449,7 @@ convert_to_integer (tree type, tree expr
 
       /* Convert to an unsigned integer of the correct width first,
 	 and from there widen/truncate to the required type.  */
-      expr = fold_build1 (CONVERT_EXPR,
+      expr = fold_build1 (NOP_EXPR,
 			  lang_hooks.types.type_for_size (POINTER_SIZE, 0),
 			  expr);
       return fold_convert (type, expr);
@@ -711,7 +703,7 @@ convert_to_integer (tree type, tree expr
 	  break;
 	}
 
-      return build1 (CONVERT_EXPR, type, expr);
+      return build1 (NOP_EXPR, type, expr);
 
     case REAL_TYPE:
       return build1 (FIX_TRUNC_EXPR, type, expr);



More information about the Gcc-patches mailing list