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]

folding rtxen as trees...



The history of this patch is a little interesting.  A customer
reported that a bugfix they received against an old toolchain wasn't
present in the new toolchain.  Investigation revealed that a patch
(which does the same as this one) was missing.  Unfortunately, their
testcase isn't readily available, so I'm not sure what precisely is
going wrong; the trees for which first_rtl_op and TREE_CODE_LENGTH
differ that can get here are GOTO_SUBROUTINE_EXPR, WITH_CLEANUP_EXPR,
and METHOD_CALL_EXPR, none of which am I really sure how they can get
into fold().  I'd be interested in anyone's ideas on how to generate a
testcase.

Oh, and there's a parenthesisation fix.

Boostrapped & tested on powerpc-linux.

-- 
- Geoffrey Keating <geoffk@geoffk.org>

===File ~/patches/cygnus/nortel-foldrtlop.patch=============
2001-04-19  Geoff Keating  <geoffk@redhat.com>

	* fold-const.c (fold): Use first_rtl_op rather than
	TREE_CODE_LENGTH when looping over parameters of a tree.
	Correct strange grouping in test for evaluated SAVE_EXPR.

Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.154
diff -p -u -u -p -r1.154 fold-const.c
--- fold-const.c	2001/04/02 08:08:20	1.154
+++ fold-const.c	2001/04/20 01:21:50
@@ -4864,7 +4864,7 @@ fold (expr)
 
   /* Don't try to process an RTL_EXPR since its operands aren't trees.
      Likewise for a SAVE_EXPR that's already been evaluated.  */
-  if (code == RTL_EXPR || (code == SAVE_EXPR && SAVE_EXPR_RTL (t)) != 0)
+  if (code == RTL_EXPR || (code == SAVE_EXPR && SAVE_EXPR_RTL (t) != 0))
     return t;
 
   /* Return right away if a constant.  */
@@ -4903,7 +4903,7 @@ fold (expr)
     }
   else if (IS_EXPR_CODE_CLASS (kind) || kind == 'r')
     {
-      register int len = TREE_CODE_LENGTH (code);
+      register int len = first_rtl_op (code);
       register int i;
       for (i = 0; i < len; i++)
 	{
============================================================


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