This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto] PATCH: CALL_EXPR changes to gcc/tree-ssa-ccp.c
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 12 Jul 2006 15:17:56 -0400
- Subject: [lto] PATCH: CALL_EXPR changes to gcc/tree-ssa-ccp.c
Already committed as "obvious".
-Sandra
2006-07-12 Sandra Loosemore <sandra@codesourcery.com>
* gcc/tree-ssa-ccp.c (ccp_fold, fold_stmt): Use new CALL_EXPR
accessors and constructor.
Index: gcc/tree-ssa-ccp.c
===================================================================
*** gcc/tree-ssa-ccp.c (revision 115346)
--- gcc/tree-ssa-ccp.c (working copy)
*************** ccp_fold (tree stmt)
*** 927,936 ****
/* We may be able to fold away calls to builtin functions if their
arguments are constants. */
else if (code == CALL_EXPR
! && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
! && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0))
! == FUNCTION_DECL)
! && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (rhs, 0), 0)))
{
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_USE))
{
--- 927,935 ----
/* We may be able to fold away calls to builtin functions if their
arguments are constants. */
else if (code == CALL_EXPR
! && TREE_CODE (CALL_EXPR_FN (rhs)) == ADDR_EXPR
! && TREE_CODE (TREE_OPERAND (CALL_EXPR_FN (rhs), 0)) == FUNCTION_DECL
! && DECL_BUILT_IN (TREE_OPERAND (CALL_EXPR_FN (rhs), 0)))
{
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_USE))
{
*************** fold_stmt (tree *stmt_p)
*** 2370,2378 ****
then we may need to fold instances of *&VAR into VAR, etc. */
if (walk_tree (stmt_p, fold_stmt_r, &fold_stmt_r_data, NULL))
{
! *stmt_p
! = build_function_call_expr (implicit_built_in_decls[BUILT_IN_TRAP],
! NULL);
return true;
}
--- 2369,2375 ----
then we may need to fold instances of *&VAR into VAR, etc. */
if (walk_tree (stmt_p, fold_stmt_r, &fold_stmt_r_data, NULL))
{
! *stmt_p = build_call_expr (implicit_built_in_decls[BUILT_IN_TRAP], 0);
return true;
}
*************** fold_stmt (tree *stmt_p)
*** 2401,2407 ****
here where we can just smash the call operand. Also
CALL_EXPR_RETURN_SLOT_OPT needs to be handled correctly and
copied, fold_ternary does not have not information. */
! callee = TREE_OPERAND (rhs, 0);
if (TREE_CODE (callee) == OBJ_TYPE_REF
&& lang_hooks.fold_obj_type_ref
&& TREE_CODE (OBJ_TYPE_REF_OBJECT (callee)) == ADDR_EXPR
--- 2398,2404 ----
here where we can just smash the call operand. Also
CALL_EXPR_RETURN_SLOT_OPT needs to be handled correctly and
copied, fold_ternary does not have not information. */
! callee = CALL_EXPR_FN (rhs);
if (TREE_CODE (callee) == OBJ_TYPE_REF
&& lang_hooks.fold_obj_type_ref
&& TREE_CODE (OBJ_TYPE_REF_OBJECT (callee)) == ADDR_EXPR
*************** fold_stmt (tree *stmt_p)
*** 2419,2425 ****
t = lang_hooks.fold_obj_type_ref (callee, t);
if (t)
{
! TREE_OPERAND (rhs, 0) = t;
changed = true;
}
}
--- 2416,2422 ----
t = lang_hooks.fold_obj_type_ref (callee, t);
if (t)
{
! CALL_EXPR_FN (rhs) = t;
changed = true;
}
}