#include "tree-gimple.h"
#include "toplev.h"
-static tree java_gimplify_labeled_block_expr (tree);
-static tree java_gimplify_exit_block_expr (tree);
static tree java_gimplify_block (tree);
-static tree java_gimplify_try_expr (tree);
static enum gimplify_status java_gimplify_modify_expr (tree*, tree*, tree *);
static enum gimplify_status java_gimplify_component_ref (tree*, tree*, tree *);
static enum gimplify_status java_gimplify_self_mod_expr (tree*, tree*, tree *);
*expr_p = java_gimplify_block (*expr_p);
break;
- case EXPR_WITH_FILE_LOCATION:
-#ifdef USE_MAPPED_LOCATION
- input_location = EXPR_LOCATION (*expr_p);
-#else
- input_location.file = EXPR_WFL_FILENAME (*expr_p);
- input_location.line = EXPR_WFL_LINENO (*expr_p);
-#endif
- *expr_p = EXPR_WFL_NODE (*expr_p);
- if (EXPR_P (*expr_p))
- SET_EXPR_LOCATION (*expr_p, input_location);
- break;
-
- case LABELED_BLOCK_EXPR:
- *expr_p = java_gimplify_labeled_block_expr (*expr_p);
- break;
-
- case EXIT_BLOCK_EXPR:
- *expr_p = java_gimplify_exit_block_expr (*expr_p);
- break;
-
- case TRY_EXPR:
- *expr_p = java_gimplify_try_expr (*expr_p);
- break;
-
case VAR_DECL:
*expr_p = java_replace_reference (*expr_p, /* want_lvalue */ false);
return GS_UNHANDLED;
return GS_OK;
}
-/* Gimplify a LABELED_BLOCK_EXPR into a LABEL_EXPR following
- a (possibly empty) body. */
-
-static tree
-java_gimplify_labeled_block_expr (tree expr)
-{
- tree body = LABELED_BLOCK_BODY (expr);
- tree label = LABELED_BLOCK_LABEL (expr);
- tree t;
-
- DECL_CONTEXT (label) = current_function_decl;
- t = build1 (LABEL_EXPR, void_type_node, label);
- if (body != NULL_TREE)
- t = build2 (COMPOUND_EXPR, void_type_node, body, t);
- return t;
-}
-
-/* Gimplify a EXIT_BLOCK_EXPR into a GOTO_EXPR. */
-
-static tree
-java_gimplify_exit_block_expr (tree expr)
-{
- tree labeled_block = EXIT_BLOCK_LABELED_BLOCK (expr);
- tree label;
-
- /* First operand must be a LABELED_BLOCK_EXPR, which should
- already be lowered (or partially lowered) when we get here. */
- gcc_assert (TREE_CODE (labeled_block) == LABELED_BLOCK_EXPR);
-
- label = LABELED_BLOCK_LABEL (labeled_block);
- return build1 (GOTO_EXPR, void_type_node, label);
-}
-
-
-
static enum gimplify_status
java_gimplify_component_ref (tree *expr_p, tree *pre_p, tree *post_p)
{
if (stat == GS_ERROR)
return stat;
- sync_expr
- = build3 (CALL_EXPR, void_type_node,
- build_address_of (built_in_decls[BUILT_IN_SYNCHRONIZE]),
- NULL_TREE, NULL_TREE);
+ sync_expr = build_call_expr (built_in_decls[BUILT_IN_SYNCHRONIZE], 0);
TREE_SIDE_EFFECTS (sync_expr) = 1;
*expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p),
sync_expr, *expr_p);
*/
enum gimplify_status stat;
- tree sync_expr
- = build3 (CALL_EXPR, void_type_node,
- build_address_of (built_in_decls[BUILT_IN_SYNCHRONIZE]),
- NULL_TREE, NULL_TREE);
+ tree sync_expr =
+ build_call_expr (built_in_decls[BUILT_IN_SYNCHRONIZE], 0);
TREE_SIDE_EFFECTS (sync_expr) = 1;
stat = gimplify_expr (&rhs, pre_p, post_p,
return build3 (BIND_EXPR, TREE_TYPE (java_block), decls, body, block);
}
-static tree
-java_gimplify_try_expr (tree try_expr)
-{
- tree body = TREE_OPERAND (try_expr, 0);
- tree handler = TREE_OPERAND (try_expr, 1);
- tree catch = NULL_TREE;
-
- /* Build a CATCH_EXPR for each handler. */
- while (handler)
- {
- tree java_catch = TREE_OPERAND (handler, 0);
- tree catch_type = TREE_TYPE (TREE_TYPE (BLOCK_EXPR_DECLS (java_catch)));
- tree expr = build2 (CATCH_EXPR, void_type_node,
- prepare_eh_table_type (catch_type),
- handler);
- if (catch)
- catch = build2 (COMPOUND_EXPR, void_type_node, catch, expr);
- else
- catch = expr;
- handler = TREE_CHAIN (handler);
- }
- return build2 (TRY_CATCH_EXPR, void_type_node, body, catch);
-}
-
/* Dump a tree of some kind. This is a convenience wrapper for the
dump_* functions in tree-dump.c. */
static void