Java patch for TRUTH_XOR_EXPR etc

Per Bothner bothner@cygnus.com
Thu Jan 28 16:43:00 GMT 1999


(Currently, jc1 does not directly generate TRUTH_XOR_EXPR etc,
but they can appear as a result of constant-folding.)

I checked in the following patch:

Thu Jan 28 14:45:39 1999  Per Bothner  <bothner@cygnus.com>

	* check-init.c (check_bool2_init, check_bool_init, check_init):
	Handle TRUTH_AND_EXPR, TRUTH_OR_EXPR, and TRUTH_XOR_EXPR.
	* jcf-write.c (generate_bytecode_insns):  Likewise.

Index: check-init.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/java/check-init.c,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 check-init.c
--- check-init.c	1999/01/08 23:51:20	1.1.2.2
+++ check-init.c	1999/01/28 22:48:11
@@ -188,13 +188,13 @@ check_bool2_init (code, exp0, exp1, befo
       INTERSECT (before, when_false_0, when_false_1);
       UNION (when_false, when_false, before);
     }
-  else if (code == BIT_AND_EXPR)
+  else if (code == BIT_AND_EXPR || code == TRUTH_AND_EXPR)
     {
       UNION (when_true, when_true_0, when_true_1);
       INTERSECT (when_false, when_false_0, when_false_1);
       UNION (when_false, when_false, before);
     }
-  else /* if (code == BIT_IOR_EXPR) */
+  else /* if (code == BIT_IOR_EXPR || code == TRUTH_OR_EXPR) */
     {
       UNION (when_false, when_false_0, when_false_1);
       INTERSECT (when_true, when_true_0, when_true_1);
@@ -263,12 +263,15 @@ check_bool_init (exp, before, when_false
 
     case BIT_AND_EXPR:
     case BIT_IOR_EXPR:
+    case TRUTH_AND_EXPR:
+    case TRUTH_OR_EXPR:
     case EQ_EXPR:
       check_bool2_init (TREE_CODE (exp),
 			TREE_OPERAND (exp, 0), TREE_OPERAND (exp, 1),
 			before, when_false, when_true);
       return;
 
+    case TRUTH_XOR_EXPR:
     case BIT_XOR_EXPR:
     case NE_EXPR:
       /* Just like EQ_EXPR, but switch when_true and when_false. */
@@ -592,6 +595,9 @@ check_init (exp, before)
       break;
     case UNARY_PLUS_EXPR:
     case NEGATE_EXPR:
+    case TRUTH_AND_EXPR:
+    case TRUTH_OR_EXPR:
+    case TRUTH_XOR_EXPR:
     case TRUTH_NOT_EXPR:
     case BIT_NOT_EXPR:
     case CONVERT_EXPR:
Index: jcf-write.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/java/jcf-write.c,v
retrieving revision 1.13.2.15
diff -u -p -r1.13.2.15 jcf-write.c
--- jcf-write.c	1999/01/25 22:18:51	1.13.2.15
+++ jcf-write.c	1999/01/28 22:48:11
@@ -1938,8 +1938,11 @@ generate_bytecode_insns (exp, target, st
     case LSHIFT_EXPR:   jopcode = OPCODE_ishl;   goto binop;
     case RSHIFT_EXPR:   jopcode = OPCODE_ishr;   goto binop;
     case URSHIFT_EXPR:  jopcode = OPCODE_iushr;  goto binop;
+    case TRUTH_AND_EXPR:
     case BIT_AND_EXPR:  jopcode = OPCODE_iand;   goto binop;
+    case TRUTH_OR_EXPR:
     case BIT_IOR_EXPR:  jopcode = OPCODE_ior;    goto binop;
+    case TRUTH_XOR_EXPR:
     case BIT_XOR_EXPR:  jopcode = OPCODE_ixor;   goto binop;
     binop:
     {



More information about the Gcc-patches mailing list