* expr.c (expand_expr_real_1): Remove cases for EXIT_BLOCK_EXPR
and LABELED_BLOCK_EXPR.
* gimplify.c (gimplify_labeled_block_expr): Remove.
(gimplify_exit_block_expr): Remove.
(gimplify_expr): Don't call them.
* tree-inline.c (copy_body_r): Don't handle EXIT_BLOCK_EXPR
and LABELED_BLOCK_EXPR.
(estimate_num_insns_1): Likewise.
(walk_tree): Likewise.
* tree-pretty-print.c (dump_generic_node): Don't handle
EXIT_BLOCK_EXPR and LABELED_BLOCK_EXPR.
* tree.def (EXIT_BLOCK_EXPR): Moved to java-tree.def.
(LABELED_BLOCK_EXPR): Likewise.
* tree.h (LABELED_BLOCK_LABEL): Moved to java-tree.h.
(LABELED_BLOCK_BODY): Likewise.
(EXIT_BLOCK_LABELED_BLOCK): Likewise.
(EXIT_BLOCK_RETURN): Removed.
java/
* java-gimplify.c (java_gimplify_labeled_block_expr): New function.
(java_gimplify_exit_block_expr): New function.
(java_gimplify_expr): Use them to gimplify EXIT_BLOCK_EXPR and
LABELED_BLOCK_EXPR.
* java-tree.def (LABELED_BLOCK_EXPR): Moved from tree.def.
(EXIT_BLOCK_EXPR): Likewise.
* java-tree.h (LABELED_BLOCK_LABEL): Moved from tree.h.
(LABELED_BLOCK_BODY): Likewise.
(EXIT_BLOCK_LABELED_BLOCK): Likewise.
* jcf-write.c (generate_bytecode_insns): Don't handle the unused
EXIT_BLOCK_RETURN operand. Use EXIT_BLOCK_LABELED_BLOCK instead of
TREE_OPERAND.
* lang.c (java_tree_inlining_walk_subtrees): Handle EXIT_BLOCK_EXPR.
(java_dump_tree): Use LABELED_BLOCK_LABEL, LABELED_BLOCK_BODY, and
EXIT_BLOCK_LABELED_BLOCK instead of TREE_OPERAND. Don't handle the
second operand of EXIT_BLOCK_EXPR.
* parse.y (find_expr_with_wfl): Use LABELED_BLOCK_BODY instead of
TREE_OPERAND.
(build_bc_statement): Use build1 to build EXIT_BLOCK_EXPR nodes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91149
138bc75d-0d04-0410-961f-
82ee72b054a4
2004-11-24 Steven Bosscher <stevenb@suse.de>
+ * expr.c (expand_expr_real_1): Remove cases for EXIT_BLOCK_EXPR
+ and LABELED_BLOCK_EXPR.
+ * gimplify.c (gimplify_labeled_block_expr): Remove.
+ (gimplify_exit_block_expr): Remove.
+ (gimplify_expr): Don't call them.
+ * tree-inline.c (copy_body_r): Don't handle EXIT_BLOCK_EXPR
+ and LABELED_BLOCK_EXPR.
+ (estimate_num_insns_1): Likewise.
+ (walk_tree): Likewise.
+ * tree-pretty-print.c (dump_generic_node): Don't handle
+ EXIT_BLOCK_EXPR and LABELED_BLOCK_EXPR.
+ * tree.def (EXIT_BLOCK_EXPR): Moved to java-tree.def.
+ (LABELED_BLOCK_EXPR): Likewise.
+ * tree.h (LABELED_BLOCK_LABEL): Moved to java-tree.h.
+ (LABELED_BLOCK_BODY): Likewise.
+ (EXIT_BLOCK_LABELED_BLOCK): Likewise.
+ (EXIT_BLOCK_RETURN): Removed.
+
+2004-11-24 Steven Bosscher <stevenb@suse.de>
+
* cfgrtl.c (rtl_delete_block): Fix comment.
* emit-rtl.c (remove_unnecessary_notes): Die if we see BLOCK_BEG
or BLOCK_END insn notes.
(record_jump_cond): Use it instead of gen_lowpart.
2004-11-23 Daniel Jacobowitz <dan@codesourcery.com>
- Joseph Myers <joseph@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
* config/sol2-c.c (solaris_register_pragmas): Use
c_register_pragma_with_expansion.
case POSTDECREMENT_EXPR:
case LOOP_EXPR:
case EXIT_EXPR:
- case LABELED_BLOCK_EXPR:
- case EXIT_BLOCK_EXPR:
case TRUTH_ANDIF_EXPR:
case TRUTH_ORIF_EXPR:
/* Lowered by gimplify.c. */
return GS_ALL_DONE;
}
-/* Gimplify a LABELED_BLOCK_EXPR into a LABEL_EXPR following
- a (possibly empty) body. */
-
-static enum gimplify_status
-gimplify_labeled_block_expr (tree *expr_p)
-{
- tree body = LABELED_BLOCK_BODY (*expr_p);
- tree label = LABELED_BLOCK_LABEL (*expr_p);
- tree t;
-
- DECL_CONTEXT (label) = current_function_decl;
- t = build (LABEL_EXPR, void_type_node, label);
- if (body != NULL_TREE)
- t = build (COMPOUND_EXPR, void_type_node, body, t);
- *expr_p = t;
-
- return GS_OK;
-}
-
-/* Gimplify a EXIT_BLOCK_EXPR into a GOTO_EXPR. */
-
-static enum gimplify_status
-gimplify_exit_block_expr (tree *expr_p)
-{
- tree labeled_block = TREE_OPERAND (*expr_p, 0);
- 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);
- *expr_p = build1 (GOTO_EXPR, void_type_node, label);
-
- return GS_OK;
-}
-
/* Build a GOTO to the LABEL_DECL pointed to by LABEL_P, building it first
if necessary. */
ret = gimplify_switch_expr (expr_p, pre_p);
break;
- case LABELED_BLOCK_EXPR:
- ret = gimplify_labeled_block_expr (expr_p);
- break;
-
- case EXIT_BLOCK_EXPR:
- ret = gimplify_exit_block_expr (expr_p);
- break;
-
case EXIT_EXPR:
ret = gimplify_exit_expr (expr_p);
break;
+2004-11-24 Steven Bosscher <stevenb@suse.de>
+
+ * java-gimplify.c (java_gimplify_labeled_block_expr): New function.
+ (java_gimplify_exit_block_expr): New function.
+ (java_gimplify_expr): Use them to gimplify EXIT_BLOCK_EXPR and
+ LABELED_BLOCK_EXPR.
+ * java-tree.def (LABELED_BLOCK_EXPR): Moved from tree.def.
+ (EXIT_BLOCK_EXPR): Likewise.
+ * java-tree.h (LABELED_BLOCK_LABEL): Moved from tree.h.
+ (LABELED_BLOCK_BODY): Likewise.
+ (EXIT_BLOCK_LABELED_BLOCK): Likewise.
+ * jcf-write.c (generate_bytecode_insns): Don't handle the unused
+ EXIT_BLOCK_RETURN operand. Use EXIT_BLOCK_LABELED_BLOCK instead of
+ TREE_OPERAND.
+ * lang.c (java_tree_inlining_walk_subtrees): Handle EXIT_BLOCK_EXPR.
+ (java_dump_tree): Use LABELED_BLOCK_LABEL, LABELED_BLOCK_BODY, and
+ EXIT_BLOCK_LABELED_BLOCK instead of TREE_OPERAND. Don't handle the
+ second operand of EXIT_BLOCK_EXPR.
+ * parse.y (find_expr_with_wfl): Use LABELED_BLOCK_BODY instead of
+ TREE_OPERAND.
+ (build_bc_statement): Use build1 to build EXIT_BLOCK_EXPR nodes.
+
2004-11-23 Ben Elliston <bje@au.ibm.com>
* xref.h (xref_flag_value): Remove.
#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_case_expr (tree);
static tree java_gimplify_default_expr (tree);
static tree java_gimplify_block (tree);
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 CASE_EXPR:
*expr_p = java_gimplify_case_expr (*expr_p);
break;
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 = build (LABEL_EXPR, void_type_node, label);
+ if (body != NULL_TREE)
+ t = build (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);
+}
+
/* 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. */
/* Defines `this' as an expression. */
DEFTREECODE (THIS_EXPR, "this", tcc_unary, 0)
+/* A labeled block. Operand 0 is the label that will be generated to
+ mark the end of the block. Operand 1 is the labeled block body. */
+DEFTREECODE (LABELED_BLOCK_EXPR, "labeled_block_expr", tcc_expression, 2)
+
+/* Exit a labeled block, possibly returning a value. Operand 0 is a
+ LABELED_BLOCK_EXPR to exit. */
+DEFTREECODE (EXIT_BLOCK_EXPR, "exit_block_expr", tcc_statement, 1)
+
/* Case statement expression.
Operand 1 is the case value. */
DEFTREECODE (CASE_EXPR, "case", tcc_expression, 1)
#undef DEBUG_JAVA_BINDING_LEVELS
+/* In a LABELED_BLOCK_EXPR node. */
+#define LABELED_BLOCK_LABEL(NODE) \
+ TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 0)
+#define LABELED_BLOCK_BODY(NODE) \
+ TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 1)
+
+/* In an EXIT_BLOCK_EXPR node. */
+#define EXIT_BLOCK_LABELED_BLOCK(NODE) \
+ TREE_OPERAND_CHECK_CODE (NODE, EXIT_BLOCK_EXPR, 0)
+
/* In an EXPR_WITH_FILE_LOCATION node. */
#define EXPR_WFL_EMIT_LINE_NOTE(NODE) \
(EXPR_WITH_FILE_LOCATION_CHECK (NODE)->common.public_flag)
case EXIT_BLOCK_EXPR:
{
struct jcf_block *label = state->labeled_blocks;
- if (TREE_OPERAND (exp, 1) != NULL) goto notimpl;
- while (label->u.labeled_block != TREE_OPERAND (exp, 0))
+ while (label->u.labeled_block != EXIT_BLOCK_LABELED_BLOCK (exp))
label = label->next;
call_cleanups (label, state);
emit_goto (label, state);
}
}
/* fall through */
- notimpl:
default:
error("internal error in generate_bytecode_insn - tree code not implemented: %s",
tree_code_name [(int) TREE_CODE (exp)]);
WALK_SUBTREE (BLOCK_EXPR_BODY (t));
return NULL_TREE;
+ case EXIT_BLOCK_EXPR:
+ *subtrees = 0;
+ return NULL_TREE;
+
default:
return NULL_TREE;
}
return true;
case LABELED_BLOCK_EXPR:
- dump_child ("label", TREE_OPERAND (t, 0));
- dump_child ("block", TREE_OPERAND (t, 1));
+ dump_child ("label", LABELED_BLOCK_LABEL (t));
+ dump_child ("block", LABELED_BLOCK_BODY (t));
return true;
case EXIT_BLOCK_EXPR:
- dump_child ("block", TREE_OPERAND (t, 0));
- dump_child ("val", TREE_OPERAND (t, 1));
+ dump_child ("block", EXIT_BLOCK_LABELED_BLOCK (t));
return true;
case BLOCK:
continue;
case LABELED_BLOCK_EXPR:
- node = TREE_OPERAND (node, 1);
+ node = LABELED_BLOCK_BODY (node);
continue;
default:
return node;
case EXIT_BLOCK_EXPR:
- /* We don't complete operand 1, because it's the return value of
- the EXIT_BLOCK_EXPR which doesn't exist it Java */
return patch_bc_statement (node);
case CASE_EXPR:
}
/* Unlabeled break/continue will be handled during the
break/continue patch operation */
- break_continue = build2 (EXIT_BLOCK_EXPR, NULL_TREE,
- label_block_expr, NULL_TREE);
+ break_continue = build1 (EXIT_BLOCK_EXPR, NULL_TREE, label_block_expr);
IS_BREAK_STMT_P (break_continue) = is_break;
TREE_SIDE_EFFECTS (break_continue) = 1;
remap_save_expr (tp, id->decl_map, walk_subtrees);
else if (TREE_CODE (*tp) == BIND_EXPR)
copy_bind_expr (tp, walk_subtrees, id);
- else if (TREE_CODE (*tp) == LABELED_BLOCK_EXPR)
- {
- /* We need a new copy of this labeled block; the EXIT_BLOCK_EXPR
- will refer to it, so save a copy ready for remapping. We
- save it in the decl_map, although it isn't a decl. */
- tree new_block = copy_node (*tp);
- insert_decl_map (id, *tp, new_block);
- *tp = new_block;
- }
- else if (TREE_CODE (*tp) == EXIT_BLOCK_EXPR)
- {
- splay_tree_node n
- = splay_tree_lookup (id->decl_map,
- (splay_tree_key) TREE_OPERAND (*tp, 0));
- /* We _must_ have seen the enclosing LABELED_BLOCK_EXPR. */
- gcc_assert (n);
- *tp = copy_node (*tp);
- TREE_OPERAND (*tp, 0) = (tree) n->value;
- }
/* Types may need remapping as well. */
else if (TYPE_P (*tp))
*tp = remap_type (*tp, id);
case FILTER_EXPR: /* ??? */
case COMPOUND_EXPR:
case BIND_EXPR:
- case LABELED_BLOCK_EXPR:
case WITH_CLEANUP_EXPR:
case NOP_EXPR:
case VIEW_CONVERT_EXPR:
case SAVE_EXPR:
case ADDR_EXPR:
case COMPLEX_EXPR:
- case EXIT_BLOCK_EXPR:
case CASE_LABEL_EXPR:
case SSA_NAME:
case CATCH_EXPR:
}
}
- else if (code != EXIT_BLOCK_EXPR
- && code != SAVE_EXPR
+ else if (code != SAVE_EXPR
&& code != BIND_EXPR
&& IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code)))
{
case CONSTRUCTOR:
WALK_SUBTREE_TAIL (CONSTRUCTOR_ELTS (*tp));
- case EXIT_BLOCK_EXPR:
- WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, 1));
-
case SAVE_EXPR:
WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, 0));
pp_string (buffer, " [non-local]");
break;
- case LABELED_BLOCK_EXPR:
- op0 = LABELED_BLOCK_LABEL (node);
- /* If this is for break or continue, don't bother printing it. */
- if (DECL_NAME (op0))
- {
- const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
- if (strcmp (name, "break") == 0
- || strcmp (name, "continue") == 0)
- {
- dump_generic_node (buffer, LABELED_BLOCK_BODY (node), spc, flags, false);
- break;
- }
- }
- dump_generic_node (buffer, LABELED_BLOCK_LABEL (node), spc, flags, false);
- pp_string (buffer, ": {");
- if (!(flags & TDF_SLIM))
- newline_and_indent (buffer, spc+2);
- dump_generic_node (buffer, LABELED_BLOCK_BODY (node), spc+2, flags, true);
- if (!flags)
- newline_and_indent (buffer, spc);
- pp_character (buffer, '}');
- is_expr = false;
- break;
-
- case EXIT_BLOCK_EXPR:
- op0 = LABELED_BLOCK_LABEL (EXIT_BLOCK_LABELED_BLOCK (node));
- /* If this is for a break or continue, print it accordingly. */
- if (DECL_NAME (op0))
- {
- const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
- if (strcmp (name, "break") == 0
- || strcmp (name, "continue") == 0)
- {
- pp_string (buffer, name);
- break;
- }
- }
- pp_string (buffer, "<<<exit block ");
- dump_generic_node (buffer, op0, spc, flags, false);
- pp_string (buffer, ">>>");
- break;
-
case EXC_PTR_EXPR:
pp_string (buffer, "<<<exception object>>>");
break;
nodes for the function. */
DEFTREECODE (BIND_EXPR, "bind_expr", tcc_expression, 3)
-/* A labeled block. Operand 0 is the label that will be generated to
- mark the end of the block.
- Operand 1 is the labeled block body. */
-DEFTREECODE (LABELED_BLOCK_EXPR, "labeled_block_expr", tcc_expression, 2)
-
/* Function call. Operand 0 is the function.
Operand 1 is the argument list, a list of expressions
made out of a chain of TREE_LIST nodes.
The type should be void and the value should be ignored. */
DEFTREECODE (LOOP_EXPR, "loop_expr", tcc_statement, 1)
-/* Exit a labeled block, possibly returning a value. Operand 0 is a
- LABELED_BLOCK_EXPR to exit. Operand 1 is the value to return. It
- may be left null. */
-DEFTREECODE (EXIT_BLOCK_EXPR, "exit_block_expr", tcc_statement, 2)
-
/* Switch expression.
TREE_TYPE is the original type of the condition, before any
#define REF_ORIGINAL(NODE) TREE_CHAIN (TREE_CHECK3 (NODE, \
INDIRECT_REF, ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF))
-/* In a LABELED_BLOCK_EXPR node. */
-#define LABELED_BLOCK_LABEL(NODE) \
- TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 0)
-#define LABELED_BLOCK_BODY(NODE) \
- TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 1)
-
-/* In an EXIT_BLOCK_EXPR node. */
-#define EXIT_BLOCK_LABELED_BLOCK(NODE) \
- TREE_OPERAND_CHECK_CODE (NODE, EXIT_BLOCK_EXPR, 0)
-#define EXIT_BLOCK_RETURN(NODE) TREE_OPERAND_CHECK_CODE (NODE, EXIT_BLOCK_EXPR, 1)
-
/* In a LOOP_EXPR node. */
#define LOOP_EXPR_BODY(NODE) TREE_OPERAND_CHECK_CODE (NODE, LOOP_EXPR, 0)