summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-03-03 18:02:34 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-03-03 18:02:34 +0000
commit17388a61b270a21ee711cd51e003c17d2b3bdf29 (patch)
tree8266a71177053c8198869a5316c079498cea679b /llvm/lib
parent0b6eb591a4d6a7ce35d1a06ecf37637920715fce (diff)
downloadbcm5719-llvm-17388a61b270a21ee711cd51e003c17d2b3bdf29.tar.gz
bcm5719-llvm-17388a61b270a21ee711cd51e003c17d2b3bdf29.zip
Revert "[C++11] Replace LLVM atomics with std::atomic."
Breaks the MSVC build. DataStream.cpp(44): error C2552: 'llvm::Statistic::Value' : non-aggregates cannot be initialized with initializer list llvm-svn: 202731
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Attributes.cpp1
-rw-r--r--llvm/lib/IR/DiagnosticInfo.cpp6
-rw-r--r--llvm/lib/Support/ManagedStatic.cpp3
-rw-r--r--llvm/lib/Support/Statistic.cpp2
-rw-r--r--llvm/lib/Support/Threading.cpp6
-rw-r--r--llvm/lib/Support/Timer.cpp4
6 files changed, 12 insertions, 10 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 24cd6c7c1a2..9d9d948527c 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -18,6 +18,7 @@
#include "LLVMContextImpl.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/IR/Type.h"
+#include "llvm/Support/Atomic.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Mutex.h"
diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp
index 75ddd94b354..86e8788eb09 100644
--- a/llvm/lib/IR/DiagnosticInfo.cpp
+++ b/llvm/lib/IR/DiagnosticInfo.cpp
@@ -19,14 +19,14 @@
#include "llvm/IR/Function.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Metadata.h"
-#include <atomic>
+#include "llvm/Support/Atomic.h"
#include <string>
using namespace llvm;
int llvm::getNextAvailablePluginDiagnosticKind() {
- static std::atomic<int> PluginKindID(DK_FirstPluginKind);
- return ++PluginKindID;
+ static sys::cas_flag PluginKindID = DK_FirstPluginKind;
+ return (int)sys::AtomicIncrement(&PluginKindID);
}
DiagnosticInfoInlineAsm::DiagnosticInfoInlineAsm(const Instruction &I,
diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp
index c19f8cb4859..098cccb68df 100644
--- a/llvm/lib/Support/ManagedStatic.cpp
+++ b/llvm/lib/Support/ManagedStatic.cpp
@@ -13,6 +13,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Config/config.h"
+#include "llvm/Support/Atomic.h"
#include <cassert>
using namespace llvm;
@@ -27,7 +28,7 @@ void ManagedStaticBase::RegisterManagedStatic(void *(*Creator)(),
void* tmp = Creator ? Creator() : 0;
TsanHappensBefore(this);
- std::atomic_thread_fence(std::memory_order_seq_cst);
+ sys::MemoryFence();
// This write is racy against the first read in the ManagedStatic
// accessors. The race is benign because it does a second read after a
diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp
index 9d075736b30..56c3b0f5659 100644
--- a/llvm/lib/Support/Statistic.cpp
+++ b/llvm/lib/Support/Statistic.cpp
@@ -76,7 +76,7 @@ void Statistic::RegisterStatistic() {
StatInfo->addStatistic(this);
TsanHappensBefore(this);
- std::atomic_thread_fence(std::memory_order_seq_cst);
+ sys::MemoryFence();
// Remember we have been registered.
TsanIgnoreWritesBegin();
Initialized = true;
diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
index 15dd8a98052..9d7ac6c18de 100644
--- a/llvm/lib/Support/Threading.cpp
+++ b/llvm/lib/Support/Threading.cpp
@@ -13,8 +13,8 @@
#include "llvm/Support/Threading.h"
#include "llvm/Config/config.h"
+#include "llvm/Support/Atomic.h"
#include "llvm/Support/Mutex.h"
-#include <atomic>
#include <cassert>
using namespace llvm;
@@ -31,7 +31,7 @@ bool llvm::llvm_start_multithreaded() {
// We fence here to ensure that all initialization is complete BEFORE we
// return from llvm_start_multithreaded().
- std::atomic_thread_fence(std::memory_order_seq_cst);
+ sys::MemoryFence();
return true;
#else
return false;
@@ -44,7 +44,7 @@ void llvm::llvm_stop_multithreaded() {
// We fence here to insure that all threaded operations are complete BEFORE we
// return from llvm_stop_multithreaded().
- std::atomic_thread_fence(std::memory_order_seq_cst);
+ sys::MemoryFence();
multithreaded_mode = false;
delete global_lock;
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp
index 03845f21f2d..0456f5d6383 100644
--- a/llvm/lib/Support/Timer.cpp
+++ b/llvm/lib/Support/Timer.cpp
@@ -81,14 +81,14 @@ raw_ostream *llvm::CreateInfoOutputFile() {
static TimerGroup *DefaultTimerGroup = 0;
static TimerGroup *getDefaultTimerGroup() {
TimerGroup *tmp = DefaultTimerGroup;
- std::atomic_thread_fence(std::memory_order_seq_cst);
+ sys::MemoryFence();
if (tmp) return tmp;
llvm_acquire_global_lock();
tmp = DefaultTimerGroup;
if (!tmp) {
tmp = new TimerGroup("Miscellaneous Ungrouped Timers");
- std::atomic_thread_fence(std::memory_order_seq_cst);
+ sys::MemoryFence();
DefaultTimerGroup = tmp;
}
llvm_release_global_lock();
OpenPOWER on IntegriCloud