[gcjx] Patch: FYI: minor '%=' cleanup
Tom Tromey
tromey@redhat.com
Mon Oct 10 19:54:00 GMT 2005
I'm checking this in on the gcjx branch.
This changes the '%=' code to use handle_op_assignment.
There is still some bug in the 'op=' code causing it not to work, but
at least this way we only have to fix it once.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* tree.cc (visit_op_assignment): Use handle_op_assignment.
(handle_op_assignment): Handle 'mod' specially.
Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.54
diff -u -r1.1.2.54 tree.cc
--- tree.cc 9 Oct 2005 22:55:04 -0000 1.1.2.54
+++ tree.cc 10 Oct 2005 19:53:19 -0000
@@ -1595,10 +1595,18 @@
if (! is_shift)
lhs_dup_tree = fold (convert (rhs_type, lhs_dup_tree));
+ // The 'mod' operation requires a special case as it may expand to a
+ // builtin or a function call.
+ tree operation;
+ if (op == TRUNC_MOD_EXPR)
+ operation = build_mod (rhs_type, lhs_dup_tree, rhs_tree);
+ else
+ operation = build2 (op, rhs_type, lhs_dup_tree, rhs_tree);
+ TREE_SIDE_EFFECTS (operation) = (TREE_SIDE_EFFECTS (lhs_tree)
+ | TREE_SIDE_EFFECTS (rhs_tree));
+
current = build2 (MODIFY_EXPR, TREE_TYPE (lhs_tree), lhs_tree,
- fold (convert (TREE_TYPE (lhs_tree),
- build2 (op, rhs_type,
- lhs_dup_tree, rhs_tree))));
+ fold (convert (TREE_TYPE (lhs_tree), operation)));
TREE_SIDE_EFFECTS (current) = 1;
annotate (current, element);
@@ -1674,19 +1682,7 @@
const ref_expression &lhs,
const ref_expression &rhs)
{
- lhs->visit (this);
- tree lhs_tree = save_expr (current);
- rhs->visit (this);
- tree rhs_tree = current;
-
- tree div_type = gcc_builtins->map_type (op->type ());
-
- current = build2 (MODIFY_EXPR, gcc_builtins->map_type (lhs->type ()),
- lhs_tree,
- build_mod (div_type, lhs_tree,
- rhs_tree));
- TREE_SIDE_EFFECTS (current) = 1;
- annotate (current, op);
+ handle_op_assignment (op, TRUNC_MOD_EXPR, lhs, rhs);
}
void
More information about the Java-patches
mailing list