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
This commit is contained in:
Joseph Myers 2004-07-05 20:49:20 +01:00 committed by Joseph Myers
parent bd4c825020
commit 8f99553ff6
45 changed files with 136 additions and 265 deletions

View file

@ -1,3 +1,32 @@
2004-07-05 Joseph S. Myers <jsm@polyomino.org.uk>
* 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.
2004-07-05 Richard Henderson <rth@redhat.com>
* function.c (assign_parm_setup_reg): Properly rename variables in

View file

@ -2944,17 +2944,10 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
tree builtin = built_in_decls [DECL_FUNCTION_CODE (decl)];
SET_DECL_RTL (builtin, NULL_RTX);
change_decl_assembler_name (builtin, get_identifier (starred));
#ifdef TARGET_MEM_FUNCTIONS
if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMCPY)
init_block_move_fn (starred);
else if (DECL_FUNCTION_CODE (decl) == BUILT_IN_MEMSET)
init_block_clear_fn (starred);
#else
if (DECL_FUNCTION_CODE (decl) == BUILT_IN_BCOPY)
init_block_move_fn (starred);
else if (DECL_FUNCTION_CODE (decl) == BUILT_IN_BZERO)
init_block_clear_fn (starred);
#endif
}
SET_DECL_RTL (decl, NULL_RTX);
change_decl_assembler_name (decl, get_identifier (starred));

View file

@ -2012,11 +2012,13 @@ v850-*-*)
;;
vax-*-bsd*) # VAXen running BSD
tm_file="${tm_file} vax/bsd.h"
tmake_file=vax/t-memfuncs
use_collect2=yes
use_fixproto=yes
;;
vax-*-sysv*) # VAXen running system V
tm_file="${tm_file} vax/vaxv.h"
tmake_file=vax/t-memfuncs
use_fixproto=yes
;;
vax-*-netbsdelf*)
@ -2034,6 +2036,7 @@ vax-*-openbsd*)
;;
vax-*-ultrix*) # VAXen running ultrix
tm_file="${tm_file} vax/ultrix.h"
tmake_file=vax/t-memfuncs
use_fixproto=yes
;;
xscale-*-elf)

View file

