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]

Re: generate_bytecode_insn - tree code not implemented: min_expr


Try this.

Roger, I'm still interested in finding out what canonical set of
expressions I really should expect.  There may be more I don't know
about, leaving latent bugs.

Andrew.

2003-09-16  Andrew Haley  <aph@redhat.com>

	* jcf-write.c (generate_bytecode_insns): Add MIN_EXPR and MAX_EXPR.

Index: jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.130
diff -c -2 -p -r1.130 jcf-write.c
*** jcf-write.c	12 Aug 2003 20:34:51 -0000	1.130
--- jcf-write.c	16 Sep 2003 15:03:15 -0000
*************** generate_bytecode_insns (tree exp, int t
*** 2414,2417 ****
--- 2414,2433 ----
        NOTE_PUSH (1);  /* Pushed by exception system. */
        break;
+     case MIN_EXPR:
+     case MAX_EXPR:
+       {
+ 	/* This copes with cases where fold() has created MIN or MAX
+ 	   from a conditional expression.  */
+ 	enum tree_code code = TREE_CODE (exp) == MIN_EXPR ? LT_EXPR : GT_EXPR;
+ 	tree op0 = TREE_OPERAND (exp, 0);
+ 	tree op1 = TREE_OPERAND (exp, 1);
+ 	if (TREE_SIDE_EFFECTS (op0) || TREE_SIDE_EFFECTS (op1))
+ 	  abort ();
+ 	tree new = build (COND_EXPR, TREE_TYPE (exp), 
+ 			  build (code, boolean_type_node, op0, op1), 
+ 			  op0, op1);	  
+ 	generate_bytecode_insns (new, target, state);
+ 	break;
+       }					     
      case NEW_CLASS_EXPR:
        {


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