This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] builtins.c: Change fold_builtin_memcpy to take decomposedarguments.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 19 Mar 2005 08:20:42 -0500 (EST)
- Subject: [patch] builtins.c: Change fold_builtin_memcpy to take decomposedarguments.
Hi,
Attached is a patch to change fold_builtin_memcpy to take decomposed
arguments.
For a patch description, see:
http://gcc.gnu.org/ml/gcc-patches/2005-03/msg00916.html
This patch is a fold_builtin_memcpy version of Roger's patch above.
Tested on i686-pc-linux-gnu. OK to apply?
Kazu Hirata
2005-03-19 Kazu Hirata <kazu@cs.umass.edu>
* builtins.c (fold_builtin_memcpy): Take decomposed arguments
of CALL_EXPR.
(expand_builtin_memcpy, fold_builtin_1): Update calls to
fold_builtin_memcpy.
Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.439
diff -u -d -p -r1.439 builtins.c
--- builtins.c 18 Mar 2005 03:45:51 -0000 1.439
+++ builtins.c 18 Mar 2005 03:50:42 -0000
@@ -162,7 +162,7 @@ static tree fold_builtin_floor (tree);
static tree fold_builtin_ceil (tree);
static tree fold_builtin_round (tree);
static tree fold_builtin_bitop (tree, tree);
-static tree fold_builtin_memcpy (tree);
+static tree fold_builtin_memcpy (tree, tree);
static tree fold_builtin_mempcpy (tree, tree, int);
static tree fold_builtin_memmove (tree, tree);
static tree fold_builtin_strchr (tree, tree);
@@ -2623,6 +2623,7 @@ builtin_memcpy_read_str (void *data, HOS
static rtx
expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode)
{
+ tree fndecl = get_callee_fndecl (exp);
tree arglist = TREE_OPERAND (exp, 1);
if (!validate_arglist (arglist,
POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE))
@@ -2637,7 +2638,7 @@ expand_builtin_memcpy (tree exp, rtx tar
unsigned int dest_align
= get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
rtx dest_mem, src_mem, dest_addr, len_rtx;
- tree result = fold_builtin_memcpy (exp);
+ tree result = fold_builtin_memcpy (fndecl, arglist);
if (result)
return expand_expr (result, target, mode, EXPAND_NORMAL);
@@ -7162,10 +7163,8 @@ fold_builtin_exponent (tree fndecl, tree
NULL_TREE if no simplification can be made. */
static tree
-fold_builtin_memcpy (tree exp)
+fold_builtin_memcpy (tree fndecl, tree arglist)
{
- tree fndecl = get_callee_fndecl (exp);
- tree arglist = TREE_OPERAND (exp, 1);
tree dest, src, len;
if (!validate_arglist (arglist,
@@ -8235,7 +8234,7 @@ fold_builtin_1 (tree exp, bool ignore)
return fold_builtin_bitop (fndecl, arglist);
case BUILT_IN_MEMCPY:
- return fold_builtin_memcpy (exp);
+ return fold_builtin_memcpy (fndecl, arglist);
case BUILT_IN_MEMPCPY:
return fold_builtin_mempcpy (arglist, type, /*endp=*/1);