[llvm-commits] [compiler-rt] r165218 - in /compiler-rt/trunk/lib/tsan/rtl: tsan_interface_atomic.cc tsan_interface_atomic.h tsan_stat.h
Dmitry Vyukov
dvyukov at google.com
Thu Oct 4 03:08:23 PDT 2012
Author: dvyukov
Date: Thu Oct 4 05:08:23 2012
New Revision: 165218
URL: http://llvm.org/viewvc/llvm-project?rev=165218&view=rev
Log:
tsan: add atomic_fetch_sub() and atomic_signal_fence() functions
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.cc
compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.h
compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.cc?rev=165218&r1=165217&r2=165218&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.cc Thu Oct 4 05:08:23 2012
@@ -131,6 +131,17 @@
}
template<typename T>
+static T AtomicFetchSub(ThreadState *thr, uptr pc, volatile T *a, T v,
+ morder mo) {
+ if (IsReleaseOrder(mo))
+ Release(thr, pc, (uptr)a);
+ v = __sync_fetch_and_sub(a, v);
+ if (IsAcquireOrder(mo))
+ Acquire(thr, pc, (uptr)a);
+ return v;
+}
+
+template<typename T>
static T AtomicFetchAnd(ThreadState *thr, uptr pc, volatile T *a, T v,
morder mo) {
if (IsReleaseOrder(mo))
@@ -246,6 +257,22 @@
SCOPED_ATOMIC(FetchAdd, a, v, mo);
}
+a8 __tsan_atomic8_fetch_sub(volatile a8 *a, a8 v, morder mo) {
+ SCOPED_ATOMIC(FetchSub, a, v, mo);
+}
+
+a16 __tsan_atomic16_fetch_sub(volatile a16 *a, a16 v, morder mo) {
+ SCOPED_ATOMIC(FetchSub, a, v, mo);
+}
+
+a32 __tsan_atomic32_fetch_sub(volatile a32 *a, a32 v, morder mo) {
+ SCOPED_ATOMIC(FetchSub, a, v, mo);
+}
+
+a64 __tsan_atomic64_fetch_sub(volatile a64 *a, a64 v, morder mo) {
+ SCOPED_ATOMIC(FetchSub, a, v, mo);
+}
+
a8 __tsan_atomic8_fetch_and(volatile a8 *a, a8 v, morder mo) {
SCOPED_ATOMIC(FetchAnd, a, v, mo);
}
@@ -338,3 +365,6 @@
char* a;
SCOPED_ATOMIC(Fence, mo);
}
+
+void __tsan_atomic_signal_fence(morder mo) {
+}
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.h?rev=165218&r1=165217&r2=165218&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interface_atomic.h Thu Oct 4 05:08:23 2012
@@ -69,6 +69,15 @@
__tsan_atomic64 __tsan_atomic64_fetch_add(volatile __tsan_atomic64 *a,
__tsan_atomic64 v, __tsan_memory_order mo);
+__tsan_atomic8 __tsan_atomic8_fetch_sub(volatile __tsan_atomic8 *a,
+ __tsan_atomic8 v, __tsan_memory_order mo);
+__tsan_atomic16 __tsan_atomic16_fetch_sub(volatile __tsan_atomic16 *a,
+ __tsan_atomic16 v, __tsan_memory_order mo);
+__tsan_atomic32 __tsan_atomic32_fetch_sub(volatile __tsan_atomic32 *a,
+ __tsan_atomic32 v, __tsan_memory_order mo);
+__tsan_atomic64 __tsan_atomic64_fetch_sub(volatile __tsan_atomic64 *a,
+ __tsan_atomic64 v, __tsan_memory_order mo);
+
__tsan_atomic8 __tsan_atomic8_fetch_and(volatile __tsan_atomic8 *a,
__tsan_atomic8 v, __tsan_memory_order mo);
__tsan_atomic16 __tsan_atomic16_fetch_and(volatile __tsan_atomic16 *a,
@@ -115,6 +124,7 @@
__tsan_atomic64 *c, __tsan_atomic64 v, __tsan_memory_order mo);
void __tsan_atomic_thread_fence(__tsan_memory_order mo);
+void __tsan_atomic_signal_fence(__tsan_memory_order mo);
#ifdef __cplusplus
} // extern "C"
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h?rev=165218&r1=165217&r2=165218&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_stat.h Thu Oct 4 05:08:23 2012
@@ -73,6 +73,7 @@
StatAtomicStore,
StatAtomicExchange,
StatAtomicFetchAdd,
+ StatAtomicFetchSub,
StatAtomicFetchAnd,
StatAtomicFetchOr,
StatAtomicFetchXor,
More information about the llvm-commits
mailing list