/* Tree lowering pass. This pass converts the GENERIC functions-as-trees
tree representation into the GIMPLE form.
- Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
+ Free Software Foundation, Inc.
Major work done by Sebastian Pop <s.pop@laposte.net>,
Diego Novillo <dnovillo@redhat.com> and Jason Merrill <jason@redhat.com>.
/* The wrapper is on the RHS of an assignment that we're pushing
down. */
gcc_assert (TREE_CODE (temp) == INIT_EXPR
+ || TREE_CODE (temp) == GIMPLE_MODIFY_STMT
|| TREE_CODE (temp) == MODIFY_EXPR);
- TREE_OPERAND (temp, 1) = *p;
+ GENERIC_TREE_OPERAND (temp, 1) = *p;
*p = temp;
}
else
else
{
result = create_tmp_var (TREE_TYPE (result_decl), NULL);
+ if (TREE_CODE (TREE_TYPE (result)) == COMPLEX_TYPE
+ || TREE_CODE (TREE_TYPE (result)) == VECTOR_TYPE)
+ DECL_GIMPLE_REG_P (result) = 1;
/* ??? With complex control flow (usually involving abnormal edges),
we can wind up warning about an uninitialized value for this. Due
if (tret == GS_ERROR)
ret = GS_ERROR;
}
+ if (!is_gimple_reg (GENERIC_TREE_OPERAND (*expr_p, 0)))
+ GENERIC_TREE_OPERAND (*expr_p, 1) = get_formal_tmp_var (ctor, pre_p);
}
break;
return ret;
}
-/* Promote partial stores to COMPLEX variables to total stores. *EXPR_P is
- a MODIFY_EXPR with a lhs of a REAL/IMAGPART_EXPR of a variable with
- DECL_GIMPLE_REG_P set. */
-
-static enum gimplify_status
-gimplify_modify_expr_complex_part (tree *expr_p, tree *pre_p, bool want_value)
-{
- enum tree_code code, ocode;
- tree lhs, rhs, new_rhs, other, realpart, imagpart;
-
- lhs = GENERIC_TREE_OPERAND (*expr_p, 0);
- rhs = GENERIC_TREE_OPERAND (*expr_p, 1);
- code = TREE_CODE (lhs);
- lhs = TREE_OPERAND (lhs, 0);
-
- ocode = code == REALPART_EXPR ? IMAGPART_EXPR : REALPART_EXPR;
- other = build1 (ocode, TREE_TYPE (rhs), lhs);
- other = get_formal_tmp_var (other, pre_p);
-
- realpart = code == REALPART_EXPR ? rhs : other;
- imagpart = code == REALPART_EXPR ? other : rhs;
-
- if (TREE_CONSTANT (realpart) && TREE_CONSTANT (imagpart))
- new_rhs = build_complex (TREE_TYPE (lhs), realpart, imagpart);
- else
- new_rhs = build2 (COMPLEX_EXPR, TREE_TYPE (lhs), realpart, imagpart);
-
- GENERIC_TREE_OPERAND (*expr_p, 0) = lhs;
- GENERIC_TREE_OPERAND (*expr_p, 1) = new_rhs;
-
- if (want_value)
- {
- append_to_statement_list (*expr_p, pre_p);
- *expr_p = rhs;
- }
-
- return GS_ALL_DONE;
-}
-
-
/* Destructively convert the TREE pointer in TP into a gimple tuple if
appropriate. */
}
}
+/* Promote partial stores to COMPLEX variables to total stores. *EXPR_P is
+ a MODIFY_EXPR with a lhs of a REAL/IMAGPART_EXPR of a variable with
+ DECL_GIMPLE_REG_P set. */
+
+static enum gimplify_status
+gimplify_modify_expr_complex_part (tree *expr_p, tree *pre_p, bool want_value)
+{
+ enum tree_code code, ocode;
+ tree lhs, rhs, new_rhs, other, realpart, imagpart;
+
+ lhs = GENERIC_TREE_OPERAND (*expr_p, 0);
+ rhs = GENERIC_TREE_OPERAND (*expr_p, 1);
+ code = TREE_CODE (lhs);
+ lhs = TREE_OPERAND (lhs, 0);
+
+ ocode = code == REALPART_EXPR ? IMAGPART_EXPR : REALPART_EXPR;
+ other = build1 (ocode, TREE_TYPE (rhs), lhs);
+ other = get_formal_tmp_var (other, pre_p);
+
+ realpart = code == REALPART_EXPR ? rhs : other;
+ imagpart = code == REALPART_EXPR ? other : rhs;
+
+ if (TREE_CONSTANT (realpart) && TREE_CONSTANT (imagpart))
+ new_rhs = build_complex (TREE_TYPE (lhs), realpart, imagpart);
+ else
+ new_rhs = build2 (COMPLEX_EXPR, TREE_TYPE (lhs), realpart, imagpart);
+
+ GENERIC_TREE_OPERAND (*expr_p, 0) = lhs;
+ GENERIC_TREE_OPERAND (*expr_p, 1) = new_rhs;
+
+ if (want_value)
+ {
+ tree_to_gimple_tuple (expr_p);
+
+ append_to_statement_list (*expr_p, pre_p);
+ *expr_p = rhs;
+ }
+
+ return GS_ALL_DONE;
+}
+
/* Gimplify the MODIFY_EXPR node pointed to by EXPR_P.
modify_expr