diff options
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/java/java-gimplify.c | 42 |
2 files changed, 27 insertions, 21 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 7fdaf07..8aeeba5 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2004-08-18 Richard Henderson <rth@redhat.com> + + * java-gimplify.c (java_gimplify_expr): Move '2' handling into + default case. Treat '<' similarly. Update for + is_gimple_formal_tmp_var name change. + 2004-08-17 Andrew Haley <aph@redhat.com> * lang.c (lang_printable_name): Obey verbose flag. diff --git a/gcc/java/java-gimplify.c b/gcc/java/java-gimplify.c index 0945559..ea1b3f0 100644 --- a/gcc/java/java-gimplify.c +++ b/gcc/java/java-gimplify.c @@ -60,28 +60,9 @@ int java_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED, tree *post_p ATTRIBUTE_UNUSED) { - char code_class = TREE_CODE_CLASS(TREE_CODE (*expr_p)); - - /* Java insists on strict left-to-right evaluation of expressions. - A problem may arise if a variable used in the LHS of a binary - operation is altered by an assignment to that value in the RHS - before we've performed the operation. So, we always copy every - LHS to a temporary variable. - - FIXME: Are there any other cases where we should do this? - Parameter lists, maybe? Or perhaps that's unnecessary because - the front end already generates SAVE_EXPRs. */ - if (code_class == '2') - { - tree lhs = TREE_OPERAND (*expr_p, 0); - enum gimplify_status stat - = gimplify_expr (&lhs, pre_p, post_p, is_gimple_tmp_var, fb_rvalue); - if (stat == GS_ERROR) - return stat; - TREE_OPERAND (*expr_p, 0) = lhs; - } + enum tree_code code = TREE_CODE (*expr_p); - switch (TREE_CODE (*expr_p)) + switch (code) { case BLOCK: *expr_p = java_gimplify_block (*expr_p); @@ -150,6 +131,25 @@ java_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED, abort (); default: + /* Java insists on strict left-to-right evaluation of expressions. + A problem may arise if a variable used in the LHS of a binary + operation is altered by an assignment to that value in the RHS + before we've performed the operation. So, we always copy every + LHS to a temporary variable. + + FIXME: Are there any other cases where we should do this? + Parameter lists, maybe? Or perhaps that's unnecessary because + the front end already generates SAVE_EXPRs. */ + + if (TREE_CODE_CLASS (code) == '2' || TREE_CODE_CLASS (code) == '<') + { + enum gimplify_status stat + = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, + is_gimple_formal_tmp_var, fb_rvalue); + if (stat == GS_ERROR) + return stat; + } + return GS_UNHANDLED; } |