summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-16 03:38:22 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-02-16 03:38:22 +0000
commit41076ef6f964adde18101acf85c620c4818a83e2 (patch)
treeab46b6fc569996fc94b0894059374459f6e9ad7f
parentf74811fea0c596c8ba7dbc74dddffe5c7c6e7b14 (diff)
downloadgcc-41076ef6f964adde18101acf85c620c4818a83e2.tar.gz
PR middle-end/30391
* tree.c (expr_align): Handle MODIFY_EXPR. GIMPLE_MODIFY_STMT should be unreachable. (build2_stat): Allow construction of MODIFY_EXPR at any time. For the time being redirect GIMPLE_MODIFY_STMT to the new (renamed) build_gimple_modify_stmt_stat. (build2_gimple_stat): Rename to... (build_gimple_modify_stmt_stat): Now longer take a CODE argument. Always build a GIMPLE_MODIFY_STMT node. * tree.h (build2_gimple, build2_gimple_stat): Delete. (build_gimple_modify_stmt, build_gimple_modify_stmt_stat): New declarations. * tree-cfg.c (factor_computed_gotos, tree_merge_blocks, gimplify_val): Use build_gimple_modify_stmt instead of build2_gimple. * tree-complex.c (set_component_ssa_name, expand_complex_move, expand_complex_div_wide): Likewise. * tree-ssa-dom.c (record_equivalences_from_stmt): Likewise. * tree-ssa-loop-im.c (schedule_sm): Likewise. * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Likewise. * tree-ssa-loop-manip.c (create_iv): Likewise. * tree-ssa-phiopt.c (conditional_replacement, minmax_replacement, abs_replacement): Likewise. * tree-ssa-pre.c (create_expression_by_pieces, poolify_modify_stmt, realify_fake_stores): Likewise. * builtins.c (std_expand_builtin_va_start): Build a MODIFY_EXPR node rather than a GIMPLE_MODIFY_STMT node. (std_gimpify_va_arg_expr, expand_builtin_va_copy, fold_builtin_memset, fold_builtin_memory_op, do_mpfr_sincos): Likewise. (integer_valued_real_p): Handle MODIFY_EXPR, not GIMPLE_MODIFY_STMT. * expr.c (expand_expr_real_1): Handle both MODIFY_EXPR and GIMPLE_MODIFY_STMT. * gfortran.dg/pr30391-1.f90: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122030 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog37
-rw-r--r--gcc/builtins.c20
-rw-r--r--gcc/expr.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr30391-1.f9010
-rw-r--r--gcc/tree-cfg.c8
-rw-r--r--gcc/tree-complex.c16
-rw-r--r--gcc/tree-ssa-dom.c4
-rw-r--r--gcc/tree-ssa-loop-im.c6
-rw-r--r--gcc/tree-ssa-loop-ivopts.c4
-rw-r--r--gcc/tree-ssa-loop-manip.c5
-rw-r--r--gcc/tree-ssa-phiopt.c22
-rw-r--r--gcc/tree-ssa-pre.c15
-rw-r--r--gcc/tree.c48
-rw-r--r--gcc/tree.h6
15 files changed, 131 insertions, 85 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aac9a3e3610..d2991a04852 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,40 @@
+2007-02-15 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/30391
+ * tree.c (expr_align): Handle MODIFY_EXPR. GIMPLE_MODIFY_STMT
+ should be unreachable.
+ (build2_stat): Allow construction of MODIFY_EXPR at any time.
+ For the time being redirect GIMPLE_MODIFY_STMT to the new
+ (renamed) build_gimple_modify_stmt_stat.
+ (build2_gimple_stat): Rename to...
+ (build_gimple_modify_stmt_stat): Now longer take a CODE argument.
+ Always build a GIMPLE_MODIFY_STMT node.
+ * tree.h (build2_gimple, build2_gimple_stat): Delete.
+ (build_gimple_modify_stmt, build_gimple_modify_stmt_stat): New
+ declarations.
+
+ * tree-cfg.c (factor_computed_gotos, tree_merge_blocks,
+ gimplify_val): Use build_gimple_modify_stmt instead of build2_gimple.
+ * tree-complex.c (set_component_ssa_name, expand_complex_move,
+ expand_complex_div_wide): Likewise.
+ * tree-ssa-dom.c (record_equivalences_from_stmt): Likewise.
+ * tree-ssa-loop-im.c (schedule_sm): Likewise.
+ * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr): Likewise.
+ * tree-ssa-loop-manip.c (create_iv): Likewise.
+ * tree-ssa-phiopt.c (conditional_replacement, minmax_replacement,
+ abs_replacement): Likewise.
+ * tree-ssa-pre.c (create_expression_by_pieces, poolify_modify_stmt,
+ realify_fake_stores): Likewise.
+
+ * builtins.c (std_expand_builtin_va_start): Build a MODIFY_EXPR
+ node rather than a GIMPLE_MODIFY_STMT node.
+ (std_gimpify_va_arg_expr, expand_builtin_va_copy,
+ fold_builtin_memset, fold_builtin_memory_op, do_mpfr_sincos):
+ Likewise.
+ (integer_valued_real_p): Handle MODIFY_EXPR, not GIMPLE_MODIFY_STMT.
+ * expr.c (expand_expr_real_1): Handle both MODIFY_EXPR and
+ GIMPLE_MODIFY_STMT.
+
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/30433
diff --git a/gcc/builtins.c b/gcc/builtins.c
index ac1e1b4a058..79d62d99f44 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -4544,7 +4544,7 @@ std_expand_builtin_va_start (tree valist, rtx nextarg)
{
tree t;
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (valist), valist,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist,
make_tree (ptr_type_node, nextarg));
TREE_SIDE_EFFECTS (t) = 1;
@@ -4613,12 +4613,12 @@ std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
&& !integer_zerop (TYPE_SIZE (type)))
{
t = fold_convert (TREE_TYPE (valist), size_int (boundary - 1));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (valist), valist_tmp,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
build2 (PLUS_EXPR, TREE_TYPE (valist), valist_tmp, t));
gimplify_and_add (t, pre_p);
t = fold_convert (TREE_TYPE (valist), size_int (-boundary));
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (valist), valist_tmp,
+ t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
build2 (BIT_AND_EXPR, TREE_TYPE (valist), valist_tmp, t));
gimplify_and_add (t, pre_p);
}
@@ -4657,7 +4657,7 @@ std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
/* Compute new value for AP. */
t = fold_convert (TREE_TYPE (valist), rounded_size);
t = build2 (PLUS_EXPR, TREE_TYPE (valist), valist_tmp, t);
- t = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (valist), valist, t);
+ t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist, t);
gimplify_and_add (t, pre_p);
addr = fold_convert (build_pointer_type (type), addr);
@@ -4821,7 +4821,7 @@ expand_builtin_va_copy (tree exp)
if (TREE_CODE (va_list_type_node) != ARRAY_TYPE)
{
- t = build2 (GIMPLE_MODIFY_STMT, va_list_type_node, dst, src);
+ t = build2 (MODIFY_EXPR, va_list_type_node, dst, src);
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
}
@@ -6933,7 +6933,7 @@ integer_valued_real_p (tree t)
return integer_valued_real_p (TREE_OPERAND (t, 0));
case COMPOUND_EXPR:
- case GIMPLE_MODIFY_STMT:
+ case MODIFY_EXPR:
case BIND_EXPR:
return integer_valued_real_p (GENERIC_TREE_OPERAND (t, 1));
@@ -8302,7 +8302,7 @@ fold_builtin_memset (tree dest, tree c, tree len, tree type, bool ignore)
}
ret = build_int_cst_type (TREE_TYPE (var), cval);
- ret = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (var), var, ret);
+ ret = build2 (MODIFY_EXPR, TREE_TYPE (var), var, ret);
if (ignore)
return ret;
@@ -8449,7 +8449,7 @@ fold_builtin_memory_op (tree dest, tree src, tree len, tree type, bool ignore, i
expr = fold_convert (TREE_TYPE (destvar), srcvar);
else
expr = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (destvar), srcvar);
- expr = build2 (GIMPLE_MODIFY_STMT, TREE_TYPE (destvar), destvar, expr);
+ expr = build2 (MODIFY_EXPR, TREE_TYPE (destvar), destvar, expr);
}
if (ignore)
@@ -12097,10 +12097,10 @@ do_mpfr_sincos (tree arg, tree arg_sinp, tree arg_cosp)
&& TYPE_MAIN_VARIANT (TREE_TYPE (arg_cosp)) == TYPE_MAIN_VARIANT (type))
{
/* Set the values. */
- result_s = fold_build2 (GIMPLE_MODIFY_STMT, type, arg_sinp,
+ result_s = fold_build2 (MODIFY_EXPR, type, arg_sinp,
result_s);
TREE_SIDE_EFFECTS (result_s) = 1;
- result_c = fold_build2 (GIMPLE_MODIFY_STMT, type, arg_cosp,
+ result_c = fold_build2 (MODIFY_EXPR, type, arg_cosp,
result_c);
TREE_SIDE_EFFECTS (result_c) = 1;
/* Combine the assignments into a compound expr. */
diff --git a/gcc/expr.c b/gcc/expr.c
index 1c2ff13fa17..f624d95c415 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -8665,6 +8665,15 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
target = expand_vec_cond_expr (exp, target);
return target;
+ case MODIFY_EXPR:
+ {
+ tree lhs = TREE_OPERAND (exp, 0);
+ tree rhs = TREE_OPERAND (exp, 1);
+ gcc_assert (ignore);
+ expand_assignment (lhs, rhs);
+ return const0_rtx;
+ }
+
case GIMPLE_MODIFY_STMT:
{
tree lhs = GIMPLE_STMT_OPERAND (exp, 0);
@@ -8700,7 +8709,6 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
}
expand_assignment (lhs, rhs);
-
return const0_rtx;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e05d167bfe9..56519172654 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-02-15 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/30391
+ * gfortran.dg/pr30391-1.f90: New test case.
+
2007-02-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/30433
diff --git a/gcc/testsuite/gfortran.dg/pr30391-1.f90 b/gcc/testsuite/gfortran.dg/pr30391-1.f90
new file mode 100644
index 00000000000..28ca7542718
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr30391-1.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-O1" }
+SUBROUTINE check_for_overlap (cell_length)
+ REAL, DIMENSION(1:3), INTENT(IN), OPTIONAL :: cell_length
+ REAL, DIMENSION(1:3) :: abc, box_length
+
+ IF (PRESENT(cell_length)) THEN
+ box_length(1:3)=abc(1:3)
+ ENDIF
+END SUBROUTINE check_for_overlap
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 7d28aa941a7..4d6957fc603 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -294,8 +294,8 @@ factor_computed_gotos (void)
}
/* Copy the original computed goto's destination into VAR. */
- assignment = build2_gimple (GIMPLE_MODIFY_STMT,
- var, GOTO_DESTINATION (last));
+ assignment = build_gimple_modify_stmt (var,
+ GOTO_DESTINATION (last));
bsi_insert_before (&bsi, assignment, BSI_SAME_STMT);
/* And re-vector the computed goto to the new destination. */
@@ -1260,7 +1260,7 @@ tree_merge_blocks (basic_block a, basic_block b)
with ordering of phi nodes. This is because A is the single
predecessor of B, therefore results of the phi nodes cannot
appear as arguments of the phi nodes. */
- copy = build2_gimple (GIMPLE_MODIFY_STMT, def, use);
+ copy = build_gimple_modify_stmt (def, use);
bsi_insert_after (&bsi, copy, BSI_NEW_STMT);
SSA_NAME_DEF_STMT (def) = copy;
remove_phi_node (phi, NULL, false);
@@ -5646,7 +5646,7 @@ gimplify_val (block_stmt_iterator *bsi, tree type, tree exp)
return exp;
t = make_rename_temp (type, NULL);
- new_stmt = build2_gimple (GIMPLE_MODIFY_STMT, t, exp);
+ new_stmt = build_gimple_modify_stmt (t, exp);
orig_stmt = bsi_stmt (*bsi);
SET_EXPR_LOCUS (new_stmt, EXPR_LOCUS (orig_stmt));
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index fce124eb595..a64ec1805c5 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1,5 +1,5 @@
/* Lower complex number operations to scalar operations.
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GCC.
@@ -532,7 +532,7 @@ set_component_ssa_name (tree ssa_name, bool imag_p, tree value)
/* Do all the work to assign VALUE to COMP. */
value = force_gimple_operand (value, &list, false, NULL);
- last = build2_gimple (GIMPLE_MODIFY_STMT, comp, value);
+ last = build_gimple_modify_stmt (comp, value);
append_to_statement_list (last, &list);
gcc_assert (SSA_NAME_DEF_STMT (comp) == NULL);
@@ -773,7 +773,7 @@ expand_complex_move (block_stmt_iterator *bsi, tree stmt, tree type,
i = extract_component (bsi, rhs, 1, false);
x = build1 (REALPART_EXPR, inner_type, unshare_expr (lhs));
- x = build2_gimple (GIMPLE_MODIFY_STMT, x, r);
+ x = build_gimple_modify_stmt (x, r);
bsi_insert_before (bsi, x, BSI_SAME_STMT);
if (stmt == bsi_stmt (*bsi))
@@ -785,7 +785,7 @@ expand_complex_move (block_stmt_iterator *bsi, tree stmt, tree type,
else
{
x = build1 (IMAGPART_EXPR, inner_type, unshare_expr (lhs));
- x = build2_gimple (GIMPLE_MODIFY_STMT, x, i);
+ x = build_gimple_modify_stmt (x, i);
bsi_insert_before (bsi, x, BSI_SAME_STMT);
stmt = bsi_stmt (*bsi);
@@ -1115,9 +1115,9 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
if (bb_true)
{
- t1 = build2_gimple (GIMPLE_MODIFY_STMT, rr, tr);
+ t1 = build_gimple_modify_stmt (rr, tr);
bsi_insert_before (bsi, t1, BSI_SAME_STMT);
- t1 = build2_gimple (GIMPLE_MODIFY_STMT, ri, ti);
+ t1 = build_gimple_modify_stmt (ri, ti);
bsi_insert_before (bsi, t1, BSI_SAME_STMT);
bsi_remove (bsi, true);
}
@@ -1154,9 +1154,9 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type,
if (bb_false)
{
- t1 = build2_gimple (GIMPLE_MODIFY_STMT, rr, tr);
+ t1 = build_gimple_modify_stmt (rr, tr);
bsi_insert_before (bsi, t1, BSI_SAME_STMT);
- t1 = build2_gimple (GIMPLE_MODIFY_STMT, ri, ti);
+ t1 = build_gimple_modify_stmt (ri, ti);
bsi_insert_before (bsi, t1, BSI_SAME_STMT);
bsi_remove (bsi, true);
}
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 8ebd1399fb8..888c5ee7bde 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1,5 +1,5 @@
/* SSA Dominator optimizations for trees
- Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
@@ -1623,7 +1623,7 @@ record_equivalences_from_stmt (tree stmt, int may_optimize_p, stmt_ann_t ann)
if (rhs)
{
/* Build a new statement with the RHS and LHS exchanged. */
- new = build2_gimple (GIMPLE_MODIFY_STMT, rhs, lhs);
+ new = build_gimple_modify_stmt (rhs, lhs);
create_ssa_artificial_load_stmt (new, stmt);
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index f1db0376fd1..316c3d2c1b6 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1,5 +1,5 @@
/* Loop invariant motion.
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GCC.
@@ -1053,7 +1053,7 @@ schedule_sm (struct loop *loop, VEC (edge, heap) *exits, tree ref,
LIM_DATA (aref->stmt)->sm_done = true;
/* Emit the load & stores. */
- load = build2_gimple (GIMPLE_MODIFY_STMT, tmp_var, ref);
+ load = build_gimple_modify_stmt (tmp_var, ref);
get_stmt_ann (load)->common.aux = xcalloc (1, sizeof (struct lim_aux_data));
LIM_DATA (load)->max_loop = loop;
LIM_DATA (load)->tgt_loop = loop;
@@ -1064,7 +1064,7 @@ schedule_sm (struct loop *loop, VEC (edge, heap) *exits, tree ref,
for (i = 0; VEC_iterate (edge, exits, i, ex); i++)
{
- store = build2_gimple (GIMPLE_MODIFY_STMT, unshare_expr (ref), tmp_var);
+ store = build_gimple_modify_stmt (unshare_expr (ref), tmp_var);
bsi_insert_on_edge (ex, store);
}
}
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 8ca7e51122f..8223facd6dd 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1,5 +1,5 @@
/* Induction variable optimizations.
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GCC.
@@ -4946,7 +4946,7 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data,
{
if (stmts)
bsi_insert_after (&bsi, stmts, BSI_CONTINUE_LINKING);
- ass = build2_gimple (GIMPLE_MODIFY_STMT, tgt, op);
+ ass = build_gimple_modify_stmt (tgt, op);
bsi_insert_after (&bsi, ass, BSI_NEW_STMT);
remove_statement (use->stmt, false);
SSA_NAME_DEF_STMT (tgt) = ass;
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 715c412c790..bce9890d6a4 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -103,8 +103,9 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
if (stmts)
bsi_insert_on_edge_immediate (pe, stmts);
- stmt = build2_gimple (GIMPLE_MODIFY_STMT, va,
- build2 (incr_op, TREE_TYPE (base), vb, step));
+ stmt = build_gimple_modify_stmt (va,
+ build2 (incr_op, TREE_TYPE (base),
+ vb, step));
SSA_NAME_DEF_STMT (va) = stmt;
if (after)
bsi_insert_after (incr_pos, stmt, BSI_NEW_STMT);
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 2cc7ad79425..f8e96bd3929 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -1,5 +1,5 @@
/* Optimization of PHI nodes by converting them into straightline code.
- Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GCC.
@@ -439,7 +439,7 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
TREE_OPERAND (old_result, 0),
TREE_OPERAND (old_result, 1));
- new1 = build2_gimple (GIMPLE_MODIFY_STMT, new_var, new1);
+ new1 = build_gimple_modify_stmt (new_var, new1);
SSA_NAME_DEF_STMT (new_var) = new1;
bsi_insert_after (&bsi, new1, BSI_NEW_STMT);
@@ -470,7 +470,7 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
|| (e1 == true_edge && integer_onep (arg1))
|| (e1 == false_edge && integer_zerop (arg1)))
{
- new = build2_gimple (GIMPLE_MODIFY_STMT, new_var1, cond);
+ new = build_gimple_modify_stmt (new_var1, cond);
}
else
{
@@ -514,14 +514,14 @@ conditional_replacement (basic_block cond_bb, basic_block middle_bb,
tmp = create_tmp_var (TREE_TYPE (op0), NULL);
add_referenced_var (tmp);
cond_tmp = make_ssa_name (tmp, NULL);
- new = build2_gimple (GIMPLE_MODIFY_STMT, cond_tmp, op0);
+ new = build_gimple_modify_stmt (cond_tmp, op0);
SSA_NAME_DEF_STMT (cond_tmp) = new;
bsi_insert_after (&bsi, new, BSI_NEW_STMT);
cond = fold_convert (TREE_TYPE (result), cond_tmp);
}
- new = build2_gimple (GIMPLE_MODIFY_STMT, new_var1, cond);
+ new = build_gimple_modify_stmt (new_var1, cond);
}
bsi_insert_after (&bsi, new, BSI_NEW_STMT);
@@ -853,8 +853,7 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
/* Emit the statement to compute min/max. */
result = duplicate_ssa_name (PHI_RESULT (phi), NULL);
- new = build2_gimple (GIMPLE_MODIFY_STMT, result,
- build2 (minmax, type, arg0, arg1));
+ new = build_gimple_modify_stmt (result, build2 (minmax, type, arg0, arg1));
SSA_NAME_DEF_STMT (result) = new;
bsi = bsi_last (cond_bb);
bsi_insert_before (&bsi, new, BSI_NEW_STMT);
@@ -966,8 +965,8 @@ abs_replacement (basic_block cond_bb, basic_block middle_bb,
lhs = result;
/* Build the modify expression with abs expression. */
- new = build2_gimple (GIMPLE_MODIFY_STMT,
- lhs, build1 (ABS_EXPR, TREE_TYPE (lhs), rhs));
+ new = build_gimple_modify_stmt (lhs,
+ build1 (ABS_EXPR, TREE_TYPE (lhs), rhs));
SSA_NAME_DEF_STMT (lhs) = new;
bsi = bsi_last (cond_bb);
@@ -978,8 +977,9 @@ abs_replacement (basic_block cond_bb, basic_block middle_bb,
/* Get the right BSI. We want to insert after the recently
added ABS_EXPR statement (which we know is the first statement
in the block. */
- new = build2_gimple (GIMPLE_MODIFY_STMT,
- result, build1 (NEGATE_EXPR, TREE_TYPE (lhs), lhs));
+ new = build_gimple_modify_stmt (result,
+ build1 (NEGATE_EXPR, TREE_TYPE (lhs),
+ lhs));
SSA_NAME_DEF_STMT (result) = new;
bsi_insert_after (&bsi, new, BSI_NEW_STMT);
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index b39c9e8e9f3..5e47a43ab16 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -1,5 +1,6 @@
/* SSA-PRE for trees.
- Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Contributed by Daniel Berlin <dan@dberlin.org> and Steven Bosscher
<stevenb@suse.de>
@@ -2606,7 +2607,7 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
|| TREE_CODE (TREE_TYPE (expr)) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (temp) = 1;
- newexpr = build2_gimple (GIMPLE_MODIFY_STMT, temp, newexpr);
+ newexpr = build_gimple_modify_stmt (temp, newexpr);
name = make_ssa_name (temp, newexpr);
GIMPLE_STMT_OPERAND (newexpr, 0) = name;
NECESSARY (newexpr) = 0;
@@ -3385,7 +3386,7 @@ static tree
poolify_modify_stmt (tree op1, tree op2)
{
if (modify_expr_template == NULL)
- modify_expr_template = build2_gimple (GIMPLE_MODIFY_STMT, op1, op2);
+ modify_expr_template = build_gimple_modify_stmt (op1, op2);
GIMPLE_STMT_OPERAND (modify_expr_template, 0) = op1;
GIMPLE_STMT_OPERAND (modify_expr_template, 1) = op2;
@@ -3486,7 +3487,7 @@ realify_fake_stores (void)
if (NECESSARY (stmt))
{
block_stmt_iterator bsi;
- tree newstmt;
+ tree newstmt, tmp;
/* Mark the temp variable as referenced */
add_referenced_var (SSA_NAME_VAR (GIMPLE_STMT_OPERAND (stmt, 0)));
@@ -3497,9 +3498,9 @@ realify_fake_stores (void)
as a plain ssa name copy. */
bsi = bsi_for_stmt (stmt);
bsi_prev (&bsi);
- newstmt = build2_gimple (GIMPLE_MODIFY_STMT,
- GIMPLE_STMT_OPERAND (stmt, 0),
- GIMPLE_STMT_OPERAND (bsi_stmt (bsi), 1));
+ tmp = GIMPLE_STMT_OPERAND (bsi_stmt (bsi), 1);
+ newstmt = build_gimple_modify_stmt (GIMPLE_STMT_OPERAND (stmt, 0),
+ tmp);
SSA_NAME_DEF_STMT (GIMPLE_STMT_OPERAND (newstmt, 0)) = newstmt;
bsi_insert_before (&bsi, newstmt, BSI_SAME_STMT);
bsi = bsi_for_stmt (stmt);
diff --git a/gcc/tree.c b/gcc/tree.c
index 842e1d032ca..d9982e8b2ec 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1896,14 +1896,11 @@ expr_align (tree t)
align1 = TYPE_ALIGN (TREE_TYPE (t));
return MAX (align0, align1);
- case MODIFY_EXPR:
- /* FIXME tuples: It is unclear to me if this function, which
- is only called from ADA, is called on gimple or non gimple
- trees. Let's assume it's from gimple trees unless we hit
- this abort. */
+ case GIMPLE_MODIFY_STMT:
+ /* We should never ask for the alignment of a gimple statement. */
gcc_unreachable ();
- case SAVE_EXPR: case COMPOUND_EXPR: case GIMPLE_MODIFY_STMT:
+ case SAVE_EXPR: case COMPOUND_EXPR: case MODIFY_EXPR:
case INIT_EXPR: case TARGET_EXPR: case WITH_CLEANUP_EXPR:
case CLEANUP_POINT_EXPR:
/* These don't change the alignment of an object. */
@@ -3062,16 +3059,14 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
gcc_assert (TREE_CODE_LENGTH (code) == 2);
- if (code == MODIFY_EXPR && cfun && cfun->gimplified)
- {
- /* We should be talking GIMPLE_MODIFY_STMT by now. */
- gcc_unreachable ();
- }
-
- /* FIXME tuples: For now let's be lazy; later we must rewrite all
- build2 calls to build2_gimple calls. */
- if (TREE_CODE_CLASS (code) == tcc_gimple_stmt)
- return build2_gimple (code, arg0, arg1);
+#if 1
+ /* FIXME tuples: Statement's aren't expressions! */
+ if (code == GIMPLE_MODIFY_STMT)
+ return build_gimple_modify_stmt_stat (arg0, arg1 PASS_MEM_STAT);
+#else
+ /* Must use build_gimple_modify_stmt to construct GIMPLE_MODIFY_STMTs. */
+ gcc_assert (code != GIMPLE_MODIFY_STMT);
+#endif
t = make_node_stat (code PASS_MEM_STAT);
TREE_TYPE (t) = tt;
@@ -3104,31 +3099,18 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
}
-/* Similar as build2_stat, but for GIMPLE tuples. For convenience's sake,
- arguments and return type are trees. */
+/* Build a GIMPLE_MODIFY_STMT node. This tree code doesn't have a
+ type, so we can't use build2 (a.k.a. build2_stat). */
tree
-build2_gimple_stat (enum tree_code code, tree arg0, tree arg1 MEM_STAT_DECL)
+build_gimple_modify_stmt_stat (tree arg0, tree arg1 MEM_STAT_DECL)
{
- bool side_effects;
tree t;
- gcc_assert (TREE_CODE_LENGTH (code) == 2);
-
- t = make_node_stat (code PASS_MEM_STAT);
-
- side_effects = TREE_SIDE_EFFECTS (t);
-
+ t = make_node_stat (GIMPLE_MODIFY_STMT PASS_MEM_STAT);
/* ?? We don't care about setting flags for tuples... */
GIMPLE_STMT_OPERAND (t, 0) = arg0;
GIMPLE_STMT_OPERAND (t, 1) = arg1;
-
- /* ...except perhaps side_effects and volatility. ?? */
- TREE_SIDE_EFFECTS (t) = side_effects;
- TREE_THIS_VOLATILE (t) = (TREE_CODE_CLASS (code) == tcc_reference
- && arg0 && TREE_THIS_VOLATILE (arg0));
-
-
return t;
}
diff --git a/gcc/tree.h b/gcc/tree.h
index 2df9aabc8f3..b656e1bfa48 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3684,8 +3684,6 @@ extern tree build1_stat (enum tree_code, tree, tree MEM_STAT_DECL);
#define build1(c,t1,t2) build1_stat (c,t1,t2 MEM_STAT_INFO)
extern tree build2_stat (enum tree_code, tree, tree, tree MEM_STAT_DECL);
#define build2(c,t1,t2,t3) build2_stat (c,t1,t2,t3 MEM_STAT_INFO)
-extern tree build2_gimple_stat (enum tree_code, tree, tree MEM_STAT_DECL);
-#define build2_gimple(c,t1,t2) build2_gimple_stat (c,t1,t2 MEM_STAT_INFO)
extern tree build3_stat (enum tree_code, tree, tree, tree, tree MEM_STAT_DECL);
#define build3(c,t1,t2,t3,t4) build3_stat (c,t1,t2,t3,t4 MEM_STAT_INFO)
extern tree build4_stat (enum tree_code, tree, tree, tree, tree,
@@ -3699,6 +3697,10 @@ extern tree build7_stat (enum tree_code, tree, tree, tree, tree, tree,
#define build7(c,t1,t2,t3,t4,t5,t6,t7,t8) \
build7_stat (c,t1,t2,t3,t4,t5,t6,t7,t8 MEM_STAT_INFO)
+extern tree build_gimple_modify_stmt_stat (tree, tree MEM_STAT_DECL);
+#define build_gimple_modify_stmt(t1,t2) \
+ build_gimple_modify_stmt_stat (t1,t2 MEM_STAT_INFO)
+
extern tree build_int_cst (tree, HOST_WIDE_INT);
extern tree build_int_cst_type (tree, HOST_WIDE_INT);
extern tree build_int_cstu (tree, unsigned HOST_WIDE_INT);