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] For the time being avoid some machine dependent fold optimizations if flag_syntax_only


Hi!

Andrew asked me to post this patch.
Although the result of the discussion about target independent folding
was in my understanding that we need to separate target independent folder
from target dependent one, this certainly won't happen in time for GCC 4.0.
This patch makes sure that gcj -C generates identical class files no matter
what target it was configured for.  Furthermore, the generated bytecode is
better or at least as good as before - e.g. the LOAD_EXTEND_OP if causes
extra unneeded bytecode to be generated.
Bootstrapped/regtested on {i386,x86_64,ia64,ppc,ppc64,s390,s390x}-redhat-linux,
no regressions.
Ok?

2004-12-14  Jakub Jelinek  <jakub@redhat.com>

	* fold-const.c (fold_single_bit_test): If flag_syntax_only, pretend
	LOAD_EXTEND_OP is not defined.
	(fold): Likewise.  If flag_syntax_only, don't depend on BITS_PER_WORD.

--- gcc/fold-const.c.jj	2004-08-14 12:17:15.000000000 +0200
+++ gcc/fold-const.c	2004-08-14 13:00:37.814514205 +0200
@@ -5876,7 +5876,8 @@ fold_single_bit_test (enum tree_code cod
 	 operations as unsigned.  If we must use the AND, we have a choice.
 	 Normally unsigned is faster, but for some machines signed is.  */
 #ifdef LOAD_EXTEND_OP
-      ops_unsigned = (LOAD_EXTEND_OP (operand_mode) == SIGN_EXTEND ? 0 : 1);
+      ops_unsigned = (LOAD_EXTEND_OP (operand_mode) == SIGN_EXTEND 
+		      && !flag_syntax_only) ? 0 : 1;
 #else
       ops_unsigned = 1;
 #endif
@@ -6404,10 +6405,11 @@ fold (tree expr)
 	      && ! VOID_TYPE_P (TREE_OPERAND (tem, 2))
 	      && (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (tem, 1), 0))
 		  == TREE_TYPE (TREE_OPERAND (TREE_OPERAND (tem, 2), 0)))
-	      && ! (INTEGRAL_TYPE_P (TREE_TYPE (tem))
-		    && (INTEGRAL_TYPE_P
-			(TREE_TYPE (TREE_OPERAND (TREE_OPERAND (tem, 1), 0))))
-		    && TYPE_PRECISION (TREE_TYPE (tem)) <= BITS_PER_WORD))
+	      && (! (INTEGRAL_TYPE_P (TREE_TYPE (tem))
+		     && (INTEGRAL_TYPE_P
+			 (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (tem, 1), 0))))
+		     && TYPE_PRECISION (TREE_TYPE (tem)) <= BITS_PER_WORD)
+		  || flag_syntax_only))
 	    tem = build1 (code, type,
 			  build3 (COND_EXPR,
 				  TREE_TYPE (TREE_OPERAND
@@ -6614,6 +6616,7 @@ fold (tree expr)
 	      change = (cst == 0);
 #ifdef LOAD_EXTEND_OP
 	      if (change
+		  && !flag_syntax_only
 		  && (LOAD_EXTEND_OP (TYPE_MODE (TREE_TYPE (and0)))
 		      == ZERO_EXTEND))
 		{

	Jakub


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