@ -1835,6 +1835,3 @@ do { \
/* The system headers under Alpha systems are generally C++-aware. */
#define NO_IMPLICIT_EXTERN_C
/* Generate calls to memcpy, etc., not bcopy, etc. */
#define TARGET_MEM_FUNCTIONS 1

View file

@ -802,11 +802,6 @@ do { \
emit_insn (gen_flush_icache (validize_mem (gen_rtx_MEM (SImode, TRAMP)))); \
} while (0)
/* Library calls. */
/* Generate calls to memcpy, memcmp and memset. */
#define TARGET_MEM_FUNCTIONS
/* Addressing modes, and classification of registers for them. */
/* Maximum number of registers that can appear in a valid memory address. */

View file

@ -536,9 +536,6 @@ extern int arm_is_6_or_7;
that is controlled by the APCS-FRAME option. */
#define CAN_DEBUG_WITHOUT_FP
#undef TARGET_MEM_FUNCTIONS
#define TARGET_MEM_FUNCTIONS 1
#define OVERRIDE_OPTIONS arm_override_options ()
/* Nonzero if PIC code requires explicit qualifiers to generate

View file

@ -803,8 +803,6 @@ extern int avr_case_values_threshold;
#define ADJUST_INSN_LENGTH(INSN, LENGTH) (LENGTH =\
adjust_insn_length (INSN, LENGTH))
#define TARGET_MEM_FUNCTIONS
#define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
#define CC1_SPEC "%{profile:-p}"

View file

@ -1193,10 +1193,6 @@ CUMULATIVE_ARGS;
fprintf (FILE, "\tpop\tar2\n"); \
}
/* Implicit Calls to Library Routines. */
#define TARGET_MEM_FUNCTIONS
/* CC_NOOVmode should be used when the first operand is a PLUS, MINUS, NEG
or MULT.
CCmode should be used when no special processing is needed. */

View file

@ -139,11 +139,6 @@ Boston, MA 02111-1307, USA. */
#define MAX_OFILE_ALIGNMENT 16
/* Node: Library Calls */
#define TARGET_MEM_FUNCTIONS
/* Node: Data Output */
#define ESCAPES \

View file

@ -58,10 +58,6 @@ Boston, MA 02111-1307, USA. */
#define PCC_BITFIELD_TYPE_MATTERS 1
#endif
/* Implicit library calls should use memcpy, not bcopy, etc. */
#define TARGET_MEM_FUNCTIONS
/* Handle #pragma weak and #pragma pack. */
#define HANDLE_SYSV_PRAGMA 1

View file

@ -12,10 +12,6 @@
#undef STANDARD_INCLUDE_DIR
#define STANDARD_INCLUDE_DIR "/include"
/* Implicit library calls should use memcpy, not bcopy, etc. */
#undef TARGET_MEM_FUNCTIONS
#define TARGET_MEM_FUNCTIONS
/* The system headers under GNU are C++-aware. */
#define NO_IMPLICIT_EXTERN_C

View file

@ -1138,12 +1138,6 @@ struct cum_arg
#define FINAL_PRESCAN_INSN(insn, operand, nop) \
final_prescan_insn (insn, operand, nop)
/* Define this macro if GCC should generate calls to the System V
(and ANSI C) library functions `memcpy' and `memset' rather than
the BSD functions `bcopy' and `bzero'. */
#define TARGET_MEM_FUNCTIONS
#define MOVE_RATIO 3
/* Define the codes that are matched by predicates in h8300.c. */

View file

@ -49,10 +49,6 @@ Boston, MA 02111-1307, USA. */
#define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME);
/* Implicit library calls should use memcpy, not bcopy, etc. */
#define TARGET_MEM_FUNCTIONS
/* In the past there was confusion as to what the argument to .align was
in GAS. For the last several years the rule has been this: for a.out
file formats that argument is LOG, and for all other file formats the

View file

@ -1555,15 +1555,6 @@ do { \
#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, STATIC_CHAIN) \
ia64_initialize_trampoline((ADDR), (FNADDR), (STATIC_CHAIN))
/* Implicit Calls to Library Routines */
/* Define this macro if GCC should generate calls to the System V (and ANSI
C) library functions `memcpy' and `memset' rather than the BSD functions
`bcopy' and `bzero'. */
#define TARGET_MEM_FUNCTIONS
/* Addressing Modes */

View file

@ -22,10 +22,6 @@ along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef TARGET_MEM_FUNCTIONS
#define TARGET_MEM_FUNCTIONS
#endif
/* POSIX/Uni-thread only for now. Look at the winnt version
for windows/multi thread */

View file

@ -808,8 +808,6 @@ extern int ip2k_reorg_merge_qimode;
#define FUNCTION_PROFILER(FILE, LABELNO) \
fprintf ((FILE), "/* profiler %d */", (LABELNO))
#define TARGET_MEM_FUNCTIONS
#undef ENDFILE_SPEC
#undef LINK_SPEC
#undef STARTFILE_SPEC

View file

@ -64,10 +64,6 @@ Boston, MA 02111-1307, USA. */
#define SDB_DEBUGGING_INFO 1
/* Generate calls to memcpy, memcmp and memset. */
#define TARGET_MEM_FUNCTIONS
/* Handle #pragma pack and sometimes #pragma weak. */
#define HANDLE_SYSV_PRAGMA 1

View file

@ -2601,19 +2601,11 @@ block_move_call (rtx dest_reg, rtx src_reg, rtx bytes_rtx)
&& GET_MODE (bytes_rtx) != Pmode)
bytes_rtx = convert_to_mode (Pmode, bytes_rtx, 1);
#ifdef TARGET_MEM_FUNCTIONS
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "memcpy"), 0,
VOIDmode, 3, dest_reg, Pmode, src_reg, Pmode,
convert_to_mode (TYPE_MODE (sizetype), bytes_rtx,
TYPE_UNSIGNED (sizetype)),
TYPE_MODE (sizetype));
#else
emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "bcopy"), 0,
VOIDmode, 3, src_reg, Pmode, dest_reg, Pmode,
convert_to_mode (TYPE_MODE (integer_type_node), bytes_rtx,
TYPE_UNSIGNED (integer_type_node)),
TYPE_MODE (integer_type_node));
#endif
}
/* The maximum number of bytes to copy using pairs of load/store instructions.

View file

@ -1260,11 +1260,6 @@ L2: .word STATIC
} \
while (0)
/* Library calls. */
/* Generate calls to memcpy, memcmp and memset. */
#define TARGET_MEM_FUNCTIONS
#define RETURN_ADDR_RTX(COUNT, FRAME) m32r_return_addr (COUNT)
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, RETURN_ADDR_REGNUM)

View file

