public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 2/2 c/c++/java/ada/fortran/middle-end]: Merging meaning of CONVERT_EXPR and NOP_EXPR v.3
@ 2008-08-28 16:52 Tomas Bily
  0 siblings, 0 replies; only message in thread
From: Tomas Bily @ 2008-08-28 16:52 UTC (permalink / raw)
  To: gcc-patches; +Cc: tbily, tomby

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.

Patch ping http://gcc.gnu.org/ml/gcc-patches/2008-08/msg01535.html.

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

Ok for trunk ?

Greetings
Tomas

Changelog:

	* tree-vect-generic.c (expand_vector_operations_1): Remove useless check.
	* convert.c (convert_to_pointer, convert_to_integer): Use NOP_EXPR
	insteed CONVERT_EXPR.
	* stmt.c (emit_case_nodes): Likewise.
	* tree-ssa-phiopt.c (conditional_replacement): Likewise.
	* fortran/convert.c (convert): Likewise.
	* ada/gcc-interface/utils.c (convert): Likewise.
	* cp/cvt.c (cp_convert_to_pointer, convert_to_void): Likewise.
	* cp/typeck.c (cp_build_unary_op): Likewise.
	* java/expr.c (build_jni_stub): Likewise.
	* java/typeck.c (convert): Likewise.


Index: gcc/java/typeck.c
===================================================================
--- gcc/java/typeck.c	(revision 139591)
+++ 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 139591)
+++ gcc/java/expr.c	(working copy)
@@ -2800,7 +2800,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 139591)
+++ gcc/cp/typeck.c	(working copy)
@@ -4381,7 +4381,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 (DECL_MAIN_P (arg))
@@ -4405,7 +4405,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 139591)
+++ 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
@@ -985,7 +987,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/gcc-interface/utils.c
===================================================================
--- gcc/ada/gcc-interface/utils.c	(revision 139591)
+++ gcc/ada/gcc-interface/utils.c	(working copy)
@@ -4259,7 +4259,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 INTEGER_TYPE:
       if (TYPE_HAS_ACTUAL_BOUNDS_P (type)
Index: gcc/fortran/convert.c
===================================================================
--- gcc/fortran/convert.c	(revision 139591)
+++ 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/tree-ssa-phiopt.c
===================================================================
--- gcc/tree-ssa-phiopt.c	(revision 139591)
+++ gcc/tree-ssa-phiopt.c	(working copy)
@@ -515,7 +515,7 @@ conditional_replacement (basic_block con
     {
       new_var2 = create_tmp_var (TREE_TYPE (result), NULL);
       add_referenced_var (new_var2);
-      new_stmt = gimple_build_assign_with_ops (CONVERT_EXPR, new_var2,
+      new_stmt = gimple_build_assign_with_ops (NOP_EXPR, new_var2,
 					       new_var, NULL);
       new_var2 = make_ssa_name (new_var2, new_stmt);
       gimple_assign_set_lhs (new_stmt, new_var2);
Index: gcc/tree-vect-generic.c
===================================================================
--- gcc/tree-vect-generic.c	(revision 139591)
+++ gcc/tree-vect-generic.c	(working copy)
@@ -422,8 +422,6 @@ expand_vector_operations_1 (gimple_stmt_
       || code == VIEW_CONVERT_EXPR)
     return;
   
-  gcc_assert (code != CONVERT_EXPR);
-
   /* The signedness is determined from input argument.  */
   if (code == VEC_UNPACK_FLOAT_HI_EXPR
       || code == VEC_UNPACK_FLOAT_LO_EXPR)
Index: gcc/stmt.c
===================================================================
--- gcc/stmt.c	(revision 139591)
+++ gcc/stmt.c	(working copy)
@@ -3249,8 +3249,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 139591)
+++ 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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-08-27 16:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-28 16:52 [PATCH 2/2 c/c++/java/ada/fortran/middle-end]: Merging meaning of CONVERT_EXPR and NOP_EXPR v.3 Tomas Bily

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).