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] fold-const.c: Reorganize fold - Part 13/n


Hi,

Attached is part 13 of my patch to reorganize fold.

Eventually, we want fold_unary to look like

  fold_unary (code, type, op0)

instead of

  fold_unary (unary_expr)

So we should use code, type and op0 instead of t.

Currently, fold_unary uses copy_node to copy t.  The patch replaces
copy_node with build1.

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

Kazu Hirata

2005-03-06  Kazu Hirata  <kazu@cs.umass.edu>

	* fold-const.c (fold_unary): Use build1 instead of copy_node.

Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.531
diff -u -d -p -r1.531 fold-const.c
--- fold-const.c	6 Mar 2005 17:23:03 -0000	1.531
+++ fold-const.c	6 Mar 2005 17:44:55 -0000
@@ -6808,8 +6808,7 @@ fold_unary (tree expr)
 	{
 	  /* Don't leave an assignment inside a conversion
 	     unless assigning a bitfield.  */
-	  tem = copy_node (t);
-	  TREE_OPERAND (tem, 0) = TREE_OPERAND (op0, 1);
+	  tem = build1 (code, type, TREE_OPERAND (op0, 1));
 	  /* First do the assignment, then return converted constant.  */
 	  tem = build2 (COMPOUND_EXPR, TREE_TYPE (tem), op0, fold (tem));
 	  TREE_NO_WARNING (tem) = 1;


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