This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

memcpy vs memmove and structure returns



I've checked in Loren's patch from March to the mainline and branch
trees to fix a codegen regression on several platforms
(execute/20010124-1.c).

This is step #1 (of 2) related to revamping how assignments work.  
The second part (still under construction) is designed to allow us
to use memcpy for structure returns when we can prove it's safe.

I've bootstrapped both PA32 and PA64 with this change on the gcc-3.0
branch.
        * expr.h (enum libfunc_index): Add LTI_memmove.
        (memmove_libfunc): Define macro.
        * optabs.c (init_optabs): Initialize memmove_libfunc.
        * expr.c (expand_assignment): Use memmove_libfunc instead of
        memcpy_libfunc.

Index: expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expr.c,v
retrieving revision 1.295.2.4
diff -c -3 -p -r1.295.2.4 expr.c
*** expr.c	2001/03/15 19:01:59	1.295.2.4
--- expr.c	2001/04/14 03:30:59
*************** expand_assignment (to, from, want_value,
*** 3843,3849 ****
  			   TYPE_MODE (sizetype));
  
  #ifdef TARGET_MEM_FUNCTIONS
!       emit_library_call (memcpy_libfunc, LCT_NORMAL,
  			 VOIDmode, 3, XEXP (to_rtx, 0), Pmode,
  			 XEXP (from_rtx, 0), Pmode,
  			 convert_to_mode (TYPE_MODE (sizetype),
--- 3843,3849 ----
  			   TYPE_MODE (sizetype));
  
  #ifdef 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),
Index: expr.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expr.h,v
retrieving revision 1.73
diff -c -3 -p -r1.73 expr.h
*** expr.h	2000/12/03 23:58:44	1.73
--- expr.h	2001/04/14 03:31:01
*************** enum libfunc_index
*** 493,498 ****
--- 493,499 ----
    LTI_trunctfdf2,
  
    LTI_memcpy,
+   LTI_memmove,
    LTI_bcopy,
    LTI_memcmp,
    LTI_bcmp,
*************** extern rtx libfunc_table[LTI_MAX];
*** 626,631 ****
--- 627,633 ----
  #define trunctfdf2_libfunc	(libfunc_table[LTI_trunctfdf2])
  
  #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])
Index: optabs.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/optabs.c,v
retrieving revision 1.87
diff -c -3 -p -r1.87 optabs.c
*** optabs.c	2001/01/28 01:50:06	1.87
--- optabs.c	2001/04/14 03:31:05
*************** init_optabs ()
*** 4757,4762 ****
--- 4757,4763 ----
    trunctfdf2_libfunc = init_one_libfunc ("__trunctfdf2");
  
    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");



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]