aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@gcc.gnu.org>2007-09-14 14:50:26 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2007-09-14 14:50:26 +0000
commitd9dced13700cc3e2ee269d9dcdb7383fb6034501 (patch)
tree5fe65fdbed9bdd4d82e32814abcd604d2cdc1549 /gcc/config
parentea4ba342859a1d405d60b07712d0d6020e89dadf (diff)
downloadgcc-d9dced13700cc3e2ee269d9dcdb7383fb6034501.zip
gcc-d9dced13700cc3e2ee269d9dcdb7383fb6034501.tar.gz
gcc-d9dced13700cc3e2ee269d9dcdb7383fb6034501.tar.bz2
configure.ac (mips*-sde-elf*): New stanza.
* configure.ac (mips*-sde-elf*): New stanza. Add target-libiberty to $skipdirs and only disable gprof for newlib. Use the normal mips*-elf* handling in other respects. * configure: Regnerate. gcc/ 2007-xx-xx Nigel Stephens <nigel@mips.com> David Ung <davidu@mips.com> Thiemo Seufer <ths@mips.com> Richard Sandiford <richard@codesourcery.com> * config.gcc (mips*-sde-elf*): Add support for the SDE C libraries. * configure.ac: Add a mipssde threading type. * configure: Regenerate. * config/mips/sdemtk.h: New file. * config/mips/t-sdemtk: Likewise. * config/mips/sdemtk.opt: Likewise. * gthr-mipssde.h: Likewise. * config/mips/sde.h (FUNCTION_PROFILER): Move to config/mips/sdemtk.h. * config/mips/mips.h (MIPS_SAVE_REG_FOR_PROFILING_P): New macro. (MIPS_ICACHE_SYNC): New macro, split from ... * config/mips/mips.md (clear_cache): ...here. * config/mips/mips.c (mips_save_reg_p): Check MIPS_SAVE_REG_FOR_PROFILING_P on profiled functions. (build_mips16_function_stub): Use targetm.strip_name_encoding. (build_mips16_call_stub): Likewise. libstdc++-v3/ 2007-xx-xx Thiemo Seufer <ths@mips.com> * crossconfig.m4 (mips*-sde-elf*): New stanza. * configure: Regenerate. From-SVN: r128495
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/mips/mips.c7
-rw-r--r--gcc/config/mips/mips.h10
-rw-r--r--gcc/config/mips/mips.md8
-rw-r--r--gcc/config/mips/sde.h13
-rw-r--r--gcc/config/mips/sdemtk.h108
-rw-r--r--gcc/config/mips/sdemtk.opt24
-rw-r--r--gcc/config/mips/t-sdemtk26
7 files changed, 176 insertions, 20 deletions
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 410f7d7..5c26195 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -7473,6 +7473,10 @@ mips_save_reg_p (unsigned int regno)
if (regno == HARD_FRAME_POINTER_REGNUM && frame_pointer_needed)
return true;
+ /* Check for registers that must be saved for FUNCTION_PROFILER. */
+ if (current_function_profile && MIPS_SAVE_REG_FOR_PROFILING_P (regno))
+ return true;
+
/* We need to save the incoming return address if it is ever clobbered
within the function, if __builtin_eh_return is being used to set a
different return address, or if a stub is being used to return a
@@ -9701,6 +9705,7 @@ build_mips16_function_stub (FILE *file)
unsigned int f;
fnname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
+ fnname = targetm.strip_name_encoding (fnname);
secname = (char *) alloca (strlen (fnname) + 20);
sprintf (secname, ".mips16.fn.%s", fnname);
stubname = (char *) alloca (strlen (fnname) + 20);
@@ -9937,7 +9942,7 @@ build_mips16_call_stub (rtx retval, rtx fn, rtx arg_size, int fp_code)
/* We know the function we are going to call. If we have already
built a stub, we don't need to do anything further. */
- fnname = XSTR (fn, 0);
+ fnname = targetm.strip_name_encoding (XSTR (fn, 0));
for (l = mips16_stubs; l != NULL; l = l->next)
if (strcmp (l->name, fnname) == 0)
break;
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index c8cad32..55e605a 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -2152,6 +2152,9 @@ typedef struct mips_args {
fprintf (FILE, "\t.set\tat\n"); \
}
+/* The profiler preserves all interesting registers, including $31. */
+#define MIPS_SAVE_REG_FOR_PROFILING_P(REGNO) false
+
/* No mips port has ever used the profiler counter word, so don't emit it
or the label for it. */
@@ -2227,6 +2230,13 @@ typedef struct mips_args {
#define CACHE_FLUSH_FUNC "_flush_cache"
#endif
+#define MIPS_ICACHE_SYNC(ADDR, SIZE) \
+ /* Flush both caches. We need to flush the data cache in case \
+ the system has a write-back cache. */ \
+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func), \
+ 0, VOIDmode, 3, ADDR, Pmode, SIZE, Pmode, \
+ GEN_INT (3), TYPE_MODE (integer_type_node))
+
/* A C statement to initialize the variable parts of a trampoline.
ADDR is an RTX for the address of the trampoline; FNADDR is an
RTX for the address of the nested function; STATIC_CHAIN is an
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index 2999806..842fa08 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -4274,12 +4274,8 @@
{
rtx len = gen_reg_rtx (Pmode);
emit_insn (gen_sub3_insn (len, operands[1], operands[0]));
- /* Flush both caches. We need to flush the data cache in case
- the system has a write-back cache. */
- emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func),
- 0, VOIDmode, 3, operands[0], Pmode, len, Pmode,
- GEN_INT (3), TYPE_MODE (integer_type_node));
- }
+ MIPS_ICACHE_SYNC (operands[0], len);
+ }
DONE;
}")
diff --git a/gcc/config/mips/sde.h b/gcc/config/mips/sde.h
index 7573bd6..35a8ad1 100644
--- a/gcc/config/mips/sde.h
+++ b/gcc/config/mips/sde.h
@@ -130,19 +130,6 @@ Boston, MA 02111-1307, USA. */
#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
#endif
-/* This version of _mcount does not pop 2 words from the stack. */
-#undef FUNCTION_PROFILER
-#define FUNCTION_PROFILER(FILE, LABELNO) \
- { \
- fprintf (FILE, "\t.set\tnoat\n"); \
- /* MIPS16 code passes saved $ra in $v1 instead of $at. */ \
- fprintf (FILE, "\tmove\t%s,%s\n", \
- reg_names[GP_REG_FIRST + (TARGET_MIPS16 ? 3 : 1)], \
- reg_names[GP_REG_FIRST + 31]); \
- fprintf (FILE, "\tjal\t_mcount\n"); \
- fprintf (FILE, "\t.set\tat\n"); \
- }
-
/* Force all .init and .fini entries to be 32-bit, not mips16, so that
in a mixed environment they are all the same mode. The crti.asm and
crtn.asm files will also be compiled as 32-bit due to the
diff --git a/gcc/config/mips/sdemtk.h b/gcc/config/mips/sdemtk.h
new file mode 100644
index 0000000..9d20b47
--- /dev/null
+++ b/gcc/config/mips/sdemtk.h
@@ -0,0 +1,108 @@
+/* Definitions of target machine for GNU compiler.
+ MIPS SDE version, for use with the SDE C library rather than newlib.
+ Copyright (C) 2007
+ 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 TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_assert ("system=sde"); \
+ builtin_assert ("system=posix"); \
+ builtin_define ("__SDE_MIPS__"); \
+ \
+ /* Deprecated: use __mips_isa_rev >= 2. */ \
+ if (ISA_MIPS32R2) \
+ builtin_define ("__mipsr2"); \
+ \
+ /* Deprecated: use __mips_fpr == 64. */ \
+ if (TARGET_FLOAT64) \
+ builtin_define ("__mipsfp64"); \
+ \
+ if (TARGET_NO_FLOAT) \
+ { \
+ builtin_define ("__NO_FLOAT"); \
+ builtin_define ("__mips_no_float"); \
+ } \
+ else if (TARGET_SOFT_FLOAT_ABI) \
+ builtin_define ("__SOFT_FLOAT"); \
+ else if (TARGET_SINGLE_FLOAT) \
+ builtin_define ("__SINGLE_FLOAT"); \
+ \
+ if (TARGET_BIG_ENDIAN) \
+ { \
+ builtin_assert ("endian=big"); \
+ builtin_assert ("cpu=mipseb"); \
+ } \
+ else \
+ { \
+ builtin_assert ("endian=little"); \
+ builtin_assert ("cpu=mipsel"); \
+ } \
+ } \
+ while (0)
+
+#undef SUBTARGET_OVERRIDE_OPTIONS
+#define SUBTARGET_OVERRIDE_OPTIONS \
+ do \
+ { \
+ if (TARGET_NO_FLOAT) \
+ { \
+ target_flags |= MASK_SOFT_FLOAT_ABI; \
+ target_flags_explicit |= MASK_SOFT_FLOAT_ABI; \
+ } \
+ } \
+ while (0)
+
+/* For __clear_cache in libgcc2.c. */
+#ifdef IN_LIBGCC2
+extern void mips_sync_icache (void *beg, unsigned long len);
+#undef CLEAR_INSN_CACHE
+#define CLEAR_INSN_CACHE(beg, end) \
+ mips_sync_icache (beg, end - beg)
+#endif
+
+/* For mips_cache_flush_func in mips.opt. */
+#undef CACHE_FLUSH_FUNC
+#define CACHE_FLUSH_FUNC "mips_sync_icache"
+
+/* For inline code which needs to sync the icache and dcache,
+ noting that the SDE library takes arguments (address, size). */
+#undef MIPS_ICACHE_SYNC
+#define MIPS_ICACHE_SYNC(ADDR, SIZE) \
+ emit_library_call (gen_rtx_SYMBOL_REF (Pmode, mips_cache_flush_func), \
+ 0, VOIDmode, 2, ADDR, Pmode, \
+ SIZE, TYPE_MODE (sizetype))
+
+/* This version of _mcount does not pop 2 words from the stack. */
+#undef FUNCTION_PROFILER
+#define FUNCTION_PROFILER(FILE, LABELNO) \
+ { \
+ fprintf (FILE, "\t.set\tnoat\n"); \
+ /* MIPS16 code passes saved $ra in $v1 instead of $at. */ \
+ fprintf (FILE, "\tmove\t%s,%s\n", \
+ reg_names[GP_REG_FIRST + (TARGET_MIPS16 ? 3 : 1)], \
+ reg_names[GP_REG_FIRST + 31]); \
+ fprintf (FILE, "\tjal\t_mcount\n"); \
+ fprintf (FILE, "\t.set\tat\n"); \
+ }
+
+/* ...nor does the call sequence preserve $31. */
+#undef MIPS_SAVE_REG_FOR_PROFILING_P
+#define MIPS_SAVE_REG_FOR_PROFILING_P(REGNO) ((REGNO) == GP_REG_FIRST + 31)
diff --git a/gcc/config/mips/sdemtk.opt b/gcc/config/mips/sdemtk.opt
new file mode 100644
index 0000000..1f7531b
--- /dev/null
+++ b/gcc/config/mips/sdemtk.opt
@@ -0,0 +1,24 @@
+; Options for the MIPS SDE configuration.
+;
+; Copyright (C) 2007 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, 51 Franklin Street, Fifth Floor, Boston, MA
+; 02110-1301, USA.
+
+mno-float
+Target Report RejectNegative Var(TARGET_NO_FLOAT)
+Prevent the use of all floating-point operations
diff --git a/gcc/config/mips/t-sdemtk b/gcc/config/mips/t-sdemtk
new file mode 100644
index 0000000..5169dee
--- /dev/null
+++ b/gcc/config/mips/t-sdemtk
@@ -0,0 +1,26 @@
+# Override newlib settings in t-sde and set up for building
+# against SDE header files and libraries.
+
+MULTILIB_OPTIONS = EL/EB mips32/mips32r2/mips64 mips16 msoft-float/mno-float/mfp64
+MULTILIB_DIRNAMES = el eb mips32 mips32r2 mips64 mips16 sof nof f64
+
+# Remove stdarg.h and stddef.h from USER_H.
+USER_H = $(srcdir)/ginclude/float.h \
+ $(srcdir)/ginclude/iso646.h \
+ $(srcdir)/ginclude/stdbool.h \
+ $(srcdir)/ginclude/varargs.h \
+ $(EXTRA_HEADERS)
+
+# Don't run fixinclude
+STMP_FIXINC = stmp-sdefixinc
+stmp-sdefixinc: gsyslimits.h
+ rm -rf include; mkdir include
+ chmod a+rx include
+ rm -f include/syslimits.h
+ cp $(srcdir)/gsyslimits.h include/syslimits.h
+ chmod a+r include/syslimits.h
+ $(STAMP) stmp-sdefixinc
+
+# Don't build FPBIT and DPBIT; we'll be using the SDE soft-float library.
+FPBIT =
+DPBIT =