diff options
author | kan <kan@FreeBSD.org> | 2002-09-01 20:38:57 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2002-09-01 20:38:57 +0000 |
commit | 2e25f3a6c57335cba50111faceb0ce2ab59e9bcb (patch) | |
tree | c6857d31c36dbd89a881b0229bf38b062797d413 /contrib/gcc/config/sparc | |
parent | 0895e1acb698e05d503c26bec5471de2e88b7d93 (diff) | |
download | FreeBSD-src-2e25f3a6c57335cba50111faceb0ce2ab59e9bcb.zip FreeBSD-src-2e25f3a6c57335cba50111faceb0ce2ab59e9bcb.tar.gz |
Gcc 3.2.1-prerelease from the FSF anoncvs repo gcc-3_2-branch on 1-Sep-2002 00:00:01 EDT.
Diffstat (limited to 'contrib/gcc/config/sparc')
-rw-r--r-- | contrib/gcc/config/sparc/netbsd-elf.h | 21 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/openbsd1-64.h | 24 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/openbsd64.h | 75 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/sol2.h | 10 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/sparc-protos.h | 2 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/sparc.c | 79 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/sparc.h | 41 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/t-crtfm | 4 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/t-linux64 | 3 | ||||
-rw-r--r-- | contrib/gcc/config/sparc/t-sol2-64 | 3 |
10 files changed, 233 insertions, 29 deletions
diff --git a/contrib/gcc/config/sparc/netbsd-elf.h b/contrib/gcc/config/sparc/netbsd-elf.h index b4bbf71..f141f89 100644 --- a/contrib/gcc/config/sparc/netbsd-elf.h +++ b/contrib/gcc/config/sparc/netbsd-elf.h @@ -31,12 +31,28 @@ Boston, MA 02111-1307, USA. */ /* CPP defines used for 64 bit code. */ #undef CPP_SUBTARGET_SPEC64 #define CPP_SUBTARGET_SPEC64 \ - "-D__sparc64__ -D__arch64__ -D__sparc_v9__ %{posix:-D_POSIX_SOURCE}" + "-D__sparc64__ -D__sparc_v9__ -D_LP64 %{posix:-D_POSIX_SOURCE}" /* CPP defines used for 32 bit code. */ #undef CPP_SUBTARGET_SPEC32 #define CPP_SUBTARGET_SPEC32 "-D__sparc %{posix:-D_POSIX_SOURCE}" +/* CPP_ARCH32_SPEC and CPP_ARCH64_SPEC are wrong from sparc/sparc.h; we + always want the non-SPARC_BI_ARCH versions, since the SPARC_BI_ARCH + versions define __SIZE_TYPE__ and __PTRDIFF_TYPE__ incorrectly for + NetBSD. */ +#undef CPP_ARCH32_SPEC +#define CPP_ARCH32_SPEC "-D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc" + +#undef CPP_ARCH64_SPEC +#define CPP_ARCH64_SPEC "-D__arch64__ -Acpu=sparc64 -Amachine=sparc64" + +/* sparc/sparc.h defines NO_BUILTIN_SIZE_TYPE and NO_BUILTIN_PTRDIFF_TYPE + if SPARC_BI_ARCH is defined. This is wrong for NetBSD; size_t and + ptrdiff_t do not change for 32-bit vs. 64-bit. */ +#undef NO_BUILTIN_PTRDIFF_TYPE +#undef NO_BUILTIN_SIZE_TYPE + /* SIZE_TYPE and PTRDIFF_TYPE are wrong from sparc/sparc.h. */ #undef SIZE_TYPE #define SIZE_TYPE "long unsigned int" @@ -99,9 +115,6 @@ Boston, MA 02111-1307, USA. */ * Clean up afterwards generic SPARC ELF configuration. */ -#undef TRANSFER_FROM_TRAMPOLINE -#define TRANSFER_FROM_TRAMPOLINE - /* FIXME: Aren't these supposed to be available for SPARC ELF? */ #undef MULDI3_LIBCALL #undef DIVDI3_LIBCALL diff --git a/contrib/gcc/config/sparc/openbsd1-64.h b/contrib/gcc/config/sparc/openbsd1-64.h new file mode 100644 index 0000000..1310538 --- /dev/null +++ b/contrib/gcc/config/sparc/openbsd1-64.h @@ -0,0 +1,24 @@ +/* Configuration file for sparc64 OpenBSD target. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +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. */ + +#define OBSD_HAS_DECLARE_FUNCTION_NAME +#define OBSD_HAS_DECLARE_FUNCTION_SIZE +#define OBSD_HAS_DECLARE_OBJECT + diff --git a/contrib/gcc/config/sparc/openbsd64.h b/contrib/gcc/config/sparc/openbsd64.h new file mode 100644 index 0000000..4dfe381 --- /dev/null +++ b/contrib/gcc/config/sparc/openbsd64.h @@ -0,0 +1,75 @@ +/* Configuration file for sparc64 OpenBSD target. + Copyright (C) 1999 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +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. */ + +#undef TARGET_VERSION +#define TARGET_VERSION fprintf (stderr, " (sparc64 OpenBSD ELF)") + +/* XXX - do we really want HARD_QUAD? */ +#undef TARGET_DEFAULT +#define TARGET_DEFAULT \ +(MASK_V9 + MASK_PTR64 + MASK_64BIT + MASK_HARD_QUAD \ + + MASK_APP_REGS + MASK_FPU + MASK_STACK_BIAS + MASK_LONG_DOUBLE_128) + +#undef SPARC_DEFAULT_CMODEL +#define SPARC_DEFAULT_CMODEL CM_MEDMID + +/* Run-time target specifications. */ +#undef CPP_PREDEFINES +#define CPP_PREDEFINES "-D__unix__ -D__sparc__ -D__sparc64__ -D__sparcv9__ -D__sparc_v9__ -D__arch64__ -D__ELF__ -D__OpenBSD__ -Asystem(unix) -Asystem(OpenBSD) -Acpu(sparc) -Amachine(sparc)" + +#undef CPP_SUBTARGET_SPEC +#define CPP_SUBTARGET_SPEC "" + +#undef MD_EXEC_PREFIX +#undef MD_STARTFILE_PREFIX + +#undef ASM_SPEC +#define ASM_SPEC "\ +%{v:-V} -s %{fpic:-K PIC} %{fPIC:-K PIC} \ +%{mlittle-endian:-EL} \ +%(asm_cpu) %(asm_arch) \ +" + +/* Layout of source language data types. */ +#undef WCHAR_TYPE +#define WCHAR_TYPE "int" + +#undef WCHAR_TYPE_SIZE +#define WCHAR_TYPE_SIZE 32 + +#undef LONG_DOUBLE_TYPE_SIZE +#define LONG_DOUBLE_TYPE_SIZE 128 + +#undef LINK_SPEC +#define LINK_SPEC \ + "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \ + %{shared:-shared} %{R*} \ + %{static:-Bstatic} \ + %{!static:-Bdynamic} \ + %{assert*} \ + %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}" + +/* As an elf system, we need crtbegin/crtend stuff. */ +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "\ + %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \ + crtbegin%O%s} %{shared:crtbeginS%O%s}" +#undef ENDFILE_SPEC +#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}" diff --git a/contrib/gcc/config/sparc/sol2.h b/contrib/gcc/config/sparc/sol2.h index 67e064d..56bfbb7 100644 --- a/contrib/gcc/config/sparc/sol2.h +++ b/contrib/gcc/config/sparc/sol2.h @@ -71,17 +71,21 @@ Boston, MA 02111-1307, USA. */ /* This is here rather than in sparc.h because it's not known what other assemblers will accept. */ + #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 #undef ASM_CPU_DEFAULT_SPEC #define ASM_CPU_DEFAULT_SPEC "-xarch=v8plus" #endif + #if TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc #undef ASM_CPU_DEFAULT_SPEC #define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusa" #endif + #undef ASM_CPU_SPEC #define ASM_CPU_SPEC "\ %{mcpu=v8plus:-xarch=v8plus} \ +%{mcpu=v9:-xarch=v8plus} \ %{mcpu=ultrasparc:-xarch=v8plusa} \ %{!mcpu*:%(asm_cpu_default)} \ " @@ -227,6 +231,12 @@ Boston, MA 02111-1307, USA. */ #define MODDI3_LIBCALL "__rem64" #define UMODDI3_LIBCALL "__urem64" +/* Solaris's _Qp_* library routine implementation clobbers the output + memory before the inputs are fully consumed. */ + +#undef TARGET_BUGGY_QP_LIB +#define TARGET_BUGGY_QP_LIB 1 + #undef INIT_SUBTARGET_OPTABS #define INIT_SUBTARGET_OPTABS \ fixsfdi_libfunc \ diff --git a/contrib/gcc/config/sparc/sparc-protos.h b/contrib/gcc/config/sparc/sparc-protos.h index fd372de..7de8940 100644 --- a/contrib/gcc/config/sparc/sparc-protos.h +++ b/contrib/gcc/config/sparc/sparc-protos.h @@ -123,4 +123,6 @@ extern rtx gen_df_reg PARAMS ((rtx, int)); extern int sparc_extra_constraint_check PARAMS ((rtx, int, int)); #endif /* RTX_CODE */ +extern void sparc_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT, tree)); + #endif /* __SPARC_PROTOS_H__ */ diff --git a/contrib/gcc/config/sparc/sparc.c b/contrib/gcc/config/sparc/sparc.c index 28bbcec..6ef28141c 100644 --- a/contrib/gcc/config/sparc/sparc.c +++ b/contrib/gcc/config/sparc/sparc.c @@ -2489,9 +2489,17 @@ emit_soft_tfmode_libcall (func_name, nargs, operands) /* TFmode arguments and return values are passed by reference. */ if (GET_MODE (this_arg) == TFmode) { - if (GET_CODE (this_arg) == MEM) + int force_stack_temp; + + force_stack_temp = 0; + if (TARGET_BUGGY_QP_LIB && i == 0) + force_stack_temp = 1; + + if (GET_CODE (this_arg) == MEM + && ! force_stack_temp) this_arg = XEXP (this_arg, 0); - else if (CONSTANT_P (this_arg)) + else if (CONSTANT_P (this_arg) + && ! force_stack_temp) { this_slot = force_const_mem (TFmode, this_arg); this_arg = XEXP (this_slot, 0); @@ -8993,3 +9001,70 @@ sparc_extra_constraint_check (op, c, strict) return reload_ok_mem; } + +/* Output code to add DELTA to the first argument, and then jump to FUNCTION. + Used for C++ multiple inheritance. */ + +void +sparc_output_mi_thunk (file, thunk_fndecl, delta, function) + FILE *file; + tree thunk_fndecl ATTRIBUTE_UNUSED; + HOST_WIDE_INT delta; + tree function; +{ + rtx this, insn, funexp, delta_rtx, tmp; + + reload_completed = 1; + no_new_pseudos = 1; + current_function_uses_only_leaf_regs = 1; + + emit_note (NULL, NOTE_INSN_PROLOGUE_END); + + /* Find the "this" pointer. Normally in %o0, but in ARCH64 if the function + returns a structure, the structure return pointer is there instead. */ + if (TARGET_ARCH64 && aggregate_value_p (TREE_TYPE (TREE_TYPE (function)))) + this = gen_rtx_REG (Pmode, SPARC_INCOMING_INT_ARG_FIRST + 1); + else + this = gen_rtx_REG (Pmode, SPARC_INCOMING_INT_ARG_FIRST); + + /* Add DELTA. When possible use a plain add, otherwise load it into + a register first. */ + delta_rtx = GEN_INT (delta); + if (!SPARC_SIMM13_P (delta)) + { + rtx scratch = gen_rtx_REG (Pmode, 1); + if (TARGET_ARCH64) + sparc_emit_set_const64 (scratch, delta_rtx); + else + sparc_emit_set_const32 (scratch, delta_rtx); + delta_rtx = scratch; + } + + tmp = gen_rtx_PLUS (Pmode, this, delta_rtx); + emit_insn (gen_rtx_SET (VOIDmode, this, tmp)); + + /* Generate a tail call to the target function. */ + if (! TREE_USED (function)) + { + assemble_external (function); + TREE_USED (function) = 1; + } + funexp = XEXP (DECL_RTL (function), 0); + funexp = gen_rtx_MEM (FUNCTION_MODE, funexp); + insn = emit_call_insn (gen_sibcall (funexp)); + SIBLING_CALL_P (insn) = 1; + emit_barrier (); + + /* Run just enough of rest_of_compilation to get the insns emitted. + There's not really enough bulk here to make other passes such as + instruction scheduling worth while. Note that use_thunk calls + assemble_start_function and assemble_end_function. */ + insn = get_insns (); + shorten_branches (insn); + final_start_function (insn, file, 1); + final (insn, file, 1, 0); + final_end_function (); + + reload_completed = 0; + no_new_pseudos = 0; +} diff --git a/contrib/gcc/config/sparc/sparc.h b/contrib/gcc/config/sparc/sparc.h index 3f21578..2902f06 100644 --- a/contrib/gcc/config/sparc/sparc.h +++ b/contrib/gcc/config/sparc/sparc.h @@ -1414,6 +1414,8 @@ extern char leaf_reg_remap[]; #define PREFERRED_RELOAD_CLASS(X,CLASS) \ (CONSTANT_P (X) \ ? ((FP_REG_CLASS_P (CLASS) \ + || (CLASS) == GENERAL_OR_FP_REGS \ + || (CLASS) == GENERAL_OR_EXTRA_FP_REGS \ || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ && ! TARGET_FPU) \ || (GET_MODE (X) == TFmode \ @@ -1958,7 +1960,8 @@ do { \ return an rtx for the address of the word in the frame that holds the dynamic chain--the previous frame's address. ??? -mflat support? */ -#define DYNAMIC_CHAIN_ADDRESS(frame) plus_constant (frame, 14 * UNITS_PER_WORD) +#define DYNAMIC_CHAIN_ADDRESS(frame) \ + plus_constant (frame, 14 * UNITS_PER_WORD + SPARC_STACK_BIAS) /* The return address isn't on the stack, it is in a register, so we can't access it from the current frame pointer. We can access it from the @@ -2568,6 +2571,11 @@ do { \ #define LTTF2_LIBCALL "_Q_flt" #define LETF2_LIBCALL "_Q_fle" +/* Assume by default that the _Qp_* 64-bit libcalls are implemented such + that the inputs are fully consumed before the output memory is clobbered. */ + +#define TARGET_BUGGY_QP_LIB 0 + /* We can define the TFmode sqrt optab only if TARGET_FPU. This is because with soft-float, the SFmode and DFmode sqrt instructions will be absent, and the compiler will notice and try to use the TFmode sqrt instruction @@ -2604,6 +2612,17 @@ do { \ sqrt_optab->handlers[(int) TFmode].libfunc \ = init_one_libfunc ("_Q_sqrt"); \ } \ + if (TARGET_ARCH64) \ + { \ + /* In the SPARC 64bit ABI, these libfuncs do not exist in the \ + library. Make sure the compiler does not emit calls to them \ + by accident. */ \ + sdiv_optab->handlers[(int) SImode].libfunc = NULL; \ + udiv_optab->handlers[(int) SImode].libfunc = NULL; \ + smod_optab->handlers[(int) SImode].libfunc = NULL; \ + umod_optab->handlers[(int) SImode].libfunc = NULL; \ + smul_optab->handlers[(int) SImode].libfunc = NULL; \ + } \ INIT_SUBTARGET_OPTABS; \ } while (0) @@ -2903,24 +2922,8 @@ do { \ /* Output code to add DELTA to the first argument, and then jump to FUNCTION. Used for C++ multiple inheritance. */ -#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ -do { \ - int reg = 0; \ - \ - if (TARGET_ARCH64 \ - && aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION)))) \ - reg = 1; \ - if ((DELTA) >= 4096 || (DELTA) < -4096) \ - fprintf (FILE, "\tset\t%d, %%g1\n\tadd\t%%o%d, %%g1, %%o%d\n", \ - (int)(DELTA), reg, reg); \ - else \ - fprintf (FILE, "\tadd\t%%o%d, %d, %%o%d\n", reg, (int)(DELTA), reg);\ - fprintf (FILE, "\tor\t%%o7, %%g0, %%g1\n"); \ - fprintf (FILE, "\tcall\t"); \ - assemble_name (FILE, XSTR (XEXP (DECL_RTL (FUNCTION), 0), 0)); \ - fprintf (FILE, ", 0\n"); \ - fprintf (FILE, "\t or\t%%g1, %%g0, %%o7\n"); \ -} while (0) +#define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \ + sparc_output_mi_thunk (FILE, THUNK_FNDECL, DELTA, FUNCTION) #define PRINT_OPERAND_PUNCT_VALID_P(CHAR) \ ((CHAR) == '#' || (CHAR) == '*' || (CHAR) == '^' || (CHAR) == '(' || (CHAR) == '_') diff --git a/contrib/gcc/config/sparc/t-crtfm b/contrib/gcc/config/sparc/t-crtfm index 744537d..e0adb97 100644 --- a/contrib/gcc/config/sparc/t-crtfm +++ b/contrib/gcc/config/sparc/t-crtfm @@ -1,4 +1,4 @@ EXTRA_PARTS += crtfastmath.o -crtfastmath.o: $(srcdir)/config/sparc/crtfastmath.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -c -o crtfastmath.o $(srcdir)/config/sparc/crtfastmath.c +$(T)crtfastmath.o: $(srcdir)/config/sparc/crtfastmath.c $(GCC_PASSES) + $(GCC_FOR_TARGET) $(MULTILIB_CFLAGS) $(LIBGCC2_CFLAGS) -c -o $(T)crtfastmath.o $(srcdir)/config/sparc/crtfastmath.c diff --git a/contrib/gcc/config/sparc/t-linux64 b/contrib/gcc/config/sparc/t-linux64 index c93ff25..a648626 100644 --- a/contrib/gcc/config/sparc/t-linux64 +++ b/contrib/gcc/config/sparc/t-linux64 @@ -7,7 +7,8 @@ MULTILIB_EXCLUSIONS = m32/!m64/mno-app-regs m32/!m64/mcmodel=medany LIBGCC = stmp-multilib INSTALL_LIBGCC = install-multilib -EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o +EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o \ + crtfastmath.o SHLIB_SLIBDIR_SUFFIXES = 64:64 32: diff --git a/contrib/gcc/config/sparc/t-sol2-64 b/contrib/gcc/config/sparc/t-sol2-64 index ef7dee7..39204d7 100644 --- a/contrib/gcc/config/sparc/t-sol2-64 +++ b/contrib/gcc/config/sparc/t-sol2-64 @@ -5,6 +5,7 @@ MULTILIB_MATCHES = LIBGCC = stmp-multilib INSTALL_LIBGCC = install-multilib -EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o gmon.o crt1.o crti.o crtn.o gcrt1.o +EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o gmon.o crt1.o crti.o crtn.o gcrt1.o \ + crtfastmath.o SHLIB_SLIBDIR_SUFFIXES = sparcv9:/sparcv9 sparcv7: |