summaryrefslogtreecommitdiffstats
path: root/libstdc++/config/cpu/generic
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++/config/cpu/generic')
-rw-r--r--libstdc++/config/cpu/generic/atomic_word.h52
-rw-r--r--libstdc++/config/cpu/generic/atomicity_builtins/atomicity.h50
-rw-r--r--libstdc++/config/cpu/generic/atomicity_mutex/atomicity.h61
-rw-r--r--libstdc++/config/cpu/generic/cpu_defines.h38
-rw-r--r--libstdc++/config/cpu/generic/cxxabi_tweaks.h60
5 files changed, 261 insertions, 0 deletions
diff --git a/libstdc++/config/cpu/generic/atomic_word.h b/libstdc++/config/cpu/generic/atomic_word.h
new file mode 100644
index 0000000..3365733
--- /dev/null
+++ b/libstdc++/config/cpu/generic/atomic_word.h
@@ -0,0 +1,52 @@
+// Low-level type for atomic operations -*- C++ -*-
+
+// Copyright (C) 2004 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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.
+
+// This library 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 this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file atomic_word.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_ATOMIC_WORD_H
+#define _GLIBCXX_ATOMIC_WORD_H 1
+
+typedef int _Atomic_word;
+
+// Define these two macros using the appropriate memory barrier for the target.
+// The commented out versions below are the defaults.
+// See ia64/atomic_word.h for an alternative approach.
+
+// This one prevents loads from being hoisted across the barrier;
+// in other words, this is a Load-Load acquire barrier.
+// This is necessary iff TARGET_RELAXED_ORDERING is defined in tm.h.
+// #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile ("":::"memory")
+
+// This one prevents stores from being sunk across the barrier; in other
+// words, a Store-Store release barrier.
+// #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile ("":::"memory")
+
+#endif
diff --git a/libstdc++/config/cpu/generic/atomicity_builtins/atomicity.h b/libstdc++/config/cpu/generic/atomicity_builtins/atomicity.h
new file mode 100644
index 0000000..8128c09
--- /dev/null
+++ b/libstdc++/config/cpu/generic/atomicity_builtins/atomicity.h
@@ -0,0 +1,50 @@
+// Low-level functions for atomic operations: version for CPUs providing
+// atomic builtins -*- C++ -*-
+
+// Copyright (C) 2006 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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.
+
+// This library 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 this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file ext/atomicity.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#include <bits/c++config.h>
+#include <bits/atomic_word.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ _Atomic_word
+ __attribute__ ((__unused__))
+ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
+ { return __sync_fetch_and_add(__mem, __val); }
+
+ void
+ __attribute__ ((__unused__))
+ __atomic_add(volatile _Atomic_word* __mem, int __val)
+ { __sync_fetch_and_add(__mem, __val); }
+
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++/config/cpu/generic/atomicity_mutex/atomicity.h b/libstdc++/config/cpu/generic/atomicity_mutex/atomicity.h
new file mode 100644
index 0000000..e9ee10c
--- /dev/null
+++ b/libstdc++/config/cpu/generic/atomicity_mutex/atomicity.h
@@ -0,0 +1,61 @@
+// Low-level functions for atomic operations: Generic version -*- C++ -*-
+
+// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006
+// Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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.
+
+// This library 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 this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file ext/atomicity.h
+ * This file is a GNU extension to the Standard C++ Library.
+ */
+
+#include <ext/atomicity.h>
+#include <ext/concurrence.h>
+
+namespace
+{
+ __gnu_cxx::__mutex atomic_mutex;
+} // anonymous namespace
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ _Atomic_word
+ __attribute__ ((__unused__))
+ __exchange_and_add(volatile _Atomic_word* __mem, int __val)
+ {
+ __gnu_cxx::__scoped_lock sentry(atomic_mutex);
+ _Atomic_word __result;
+ __result = *__mem;
+ *__mem += __val;
+ return __result;
+ }
+
+ void
+ __attribute__ ((__unused__))
+ __atomic_add(volatile _Atomic_word* __mem, int __val)
+ { __exchange_and_add(__mem, __val); }
+
+_GLIBCXX_END_NAMESPACE
diff --git a/libstdc++/config/cpu/generic/cpu_defines.h b/libstdc++/config/cpu/generic/cpu_defines.h
new file mode 100644
index 0000000..cf53469
--- /dev/null
+++ b/libstdc++/config/cpu/generic/cpu_defines.h
@@ -0,0 +1,38 @@
+// Specific definitions for generic platforms -*- C++ -*-
+
+// Copyright (C) 2005 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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.
+
+// This library 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 this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file cpu_defines.h
+ * This is an internal header file, included by other library headers.
+ * You should not attempt to use it directly.
+ */
+
+#ifndef _GLIBCXX_CPU_DEFINES
+#define _GLIBCXX_CPU_DEFINES 1
+
+#endif
diff --git a/libstdc++/config/cpu/generic/cxxabi_tweaks.h b/libstdc++/config/cpu/generic/cxxabi_tweaks.h
new file mode 100644
index 0000000..95fd306
--- /dev/null
+++ b/libstdc++/config/cpu/generic/cxxabi_tweaks.h
@@ -0,0 +1,60 @@
+// Control various target specific ABI tweaks. Generic version.
+
+// Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library 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.
+
+// This library 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 this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file cxxabi_tweaks.h
+ * The header provides an CPU-variable interface to the C++ ABI.
+ */
+
+#ifndef _CXXABI_TWEAKS_H
+#define _CXXABI_TWEAKS_H 1
+
+#ifdef __cplusplus
+namespace __cxxabiv1
+{
+ extern "C"
+ {
+#endif
+
+ // The generic ABI uses the first byte of a 64-bit guard variable.
+#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0)
+#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1
+ __extension__ typedef int __guard __attribute__((mode (__DI__)));
+
+ // __cxa_vec_ctor has void return type.
+ typedef void __cxa_vec_ctor_return_type;
+#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return
+ // Constructors and destructors do not return a value.
+ typedef void __cxa_cdtor_return_type;
+
+#ifdef __cplusplus
+ }
+} // namespace __cxxabiv1
+#endif
+
+#endif
OpenPOWER on IntegriCloud