diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2004-07-05 20:49:20 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2004-07-05 20:49:20 +0100 |
commit | 8f99553ff6cdc54e5af910042f93fbfbdaac0424 (patch) | |
tree | 8e0aa0cf5c8ffabad8a0bb6237050ce3904720e0 /gcc/expr.c | |
parent | bd4c82502007c08b94a8a24d7d63c00c3a4868b9 (diff) | |
download | gcc-8f99553ff6cdc54e5af910042f93fbfbdaac0424.zip gcc-8f99553ff6cdc54e5af910042f93fbfbdaac0424.tar.gz gcc-8f99553ff6cdc54e5af910042f93fbfbdaac0424.tar.bz2 |
c-decl.c, [...]: Don't check TARGET_MEM_FUNCTIONS.
* c-decl.c, config/m32r/m32r.c, expr.c, optabs.c: Don't check
TARGET_MEM_FUNCTIONS.
* system.h: Poison TARGET_MEM_FUNCTIONS.
* libfuncs.h (LTI_bcopy, LTI_bcmp, LTI_bzero, bcopy_libfunc,
bcmp_libfunc, bzero_libfunc): Remove.
* optabs.c (init_obtabs): Don't set bcopy_libfunc, bcmp_libfunc or
bzero_libfunc.
* doc/tm.texi (TARGET_MEM_FUNCTIONS): Remove.
* doc/standards.texi: Don't mention calling BSD string functions.
* doc/invoke.texi: Likewise. Mention that memmove may be called.
* config/vax/t-memfuncs: New.
* config/memcmp.c, config/memcpy.c, config/memmove.c,
config/memset.c: New.
* config/pdp11/t-pdp11 (LIB2FUNCS_EXTRA): Use these files.
* config.gcc (vax-*-bsd*, vax-*-sysv*, vax-*-ultrix*): Use
vax/t-memfuncs.
* config/alpha/alpha.h, config/arc/arc.h, config/arm/arm.h,
config/avr/avr.h, config/c4x/c4x.h, config/cris/aout.h,
config/elfos.h, config/gnu.h, config/h8300/h8300.h,
config/i386/gas.h, config/ia64/ia64.h, config/interix.h,
config/ip2k/ip2k.h, config/lynx-ng.h, config/m32r/m32r.h,
config/mcore/mcore.h, config/mips/mips.h, config/mmix/mmix.h,
config/netbsd.h, config/openbsd.h, config/pa/pa.h,
config/rs6000/rs6000.h, config/rtems.h, config/s390/s390.h,
config/sh/sh.h, config/sparc/sparc.h, config/stormy16/stormy16.h,
config/svr3.h: Don't define TARGET_MEM_FUNCTIONS.
From-SVN: r84130
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 122 |
1 files changed, 30 insertions, 92 deletions
@@ -77,14 +77,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif #endif -/* Convert defined/undefined to boolean. */ -#ifdef TARGET_MEM_FUNCTIONS -#undef TARGET_MEM_FUNCTIONS -#define TARGET_MEM_FUNCTIONS 1 -#else -#define TARGET_MEM_FUNCTIONS 0 -#endif - /* If this is nonzero, we do not bother generating VOLATILE around volatile memory references, and we are willing to @@ -1511,7 +1503,7 @@ emit_block_move_via_movstr (rtx x, rtx y, rtx size, unsigned int align) return false; } -/* A subroutine of emit_block_move. Expand a call to memcpy or bcopy. +/* A subroutine of emit_block_move. Expand a call to memcpy. Return the return value from memcpy, 0 otherwise. */ static rtx @@ -1550,10 +1542,7 @@ emit_block_move_via_libcall (rtx dst, rtx src, rtx size) dst_tree = make_tree (ptr_type_node, dst_addr); src_tree = make_tree (ptr_type_node, src_addr); - if (TARGET_MEM_FUNCTIONS) - size_mode = TYPE_MODE (sizetype); - else - size_mode = TYPE_MODE (unsigned_type_node); + size_mode = TYPE_MODE (sizetype); size = convert_to_mode (size_mode, size, 1); size = copy_to_mode_reg (size_mode, size); @@ -1562,27 +1551,14 @@ emit_block_move_via_libcall (rtx dst, rtx src, rtx size) memcpy in this context. This could be a user call to memcpy and the user may wish to examine the return value from memcpy. For targets where libcalls and normal calls have different conventions - for returning pointers, we could end up generating incorrect code. + for returning pointers, we could end up generating incorrect code. */ - For convenience, we generate the call to bcopy this way as well. */ - - if (TARGET_MEM_FUNCTIONS) - size_tree = make_tree (sizetype, size); - else - size_tree = make_tree (unsigned_type_node, size); + size_tree = make_tree (sizetype, size); fn = emit_block_move_libcall_fn (true); arg_list = tree_cons (NULL_TREE, size_tree, NULL_TREE); - if (TARGET_MEM_FUNCTIONS) - { - arg_list = tree_cons (NULL_TREE, src_tree, arg_list); - arg_list = tree_cons (NULL_TREE, dst_tree, arg_list); - } - else - { - arg_list = tree_cons (NULL_TREE, dst_tree, arg_list); - arg_list = tree_cons (NULL_TREE, src_tree, arg_list); - } + arg_list = tree_cons (NULL_TREE, src_tree, arg_list); + arg_list = tree_cons (NULL_TREE, dst_tree, arg_list); /* Now we have to build up the CALL_EXPR itself. */ call_expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn); @@ -1601,7 +1577,7 @@ emit_block_move_via_libcall (rtx dst, rtx src, rtx size) gen_rtx_CLOBBER (VOIDmode, dst), NULL_RTX)); - return TARGET_MEM_FUNCTIONS ? retval : NULL_RTX; + return retval; } /* A subroutine of emit_block_move_via_libcall. Create the tree node @@ -1617,20 +1593,10 @@ init_block_move_fn (const char *asmspec) { tree args, fn; - if (TARGET_MEM_FUNCTIONS) - { - fn = get_identifier ("memcpy"); - args = build_function_type_list (ptr_type_node, ptr_type_node, - const_ptr_type_node, sizetype, - NULL_TREE); - } - else - { - fn = get_identifier ("bcopy"); - args = build_function_type_list (void_type_node, const_ptr_type_node, - ptr_type_node, unsigned_type_node, - NULL_TREE); - } + fn = get_identifier ("memcpy"); + args = build_function_type_list (ptr_type_node, ptr_type_node, + const_ptr_type_node, sizetype, + NULL_TREE); fn = build_decl (FUNCTION_DECL, fn, args); DECL_EXTERNAL (fn) = 1; @@ -2642,7 +2608,7 @@ clear_storage_via_clrstr (rtx object, rtx size, unsigned int align) return false; } -/* A subroutine of clear_storage. Expand a call to memset or bzero. +/* A subroutine of clear_storage. Expand a call to memset. Return the return value of memset, 0 otherwise. */ static rtx @@ -2673,10 +2639,7 @@ clear_storage_via_libcall (rtx object, rtx size) object = copy_to_mode_reg (Pmode, XEXP (object, 0)); - if (TARGET_MEM_FUNCTIONS) - size_mode = TYPE_MODE (sizetype); - else - size_mode = TYPE_MODE (unsigned_type_node); + size_mode = TYPE_MODE (sizetype); size = convert_to_mode (size_mode, size, 1); size = copy_to_mode_reg (size_mode, size); @@ -2684,20 +2647,14 @@ clear_storage_via_libcall (rtx object, rtx size) memset in this context. This could be a user call to memset and the user may wish to examine the return value from memset. For targets where libcalls and normal calls have different conventions - for returning pointers, we could end up generating incorrect code. - - For convenience, we generate the call to bzero this way as well. */ + for returning pointers, we could end up generating incorrect code. */ object_tree = make_tree (ptr_type_node, object); - if (TARGET_MEM_FUNCTIONS) - size_tree = make_tree (sizetype, size); - else - size_tree = make_tree (unsigned_type_node, size); + size_tree = make_tree (sizetype, size); fn = clear_storage_libcall_fn (true); arg_list = tree_cons (NULL_TREE, size_tree, NULL_TREE); - if (TARGET_MEM_FUNCTIONS) - arg_list = tree_cons (NULL_TREE, integer_zero_node, arg_list); + arg_list = tree_cons (NULL_TREE, integer_zero_node, arg_list); arg_list = tree_cons (NULL_TREE, object_tree, arg_list); /* Now we have to build up the CALL_EXPR itself. */ @@ -2713,7 +2670,7 @@ clear_storage_via_libcall (rtx object, rtx size) if (RTX_UNCHANGING_P (object)) emit_insn (gen_rtx_CLOBBER (VOIDmode, object)); - return (TARGET_MEM_FUNCTIONS ? retval : NULL_RTX); + return retval; } /* A subroutine of clear_storage_via_libcall. Create the tree node @@ -2729,19 +2686,10 @@ init_block_clear_fn (const char *asmspec) { tree fn, args; - if (TARGET_MEM_FUNCTIONS) - { - fn = get_identifier ("memset"); - args = build_function_type_list (ptr_type_node, ptr_type_node, - integer_type_node, sizetype, - NULL_TREE); - } - else - { - fn = get_identifier ("bzero"); - args = build_function_type_list (void_type_node, ptr_type_node, - unsigned_type_node, NULL_TREE); - } + fn = get_identifier ("memset"); + args = build_function_type_list (ptr_type_node, ptr_type_node, + integer_type_node, sizetype, + NULL_TREE); fn = build_decl (FUNCTION_DECL, fn, args); DECL_EXTERNAL (fn) = 1; @@ -4029,21 +3977,12 @@ expand_assignment (tree to, tree from, int want_value) size = expr_size (from); from_rtx = expand_expr (from, NULL_RTX, VOIDmode, 0); - if (TARGET_MEM_FUNCTIONS) - emit_library_call (memmove_libfunc, LCT_NORMAL, - VOIDmode, 3, XEXP (to_rtx, 0), Pmode, - XEXP (from_rtx, 0), Pmode, - convert_to_mode (TYPE_MODE (sizetype), - size, TYPE_UNSIGNED (sizetype)), - TYPE_MODE (sizetype)); - else - emit_library_call (bcopy_libfunc, LCT_NORMAL, - VOIDmode, 3, XEXP (from_rtx, 0), Pmode, - XEXP (to_rtx, 0), Pmode, - convert_to_mode (TYPE_MODE (integer_type_node), - size, - TYPE_UNSIGNED (integer_type_node)), - TYPE_MODE (integer_type_node)); + emit_library_call (memmove_libfunc, LCT_NORMAL, + VOIDmode, 3, XEXP (to_rtx, 0), Pmode, + XEXP (from_rtx, 0), Pmode, + convert_to_mode (TYPE_MODE (sizetype), + size, TYPE_UNSIGNED (sizetype)), + TYPE_MODE (sizetype)); preserve_temp_slots (to_rtx); free_temp_slots (); @@ -5207,10 +5146,10 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) and then "or" in whatever non-constant ranges we need in addition. If a large set is all zero or all ones, it is - probably better to set it using memset (if available) or bzero. + probably better to set it using memset. Also, if a large set has just a single range, it may also be better to first clear all the first clear the set (using - bzero/memset), and set the bits we want. */ + memset), and set the bits we want. */ /* Check for all zeros. */ if (elt == NULL_TREE && size > 0) @@ -5342,8 +5281,7 @@ store_constructor (tree exp, rtx target, int cleared, HOST_WIDE_INT size) /* Optimization: If startbit and endbit are constants divisible by BITS_PER_UNIT, call memset instead. */ - if (TARGET_MEM_FUNCTIONS - && TREE_CODE (startbit) == INTEGER_CST + if (TREE_CODE (startbit) == INTEGER_CST && TREE_CODE (endbit) == INTEGER_CST && (startb = TREE_INT_CST_LOW (startbit)) % BITS_PER_UNIT == 0 && (endb = TREE_INT_CST_LOW (endbit) + 1) % BITS_PER_UNIT == 0) |