@ -953,9 +953,6 @@ extern const enum reg_class reg_class_from_letter[];
#define WORD_REGISTER_OPERATIONS
/* Implicit library calls should use memcpy, not bcopy, etc. */
#define TARGET_MEM_FUNCTIONS
/* Assembler output control. */
#define ASM_COMMENT_START "\t//"

16
gcc/config/memcmp.c Normal file
View file

@ -0,0 +1,16 @@
/* Public domain. */
#include <stddef.h>
int
memcmp (const void *str1, const void *str2, size_t count)
{
const unsigned char *s1 = str1;
const unsigned char *s2 = str2;
while (count-- > 0)
{
if (*s1++ != *s2++)
return s1[-1] < s2[-1] ? -1 : 1;
}
return 0;
}

12
gcc/config/memcpy.c Normal file
View file

@ -0,0 +1,12 @@
/* Public domain. */
#include <stddef.h>
void *
memcpy (void *dest, const void *src, size_t len)
{
char *d = dest;
const char *s = src;
while (len--)
*d++ = *s++;
return dest;
}

20
gcc/config/memmove.c Normal file
View file

@ -0,0 +1,20 @@
/* Public domain. */
#include <stddef.h>
void *
memmove (void *dest, const void *src, size_t len)
{
char *d = dest;
const char *s = src;
if (d < s)
while (len--)
*d++ = *s++;
else
{
char *lasts = s + (len-1);
char *lastd = d + (len-1);
while (len--)
*lastd-- = *lasts--;
}
return dest;
}

11
gcc/config/memset.c Normal file
View file

@ -0,0 +1,11 @@
/* Public domain. */
#include <stddef.h>
void *
memset (void *dest, int val, size_t len)
{
unsigned char *ptr = dest;
while (len-- > 0)
*ptr++ = val;
return dest;
}

View file

@ -3363,9 +3363,6 @@ while (0)
#define DONT_ACCESS_GBLS_AFTER_EPILOGUE (TARGET_ABICALLS && !TARGET_OLDABI)
/* Generate calls to memcpy, etc., not bcopy, etc. */
#define TARGET_MEM_FUNCTIONS
#ifndef __mips16
/* Since the bits of the _init and _fini function is spread across
many object files, each potentially with its own GP, we must assume

View file

@ -806,11 +806,6 @@ typedef struct { int regs; int lib; } CUMULATIVE_ARGS;
mmix_initialize_trampoline (ADDR, FNADDR, STATIC_CHAIN)
/* Node: Library Calls */
#define TARGET_MEM_FUNCTIONS
/* Node: Addressing Modes */
#define CONSTANT_ADDRESS_P(X) \

View file

@ -159,11 +159,6 @@ Boston, MA 02111-1307, USA. */
#undef TARGET_HAS_F_SETLKW
#define TARGET_HAS_F_SETLKW
/* Implicit library calls should use memcpy, not bcopy, etc. */
#undef TARGET_MEM_FUNCTIONS
#define TARGET_MEM_FUNCTIONS 1
/* Handle #pragma weak and #pragma pack. */
#define HANDLE_SYSV_PRAGMA 1

View file

@ -130,13 +130,6 @@ Boston, MA 02111-1307, USA. */
/* Runtime target specification. */
/* Implicit calls to library routines. */
/* Use memcpy and memset instead of bcopy and bzero. */
#ifndef TARGET_MEM_FUNCTIONS
#define TARGET_MEM_FUNCTIONS
#endif
/* Miscellaneous parameters. */
/* Controlling debugging info: dbx options. */

View file

