This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR target/16379
- From: Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 06 Jul 2004 17:48:29 +0900
- Subject: [PATCH] Fix PR target/16379
Hi, Nick
This is a patch to fix PR target/1679
Please apply it.
Please commit into 3.4-branch and mainline.
Regards,
Kazuhiro Inaoka
gcc/ChangeLog
2004-07-06 Kazuhiro Inaoka <inaoka dot kazuhiro at renesas dot com>
* config/m32r/m32r.c (function_symbol): Added. For PR
target/1679.
(block_move_call): Changed.
* config/m32r/m32r-protos.h (function_symbol): Added.
* config/m32r/m32r.h (INITIALIZE_TRAMPOLINE): Changed.
Index: m32r-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r-protos.h,v
retrieving revision 1.21.4.2
diff -c -r1.21.4.2 m32r-protos.h
*** m32r-protos.h 15 Jun 2004 10:15:14 -0000 1.21.4.2
--- m32r-protos.h 6 Jul 2004 07:57:19 -0000
***************
*** 59,64 ****
--- 59,65 ----
extern int m32r_legitimate_pic_operand_p (rtx);
extern rtx m32r_legitimize_pic_address (rtx, rtx);
extern rtx m32r_return_addr (int);
+ extern rtx function_symbol (const char *);
#ifdef HAVE_MACHINE_MODES
extern int call_address_operand (rtx, Mmode);
Index: m32r.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.c,v
retrieving revision 1.80.4.2
diff -c -r1.80.4.2 m32r.c
*** m32r.c 15 Jun 2004 10:15:14 -0000 1.80.4.2
--- m32r.c 6 Jul 2004 07:57:19 -0000
***************
*** 2754,2759 ****
--- 2754,2781 ----
/* Use a library function to move some bytes. */
+ rtx
+ function_symbol (const char *name)
+ {
+ int extra_flags = 0;
+ enum m32r_model model;
+ rtx sym = gen_rtx_SYMBOL_REF (Pmode, name);
+
+ if (TARGET_MODEL_SMALL)
+ model = M32R_MODEL_SMALL;
+ else if (TARGET_MODEL_MEDIUM)
+ model = M32R_MODEL_MEDIUM;
+ else if (TARGET_MODEL_LARGE)
+ model = M32R_MODEL_LARGE;
+ else
+ abort (); /* shouldn't happen */
+ extra_flags |= model << SYMBOL_FLAG_MODEL_SHIFT;
+
+ if (extra_flags)
+ SYMBOL_REF_FLAGS (sym) |= extra_flags;
+
+ return sym;
+ }
static void
block_move_call (rtx dest_reg, rtx src_reg, rtx bytes_rtx)
***************
*** 2765,2777 ****
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,
TREE_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,
TREE_UNSIGNED (integer_type_node)),
--- 2787,2800 ----
bytes_rtx = convert_to_mode (Pmode, bytes_rtx, 1);
#ifdef TARGET_MEM_FUNCTIONS
! /* emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"), 0, */
! emit_library_call (function_symbol ("memcpy"), 0,
VOIDmode, 3, dest_reg, Pmode, src_reg, Pmode,
convert_to_mode (TYPE_MODE (sizetype), bytes_rtx,
TREE_UNSIGNED (sizetype)),
TYPE_MODE (sizetype));
#else
! emit_library_call (function_symbol ("bcopy"), 0,
VOIDmode, 3, src_reg, Pmode, dest_reg, Pmode,
convert_to_mode (TYPE_MODE (integer_type_node), bytes_rtx,
TREE_UNSIGNED (integer_type_node)),
Index: m32r.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.h,v
retrieving revision 1.99.4.4
diff -c -r1.99.4.4 m32r.h
*** m32r.h 15 Jun 2004 10:15:15 -0000 1.99.4.4
--- m32r.h 6 Jul 2004 07:57:19 -0000
***************
*** 1298,1304 ****
emit_insn (gen_flush_icache (validize_mem (gen_rtx_MEM (SImode, TRAMP)),\
GEN_INT (m32r_cache_flush_trap) )); \
else if (m32r_cache_flush_func && m32r_cache_flush_func[0]) \
! emit_library_call (gen_rtx_SYMBOL_REF (Pmode, m32r_cache_flush_func), \
0, VOIDmode, 3, TRAMP, Pmode, \
GEN_INT (TRAMPOLINE_SIZE), SImode, \
GEN_INT (3), SImode); \
--- 1298,1304 ----
emit_insn (gen_flush_icache (validize_mem (gen_rtx_MEM (SImode, TRAMP)),\
GEN_INT (m32r_cache_flush_trap) )); \
else if (m32r_cache_flush_func && m32r_cache_flush_func[0]) \
! emit_library_call (function_symbol (m32r_cache_flush_func), \
0, VOIDmode, 3, TRAMP, Pmode, \
GEN_INT (TRAMPOLINE_SIZE), SImode, \
GEN_INT (3), SImode); \