diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2004-10-04 00:04:58 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2004-10-04 00:04:58 +0000 |
commit | ef7eaebfc6a4cf1b738efe18b2740b3bc8e470e8 (patch) | |
tree | 03acb193b8a3659bdefa3a89754e8f7fb85908e8 /gcc/builtins.c | |
parent | 41775162a7e2b03f6c1f9324370dacb71527151f (diff) | |
download | gcc-ef7eaebfc6a4cf1b738efe18b2740b3bc8e470e8.zip gcc-ef7eaebfc6a4cf1b738efe18b2740b3bc8e470e8.tar.gz gcc-ef7eaebfc6a4cf1b738efe18b2740b3bc8e470e8.tar.bz2 |
builtins.c (expand_builtin_memcpy): Delete duplicate code and make the first parameter the expression not the arglist.
* builtins.c (expand_builtin_memcpy): Delete duplicate code
and make the first parameter the expression not the arglist.
From-SVN: r88466
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index dd8c8ea..08ef1b8 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -2544,8 +2544,9 @@ builtin_memcpy_read_str (void *data, HOST_WIDE_INT offset, otherwise try to get the result in TARGET, if convenient (and in mode MODE if that's convenient). */ static rtx -expand_builtin_memcpy (tree arglist, rtx target, enum machine_mode mode) +expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode) { + tree arglist = TREE_OPERAND (exp, 1); if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) return 0; @@ -2559,27 +2560,15 @@ expand_builtin_memcpy (tree arglist, rtx target, enum machine_mode mode) 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); + + if (result) + return expand_expr (result, target, mode, EXPAND_NORMAL); /* If DEST is not a pointer type, call the normal function. */ if (dest_align == 0) return 0; - /* If the LEN parameter is zero, return DEST. */ - if (integer_zerop (len)) - { - /* Evaluate and ignore SRC in case it has side-effects. */ - expand_expr (src, const0_rtx, VOIDmode, EXPAND_NORMAL); - return expand_expr (dest, target, mode, EXPAND_NORMAL); - } - - /* If SRC and DEST are the same (and not volatile), return DEST. */ - if (operand_equal_p (src, dest, 0)) - { - /* Evaluate and ignore LEN in case it has side-effects. */ - expand_expr (len, const0_rtx, VOIDmode, EXPAND_NORMAL); - return expand_expr (dest, target, mode, EXPAND_NORMAL); - } - /* If either SRC is not a pointer type, don't do this operation in-line. */ if (src_align == 0) @@ -5490,7 +5479,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, break; case BUILT_IN_MEMCPY: - target = expand_builtin_memcpy (arglist, target, mode); + target = expand_builtin_memcpy (exp, target, mode); if (target) return target; break; |