This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] unsharing empty_stmt_node (part 1)
- From: Diego Novillo <dnovillo at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jason Merrill <jason at redhat dot com>
- Date: Wed, 30 Apr 2003 16:23:54 -0400
- Subject: [tree-ssa] unsharing empty_stmt_node (part 1)
- Organization: Red Hat Canada
In GIMPLE empty statements are used to mark deleted code (to
avoid compacting the tree all the time). The problem is that
empty statements are shared, so our CFG code needs to twist and
contort to avoid them. This is becoming a constant source of
bugs. Particularly now that we are inlining already-optimized
function bodies.
This wouldn't happen if empty statements were first-class
elements of the IL. This patch implements that. Instead of
having a single empty_stmt_node object, it creates empty
statements every time they are needed and replaces equality
checks with IS_EMPTY_EXPR().
The patch is a bit long, but largely mechanical. It's still not
fully tested. I'm just running bootstrap with it. Jason, I'd
like you to take a look and see if this approach makes sense
before I implement part 2 (which would simplify the CFG code and
iterators to stop avoiding empty statements).
Thanks. Diego.
* tree.c (build_empty_stmt): New function.
* tree.h (IS_EMPTY_STMT): Define.
(TI_EMPTY_STMT): Remove.
(empty_stmt_node): Remove.
Replace 'X = empty_stmt_node' with 'X = build_empty_stmt ()',
and 'X == empty_stmt_node' with 'IS_EMPTY_STMT (X)' everywhere.
(build_empty_stmt): Declare.
* cp/cp-simplify.c (cp_simplify_stmt): Use IS_EMPTY_STMT.
* java/java-tree.h (build_java_empty_stmt): Declare.
* java/expr.c (build_java_empty_stmt): New function.
* java/decl.c (java_init_decl_processing): Don't build empty_stmt_node.
Replace 'X = empty_stmt_node' with 'X = build_java_empty_stmt ()',
and 'X == empty_stmt_node' with 'IS_EMPTY_STMT (X)' everwhere.
Index: c-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pretty-print.c,v
retrieving revision 1.1.4.23
diff -d -u -p -r1.1.4.23 c-pretty-print.c
--- c-pretty-print.c 5 Mar 2003 21:33:49 -0000 1.1.4.23
+++ c-pretty-print.c 30 Apr 2003 19:59:22 -0000
@@ -758,7 +758,7 @@ dump_c_node (buffer, node, spc, brief_du
output_add_character (buffer, ')');
if (!brief_dump)
{
- if (COND_EXPR_THEN (node) == empty_stmt_node)
+ if (IS_EMPTY_STMT (COND_EXPR_THEN (node)))
{
output_add_character (buffer, ';');
}
@@ -771,7 +771,7 @@ dump_c_node (buffer, node, spc, brief_du
newline_and_indent (buffer, spc+2);
output_add_character (buffer, '}');
}
- if (COND_EXPR_ELSE (node) != empty_stmt_node)
+ if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
{
newline_and_indent (buffer, spc);
output_add_string (buffer, "else");
Index: c-simplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-simplify.c,v
retrieving revision 1.1.4.50
diff -d -u -p -r1.1.4.50 c-simplify.c
--- c-simplify.c 26 Apr 2003 15:04:07 -0000 1.1.4.50
+++ c-simplify.c 30 Apr 2003 19:59:22 -0000
@@ -437,7 +437,7 @@ simplify_cleanup (stmt_p, next_p)
c_simplify_stmt (&body);
- if (body == empty_stmt_node)
+ if (IS_EMPTY_STMT (body))
{
/* If the body of a TRY_FINALLY is empty, then we can just
emit the handler without the enclosing TRY_FINALLY.
@@ -448,7 +448,7 @@ simplify_cleanup (stmt_p, next_p)
if (code == TRY_FINALLY_EXPR)
*stmt_p = cleanup;
else if (! find_reachable_label (cleanup))
- *stmt_p = empty_stmt_node;
+ *stmt_p = build_empty_stmt ();
}
else
*stmt_p = build (code, void_type_node, body, cleanup);
@@ -482,7 +482,7 @@ simplify_expr_stmt (stmt_p)
{
if (!TREE_SIDE_EFFECTS (stmt))
{
- if (stmt != empty_stmt_node
+ if (!IS_EMPTY_STMT (stmt)
&& !(TREE_CODE (stmt) == CONVERT_EXPR
&& VOID_TYPE_P (TREE_TYPE (stmt))))
warning ("statement with no effect");
@@ -625,7 +625,7 @@ simplify_c_loop (cond, body, incr, cond_
{
simplify_condition (&cond);
exit = build_bc_goto (bc_break);
- exit = build (COND_EXPR, void_type_node, cond, empty_stmt_node, exit);
+ exit = build (COND_EXPR, void_type_node, cond, build_empty_stmt (), exit);
exit = fold (exit);
}
else
@@ -967,7 +967,7 @@ simplify_stmt_expr (expr_p)
if (stmts_are_full_exprs_p ())
last_expr = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (last_expr),
last_expr);
- EXPR_STMT_EXPR (last_expr_stmt) = empty_stmt_node;
+ EXPR_STMT_EXPR (last_expr_stmt) = build_empty_stmt ();
#if defined ENABLE_CHECKING
if (!is_last_stmt_of_scope (last_expr_stmt))
abort ();
@@ -985,7 +985,7 @@ simplify_stmt_expr (expr_p)
else
substmt = body;
- if (substmt == empty_stmt_node)
+ if (IS_EMPTY_STMT (substmt))
substmt = last_expr;
else
substmt = build (COMPOUND_EXPR, TREE_TYPE (last_expr),
@@ -1193,8 +1193,7 @@ mostly_copy_tree_r (tp, walk_subtrees, d
|| TREE_CODE_CLASS (code) == 'd'
|| TREE_CODE_CLASS (code) == 'c'
|| TREE_CODE_CLASS (code) == 'b'
- || code == SAVE_EXPR
- || *tp == empty_stmt_node)
+ || code == SAVE_EXPR)
*walk_subtrees = 0;
else if (code == STMT_EXPR || code == SCOPE_STMT || code == BIND_EXPR)
/* Unsharing STMT_EXPRs doesn't make much sense; they tend to be
Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gimplify.c,v
retrieving revision 1.1.2.36
diff -d -u -p -r1.1.2.36 gimplify.c
--- gimplify.c 24 Apr 2003 19:20:05 -0000 1.1.2.36
+++ gimplify.c 30 Apr 2003 19:59:23 -0000
@@ -433,11 +433,10 @@ simplify_expr (expr_p, pre_p, post_p, si
case VA_ARG_EXPR:
break;
- case CONVERT_EXPR:
- if (*expr_p == empty_stmt_node)
+ case NOP_EXPR:
+ if (IS_EMPTY_STMT (*expr_p))
break;
- case NOP_EXPR:
if (VOID_TYPE_P (TREE_TYPE (*expr_p)))
{
/* Just strip a conversion to void and try again. */
@@ -793,7 +792,7 @@ voidify_wrapper_expr (wrapper)
else
{
temp = create_tmp_var (TREE_TYPE (wrapper), "retval");
- if (*p != empty_stmt_node)
+ if (!IS_EMPTY_STMT (*p))
*p = build (MODIFY_EXPR, TREE_TYPE (temp), temp, *p);
}
@@ -983,7 +982,7 @@ gimplify_exit_expr (expr_p, pre_p)
simplify_expr (&cond, pre_p, NULL, is_simple_condexpr, fb_rvalue);
expr = build1 (GOTO_EXPR, void_type_node, label);
- expr = build (COND_EXPR, void_type_node, cond, expr, empty_stmt_node);
+ expr = build (COND_EXPR, void_type_node, cond, expr, build_empty_stmt ());
*expr_p = expr;
}
@@ -1459,7 +1458,7 @@ simplify_cond_expr (expr_p, pre_p, targe
tree pred = TREE_OPERAND (expr, 0);
TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1);
expr = build (COND_EXPR, void_type_node, TREE_OPERAND (pred, 0),
- expr, empty_stmt_node);
+ expr, build_empty_stmt ());
}
while (TREE_CODE (TREE_OPERAND (expr, 0)) == TRUTH_ANDIF_EXPR);
@@ -1673,7 +1672,7 @@ simplify_boolean_expr (expr_p, pre_p)
if_cond = build (EQ_EXPR, TREE_TYPE (t), t, integer_zero_node);
if_stmt = build (COND_EXPR, void_type_node, if_cond, if_body,
- empty_stmt_node);
+ build_empty_stmt ());
/* Simplify the IF_STMT and insert it in the PRE_P chain. */
simplify_stmt (&if_stmt);
add_tree (if_stmt, pre_p);
@@ -2177,8 +2176,7 @@ mostly_copy_tree_r (tp, walk_subtrees, d
enum tree_code code = TREE_CODE (*tp);
/* Don't unshare types and SAVE_EXPR nodes. */
if (TREE_CODE_CLASS (code) == 't'
- || code == SAVE_EXPR
- || *tp == empty_stmt_node)
+ || code == SAVE_EXPR)
*walk_subtrees = 0;
else if (code == BIND_EXPR)
abort ();
@@ -2264,7 +2262,7 @@ simplify_cleanup_point_expr (expr_p, pre
if (TREE_CODE (*container) == COMPOUND_EXPR)
next = TREE_OPERAND (*container, 1);
else
- next = empty_stmt_node;
+ next = build_empty_stmt ();
tfe = build (TRY_FINALLY_EXPR, void_type_node,
next, TREE_OPERAND (wce, 1));
@@ -2350,7 +2348,8 @@ gimple_push_cleanup (cleanup, pre_p)
tree flag = create_tmp_var (integer_type_node, "cleanup");
tree ffalse = build (MODIFY_EXPR, void_type_node, flag, integer_zero_node);
tree ftrue = build (MODIFY_EXPR, void_type_node, flag, integer_one_node);
- cleanup = build (COND_EXPR, void_type_node, flag, cleanup, empty_stmt_node);
+ cleanup = build (COND_EXPR, void_type_node, flag, cleanup,
+ build_empty_stmt ());
wce = build (WITH_CLEANUP_EXPR, void_type_node, NULL_TREE,
cleanup, NULL_TREE);
add_tree (ffalse, &gimplify_ctxp->conditional_cleanups);
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.78
diff -d -u -p -r1.1.4.78 tree-cfg.c
--- tree-cfg.c 29 Apr 2003 16:48:01 -0000 1.1.4.78
+++ tree-cfg.c 30 Apr 2003 19:59:23 -0000
@@ -209,7 +209,7 @@ build_tree_cfg (fnbody)
non-executable statements at the start of the function. Otherwise
we'll end up with an empty basic block 0, which is useless. */
- if (fnbody == empty_stmt_node || TREE_CODE (fnbody) != BIND_EXPR)
+ if (IS_EMPTY_STMT (fnbody) || TREE_CODE (fnbody) != BIND_EXPR)
{
timevar_pop (TV_TREE_CFG);
return;
@@ -282,7 +282,7 @@ make_blocks (first_p, next_block_link, p
bool start_new_block;
if (first_p == NULL
- || *first_p == empty_stmt_node
+ || IS_EMPTY_STMT (*first_p)
|| *first_p == error_mark_node)
return NULL;
@@ -295,7 +295,7 @@ make_blocks (first_p, next_block_link, p
tree *stmt_p = tsi_container (i);
/* Ignore empty containers. */
- if (*stmt_p == empty_stmt_node || *stmt_p == error_mark_node)
+ if (IS_EMPTY_STMT (*stmt_p) || *stmt_p == error_mark_node)
continue;
prev_stmt = stmt;
@@ -807,7 +807,7 @@ set_parent_stmt (stmt_p, parent_stmt)
ann->parent_stmt = parent_stmt;
t = (TREE_CODE (t) == COMPOUND_EXPR) ? TREE_OPERAND (t, 0) : NULL_TREE;
}
- while (t && t != empty_stmt_node);
+ while (t && ! IS_EMPTY_STMT (t));
}
@@ -1756,7 +1756,7 @@ bsi_remove (i)
remove_stmt (&TREE_OPERAND (t, 0));
/* If both operands are empty, delete the whole COMPOUND_EXPR. */
- if (TREE_OPERAND (t, 1) == empty_stmt_node)
+ if (IS_EMPTY_STMT (TREE_OPERAND (t, 1)))
remove_stmt (i->tp);
}
else
@@ -1808,17 +1808,17 @@ remove_stmt (stmt_p)
FIXME: We should probably traverse all the def-use edges originating at
this statement to update each use of the definitions made here, but
that is expensive and can easily be checked by every pass by
- checking if SSA_NAME_DEF_STMT is empty_stmt_node. */
+ checking if SSA_NAME_DEF_STMT is a nop. */
def_p = def_op (stmt);
if (def_p && TREE_CODE (*def_p) == SSA_NAME)
- SSA_NAME_DEF_STMT (*def_p) = empty_stmt_node;
+ SSA_NAME_DEF_STMT (*def_p) = build_empty_stmt ();
vdefs = vdef_ops (stmt);
for (i = 0; vdefs && i < VARRAY_ACTIVE_SIZE (vdefs); i++)
{
tree vdef = VDEF_RESULT (VARRAY_TREE (vdefs, i));
if (TREE_CODE (vdef) == SSA_NAME)
- SSA_NAME_DEF_STMT (vdef) = empty_stmt_node;
+ SSA_NAME_DEF_STMT (vdef) = build_empty_stmt ();
}
stmt->common.ann = NULL;
@@ -1836,8 +1836,8 @@ remove_stmt (stmt_p)
&& TREE_OPERAND (stmt, 1)->common.ann->common.type == TREE_ANN_COMMON)
TREE_OPERAND (stmt, 1)->common.ann = NULL;
- /* Replace STMT with empty_stmt_node. */
- *stmt_p = empty_stmt_node;
+ /* Replace STMT with an empty statement. */
+ *stmt_p = build_empty_stmt ();
}
@@ -2817,7 +2817,7 @@ first_exec_block (entry_p)
{
tree *exec_p;
- if (entry_p == NULL || *entry_p == empty_stmt_node)
+ if (entry_p == NULL || IS_EMPTY_STMT (*entry_p))
return NULL;
exec_p = first_exec_stmt (entry_p);
@@ -2868,8 +2868,8 @@ first_stmt (bb)
/* Return the last statement in basic block BB, stripped of any NOP
containers.
- empty_stmt_nodes are never returned. NULL is returned if there are no
- such statements. */
+ empty statement nodes are never returned. NULL is returned if there are
+ no such statements. */
tree
last_stmt (bb)
@@ -2961,7 +2961,7 @@ bsi_init (tp, bb)
}
/* Similar to tsi_step() but stops at basic block boundaries and ignores
- empty_stmt_nodes inside a basic block. */
+ empty statement nodes inside a basic block. */
void
bsi_next_in_bb (i, bb)
@@ -3029,7 +3029,7 @@ bsi_next_in_bb (i, bb)
}
/* Similar to tsi_start() but initializes the iterator at the first
- statement in basic block BB which isn't an empty_stmt_node.
+ statement in basic block BB which isn't an empty statement node.
NULL is returned if there are no such statements. */
@@ -3083,7 +3083,7 @@ bsi_last (bb)
b = bsi_init (bb->end_tree_p, bb);
/* If the last stmt pointer isn't something a BSI can represent (ie, an
- empty_stmt_node), then find the last stmt the slow way. */
+ empty statement node), then find the last stmt the slow way. */
if (b.tp == NULL)
{
for (tmp = b = bsi_start (bb); !bsi_end_p (tmp); bsi_next (&tmp))
@@ -3182,7 +3182,7 @@ set_bb_for_stmt (t, bb)
{
stmt_ann_t ann;
- if (t == empty_stmt_node)
+ if (IS_EMPTY_STMT (t))
return;
do
@@ -3200,7 +3200,7 @@ set_bb_for_stmt (t, bb)
ann->bb = bb;
t = (TREE_CODE (t) == COMPOUND_EXPR) ? TREE_OPERAND (t, 0) : NULL_TREE;
}
- while (t && t != empty_stmt_node);
+ while (t && !IS_EMPTY_STMT (t));
}
@@ -3347,18 +3347,18 @@ bsi_insert_after (curr_bsi, t, mode)
{
curr_stmt = NULL_TREE;
parent = NULL_TREE;
+
/* bsi_start () will initialize the context pointer to the basic block
if the the block is completely devoid of instructions, except
- for possibnly an empty_stmt_node. */
+ for possibly an empty statement node. */
if (curr_bsi->tp == NULL && curr_bsi->context != NULL)
curr_bb = (basic_block)(curr_bsi->context);
else
abort ();
}
- /* Some blocks are empty. The block iterator points to an empty_stmt_node
- in those cases only. */
-
+ /* Some blocks are empty. The block iterator points to an empty statement
+ node in those cases only. */
if (curr_stmt == NULL_TREE)
{
/* An empty block should have only one successor, so try to find the
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.102
diff -d -u -p -r1.1.4.102 tree-dfa.c
--- tree-dfa.c 30 Apr 2003 16:30:59 -0000 1.1.4.102
+++ tree-dfa.c 30 Apr 2003 19:59:24 -0000
@@ -197,7 +197,7 @@ get_stmt_operands (stmt)
stmt_ann_t ann;
voperands_t prev_vops = NULL;
- if (stmt == error_mark_node || stmt == empty_stmt_node)
+ if (stmt == error_mark_node || IS_EMPTY_STMT (stmt))
return;
STRIP_NOPS (stmt);
@@ -1088,7 +1088,7 @@ compute_immediate_uses_for (stmt, flags)
for (i = 0; i < PHI_NUM_ARGS (stmt); i++)
{
tree imm_rdef_stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF (stmt, i));
- if (imm_rdef_stmt != empty_stmt_node)
+ if (!IS_EMPTY_STMT (imm_rdef_stmt))
add_immediate_use (imm_rdef_stmt, stmt);
}
return;
@@ -1104,7 +1104,7 @@ compute_immediate_uses_for (stmt, flags)
{
tree *use_p = VARRAY_GENERIC_PTR (ops, i);
tree imm_rdef_stmt = SSA_NAME_DEF_STMT (*use_p);
- if (imm_rdef_stmt != empty_stmt_node)
+ if (!IS_EMPTY_STMT (imm_rdef_stmt))
add_immediate_use (imm_rdef_stmt, stmt);
}
}
@@ -1116,7 +1116,7 @@ compute_immediate_uses_for (stmt, flags)
{
tree vuse = VARRAY_TREE (ops, i);
tree imm_rdef_stmt = SSA_NAME_DEF_STMT (vuse);
- if (imm_rdef_stmt != empty_stmt_node)
+ if (!IS_EMPTY_STMT (imm_rdef_stmt))
add_immediate_use (imm_rdef_stmt, stmt);
}
}
@@ -1206,8 +1206,8 @@ create_stmt_ann (t)
stmt_ann_t ann;
#if defined ENABLE_CHECKING
- if (t == empty_stmt_node
- || t == NULL_TREE
+ if (t == NULL_TREE
+ || IS_EMPTY_STMT (t)
|| TREE_CODE_CLASS (TREE_CODE (t)) == 'c'
|| TREE_CODE_CLASS (TREE_CODE (t)) == 't')
abort ();
Index: tree-flow-inline.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-flow-inline.h,v
retrieving revision 1.1.2.34
diff -d -u -p -r1.1.2.34 tree-flow-inline.h
--- tree-flow-inline.h 15 Apr 2003 19:44:49 -0000 1.1.2.34
+++ tree-flow-inline.h 30 Apr 2003 19:59:24 -0000
@@ -379,8 +379,9 @@ block_stmt_iterator i;
return (i.tp == NULL || bsi_stmt (i) == NULL_TREE);
}
-/* Similar to tsi_next() but stops at basic block boundaries. Assumes stmt
- has bb_for_stmt() set (can't be an empty_stmt_node). */
+/* Similar to tsi_next() but stops at basic block boundaries. Assumes stmt
+ has bb_for_stmt() set (can't be an empty statement node). */
+
static inline void
bsi_next (i)
block_stmt_iterator *i;
@@ -417,7 +418,7 @@ bsi_stmt (i)
{
tree t = *(bsi_stmt_ptr (i));
STRIP_NOPS (t);
- if (t == empty_stmt_node || t == error_mark_node)
+ if (IS_EMPTY_STMT (t) || t == error_mark_node)
t = NULL_TREE;
return t;
}
@@ -442,7 +443,7 @@ static inline bool
is_exec_stmt (t)
tree t;
{
- return (t && t != empty_stmt_node && t != error_mark_node);
+ return (t && !IS_EMPTY_STMT (t) && t != error_mark_node);
}
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.26.2.26
diff -d -u -p -r1.26.2.26 tree-inline.c
--- tree-inline.c 16 Apr 2003 15:26:00 -0000 1.26.2.26
+++ tree-inline.c 30 Apr 2003 19:59:24 -0000
@@ -1627,10 +1627,8 @@ copy_tree_r (tp, walk_subtrees, data)
{
enum tree_code code = TREE_CODE (*tp);
- /* We make copies of most nodes, except empty_stmt_node. */
- if (*tp == empty_stmt_node)
- *walk_subtrees = 0;
- else if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
+ /* We make copies of most nodes. */
+ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
|| TREE_CODE_CLASS (code) == 'r'
|| TREE_CODE_CLASS (code) == 'c'
|| TREE_CODE_CLASS (code) == 's'
Index: tree-iterator.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-iterator.h,v
retrieving revision 1.1.2.2
diff -d -u -p -r1.1.2.2 tree-iterator.h
--- tree-iterator.h 10 Mar 2003 17:38:31 -0000 1.1.2.2
+++ tree-iterator.h 30 Apr 2003 19:59:24 -0000
@@ -115,7 +115,7 @@ tsi_stmt (i)
{
tree t = *(tsi_stmt_ptr (i));
STRIP_NOPS (t);
- if (t == empty_stmt_node || t == error_mark_node)
+ if (IS_EMPTY_STMT (t) || t == error_mark_node)
t = NULL_TREE;
return t;
}
Index: tree-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-pretty-print.c,v
retrieving revision 1.1.2.22
diff -d -u -p -r1.1.2.22 tree-pretty-print.c
--- tree-pretty-print.c 9 Apr 2003 19:27:40 -0000 1.1.2.22
+++ tree-pretty-print.c 30 Apr 2003 19:59:25 -0000
@@ -155,7 +155,7 @@ dump_generic_node (buffer, node, spc, fl
if (node == NULL_TREE)
return spc;
- if (node != empty_stmt_node && node != error_mark_node)
+ if (!IS_EMPTY_STMT (node) && node != error_mark_node)
{
basic_block curr_bb = bb_for_stmt (node);
@@ -703,7 +703,7 @@ dump_generic_node (buffer, node, spc, fl
output_add_character (buffer, ')');
if (!(flags & TDF_SLIM))
{
- if (COND_EXPR_THEN (node) == empty_stmt_node)
+ if (IS_EMPTY_STMT (COND_EXPR_THEN (node)))
{
output_add_character (buffer, ';');
}
@@ -717,7 +717,7 @@ dump_generic_node (buffer, node, spc, fl
newline_and_indent (buffer, spc+2);
output_add_character (buffer, '}');
}
- if (COND_EXPR_ELSE (node) != empty_stmt_node)
+ if (!IS_EMPTY_STMT (COND_EXPR_ELSE (node)))
{
newline_and_indent (buffer, spc);
output_add_string (buffer, "else");
Index: tree-simple.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-simple.c,v
retrieving revision 1.1.4.32
diff -d -u -p -r1.1.4.32 tree-simple.c
--- tree-simple.c 16 Apr 2003 15:36:26 -0000 1.1.4.32
+++ tree-simple.c 30 Apr 2003 19:59:25 -0000
@@ -887,7 +887,7 @@ rationalize_compound_expr (top)
tree top;
{
if (top == NULL_TREE)
- top = empty_stmt_node;
+ top = build_empty_stmt ();
else if (TREE_CODE (top) == COMPOUND_EXPR)
top = right_assocify_expr (top);
Index: tree-ssa-dce.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dce.c,v
retrieving revision 1.1.2.33
diff -d -u -p -r1.1.2.33 tree-ssa-dce.c
--- tree-ssa-dce.c 15 Apr 2003 19:44:50 -0000 1.1.2.33
+++ tree-ssa-dce.c 30 Apr 2003 19:59:25 -0000
@@ -117,7 +117,7 @@ mark_tree_necessary (t)
void **slot;
if (t == NULL
- || t == empty_stmt_node
+ || IS_EMPTY_STMT (t)
|| t == error_mark_node
|| necessary_p (t))
return 0;
Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-pre.c,v
retrieving revision 1.1.4.52
diff -d -u -p -r1.1.4.52 tree-ssa-pre.c
--- tree-ssa-pre.c 23 Apr 2003 20:01:17 -0000 1.1.4.52
+++ tree-ssa-pre.c 30 Apr 2003 19:59:25 -0000
@@ -355,7 +355,7 @@ okay_injuring_def (inj, var)
1. aren't empty statements.
2. aren't phi nodes.
3. contain a use of VAR on the RHS. */
- if (!inj || inj == empty_stmt_node
+ if (!inj || IS_EMPTY_STMT (inj)
|| TREE_CODE (inj) == PHI_NODE
|| !maybe_find_rhs_use_for_var (inj, var))
return false;
@@ -369,7 +369,7 @@ is_injuring_def (ei, inj)
tree inj;
{
/* Things that are never injuring definitions. */
- if (!inj || inj == empty_stmt_node || TREE_CODE (inj) == PHI_NODE)
+ if (!inj || IS_EMPTY_STMT (inj) || TREE_CODE (inj) == PHI_NODE)
return false;
/* Things we can't handle. */
@@ -872,8 +872,8 @@ defs_match_p (ei, t1uses, t2)
use2 = factor_through_injuries (ei, use2, SSA_NAME_VAR (use2));
}
- if (SSA_NAME_DEF_STMT (use1) == empty_stmt_node
- || SSA_NAME_DEF_STMT (use2) == empty_stmt_node)
+ if (IS_EMPTY_STMT (SSA_NAME_DEF_STMT (use1))
+ || IS_EMPTY_STMT (SSA_NAME_DEF_STMT (use2)))
return false;
if (SSA_NAME_DEF_STMT (use1) != SSA_NAME_DEF_STMT (use2))
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.71
diff -d -u -p -r1.1.4.71 tree-ssa.c
--- tree-ssa.c 29 Apr 2003 21:26:13 -0000 1.1.4.71
+++ tree-ssa.c 30 Apr 2003 19:59:26 -0000
@@ -2321,7 +2321,7 @@ get_reaching_def (var)
default definition for it. */
if (currdef_var == NULL_TREE)
{
- default_def = make_ssa_name (var, empty_stmt_node);
+ default_def = make_ssa_name (var, build_empty_stmt ());
set_value_for (var, default_def, currdefs);
}
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.263.2.28
diff -d -u -p -r1.263.2.28 tree.c
--- tree.c 9 Apr 2003 19:27:40 -0000 1.263.2.28
+++ tree.c 30 Apr 2003 19:59:26 -0000
@@ -4729,9 +4729,6 @@ build_common_tree_nodes_2 (short_double)
TYPE_ALIGN (void_type_node) = BITS_PER_UNIT;
TYPE_USER_ALIGN (void_type_node) = 0;
- /* Used in the tree IR to represent empty statements and blocks. */
- empty_stmt_node = build1 (CONVERT_EXPR, void_type_node, size_zero_node);
-
null_pointer_node = build_int_2 (0, 0);
TREE_TYPE (null_pointer_node) = build_pointer_type (void_type_node);
layout_type (TREE_TYPE (null_pointer_node));
@@ -4924,8 +4921,8 @@ make_phi_node (var, len)
}
-/* Return an SSA_NAME node for variable VAR defined in statement STMT. STMT
- may be empty_stmt_node for artificial references (e.g., default
+/* Return an SSA_NAME node for variable VAR defined in statement STMT.
+ STMT may be an empty statement for artificial references (e.g., default
definitions created when a variable is used without a preceding
definition. See currdef_for.) */
@@ -4945,7 +4942,7 @@ make_ssa_name (var, stmt)
&& TREE_CODE (stmt) != ASM_EXPR
&& TREE_CODE (stmt) != RETURN_EXPR
&& TREE_CODE (stmt) != PHI_NODE
- && stmt != empty_stmt_node))
+ && !IS_EMPTY_STMT (stmt)))
abort ();
#endif
@@ -4976,6 +4973,14 @@ build_vdef_expr (var)
}
+/* Build an empty statement. */
+
+tree
+build_empty_stmt (void)
+{
+ return build1 (NOP_EXPR, void_type_node, size_zero_node);
+}
+
/* Links a stmt before the current stmt. */
@@ -5063,10 +5068,10 @@ tsi_delink (i)
/* This stmt is the last link in the CE chain, but we're screwed because
there isn't access to the node itself. the choices are either adding a
NULL link to the right side of the CE node, which is bad, or replacing
- this node with an empty_stmt_node. Choose the latter for now, and
+ this node with an empty statement. Choose the latter for now, and
make the iterator return NULL, so that no further iterating takes
place. */
- *(i->tp) = empty_stmt_node;
+ *(i->tp) = build_empty_stmt ();
i->tp = NULL;
}
}
@@ -5112,7 +5117,7 @@ body_is_empty (t)
{
tree_stmt_iterator i;
- if (t == empty_stmt_node)
+ if (IS_EMPTY_STMT (t))
return true;
for (i = tsi_start (&t); !tsi_end_p (i); tsi_next (&i))
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.342.2.59
diff -d -u -p -r1.342.2.59 tree.h
--- tree.h 28 Apr 2003 03:36:57 -0000 1.342.2.59
+++ tree.h 30 Apr 2003 19:59:27 -0000
@@ -899,6 +899,10 @@ struct tree_vec GTY(())
/* Define fields and accessors for some nodes that represent expressions. */
+/* Non-zero if NODE is an emtpy statement (NOP_EXPR <0>). */
+#define IS_EMPTY_STMT(NODE) (TREE_CODE (NODE) == NOP_EXPR \
+ && TREE_OPERAND (NODE, 0) == size_zero_node)
+
/* In a SAVE_EXPR node. */
#define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND (SAVE_EXPR_CHECK (NODE), 1)
#define SAVE_EXPR_RTL(NODE) (*(rtx *) &SAVE_EXPR_CHECK (NODE)->exp.operands[2])
@@ -2256,8 +2260,6 @@ enum tree_index
TI_SIZE_ZERO,
TI_SIZE_ONE,
- TI_EMPTY_STMT,
-
TI_BITSIZE_ZERO,
TI_BITSIZE_ONE,
TI_BITSIZE_UNIT,
@@ -2336,8 +2338,6 @@ extern GTY(()) tree global_trees[TI_MAX]
#define bitsize_one_node global_trees[TI_BITSIZE_ONE]
#define bitsize_unit_node global_trees[TI_BITSIZE_UNIT]
-#define empty_stmt_node global_trees[TI_EMPTY_STMT]
-
/* Base access nodes. */
#define access_public_node NULL_TREE
#define access_protected_node size_zero_node
@@ -2555,6 +2555,7 @@ extern tree build_tree_list PARAMS ((tr
extern tree build_decl PARAMS ((enum tree_code, tree, tree));
extern tree build_block PARAMS ((tree, tree, tree, tree, tree));
extern void annotate_with_file_line PARAMS ((tree, const char *, int));
+extern tree build_empty_stmt (void);
/* Construct various nodes representing data types. */
Index: cp/cp-simplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/Attic/cp-simplify.c,v
retrieving revision 1.1.4.11
diff -d -u -p -r1.1.4.11 cp-simplify.c
--- cp/cp-simplify.c 3 Apr 2003 03:11:13 -0000 1.1.4.11
+++ cp/cp-simplify.c 30 Apr 2003 19:59:28 -0000
@@ -61,7 +61,7 @@ cp_simplify_stmt (stmt_p, next_p)
case USING_STMT:
/* Just ignore for now. Eventually we will want to pass this on to
the debugger. */
- *stmt_p = empty_stmt_node;
+ *stmt_p = build_empty_stmt ();
return 1;
default:
Index: java/check-init.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/check-init.c,v
retrieving revision 1.42.2.3
diff -d -u -p -r1.42.2.3 check-init.c
--- java/check-init.c 3 Feb 2003 17:09:19 -0000 1.42.2.3
+++ java/check-init.c 30 Apr 2003 19:59:28 -0000
@@ -770,7 +770,7 @@ check_init (tree exp, words before)
break;
case NOP_EXPR:
- if (exp == empty_stmt_node)
+ if (IS_EMPTY_STMT (exp))
break;
/* ... else fall through ... */
case UNARY_PLUS_EXPR:
@@ -891,7 +891,7 @@ check_init (tree exp, words before)
tree saved_wfl = wfl;
tree body = EXPR_WFL_NODE (exp);
int saved_lineno = lineno;
- if (body == empty_stmt_node)
+ if (IS_EMPTY_STMT (body))
break;
wfl = exp;
input_filename = EXPR_WFL_FILENAME (exp);
Index: java/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.128.2.12
diff -d -u -p -r1.128.2.12 decl.c
--- java/decl.c 2 Mar 2003 19:59:11 -0000 1.128.2.12
+++ java/decl.c 30 Apr 2003 19:59:28 -0000
@@ -479,10 +479,6 @@ java_init_decl_processing (void)
null_pointer_node = build_int_2 (0, 0);
TREE_TYPE (null_pointer_node) = ptr_type_node;
- /* Used by the parser to represent empty statements and blocks. */
- empty_stmt_node = build1 (NOP_EXPR, void_type_node, size_zero_node);
- CAN_COMPLETE_NORMALLY (empty_stmt_node) = 1;
-
#if 0
/* Make a type to be the domain of a few array types
whose domains don't really matter.
Index: java/expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/expr.c,v
retrieving revision 1.147.2.11
diff -d -u -p -r1.147.2.11 expr.c
--- java/expr.c 9 Apr 2003 19:28:42 -0000 1.147.2.11
+++ java/expr.c 30 Apr 2003 19:59:29 -0000
@@ -703,7 +703,7 @@ java_check_reference (tree expr, int che
build (CALL_EXPR, void_type_node,
build_address_of (soft_nullpointer_node),
NULL_TREE, NULL_TREE),
- empty_stmt_node);
+ build_java_empty_stmt ());
expr = build (COMPOUND_EXPR, TREE_TYPE (expr), cond, expr);
}
@@ -3443,5 +3443,16 @@ build_expr_wfl (node, file, line, col)
return wfl;
}
-#include "gt-java-expr.h"
+
+/* Build a node to represent empty statements and blocks. */
+
+tree
+build_java_empty_stmt (void)
+{
+ tree t = build_empty_stmt ();
+ CAN_COMPLETE_NORMALLY (t) = 1;
+ return t;
+}
+
+#include "gt-java-expr.h"
Index: java/java-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-tree.h,v
retrieving revision 1.153.2.13
diff -d -u -p -r1.153.2.13 java-tree.h
--- java/java-tree.h 2 Mar 2003 19:59:12 -0000 1.153.2.13
+++ java/java-tree.h 30 Apr 2003 19:59:31 -0000
@@ -1297,7 +1297,7 @@ extern void compile_resource_data (char
extern void write_resource_constructor (void);
extern void compile_resource_file (char *name, const char *filename);
extern void init_resource_processing (void);
-
+extern tree build_java_empty_stmt (void);
#define DECL_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
Index: java/jcf-write.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jcf-write.c,v
retrieving revision 1.107.2.9
diff -d -u -p -r1.107.2.9 jcf-write.c
--- java/jcf-write.c 9 Apr 2003 19:28:43 -0000 1.107.2.9
+++ java/jcf-write.c 30 Apr 2003 19:59:31 -0000
@@ -1418,7 +1418,7 @@ generate_bytecode_insns (tree exp, int t
const char *saved_input_filename = input_filename;
tree body = EXPR_WFL_NODE (exp);
int saved_lineno = lineno;
- if (body == empty_stmt_node)
+ if (IS_EMPTY_STMT (body))
break;
input_filename = EXPR_WFL_FILENAME (exp);
lineno = EXPR_WFL_LINENO (exp);
@@ -1763,7 +1763,7 @@ generate_bytecode_insns (tree exp, int t
case RETURN_EXPR:
exp = TREE_OPERAND (exp, 0);
if (exp == NULL_TREE)
- exp = empty_stmt_node;
+ exp = build_java_empty_stmt ();
else if (TREE_CODE (exp) != MODIFY_EXPR)
abort ();
else
Index: java/parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.387.2.19
diff -d -u -p -r1.387.2.19 parse.y
--- java/parse.y 9 Apr 2003 19:28:43 -0000 1.387.2.19
+++ java/parse.y 30 Apr 2003 19:59:33 -0000
@@ -904,7 +904,7 @@ class_body_declaration:
| constructor_declaration
| block /* Added, JDK1.1, instance initializer */
{
- if ($1 != empty_stmt_node)
+ if (!IS_EMPTY_STMT ($1))
{
TREE_CHAIN ($1) = CPC_INSTANCE_INITIALIZER_STMT (ctxp);
SET_CPC_INSTANCE_INITIALIZER_STMT (ctxp, $1);
@@ -1192,7 +1192,7 @@ constructor_body:
addition (super invocation and field initialization) */
block_begin constructor_block_end
{
- BLOCK_EXPR_BODY ($2) = empty_stmt_node;
+ BLOCK_EXPR_BODY ($2) = build_java_empty_stmt ();
$$ = $2;
}
| block_begin explicit_constructor_invocation constructor_block_end
@@ -1355,7 +1355,7 @@ block:
if (current_function_decl && flag_emit_xref)
DECL_END_SOURCE_LINE (current_function_decl) =
EXPR_WFL_ADD_COL ($2.location, 1);
- $$ = empty_stmt_node;
+ $$ = build_java_empty_stmt ();
}
| block_begin block_statements block_end
{ $$ = $3; }
@@ -1376,7 +1376,7 @@ block_end:
EXPR_WFL_ADD_COL ($1.location, 1);
$$ = exit_block ();
if (!BLOCK_SUBBLOCKS ($$))
- BLOCK_SUBBLOCKS ($$) = empty_stmt_node;
+ BLOCK_SUBBLOCKS ($$) = build_java_empty_stmt ();
}
;
@@ -1455,7 +1455,7 @@ empty_statement:
EXPR_WFL_SET_LINECOL (wfl_operator, lineno, -1);
parse_warning_context (wfl_operator, "An empty declaration is a deprecated feature that should not be used");
}
- $$ = empty_stmt_node;
+ $$ = build_java_empty_stmt ();
}
;
@@ -1698,7 +1698,7 @@ for_statement:
$$ = finish_for_loop (0, NULL_TREE, $4, $6);
/* We have not condition, so we get rid of the EXIT_EXPR */
LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) =
- empty_stmt_node;
+ build_java_empty_stmt ();
}
| for_begin SC_TK error
{yyerror ("Invalid control expression"); RECOVER;}
@@ -1716,7 +1716,7 @@ for_statement_nsi:
$$ = finish_for_loop (0, NULL_TREE, $4, $6);
/* We have not condition, so we get rid of the EXIT_EXPR */
LOOP_EXPR_BODY_CONDITION_EXPR (LOOP_EXPR_BODY ($$), 0) =
- empty_stmt_node;
+ build_java_empty_stmt ();
}
;
@@ -1747,7 +1747,7 @@ for_begin:
}
;
for_init: /* Can be empty */
- { $$ = empty_stmt_node; }
+ { $$ = build_java_empty_stmt (); }
| statement_expression_list
{
/* Init statement recorded within the previously
@@ -1765,7 +1765,7 @@ for_init: /* Can be empty */
;
for_update: /* Can be empty */
- {$$ = empty_stmt_node;}
+ {$$ = build_java_empty_stmt ();}
| statement_expression_list
{ $$ = build_debugable_stmt (BUILD_LOCATION (), $1); }
;
@@ -2974,7 +2974,7 @@ parse_jdk1_1_error (const char *msg)
{
sorry (": `%s' JDK1.1(TM) feature", msg);
java_error_count++;
- return empty_stmt_node;
+ return build_java_empty_stmt ();
}
static int do_warning = 0;
@@ -7369,7 +7369,7 @@ source_end_java_method (void)
/* Turn function bodies with only a NOP expr null, so they don't get
generated at all and we won't get warnings when using the -W
-Wall flags. */
- if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) == empty_stmt_node)
+ if (IS_EMPTY_STMT (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))))
BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE;
/* We've generated all the trees for this function, and it has been
@@ -7728,7 +7728,7 @@ maybe_generate_pre_expand_clinit (tree c
/* We build the assignment expression that will initialize the
field to its value. There are strict rules on static
initializers (8.5). FIXME */
- if (TREE_CODE (stmt) != BLOCK && stmt != empty_stmt_node)
+ if (TREE_CODE (stmt) != BLOCK && !IS_EMPTY_STMT (stmt))
stmt = build_debugable_stmt (EXPR_WFL_LINECOL (stmt), stmt);
java_method_add_stmt (mdecl, stmt);
}
@@ -7822,7 +7822,7 @@ maybe_yank_clinit (tree mdecl)
bbody = BLOCK_EXPR_BODY (bbody);
else
return 0;
- if (bbody && ! flag_emit_class_files && bbody != empty_stmt_node)
+ if (bbody && ! flag_emit_class_files && !IS_EMPTY_STMT (bbody))
return 0;
type = DECL_CONTEXT (mdecl);
@@ -7856,7 +7856,7 @@ maybe_yank_clinit (tree mdecl)
/* Now we analyze the method body and look for something that
isn't a MODIFY_EXPR */
- if (bbody != empty_stmt_node && analyze_clinit_body (type, bbody))
+ if (!IS_EMPTY_STMT (bbody) && analyze_clinit_body (type, bbody))
return 0;
/* Get rid of <clinit> in the class' list of methods */
@@ -8791,7 +8791,7 @@ fix_constructors (tree mdecl)
{
compound = add_stmt_to_compound (compound, NULL_TREE,
TREE_OPERAND (found_call, 0));
- TREE_OPERAND (found_call, 0) = empty_stmt_node;
+ TREE_OPERAND (found_call, 0) = build_java_empty_stmt ();
}
DECL_INIT_CALLS_THIS (mdecl) = invokes_this;
@@ -10748,7 +10748,7 @@ patch_invoke (tree patch, tree method, t
tree save = save_expr (force_evaluation_order (patch));
tree type = TREE_TYPE (patch);
- patch = build (COMPOUND_EXPR, type, save, empty_stmt_node);
+ patch = build (COMPOUND_EXPR, type, save, build_java_empty_stmt ());
list = tree_cons (method, patch,
DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND (fndecl));
@@ -11532,12 +11532,12 @@ java_complete_lhs (tree node)
long blocks. */
ptr = &BLOCK_EXPR_BODY (node);
while (TREE_CODE (*ptr) == COMPOUND_EXPR
- && TREE_OPERAND (*ptr, 1) != empty_stmt_node)
+ && !IS_EMPTY_STMT (TREE_OPERAND (*ptr, 1)))
{
tree cur = java_complete_tree (TREE_OPERAND (*ptr, 0));
tree *next = &TREE_OPERAND (*ptr, 1);
TREE_OPERAND (*ptr, 0) = cur;
- if (cur == empty_stmt_node)
+ if (IS_EMPTY_STMT (cur))
{
/* Optimization; makes it easier to detect empty bodies.
Most useful for <clinit> with all-constant initializer. */
@@ -11596,9 +11596,9 @@ java_complete_lhs (tree node)
case TRY_FINALLY_EXPR:
COMPLETE_CHECK_OP_0 (node);
COMPLETE_CHECK_OP_1 (node);
- if (TREE_OPERAND (node, 0) == empty_stmt_node)
+ if (IS_EMPTY_STMT (TREE_OPERAND (node, 0)))
return TREE_OPERAND (node, 1);
- if (TREE_OPERAND (node, 1) == empty_stmt_node)
+ if (IS_EMPTY_STMT (TREE_OPERAND (node, 1)))
return TREE_OPERAND (node, 0);
CAN_COMPLETE_NORMALLY (node)
= (CAN_COMPLETE_NORMALLY (TREE_OPERAND (node, 0))
@@ -11613,7 +11613,7 @@ java_complete_lhs (tree node)
TREE_TYPE (node) = void_type_node;
POP_LABELED_BLOCK ();
- if (LABELED_BLOCK_BODY (node) == empty_stmt_node)
+ if (IS_EMPTY_STMT (LABELED_BLOCK_BODY (node)))
{
LABELED_BLOCK_BODY (node) = NULL_TREE;
CAN_COMPLETE_NORMALLY (node) = 1;
@@ -11769,7 +11769,7 @@ java_complete_lhs (tree node)
wfl_op2 = TREE_OPERAND (node, 1);
TREE_OPERAND (node, 0) = nn =
java_complete_tree (TREE_OPERAND (node, 0));
- if (wfl_op2 == empty_stmt_node)
+ if (IS_EMPTY_STMT (wfl_op2))
CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (nn);
else
{
@@ -11840,7 +11840,7 @@ java_complete_lhs (tree node)
EXPR_WFL_NODE (node) = body;
TREE_SIDE_EFFECTS (node) = TREE_SIDE_EFFECTS (body);
CAN_COMPLETE_NORMALLY (node) = CAN_COMPLETE_NORMALLY (body);
- if (body == empty_stmt_node || TREE_CONSTANT (body))
+ if (IS_EMPTY_STMT (body) || TREE_CONSTANT (body))
{
/* Makes it easier to constant fold, detect empty bodies. */
return body;
@@ -11969,7 +11969,7 @@ java_complete_lhs (tree node)
else
DECL_INITIAL (nn) = TREE_OPERAND (node, 1);
DECL_FIELD_FINAL_IUD (nn) = 1;
- return empty_stmt_node;
+ return build_java_empty_stmt ();
}
}
if (! flag_emit_class_files)
@@ -12413,14 +12413,14 @@ build_wfl_wrap (tree node, int location)
return wfl;
}
-/* Build a super() constructor invocation. Returns empty_stmt_node if
+/* Build a super() constructor invocation. Returns an empty statement if
we're currently dealing with the class java.lang.Object. */
static tree
build_super_invocation (tree mdecl)
{
if (DECL_CONTEXT (mdecl) == object_type_node)
- return empty_stmt_node;
+ return build_java_empty_stmt ();
else
{
tree super_wfl = build_wfl_node (super_identifier_node);
@@ -14732,7 +14732,7 @@ build_if_else_statement (int location, t
{
tree node;
if (!else_body)
- else_body = empty_stmt_node;
+ else_body = build_java_empty_stmt ();
node = build (COND_EXPR, NULL_TREE, expression, if_body, else_body);
EXPR_WFL_LINECOL (node) = location;
node = build_debugable_stmt (location, node);
@@ -14769,7 +14769,8 @@ patch_if_else_statement (tree node)
node = TREE_OPERAND (node, 1);
if (CAN_COMPLETE_NORMALLY (node) != can_complete_normally)
{
- node = build (COMPOUND_EXPR, void_type_node, node, empty_stmt_node);
+ node = build (COMPOUND_EXPR, void_type_node, node,
+ build_java_empty_stmt ());
CAN_COMPLETE_NORMALLY (node) = can_complete_normally;
}
return node;
@@ -14882,7 +14883,8 @@ build_loop_body (int location, tree cond
second = (reversed ? condition : body);
return
build (COMPOUND_EXPR, NULL_TREE,
- build (COMPOUND_EXPR, NULL_TREE, first, second), empty_stmt_node);
+ build (COMPOUND_EXPR, NULL_TREE, first, second),
+ build_java_empty_stmt ());
}
/* Install CONDITION (if any) and loop BODY (using REVERSED to tell
@@ -14922,7 +14924,7 @@ finish_for_loop (int location, tree cond
this because the (current interpretation of the) JLS requires
that the update expression be considered reachable even if the
for loop's body doesn't complete normally. */
- if (update != NULL_TREE && update != empty_stmt_node)
+ if (update != NULL_TREE && !IS_EMPTY_STMT (update))
{
tree up2 = update;
if (TREE_CODE (up2) == EXPR_WITH_FILE_LOCATION)