* Patch: FYI: remove some java-specific tree codes
@ 2007-07-26 18:49 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2007-07-26 18:49 UTC (permalink / raw)
To: gcc-patches List; +Cc: GCJ-patches
At the summit, Andrew Pinski and Richard Guenther mentioned that some
of the tree codes in java/java-tree.def were dead.
This patch removes the dead tree codes and various supporting bits.
Bootstrapped on x86 F7.
Tom
2007-07-26 Tom Tromey <tromey@redhat.com>
* java-tree.h (push_labeled_block, pop_labeled_block): Remove.
(LABELED_BLOCK_LABEL, LABELED_BLOCK_BODY,
EXIT_BLOCK_LABELED_BLOCK): Likewise.
* lang.c (java_tree_inlining_walk_subtrees): Update.
(java_dump_tree): Likewise.
* java-tree.def (LABELED_BLOCK_EXPR, EXIT_BLOCK_EXPR, TRY_EXPR):
Remove.
* decl.c (push_labeled_block, pop_labeled_block): Remove.
* java-gimplify.c (java_gimplify_labeled_block_expr,
java_gimplify_exit_block_expr, java_gimplify_try_expr): Remove.
(java_gimplify_expr): Update.
Index: java-gimplify.c
===================================================================
--- java-gimplify.c (revision 126877)
+++ java-gimplify.c (working copy)
@@ -32,10 +32,7 @@
#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 *);
@@ -69,18 +66,6 @@
*expr_p = java_gimplify_block (*expr_p);
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;
@@ -144,41 +129,6 @@
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)
{
@@ -347,30 +297,6 @@
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
Index: decl.c
===================================================================
--- decl.c (revision 126877)
+++ decl.c (working copy)
@@ -1126,41 +1126,6 @@
return t;
}
-/* Use a binding level to record a labeled block declaration */
-
-void
-push_labeled_block (tree lb)
-{
- tree name = DECL_NAME (LABELED_BLOCK_LABEL (lb));
- struct binding_level *b = current_binding_level;
- tree oldlocal = IDENTIFIER_LOCAL_VALUE (name);
- if (oldlocal != 0)
- b->shadowed = tree_cons (name, oldlocal, b->shadowed);
- TREE_CHAIN (lb) = b->names;
- b->names = lb;
- IDENTIFIER_LOCAL_VALUE (name) = lb;
-}
-
-/* Pop the current binding level, reinstalling values for the previous
- labeled block */
-
-void
-pop_labeled_block (void)
-{
- struct binding_level *b = current_binding_level;
- tree label = b->names;
- IDENTIFIER_LOCAL_VALUE (DECL_NAME (LABELED_BLOCK_LABEL (label))) =
- NULL_TREE;
- if (b->shadowed)
- IDENTIFIER_LOCAL_VALUE (TREE_PURPOSE (b->shadowed)) =
- TREE_VALUE (b->shadowed);
-
- /* Pop the current level, and free the structure for reuse. */
- current_binding_level = current_binding_level->level_chain;
- b->level_chain = free_binding_level;
- free_binding_level = b;
-}
-
/* Record a decl-node X as belonging to the current lexical scope.
Check for errors (such as an incompatible declaration for the same
name already seen in the same scope).
Index: java-tree.def
===================================================================
--- java-tree.def (revision 126877)
+++ java-tree.def (working copy)
@@ -32,19 +32,6 @@
/* Same as COMPARE_EXPR, but if either value is NaN, the result is 1. */
DEFTREECODE (COMPARE_G_EXPR, "compare_g_expr", tcc_binary, 2)
-/* 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)
-
-/* Try expression
- Operand 0 is the tried block,
- Operand 1 contains chained catch nodes. */
-DEFTREECODE (TRY_EXPR, "try-catch", tcc_expression, 2)
-
/*
Local variables:
mode:c
Index: lang.c
===================================================================
--- lang.c (revision 126877)
+++ lang.c (working copy)
@@ -721,10 +721,6 @@
WALK_SUBTREE (BLOCK_EXPR_BODY (t));
return NULL_TREE;
- case EXIT_BLOCK_EXPR:
- *subtrees = 0;
- return NULL_TREE;
-
default:
return NULL_TREE;
}
@@ -906,15 +902,6 @@
dump_child ("label", TREE_OPERAND (t, 0));
return true;
- case LABELED_BLOCK_EXPR:
- dump_child ("label", LABELED_BLOCK_LABEL (t));
- dump_child ("block", LABELED_BLOCK_BODY (t));
- return true;
-
- case EXIT_BLOCK_EXPR:
- dump_child ("block", EXIT_BLOCK_LABELED_BLOCK (t));
- return true;
-
case BLOCK:
if (BLOCK_EXPR_BODY (t))
{
Index: java-tree.h
===================================================================
--- java-tree.h (revision 126877)
+++ java-tree.h (working copy)
@@ -1198,12 +1198,10 @@
extern tree build_get_class (tree);
extern tree build_instanceof (tree, tree);
extern tree create_label_decl (tree);
-extern void push_labeled_block (tree);
extern tree prepare_eh_table_type (tree);
extern void java_expand_catch_classes (tree);
extern tree build_exception_object_ref (tree);
extern tree generate_name (void);
-extern void pop_labeled_block (void);
extern const char *lang_printable_name (tree, int);
extern tree maybe_add_interface (tree, tree);
extern void set_super_info (int, tree, tree, int);
@@ -1666,16 +1664,6 @@
#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)
-
extern void java_genericize (tree);
extern int java_gimplify_expr (tree *, tree *, tree *);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-07-26 18:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-26 18:49 Patch: FYI: remove some java-specific tree codes Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).