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/fortran/trans-expr.c
- From: Sandra Loosemore <sandra at codesourcery dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 21 Jul 2006 21:00:48 -0400
- Subject: [lto] PATCH: CALL_EXPR changes to gcc/fortran/trans-expr.c
Already committed as "obvious".
-Sandra
2006-07-21 Sandra Loosemore <sandra@codesourcery.com>
* gcc/fortran/trans-expr.c (gfc_conv_power_op): Use build_call_expr.
(gfc_conv_string_tmp): Likewise.
(gfc_conv_concat_op): Likewise.
(gfc_build_compare_string): Likewise.
(gfc_trans_string_copy): Likewise.
Index: gcc/fortran/trans-expr.c
===================================================================
*** gcc/fortran/trans-expr.c (revision 115645)
--- gcc/fortran/trans-expr.c (working copy)
*************** gfc_conv_power_op (gfc_se * se, gfc_expr
*** 703,709 ****
gfc_se lse;
gfc_se rse;
tree fndecl;
- tree tmp;
gfc_init_se (&lse, se);
gfc_conv_expr_val (&lse, expr->value.op.op1);
--- 703,708 ----
*************** gfc_conv_power_op (gfc_se * se, gfc_expr
*** 842,850 ****
break;
}
! tmp = gfc_chainon_list (NULL_TREE, lse.expr);
! tmp = gfc_chainon_list (tmp, rse.expr);
! se->expr = build_function_call_expr (fndecl, tmp);
}
--- 841,847 ----
break;
}
! se->expr = build_call_expr (fndecl, 2, lse.expr, rse.expr);
}
*************** gfc_conv_string_tmp (gfc_se * se, tree t
*** 855,861 ****
{
tree var;
tree tmp;
- tree args;
gcc_assert (TREE_TYPE (len) == gfc_charlen_type_node);
--- 852,857 ----
*************** gfc_conv_string_tmp (gfc_se * se, tree t
*** 873,887 ****
{
/* Allocate a temporary to hold the result. */
var = gfc_create_var (type, "pstr");
! args = gfc_chainon_list (NULL_TREE, len);
! tmp = build_function_call_expr (gfor_fndecl_internal_malloc, args);
tmp = convert (type, tmp);
gfc_add_modify_expr (&se->pre, var, tmp);
/* Free the temporary afterwards. */
tmp = convert (pvoid_type_node, var);
! args = gfc_chainon_list (NULL_TREE, tmp);
! tmp = build_function_call_expr (gfor_fndecl_internal_free, args);
gfc_add_expr_to_block (&se->post, tmp);
}
--- 869,881 ----
{
/* Allocate a temporary to hold the result. */
var = gfc_create_var (type, "pstr");
! tmp = build_call_expr (gfor_fndecl_internal_malloc, 1, len);
tmp = convert (type, tmp);
gfc_add_modify_expr (&se->pre, var, tmp);
/* Free the temporary afterwards. */
tmp = convert (pvoid_type_node, var);
! tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp);
gfc_add_expr_to_block (&se->post, tmp);
}
*************** gfc_conv_concat_op (gfc_se * se, gfc_exp
*** 900,906 ****
tree len;
tree type;
tree var;
- tree args;
tree tmp;
gcc_assert (expr->value.op.op1->ts.type == BT_CHARACTER
--- 894,899 ----
*************** gfc_conv_concat_op (gfc_se * se, gfc_exp
*** 929,942 ****
var = gfc_conv_string_tmp (se, type, len);
/* Do the actual concatenation. */
! args = NULL_TREE;
! args = gfc_chainon_list (args, len);
! args = gfc_chainon_list (args, var);
! args = gfc_chainon_list (args, lse.string_length);
! args = gfc_chainon_list (args, lse.expr);
! args = gfc_chainon_list (args, rse.string_length);
! args = gfc_chainon_list (args, rse.expr);
! tmp = build_function_call_expr (gfor_fndecl_concat_string, args);
gfc_add_expr_to_block (&se->pre, tmp);
/* Add the cleanup for the operands. */
--- 922,931 ----
var = gfc_conv_string_tmp (se, type, len);
/* Do the actual concatenation. */
! tmp = build_call_expr (gfor_fndecl_concat_string, 6,
! len, var,
! lse.string_length, lse.expr,
! rse.string_length, rse.expr);
gfc_add_expr_to_block (&se->pre, tmp);
/* Add the cleanup for the operands. */
*************** gfc_build_compare_string (tree len1, tre
*** 1160,1176 ****
tmp = fold_build2 (MINUS_EXPR, type, sc1, sc2);
}
else
! {
! tmp = NULL_TREE;
! tmp = gfc_chainon_list (tmp, len1);
! tmp = gfc_chainon_list (tmp, str1);
! tmp = gfc_chainon_list (tmp, len2);
! tmp = gfc_chainon_list (tmp, str2);
!
! /* Build a call for the comparison. */
! tmp = build_function_call_expr (gfor_fndecl_compare_string, tmp);
! }
!
return tmp;
}
--- 1149,1157 ----
tmp = fold_build2 (MINUS_EXPR, type, sc1, sc2);
}
else
! /* Build a call for the comparison. */
! tmp = build_call_expr (gfor_fndecl_compare_string, 4,
! len1, str1, len2, str2);
return tmp;
}
*************** gfc_trans_string_copy (stmtblock_t * blo
*** 2203,2214 ****
return;
}
! tmp = NULL_TREE;
! tmp = gfc_chainon_list (tmp, dlen);
! tmp = gfc_chainon_list (tmp, dest);
! tmp = gfc_chainon_list (tmp, slen);
! tmp = gfc_chainon_list (tmp, src);
! tmp = build_function_call_expr (gfor_fndecl_copy_string, tmp);
gfc_add_expr_to_block (block, tmp);
}
--- 2184,2190 ----
return;
}
! tmp = build_call_expr (gfor_fndecl_copy_string, 4, dlen, dest, slen, src);
gfc_add_expr_to_block (block, tmp);
}