java-tree.h (force_evaluation_order): Remove prototype.
authorSteven Bosscher <steven@gcc.gnu.org>
Wed, 11 Jul 2012 22:54:34 +0000 (22:54 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Wed, 11 Jul 2012 22:54:34 +0000 (22:54 +0000)
* java-tree.h (force_evaluation_order): Remove prototype.
* expr.c (force_evaluation_order): Remove unused function.

From-SVN: r189428

gcc/java/ChangeLog
gcc/java/expr.c
gcc/java/java-tree.h

index 46d9075..7943051 100644 (file)
@@ -1,5 +1,10 @@
 2012-07-11  Steven Bosscher  <steven@gcc.gnu.org>
 
+       * java-tree.h (force_evaluation_order): Remove prototype.
+       * expr.c (force_evaluation_order): Remove unused function.
+
+2012-07-11  Steven Bosscher  <steven@gcc.gnu.org>
+
        * decl.c: Do not include libfuncs.h.
        * class.c: Do not include defaults.h.
        * jvgenmain.c: Likewise.
index 5f9ddda..0429c02 100644 (file)
@@ -3689,82 +3689,6 @@ maybe_adjust_start_pc (struct JCF *jcf, int code_offset,
   return start_pc;
 }
 
-/* Force the (direct) sub-operands of NODE to be evaluated in left-to-right
-   order, as specified by Java Language Specification.
-
-   The problem is that while expand_expr will evaluate its sub-operands in
-   left-to-right order, for variables it will just return an rtx (i.e.
-   an lvalue) for the variable (rather than an rvalue).  So it is possible
-   that a later sub-operand will change the register, and when the
-   actual operation is done, it will use the new value, when it should
-   have used the original value.
-
-   We fix this by using save_expr.  This forces the sub-operand to be
-   copied into a fresh virtual register,
-
-   For method invocation, we modify the arguments so that a
-   left-to-right order evaluation is performed. Saved expressions
-   will, in CALL_EXPR order, be reused when the call will be expanded.
-
-   We also promote outgoing args if needed.  */
-
-tree
-force_evaluation_order (tree node)
-{
-  if (flag_syntax_only)
-    return node;
-  if (TREE_CODE (node) == CALL_EXPR
-      || (TREE_CODE (node) == COMPOUND_EXPR
-         && TREE_CODE (TREE_OPERAND (node, 0)) == CALL_EXPR
-         && TREE_CODE (TREE_OPERAND (node, 1)) == SAVE_EXPR)) 
-    {
-      tree call, cmp;
-      int i, nargs;
-
-      /* Account for wrapped around ctors.  */
-      if (TREE_CODE (node) == COMPOUND_EXPR)
-        call = TREE_OPERAND (node, 0);
-      else
-       call = node;
-
-      nargs = call_expr_nargs (call);
-
-      /* This reverses the evaluation order. This is a desired effect. */
-      for (i = 0, cmp = NULL_TREE; i < nargs; i++)
-       {
-         tree arg = CALL_EXPR_ARG (call, i);
-         /* Promote types smaller than integer.  This is required by
-            some ABIs.  */
-         tree type = TREE_TYPE (arg);
-         tree saved;
-         if (targetm.calls.promote_prototypes (type)
-             && INTEGRAL_TYPE_P (type)
-             && INT_CST_LT_UNSIGNED (TYPE_SIZE (type),
-                                     TYPE_SIZE (integer_type_node)))
-           arg = fold_convert (integer_type_node, arg);
-
-         saved = save_expr (force_evaluation_order (arg));
-         cmp = (cmp == NULL_TREE ? saved :
-                build2 (COMPOUND_EXPR, void_type_node, cmp, saved));
-
-         CALL_EXPR_ARG (call, i) = saved;
-       }
-      
-      if (cmp && TREE_CODE (cmp) == COMPOUND_EXPR)
-       TREE_SIDE_EFFECTS (cmp) = 1;
-
-      if (cmp)
-       {
-         cmp = build2 (COMPOUND_EXPR, TREE_TYPE (node), cmp, node);
-         if (TREE_TYPE (cmp) != void_type_node)
-           cmp = save_expr (cmp);
-         TREE_SIDE_EFFECTS (cmp) = 1;
-         node = cmp;
-       }
-    }
-  return node;
-}
-
 /* Build a node to represent empty statements and blocks. */
 
 tree
index 7001321..6169b6a 100644 (file)
@@ -1094,7 +1094,6 @@ extern int merge_type_state (tree);
 extern int push_type_0 (tree);
 extern void push_type (tree);
 extern void add_interface (tree, tree);
-extern tree force_evaluation_order (tree);
 extern tree java_create_object (tree);
 extern int verify_constant_pool (struct JCF *);
 extern void start_java_method (tree);