@ -500,9 +500,6 @@ do { \
when given unaligned data. */
#define STRICT_ALIGNMENT 1
/* Generate calls to memcpy, memcmp and memset. */
#define TARGET_MEM_FUNCTIONS
/* Value is 1 if it is a good idea to tie two pseudo registers
when one has mode MODE1 and one has mode MODE2.
If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,

View file

@ -1,5 +1,7 @@
TARGET_LIBGCC2_CFLAGS = -O2 -mfloat32
LIB2FUNCS_EXTRA = $(srcdir)/config/udivmod.c $(srcdir)/config/udivmodsi4.c
LIB2FUNCS_EXTRA = $(srcdir)/config/udivmod.c $(srcdir)/config/udivmodsi4.c \
$(srcdir)/config/memcmp.c $(srcdir)/config/memcpy.c \
$(srcdir)/config/memmove.c $(srcdir)/config/memset.c
# floating point emulation libraries
FPBIT = fp-bit.c

View file

@ -2217,10 +2217,6 @@ extern int rs6000_compare_fp_p;
the end of the line. */
#define ASM_COMMENT_START " #"
/* Implicit library calls should use memcpy, not bcopy, etc. */
#define TARGET_MEM_FUNCTIONS
/* Flag to say the TOC is initialized */
extern int toc_initialized;

View file

@ -21,11 +21,6 @@ Boston, MA 02111-1307, USA. */
/* The system headers under RTEMS are C++-aware. */
#define NO_IMPLICIT_EXTERN_C
/* Generate calls to memcpy, memcmp and memset. */
#ifndef TARGET_MEM_FUNCTIONS
#define TARGET_MEM_FUNCTIONS
#endif
/*
* Dummy start/end specification to let linker work as
* needed by autoconf scripts using this compiler.

View file

@ -722,12 +722,6 @@ CUMULATIVE_ARGS;
s390_trampoline_template (FILE)
/* Library calls. */
/* We should use memcpy, not bcopy. */
#define TARGET_MEM_FUNCTIONS
/* Addressing modes, and classification of registers for them. */
/* Recognize any constant value that is a valid address. */

View file

@ -3232,10 +3232,6 @@ enum mdep_reorg_phase_e
extern enum mdep_reorg_phase_e mdep_reorg_phase;
/* Generate calls to memcpy, memcmp and memset. */
#define TARGET_MEM_FUNCTIONS
/* Handle Renesas compiler's pragmas. */
#define REGISTER_TARGET_PRAGMAS() do { \
c_register_pragma (0, "interrupt", sh_pr_interrupt); \

View file

@ -2207,9 +2207,6 @@ do { \
/* Specify the machine mode used for addresses. */
#define Pmode (TARGET_ARCH64 ? DImode : SImode)
/* Generate calls to memcpy, memcmp and memset. */
#define TARGET_MEM_FUNCTIONS
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
return the mode to be used for the comparison. For floating-point,
CCFP[E]mode is used. CC_NOOVmode should be used when the first operand

View file

@ -497,10 +497,6 @@ enum reg_class
xstormy16_initialize_trampoline (ADDR, FNADDR, STATIC_CHAIN)
/* Implicit Calls to Library Routines */
#define TARGET_MEM_FUNCTIONS
/* Define this macro to override the type used by the library routines to pick
up arguments of type `float'. (By default, they use a union of `float' and
`int'.)

View file

@ -70,10 +70,6 @@ Boston, MA 02111-1307, USA. */
#define NO_DOLLAR_IN_LABEL
/* Implicit library calls should use memcpy, not bcopy, etc. */
#define TARGET_MEM_FUNCTIONS
/* System V Release 3 uses COFF debugging info. */
#define SDB_DEBUGGING_INFO 1

View file

@ -0,0 +1,3 @@
LIB2FUNCS_EXTRA = \
$(srcdir)/config/memcmp.c $(srcdir)/config/memcpy.c \
$(srcdir)/config/memmove.c $(srcdir)/config/memset.c

View file

@ -5437,9 +5437,9 @@ or @option{-nodefaultlibs} is used.
Do not use the standard system libraries when linking.
Only the libraries you specify will be passed to the linker.
The standard startup files are used normally, unless @option{-nostartfiles}
is used. The compiler may generate calls to memcmp, memset, and memcpy
for System V (and ISO C) environments or to bcopy and bzero for
BSD environments. These entries are usually resolved by entries in
is used. The compiler may generate calls to @code{memcmp},
@code{memset}, @code{memcpy} and @code{memmove}.
These entries are usually resolved by entries in
libc. These entry points should be supplied through some other
mechanism when this option is specified.
@ -5447,9 +5447,9 @@ mechanism when this option is specified.
@opindex nostdlib
Do not use the standard system startup files or libraries when linking.
No startup files and only the libraries you specify will be passed to
the linker. The compiler may generate calls to memcmp, memset, and memcpy
for System V (and ISO C) environments or to bcopy and bzero for
BSD environments. These entries are usually resolved by entries in
the linker. The compiler may generate calls to @code{memcmp}, @code{memset},
@code{memcpy} and @code{memmove}.
These entries are usually resolved by entries in
libc. These entry points should be supplied through some other
mechanism when this option is specified.

View file

@ -145,9 +145,7 @@ GNU C library). @xref{Standard Libraries,,Standard Libraries}.
Most of the compiler support routines used by GCC are present in
@file{libgcc}, but there are a few exceptions. GCC requires the
freestanding environment provide @code{memcpy}, @code{memmove},
@code{memset} and @code{memcmp}. Some older ports of GCC are
configured to use the BSD @code{bcopy}, @code{bzero} and @code{bcmp}
functions instead, but this is deprecated for new ports.
@code{memset} and @code{memcmp}.
Finally, if @code{__builtin_trap} is used, and the target does
not implement the @code{trap} pattern, then GCC will emit a call
to @code{abort}.

View file

@ -4811,17 +4811,6 @@ refers to the global ``variable'' @code{errno}. (On certain systems,
macro, a reasonable default is used.
@end defmac
@cindex @code{bcopy}, implicit usage
@cindex @code{memcpy}, implicit usage
@cindex @code{memmove}, implicit usage
@cindex @code{bzero}, implicit usage
@cindex @code{memset}, implicit usage
@defmac TARGET_MEM_FUNCTIONS
Define this macro if GCC should generate calls to the ISO C
(and System V) library functions @code{memcpy}, @code{memmove} and
@code{memset} rather than the BSD functions @code{bcopy} and @code{bzero}.
@end defmac
@cindex C99 math functions, implicit usage
@defmac TARGET_C99_FUNCTIONS
When this macro is nonzero, GCC will implicitly optimize @code{sin} calls into

View file

@ -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)

View file

@ -27,11 +27,8 @@ enum libfunc_index
LTI_abort,
LTI_memcpy,
LTI_memmove,
LTI_bcopy,
LTI_memcmp,
LTI_bcmp,
LTI_memset,
LTI_bzero,
LTI_setbits,
LTI_unwind_resume,
@ -58,11 +55,8 @@ extern GTY(()) rtx libfunc_table[LTI_MAX];
#define abort_libfunc (libfunc_table[LTI_abort])
#define memcpy_libfunc (libfunc_table[LTI_memcpy])
#define memmove_libfunc (libfunc_table[LTI_memmove])
#define bcopy_libfunc (libfunc_table[LTI_bcopy])
#define memcmp_libfunc (libfunc_table[LTI_memcmp])
#define bcmp_libfunc (libfunc_table[LTI_bcmp])
#define memset_libfunc (libfunc_table[LTI_memset])
#define bzero_libfunc (libfunc_table[LTI_bzero])
#define setbits_libfunc (libfunc_table[LTI_setbits])
#define unwind_resume_libfunc (libfunc_table[LTI_unwind_resume])

View file

@ -3744,15 +3744,9 @@ prepare_cmp_insn (rtx *px, rtx *py, enum rtx_code *pcomparison, rtx size,
return;
}
/* Otherwise call a library function, memcmp if we've got it,
bcmp otherwise. */
#ifdef TARGET_MEM_FUNCTIONS
/* Otherwise call a library function, memcmp. */
libfunc = memcmp_libfunc;
length_type = sizetype;
#else
libfunc = bcmp_libfunc;
length_type = integer_type_node;
#endif
result_mode = TYPE_MODE (integer_type_node);
cmp_mode = TYPE_MODE (length_type);
size = convert_to_mode (TYPE_MODE (length_type), size,
@ -5522,11 +5516,8 @@ init_optabs (void)
abort_libfunc = init_one_libfunc ("abort");
memcpy_libfunc = init_one_libfunc ("memcpy");
memmove_libfunc = init_one_libfunc ("memmove");
bcopy_libfunc = init_one_libfunc ("bcopy");
memcmp_libfunc = init_one_libfunc ("memcmp");
bcmp_libfunc = init_one_libfunc ("__gcc_bcmp");
memset_libfunc = init_one_libfunc ("memset");
bzero_libfunc = init_one_libfunc ("bzero");
setbits_libfunc = init_one_libfunc ("__setbits");
unwind_resume_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS

View file

@ -618,7 +618,7 @@ extern int snprintf (char *, size_t, const char *, ...);
DBX_OUTPUT_STANDARD_TYPES BUILTIN_SETJMP_FRAME_VALUE \
SUNOS4_SHARED_LIBRARIES PROMOTE_FOR_CALL_ONLY \
SPACE_AFTER_L_OPTION NO_RECURSIVE_FUNCTION_CSE \
DEFAULT_MAIN_RETURN
DEFAULT_MAIN_RETURN TARGET_MEM_FUNCTIONS
/* Hooks that are no longer used. */
#pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \