* configure, config.in: Rebuilt.
* config/sparc/sparc.h (ASM_RELAX_SPEC): Define.
(EXTRA_SPECS): Add asm_relax.
(ASM_SPEC): Add %(asm_relax).
(TARGET_SWITCHES): Add -mrelax and -mno-relax.
* config/sparc/linux64.h (LINK_ARCH_SPEC): Rename to LINK_SPEC.
(LINK_SPEC): Pass -relax to linker unless -mno-relax or -r.
(ASM_SPEC): Add %(asm_relax).
* config/sparc/linux.h (LINK_SPEC, ASM_SPEC): Likewise.
* config/sparc/sparc.c (output_sibcall): If HAVE_AS_RELAX_OPTION,
never use sethi/jmpl for leaf tail calls. Use or with rs2 %g0
instead of mov, so that gas can further optimize it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34466
138bc75d-0d04-0410-961f-
82ee72b054a4
+2000-06-09 Jakub Jelinek <jakub@redhat.com>
+
+ * configure.in: Check whether gas supports -relax.
+ * configure, config.in: Rebuilt.
+ * config/sparc/sparc.h (ASM_RELAX_SPEC): Define.
+ (EXTRA_SPECS): Add asm_relax.
+ (ASM_SPEC): Add %(asm_relax).
+ (TARGET_SWITCHES): Add -mrelax and -mno-relax.
+ * config/sparc/linux64.h (LINK_ARCH_SPEC): Rename to LINK_SPEC.
+ (LINK_SPEC): Pass -relax to linker unless -mno-relax or -r.
+ (ASM_SPEC): Add %(asm_relax).
+ * config/sparc/linux.h (LINK_SPEC, ASM_SPEC): Likewise.
+ * config/sparc/sparc.c (output_sibcall): If HAVE_AS_RELAX_OPTION,
+ never use sethi/jmpl for leaf tail calls. Use or with rs2 %g0
+ instead of mov, so that gas can further optimize it.
+
2000-06-08 James E. Wilson <wilson@bletchleypark.cygnus.com>
* dwarf2out.c (size_of_die, case dw_val_class_const): Use
/* Define if your assembler supports .register. */
#undef HAVE_AS_REGISTER_PSEUDO_OP
+/* Define if your assembler supports -relax option. */
+#undef HAVE_AS_RELAX_OPTION
+
/* Define if the assembler supports 64bit sparc. */
#undef AS_SPARC64_FLAG
#endif
#else
#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
+ %{!mno-relax:%{!r:-relax}} \
%{!shared: \
%{!ibcs: \
%{!static: \
It's safe to pass -s always, even if -g is not used. */
#undef ASM_SPEC
#define ASM_SPEC \
- "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} %{fPIC:-K PIC}"
+ "%{V} %{v:%{!V:-V}} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Wa,*:%*} -s %{fpic:-K PIC} \
+ %{fPIC:-K PIC} %(asm_relax)"
/* Same as sparc.h */
#undef DBX_REGISTER_NUMBER
#define LINK_SPEC "\
%(link_arch) \
%{mlittle-endian:-EL} \
+%{!mno-relax:%{!r:-relax}} \
"
#undef CC1_SPEC
#else /* !SPARC_BI_ARCH */
#undef LINK_SPEC
-#define LINK_ARCH_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
+#define LINK_SPEC "-m elf64_sparc -Y P,/usr/lib64 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
%{!dynamic-linker:-dynamic-linker /lib64/ld-linux.so.2}} \
%{static:-static}}} \
%{mlittle-endian:-EL} \
+%{!mno-relax:%{!r:-relax}} \
"
#endif /* !SPARC_BI_ARCH */
%{Wa,*:%*} \
-s %{fpic:-K PIC} %{fPIC:-K PIC} \
%{mlittle-endian:-EL} \
-%(asm_cpu) %(asm_arch) \
-"
+%(asm_cpu) %(asm_arch) %(asm_relax)"
/* Same as sparc.h */
#undef DBX_REGISTER_NUMBER
if (leaf_regs)
{
+#ifdef HAVE_AS_RELAX_OPTION
+ /* If as and ld are relaxing tail call insns into branch always,
+ use or %o7,%g0,X; call Y; or X,%g0,%o7 always, so that it can
+ be optimized. With sethi/jmpl as nor ld has no easy way how to
+ find out if somebody does not branch between the sethi and jmpl. */
+ int spare_slot = 0;
+#else
int spare_slot = ((TARGET_ARCH32 || TARGET_CM_MEDLOW) && ! flag_pic);
+#endif
int size = 0;
if ((actual_fsize || ! spare_slot) && delay_slot)
{
if (size)
fprintf (asm_out_file, "\tsub\t%%sp, -%d, %%sp\n", size);
- output_asm_insn ("mov\t%%o7, %%g1", operands);
+ /* Use or with rs2 %%g0 instead of mov, so that as/ld can optimize
+ it into branch if possible. */
+ output_asm_insn ("or\t%%o7, %%g0, %%g1", operands);
output_asm_insn ("call\t%a0, 0", operands);
- output_asm_insn (" mov\t%%g1, %%o7", operands);
+ output_asm_insn (" or\t%%g1, %%g0, %%o7", operands);
}
return "";
}
%{!m32:%{!m64:%(asm_arch_default)}} \
"
+#ifdef HAVE_AS_RELAX_OPTION
+#define ASM_RELAX_SPEC "%{!mno-relax:-relax}"
+#else
+#define ASM_RELAX_SPEC ""
+#endif
+
/* Special flags to the Sun-4 assembler when using pipe for input. */
#define ASM_SPEC "\
%| %{R} %{!pg:%{!p:%{fpic:-k} %{fPIC:-k}}} %{keep-local-as-symbols:-L} \
-%(asm_cpu) \
-"
+%(asm_cpu) %(asm_relax)"
#define LIB_SPEC "%{!shared:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{g:-lg}}"
{ "asm_cpu_default", ASM_CPU_DEFAULT_SPEC }, \
{ "asm_arch32", ASM_ARCH32_SPEC }, \
{ "asm_arch64", ASM_ARCH64_SPEC }, \
+ { "asm_relax", ASM_RELAX_SPEC }, \
{ "asm_arch_default", ASM_ARCH_DEFAULT_SPEC },\
{ "asm_arch", ASM_ARCH_SPEC }, \
SUBTARGET_EXTRA_SPECS
{"no-stack-bias", -MASK_STACK_BIAS, "Do not use stack bias" }, \
{"faster-structs", MASK_FASTER_STRUCTS, "Use structs on stronger alignment for double-word copies" }, \
{"no-faster-structs", -MASK_FASTER_STRUCTS, "Do not use structs on stronger alignment for double-word copies" }, \
+ {"relax", 0, "Optimize tail call instructions in assembler and linker" }, \
+ {"no-relax", 0, "Do not optimize tail call instructions in assembler or linker" }, \
SUBTARGET_SWITCHES \
{ "", TARGET_DEFAULT, ""}}
fi
+ echo $ac_n "checking assembler supports -relax""... $ac_c" 1>&6
+echo "configure:8921: checking assembler supports -relax" >&5
+if eval "test \"`echo '$''{'gcc_cv_as_relax_opt'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+ gcc_cv_as_relax_opt=unknown
+ if test x$gcc_cv_as != x; then
+ # Check if gas supports -relax
+ echo ".text" > conftest.s
+ if $gcc_cv_as -relax -o conftest.o conftest.s > /dev/null 2>&1; then
+ gcc_cv_as_relax_opt=yes
+ else
+ gcc_cv_as_relax_opt=no
+ fi
+ rm -f conftest.s conftest.o
+ fi
+
+fi
+
+echo "$ac_t""$gcc_cv_as_relax_opt" 1>&6
+ if test "x$gcc_cv_as_relax_opt" = xyes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_AS_RELAX_OPTION 1
+EOF
+
+ fi
+
case "$tm_file" in
*64*)
echo $ac_n "checking for 64 bit support in assembler ($gcc_cv_as)""... $ac_c" 1>&6
-echo "configure:8923: checking for 64 bit support in assembler ($gcc_cv_as)" >&5
+echo "configure:8951: checking for 64 bit support in assembler ($gcc_cv_as)" >&5
if eval "test \"`echo '$''{'gcc_cv_as_flags64'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "x$gcc_cv_as_flags64" != xno; then
echo $ac_n "checking for assembler offsetable %lo() support""... $ac_c" 1>&6
-echo "configure:8968: checking for assembler offsetable %lo() support" >&5
+echo "configure:8996: checking for assembler offsetable %lo() support" >&5
if eval "test \"`echo '$''{'gcc_cv_as_offsetable_lo10'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
i[34567]86-*-*)
echo $ac_n "checking assembler instructions""... $ac_c" 1>&6
-echo "configure:9007: checking assembler instructions" >&5
+echo "configure:9035: checking assembler instructions" >&5
gcc_cv_as_instructions=
if test x$gcc_cv_as != x; then
set "filds fists" "filds mem; fists mem"
# Build a new-libstdc++ system (ie libstdc++-v3)
echo $ac_n "checking for libstdc++ to install""... $ac_c" 1>&6
-echo "configure:9137: checking for libstdc++ to install" >&5
+echo "configure:9165: checking for libstdc++ to install" >&5
# Check whether --enable-libstdcxx-v3 or --disable-libstdcxx-v3 was given.
if test "${enable_libstdcxx_v3+set}" = set; then
enableval="$enable_libstdcxx_v3"
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:9161: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:9189: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
[Define if your assembler supports .register.])
fi
+ AC_CACHE_CHECK([assembler supports -relax],
+ gcc_cv_as_relax_opt, [
+ gcc_cv_as_relax_opt=unknown
+ if test x$gcc_cv_as != x; then
+ # Check if gas supports -relax
+ echo ".text" > conftest.s
+ if $gcc_cv_as -relax -o conftest.o conftest.s > /dev/null 2>&1; then
+ gcc_cv_as_relax_opt=yes
+ else
+ gcc_cv_as_relax_opt=no
+ fi
+ rm -f conftest.s conftest.o
+ fi
+ ])
+ if test "x$gcc_cv_as_relax_opt" = xyes; then
+ AC_DEFINE(HAVE_AS_RELAX_OPTION, 1,
+ [Define if your assembler supports -relax option.])
+ fi
+
case "$tm_file" in
*64*)
AC_CACHE_CHECK([for 64 bit support in assembler ($gcc_cv_as)],