summaryrefslogtreecommitdiff
path: root/gcc/java/java-gimplify.c
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2004-07-21 16:03:43 +0000
committerAndrew Haley <aph@gcc.gnu.org>2004-07-21 16:03:43 +0000
commit00150bf9f31d6a0ec576ead73a315f26b1c31749 (patch)
tree1785e3e0f34d4daf27613e8a698fd2c59ee721f3 /gcc/java/java-gimplify.c
parent5d16533a079388246d53311790a4a4b2a16aa6c6 (diff)
downloadgcc-00150bf9f31d6a0ec576ead73a315f26b1c31749.tar.gz
verify.c (verify_jvm_instructions): Comment change only.
2004-07-20 Andrew Haley <aph@redhat.com> * verify.c (verify_jvm_instructions): Comment change only. * typeck.c (build_java_array_type): Add size field to array name. * java-tree.h (LOCAL_SLOT_P): New. (update_aliases): Add PC argument. (pushdecl_function_level): New function. * java-gimplify.c (java_gimplify_expr): Handle VAR_DECL, MODIFY_EXPR, and SAVE_EXPR. (java_gimplify_modify_expr): New function. * expr.c (push_type_0): Call find_stack_slot() to create temporary. (expand_iinc): Pass PC to update_aliases(). (STORE_INTERNAL): Likewise. (process_jvm_instruction): Likewise. * decl.c (base_decl_map): New variable. (uniq): New variable. (update_aliases): Rewrite with more thorough checking. (debug_variable_p): New function. (push_jvm_slot): Don't initialize local variable. Don't pushdecl. (check_local_named_variable): Delete whole function. (initialize_local_variable): New function. (check_local_unnamed_variable): Add checks and comments. (find_local_variable): Rewrite. (java_replace_reference): New function. (function_binding_level): New variable. (pushdecl_function_level): New function. (maybe_pushlevels): Set DECL_LOCAL_END_PC. (maybe_pushlevels): Call pushdecl() on each of the new decls. (start_java_method): Reset uniq. Create base_decl_map. Set function_binding_level. (end_java_method): Null unused fields to save memory. From-SVN: r85009
Diffstat (limited to 'gcc/java/java-gimplify.c')
-rw-r--r--gcc/java/java-gimplify.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/java/java-gimplify.c b/gcc/java/java-gimplify.c
index 64cb7ceb88e..eb277f8caec 100644
--- a/gcc/java/java-gimplify.c
+++ b/gcc/java/java-gimplify.c
@@ -37,6 +37,7 @@ static tree java_gimplify_default_expr (tree);
static tree java_gimplify_block (tree);
static tree java_gimplify_new_array_init (tree);
static tree java_gimplify_try_expr (tree);
+static tree java_gimplify_modify_expr (tree);
static void dump_java_tree (enum tree_dump_index, tree);
@@ -117,6 +118,21 @@ java_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED,
*expr_p = build_exception_object_ref (TREE_TYPE (*expr_p));
break;
+ case VAR_DECL:
+ *expr_p = java_replace_reference (*expr_p, /* want_lvalue */ false);
+ return GS_UNHANDLED;
+
+ case MODIFY_EXPR:
+ *expr_p = java_gimplify_modify_expr (*expr_p);
+ return GS_UNHANDLED;
+
+ case SAVE_EXPR:
+ if (TREE_CODE (TREE_OPERAND (*expr_p, 0)) == VAR_DECL)
+ TREE_OPERAND (*expr_p, 0)
+ = java_replace_reference (TREE_OPERAND (*expr_p, 0),
+ /* want_lvalue */ false);
+ return GS_UNHANDLED;
+
/* These should already be lowered before we get here. */
case URSHIFT_EXPR:
case COMPARE_EXPR:
@@ -140,6 +156,33 @@ java_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED,
return GS_OK;
}
+/* This is specific to the bytecode compiler. If a variable has
+ LOCAL_SLOT_P set, replace an assignment to it with an assignment to
+ the corresponding variable that holds all its aliases. */
+
+static tree
+java_gimplify_modify_expr (tree modify_expr)
+{
+ tree lhs = TREE_OPERAND (modify_expr, 0);
+ tree rhs = TREE_OPERAND (modify_expr, 1);
+ tree lhs_type = TREE_TYPE (lhs);
+
+ if (TREE_CODE (lhs) == VAR_DECL
+ && DECL_LANG_SPECIFIC (lhs)
+ && LOCAL_SLOT_P (lhs)
+ && TREE_CODE (lhs_type) == POINTER_TYPE)
+ {
+ tree new_lhs = java_replace_reference (lhs, /* want_lvalue */ true);
+ tree new_rhs = build1 (NOP_EXPR, TREE_TYPE (new_lhs), rhs);
+ modify_expr = build (MODIFY_EXPR, TREE_TYPE (new_lhs),
+ new_lhs, new_rhs);
+ modify_expr = build1 (NOP_EXPR, lhs_type, modify_expr);
+ }
+
+ return modify_expr;
+}
+
+
static tree
java_gimplify_case_expr (tree expr)
{