This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
sh64 patches applied to sh port
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 10 Jun 2003 21:59:58 +0100
- Subject: sh64 patches applied to sh port
- Organization: SuperH UK Ltd.
--
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658
2003-06-10 J"orn Rennecke <joern.rennecke@superh.com>
* sh-protos.h (function_symbol): Declare.
* sh.c (expand_block_move, expand_ashiftrt): Use it.
(sh_expand_prologue, sh_expand_epilogue): Likewise.
(sh_initialize_trampoline): Likewise.
(function_symbol): New function.
* sh.md (udivsi3, divsi3, mulsi3, ic_invalidate_line): Use it.
(initialize_trampoline, call, call_pop, call_value, sibcall): Likewise.
(call_value_pop, shcompact_return_tramp): Likewise.
* sh.h (OVERRIDE_OPTIONS): Don't suppress --profile-arc-flag.
* sh.md (GOTaddr2picreg): Use gen_lowpart to get lowpart of
target register.
Index: sh-protos.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh-protos.h,v
retrieving revision 1.41
diff -p -r1.41 sh-protos.h
*** sh-protos.h 14 May 2003 07:29:52 -0000 1.41
--- sh-protos.h 10 Jun 2003 20:32:28 -0000
*************** extern void fpscr_set_from_mem PARAMS ((
*** 136,140 ****
--- 136,141 ----
extern void sh_pr_interrupt PARAMS ((struct cpp_reader *));
extern void sh_pr_trapa PARAMS ((struct cpp_reader *));
extern void sh_pr_nosave_low_regs PARAMS ((struct cpp_reader *));
+ extern rtx function_symbol (const char *);
#endif /* ! GCC_SH_PROTOS_H */
Index: sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.213
diff -p -r1.213 sh.c
*** sh.c 20 May 2003 15:48:03 -0000 1.213
--- sh.c 10 Jun 2003 20:32:28 -0000
*************** expand_block_move (operands)
*** 626,632 ****
entry_name = get_identifier ("__movstrSI12_i4");
! sym = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (entry_name));
func_addr_rtx = copy_to_mode_reg (Pmode, sym);
force_into (XEXP (operands[0], 0), r4);
force_into (XEXP (operands[1], 0), r5);
--- 626,632 ----
entry_name = get_identifier ("__movstrSI12_i4");
! sym = function_symbol (IDENTIFIER_POINTER (entry_name));
func_addr_rtx = copy_to_mode_reg (Pmode, sym);
force_into (XEXP (operands[0], 0), r4);
force_into (XEXP (operands[1], 0), r5);
*************** expand_block_move (operands)
*** 646,652 ****
entry_name = get_identifier (bytes & 4
? "__movstr_i4_odd"
: "__movstr_i4_even");
! sym = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (entry_name));
func_addr_rtx = copy_to_mode_reg (Pmode, sym);
force_into (XEXP (operands[0], 0), r4);
force_into (XEXP (operands[1], 0), r5);
--- 646,652 ----
entry_name = get_identifier (bytes & 4
? "__movstr_i4_odd"
: "__movstr_i4_even");
! sym = function_symbol (IDENTIFIER_POINTER (entry_name));
func_addr_rtx = copy_to_mode_reg (Pmode, sym);
force_into (XEXP (operands[0], 0), r4);
force_into (XEXP (operands[1], 0), r5);
*************** expand_block_move (operands)
*** 670,676 ****
sprintf (entry, "__movstrSI%d", bytes);
entry_name = get_identifier (entry);
! sym = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (entry_name));
func_addr_rtx = copy_to_mode_reg (Pmode, sym);
force_into (XEXP (operands[0], 0), r4);
force_into (XEXP (operands[1], 0), r5);
--- 670,676 ----
sprintf (entry, "__movstrSI%d", bytes);
entry_name = get_identifier (entry);
! sym = function_symbol (IDENTIFIER_POINTER (entry_name));
func_addr_rtx = copy_to_mode_reg (Pmode, sym);
force_into (XEXP (operands[0], 0), r4);
force_into (XEXP (operands[1], 0), r5);
*************** expand_block_move (operands)
*** 691,697 ****
rtx r6 = gen_rtx_REG (SImode, 6);
entry_name = get_identifier ("__movstr");
! sym = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (entry_name));
func_addr_rtx = copy_to_mode_reg (Pmode, sym);
force_into (XEXP (operands[0], 0), r4);
force_into (XEXP (operands[1], 0), r5);
--- 691,697 ----
rtx r6 = gen_rtx_REG (SImode, 6);
entry_name = get_identifier ("__movstr");
! sym = function_symbol (IDENTIFIER_POINTER (entry_name));
func_addr_rtx = copy_to_mode_reg (Pmode, sym);
force_into (XEXP (operands[0], 0), r4);
force_into (XEXP (operands[1], 0), r5);
*************** expand_ashiftrt (operands)
*** 1908,1914 ****
emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]);
sprintf (func, "__ashiftrt_r4_%d", value);
func_name = get_identifier (func);
! sym = gen_rtx_SYMBOL_REF (Pmode, IDENTIFIER_POINTER (func_name));
emit_move_insn (wrk, sym);
emit_insn (gen_ashrsi3_n (GEN_INT (value), wrk));
emit_move_insn (operands[0], gen_rtx_REG (SImode, 4));
--- 1908,1914 ----
emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]);
sprintf (func, "__ashiftrt_r4_%d", value);
func_name = get_identifier (func);
! sym = function_symbol (IDENTIFIER_POINTER (func_name));
emit_move_insn (wrk, sym);
emit_insn (gen_ashrsi3_n (GEN_INT (value), wrk));
emit_move_insn (operands[0], gen_rtx_REG (SImode, 4));
*************** sh_expand_prologue ()
*** 5110,5119 ****
if (SHMEDIA_REGS_STACK_ADJUST ())
{
emit_move_insn (gen_rtx_REG (Pmode, R0_REG),
! gen_rtx_SYMBOL_REF (Pmode,
! TARGET_FPU_ANY
! ? "__GCC_push_shmedia_regs"
! : "__GCC_push_shmedia_regs_nofpu"));
/* This must NOT go through the PLT, otherwise mach and macl
may be clobbered. */
emit_insn (gen_shmedia_save_restore_regs_compact
--- 5110,5118 ----
if (SHMEDIA_REGS_STACK_ADJUST ())
{
emit_move_insn (gen_rtx_REG (Pmode, R0_REG),
! function_symbol (TARGET_FPU_ANY
! ? "__GCC_push_shmedia_regs"
! : "__GCC_push_shmedia_regs_nofpu"));
/* This must NOT go through the PLT, otherwise mach and macl
may be clobbered. */
emit_insn (gen_shmedia_save_restore_regs_compact
*************** sh_expand_prologue ()
*** 5146,5153 ****
/* This must NOT go through the PLT, otherwise mach and macl
may be clobbered. */
emit_move_insn (gen_rtx_REG (Pmode, R0_REG),
! gen_rtx_SYMBOL_REF (Pmode,
! "__GCC_shcompact_incoming_args"));
emit_insn (gen_shcompact_incoming_args ());
}
}
--- 5145,5151 ----
/* This must NOT go through the PLT, otherwise mach and macl
may be clobbered. */
emit_move_insn (gen_rtx_REG (Pmode, R0_REG),
! function_symbol ("__GCC_shcompact_incoming_args"));
emit_insn (gen_shcompact_incoming_args ());
}
}
*************** sh_expand_epilogue ()
*** 5195,5204 ****
if (SHMEDIA_REGS_STACK_ADJUST ())
{
emit_move_insn (gen_rtx_REG (Pmode, R0_REG),
! gen_rtx_SYMBOL_REF (Pmode,
! TARGET_FPU_ANY
! ? "__GCC_pop_shmedia_regs"
! : "__GCC_pop_shmedia_regs_nofpu"));
/* This must NOT go through the PLT, otherwise mach and macl
may be clobbered. */
emit_insn (gen_shmedia_save_restore_regs_compact
--- 5193,5201 ----
if (SHMEDIA_REGS_STACK_ADJUST ())
{
emit_move_insn (gen_rtx_REG (Pmode, R0_REG),
! function_symbol (TARGET_FPU_ANY
! ? "__GCC_pop_shmedia_regs"
! : "__GCC_pop_shmedia_regs_nofpu"));
/* This must NOT go through the PLT, otherwise mach and macl
may be clobbered. */
emit_insn (gen_shmedia_save_restore_regs_compact
*************** sh_initialize_trampoline (tramp, fnaddr,
*** 7823,7829 ****
if (TARGET_HARVARD)
{
if (TARGET_USERMODE)
! emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__ic_invalidate"),
0, VOIDmode, 1, tramp, SImode);
else
emit_insn (gen_ic_invalidate_line (tramp));
--- 7820,7826 ----
if (TARGET_HARVARD)
{
if (TARGET_USERMODE)
! emit_library_call (function_symbol ("__ic_invalidate"),
0, VOIDmode, 1, tramp, SImode);
else
emit_insn (gen_ic_invalidate_line (tramp));
*************** sh_output_mi_thunk (file, thunk_fndecl,
*** 8476,8481 ****
--- 8473,8486 ----
reload_completed = 0;
no_new_pseudos = 0;
+ }
+
+ rtx
+ function_symbol (const char *name)
+ {
+ rtx sym = gen_rtx_SYMBOL_REF (Pmode, name);
+ SYMBOL_REF_FLAGS (sym) = SYMBOL_FLAG_FUNCTION;
+ return sym;
}
#include "gt-sh.h"
Index: sh.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.h,v
retrieving revision 1.203
diff -p -r1.203 sh.h
*** sh.h 6 Jun 2003 16:49:47 -0000 1.203
--- sh.h 10 Jun 2003 20:32:29 -0000
*************** do { \
*** 456,462 ****
/* Relaxation isn't yet supported for SHmedia */ \
target_flags &= ~RELAX_BIT; \
} \
! if (profile_flag || profile_arc_flag) \
{ \
warning ("Profiling is not supported on this target."); \
profile_flag = profile_arc_flag = 0; \
--- 456,466 ----
/* Relaxation isn't yet supported for SHmedia */ \
target_flags &= ~RELAX_BIT; \
} \
! /* -fprofile-arcs needs a working libgcov . In unified tree \
! configurations with newlib, this requires to configure with \
! --with-newlib --with-headers. But there is no way to check \
! here we have a working libgcov, so just assume that we have. */\
! if (profile_flag) \
{ \
warning ("Profiling is not supported on this target."); \
profile_flag = profile_arc_flag = 0; \
Index: sh.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.md,v
retrieving revision 1.145
diff -p -r1.145 sh.md
*** sh.md 14 May 2003 07:29:53 -0000 1.145
--- sh.md 10 Jun 2003 20:32:29 -0000
***************
*** 1358,1365 ****
/* Emit the move of the address to a pseudo outside of the libcall. */
if (TARGET_HARD_SH4 && TARGET_SH2E)
{
! emit_move_insn (operands[3],
! gen_rtx_SYMBOL_REF (SImode, \"__udivsi3_i4\"));
if (TARGET_FPU_SINGLE)
last = gen_udivsi3_i4_single (operands[0], operands[3]);
else
--- 1358,1364 ----
/* Emit the move of the address to a pseudo outside of the libcall. */
if (TARGET_HARD_SH4 && TARGET_SH2E)
{
! emit_move_insn (operands[3], function_symbol (\"__udivsi3_i4\"));
if (TARGET_FPU_SINGLE)
last = gen_udivsi3_i4_single (operands[0], operands[3]);
else
***************
*** 1375,1384 ****
else if (TARGET_SH5)
{
emit_move_insn (operands[3],
! gen_rtx_SYMBOL_REF (Pmode,
! (TARGET_FPU_ANY
! ? \"__udivsi3_i4\"
! : \"__udivsi3\")));
if (TARGET_SHMEDIA)
last = gen_udivsi3_i1_media (operands[0],
--- 1374,1382 ----
else if (TARGET_SH5)
{
emit_move_insn (operands[3],
! function_symbol (TARGET_FPU_ANY
! ? \"__udivsi3_i4\"
! : \"__udivsi3\"));
if (TARGET_SHMEDIA)
last = gen_udivsi3_i1_media (operands[0],
***************
*** 1393,1400 ****
}
else
{
! emit_move_insn (operands[3],
! gen_rtx_SYMBOL_REF (SImode, \"__udivsi3\"));
last = gen_udivsi3_i1 (operands[0], operands[3]);
}
first = emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]);
--- 1391,1397 ----
}
else
{
! emit_move_insn (operands[3], function_symbol (\"__udivsi3\"));
last = gen_udivsi3_i1 (operands[0], operands[3]);
}
first = emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]);
***************
*** 1508,1515 ****
/* Emit the move of the address to a pseudo outside of the libcall. */
if (TARGET_HARD_SH4 && TARGET_SH2E)
{
! emit_move_insn (operands[3],
! gen_rtx_SYMBOL_REF (SImode, \"__sdivsi3_i4\"));
if (TARGET_FPU_SINGLE)
last = gen_divsi3_i4_single (operands[0], operands[3]);
else
--- 1505,1511 ----
/* Emit the move of the address to a pseudo outside of the libcall. */
if (TARGET_HARD_SH4 && TARGET_SH2E)
{
! emit_move_insn (operands[3], function_symbol (\"__sdivsi3_i4\"));
if (TARGET_FPU_SINGLE)
last = gen_divsi3_i4_single (operands[0], operands[3]);
else
***************
*** 1525,1534 ****
else if (TARGET_SH5)
{
emit_move_insn (operands[3],
! gen_rtx_SYMBOL_REF (Pmode,
! (TARGET_FPU_ANY
! ? \"__sdivsi3_i4\"
! : \"__sdivsi3\")));
if (TARGET_SHMEDIA)
last = gen_divsi3_i1_media (operands[0],
--- 1521,1529 ----
else if (TARGET_SH5)
{
emit_move_insn (operands[3],
! function_symbol (TARGET_FPU_ANY
! ? \"__sdivsi3_i4\"
! : \"__sdivsi3\"));
if (TARGET_SHMEDIA)
last = gen_divsi3_i1_media (operands[0],
***************
*** 1543,1549 ****
}
else
{
! emit_move_insn (operands[3], gen_rtx_SYMBOL_REF (SImode, \"__sdivsi3\"));
last = gen_divsi3_i1 (operands[0], operands[3]);
}
first = emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]);
--- 1538,1544 ----
}
else
{
! emit_move_insn (operands[3], function_symbol (\"__sdivsi3\"));
last = gen_divsi3_i1 (operands[0], operands[3]);
}
first = emit_move_insn (gen_rtx_REG (SImode, 4), operands[1]);
***************
*** 1697,1703 ****
{
/* The address must be set outside the libcall,
since it goes into a pseudo. */
! rtx sym = gen_rtx_SYMBOL_REF (SImode, \"__mulsi3\");
rtx addr = force_reg (SImode, sym);
rtx insns = gen_mulsi3_call (operands[0], operands[1],
operands[2], addr);
--- 1692,1698 ----
{
/* The address must be set outside the libcall,
since it goes into a pseudo. */
! rtx sym = function_symbol (\"__mulsi3\");
rtx addr = force_reg (SImode, sym);
rtx insns = gen_mulsi3_call (operands[0], operands[1],
operands[2], addr);
***************
*** 3554,3560 ****
}
else if (TARGET_SHCOMPACT)
{
! operands[1] = gen_rtx_SYMBOL_REF (Pmode, \"__ic_invalidate\");
operands[1] = force_reg (Pmode, operands[1]);
emit_insn (gen_ic_invalidate_line_compact (operands[0], operands[1]));
DONE;
--- 3549,3555 ----
}
else if (TARGET_SHCOMPACT)
{
! operands[1] = function_symbol (\"__ic_invalidate\");
operands[1] = force_reg (Pmode, operands[1]);
emit_insn (gen_ic_invalidate_line_compact (operands[0], operands[1]));
DONE;
***************
*** 3609,3615 ****
rtx sfun, tramp;
tramp = force_reg (Pmode, operands[0]);
! sfun = force_reg (Pmode, gen_rtx_SYMBOL_REF (Pmode, \"__init_trampoline\"));
emit_move_insn (gen_rtx_REG (SImode, R2_REG), operands[1]);
emit_move_insn (gen_rtx_REG (SImode, R3_REG), operands[2]);
--- 3604,3610 ----
rtx sfun, tramp;
tramp = force_reg (Pmode, operands[0]);
! sfun = force_reg (Pmode, function_symbol (\"__init_trampoline\"));
emit_move_insn (gen_rtx_REG (SImode, R2_REG), operands[1]);
emit_move_insn (gen_rtx_REG (SImode, R3_REG), operands[2]);
***************
*** 5806,5813 ****
run out of registers when adjusting fpscr for the call. */
emit_insn (gen_force_mode_for_call ());
! operands[0] = gen_rtx_SYMBOL_REF (SImode,
! \"__GCC_shcompact_call_trampoline\");
if (flag_pic)
{
rtx reg = gen_reg_rtx (Pmode);
--- 5801,5807 ----
run out of registers when adjusting fpscr for the call. */
emit_insn (gen_force_mode_for_call ());
! operands[0] = function_symbol (\"__GCC_shcompact_call_trampoline\");
if (flag_pic)
{
rtx reg = gen_reg_rtx (Pmode);
***************
*** 5926,5933 ****
run out of registers when adjusting fpscr for the call. */
emit_insn (gen_force_mode_for_call ());
! operands[0] = gen_rtx_SYMBOL_REF (SImode,
! \"__GCC_shcompact_call_trampoline\");
if (flag_pic)
{
rtx reg = gen_reg_rtx (Pmode);
--- 5920,5926 ----
run out of registers when adjusting fpscr for the call. */
emit_insn (gen_force_mode_for_call ());
! operands[0] = function_symbol (\"__GCC_shcompact_call_trampoline\");
if (flag_pic)
{
rtx reg = gen_reg_rtx (Pmode);
***************
*** 6031,6038 ****
run out of registers when adjusting fpscr for the call. */
emit_insn (gen_force_mode_for_call ());
! operands[1] = gen_rtx_SYMBOL_REF (SImode,
! \"__GCC_shcompact_call_trampoline\");
if (flag_pic)
{
rtx reg = gen_reg_rtx (Pmode);
--- 6024,6030 ----
run out of registers when adjusting fpscr for the call. */
emit_insn (gen_force_mode_for_call ());
! operands[1] = function_symbol (\"__GCC_shcompact_call_trampoline\");
if (flag_pic)
{
rtx reg = gen_reg_rtx (Pmode);
***************
*** 6250,6257 ****
run out of registers when adjusting fpscr for the call. */
emit_insn (gen_force_mode_for_call ());
! operands[0] = gen_rtx_SYMBOL_REF (SImode,
! \"__GCC_shcompact_call_trampoline\");
if (flag_pic)
{
rtx reg = gen_reg_rtx (Pmode);
--- 6242,6248 ----
run out of registers when adjusting fpscr for the call. */
emit_insn (gen_force_mode_for_call ());
! operands[0] = function_symbol (\"__GCC_shcompact_call_trampoline\");
if (flag_pic)
{
rtx reg = gen_reg_rtx (Pmode);
***************
*** 6391,6398 ****
run out of registers when adjusting fpscr for the call. */
emit_insn (gen_force_mode_for_call ());
! operands[1] = gen_rtx_SYMBOL_REF (SImode,
! \"__GCC_shcompact_call_trampoline\");
if (flag_pic)
{
rtx reg = gen_reg_rtx (Pmode);
--- 6382,6388 ----
run out of registers when adjusting fpscr for the call. */
emit_insn (gen_force_mode_for_call ());
! operands[1] = function_symbol (\"__GCC_shcompact_call_trampoline\");
if (flag_pic)
{
rtx reg = gen_reg_rtx (Pmode);
***************
*** 6620,6626 ****
emit_insn (gen_ptrel (tr, dipic, lab));
if (GET_MODE (operands[0]) != GET_MODE (tr))
! tr = gen_rtx_SUBREG (GET_MODE (operands[0]), tr, 0);
insn = emit_move_insn (operands[0], tr);
--- 6610,6616 ----
emit_insn (gen_ptrel (tr, dipic, lab));
if (GET_MODE (operands[0]) != GET_MODE (tr))
! tr = gen_lowpart (GET_MODE (operands[0]), tr);
insn = emit_move_insn (operands[0], tr);
*************** mov.l\\t1f,r0\\n\\
*** 7207,7214 ****
"
{
rtx reg = gen_rtx_REG (Pmode, R0_REG);
! rtx sym = gen_rtx_SYMBOL_REF (Pmode,
! \"__GCC_shcompact_return_trampoline\");
if (flag_pic)
emit_insn (gen_symGOTPLT2reg (reg, sym));
--- 7197,7203 ----
"
{
rtx reg = gen_rtx_REG (Pmode, R0_REG);
! rtx sym = function_symbol (\"__GCC_shcompact_return_trampoline\");
if (flag_pic)
emit_insn (gen_symGOTPLT2reg (reg, sym));