+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
{
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;
&& !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);
}
/* 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);
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);
}
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));
}
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;
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)
&& 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. */
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);
}
expand_assignment (lhs, rhs);
-
return const0_rtx;
}
+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
--- /dev/null
+! { 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
}
/* 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. */
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);
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));
/* 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.
/* 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);
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))
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);
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);
}
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);
}
/* 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>
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);
/* 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.
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;
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);
}
}
/* 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.
{
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;
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);
/* 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.
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);
|| (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
{
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);
/* 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);
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);
/* 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);
/* 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>
|| 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;
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;
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)));
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);
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. */
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;
}
-/* 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;
}
#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,
#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);