summaryrefslogtreecommitdiff
path: root/libstdc++-v3/config/cpu/generic
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/config/cpu/generic')
-rw-r--r--libstdc++-v3/config/cpu/generic/atomic_word.h47
-rw-r--r--libstdc++-v3/config/cpu/generic/atomicity_builtins/atomicity.h44
-rw-r--r--libstdc++-v3/config/cpu/generic/atomicity_mutex/atomicity.h60
-rw-r--r--libstdc++-v3/config/cpu/generic/cpu_defines.h33
-rw-r--r--libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h59
5 files changed, 243 insertions, 0 deletions
diff --git a/libstdc++-v3/config/cpu/generic/atomic_word.h b/libstdc++-v3/config/cpu/generic/atomic_word.h
new file mode 100644
index 000000000..f2bdbbc96
--- /dev/null
+++ b/libstdc++-v3/config/cpu/generic/atomic_word.h
@@ -0,0 +1,47 @@
+// Low-level type for atomic operations -*- C++ -*-
+
+// Copyright (C) 2004, 2009 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @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++-v3/config/cpu/generic/atomicity_builtins/atomicity.h b/libstdc++-v3/config/cpu/generic/atomicity_builtins/atomicity.h
new file mode 100644
index 000000000..581c41fda
--- /dev/null
+++ b/libstdc++-v3/config/cpu/generic/atomicity_builtins/atomicity.h
@@ -0,0 +1,44 @@
+// Low-level functions for atomic operations: version for CPUs providing
+// atomic builtins -*- C++ -*-
+
+// Copyright (C) 2006, 2009, 2010 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <bits/c++config.h>
+#include <bits/atomic_word.h>
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ _Atomic_word
+ __attribute__ ((__unused__))
+ __exchange_and_add(volatile _Atomic_word* __mem, int __val) throw ()
+ { return __sync_fetch_and_add(__mem, __val); }
+
+ void
+ __attribute__ ((__unused__))
+ __atomic_add(volatile _Atomic_word* __mem, int __val) throw ()
+ { __sync_fetch_and_add(__mem, __val); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/config/cpu/generic/atomicity_mutex/atomicity.h b/libstdc++-v3/config/cpu/generic/atomicity_mutex/atomicity.h
new file mode 100644
index 000000000..dc0a5a065
--- /dev/null
+++ b/libstdc++-v3/config/cpu/generic/atomicity_mutex/atomicity.h
@@ -0,0 +1,60 @@
+// Low-level functions for atomic operations: Generic version -*- C++ -*-
+
+// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2010
+// 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+#include <ext/atomicity.h>
+#include <ext/concurrence.h>
+
+namespace
+{
+ __gnu_cxx::__mutex&
+ get_atomic_mutex()
+ {
+ static __gnu_cxx::__mutex atomic_mutex;
+ return atomic_mutex;
+ }
+} // anonymous namespace
+
+namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ _Atomic_word
+ __attribute__ ((__unused__))
+ __exchange_and_add(volatile _Atomic_word* __mem, int __val) throw ()
+ {
+ __gnu_cxx::__scoped_lock sentry(get_atomic_mutex());
+ _Atomic_word __result;
+ __result = *__mem;
+ *__mem += __val;
+ return __result;
+ }
+
+ void
+ __attribute__ ((__unused__))
+ __atomic_add(volatile _Atomic_word* __mem, int __val) throw ()
+ { __exchange_and_add(__mem, __val); }
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/libstdc++-v3/config/cpu/generic/cpu_defines.h b/libstdc++-v3/config/cpu/generic/cpu_defines.h
new file mode 100644
index 000000000..c1b986337
--- /dev/null
+++ b/libstdc++-v3/config/cpu/generic/cpu_defines.h
@@ -0,0 +1,33 @@
+// Specific definitions for generic platforms -*- C++ -*-
+
+// Copyright (C) 2005, 2009, 2010 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/cpu_defines.h
+ * This is an internal header file, included by other library headers.
+ * Do not attempt to use it directly. @headername{iosfwd}
+ */
+
+#ifndef _GLIBCXX_CPU_DEFINES
+#define _GLIBCXX_CPU_DEFINES 1
+
+#endif
diff --git a/libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h b/libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h
new file mode 100644
index 000000000..f48f73e00
--- /dev/null
+++ b/libstdc++-v3/config/cpu/generic/cxxabi_tweaks.h
@@ -0,0 +1,59 @@
+// Control various target specific ABI tweaks. Generic version.
+
+// Copyright (C) 2004, 2006, 2008, 2009, 2011 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 3, 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.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file bits/cxxabi_tweaks.h
+ * This is an internal header file, included by other library headers.
+ * Do not attempt to use it directly. @headername{cxxabi.h}
+ */
+
+#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
+#define _GLIBCXX_GUARD_BIT __guard_test_bit (0, 1)
+#define _GLIBCXX_GUARD_PENDING_BIT __guard_test_bit (1, 1)
+#define _GLIBCXX_GUARD_WAITING_BIT __guard_test_bit (2, 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