summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Function.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-06-18 20:56:48 +0000
committerOwen Anderson <resistor@mac.com>2009-06-18 20:56:48 +0000
commit7f1ef67a7b42fff6dd6f497ff27e9a0c2ef028f4 (patch)
treea0940c756d31d084ecb31c44347e82a5a2f2c514 /llvm/lib/VMCore/Function.cpp
parent5a6960fcc3f7c3010bc3763bac435ae56a1f09fa (diff)
downloadbcm5719-llvm-7f1ef67a7b42fff6dd6f497ff27e9a0c2ef028f4.tar.gz
bcm5719-llvm-7f1ef67a7b42fff6dd6f497ff27e9a0c2ef028f4.zip
Simplify.
llvm-svn: 73723
Diffstat (limited to 'llvm/lib/VMCore/Function.cpp')
-rw-r--r--llvm/lib/VMCore/Function.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp
index ace54d35b2c..045056643b5 100644
--- a/llvm/lib/VMCore/Function.cpp
+++ b/llvm/lib/VMCore/Function.cpp
@@ -233,37 +233,30 @@ void Function::removeAttribute(unsigned i, Attributes attr) {
// use GC.
static DenseMap<const Function*,PooledStringPtr> *GCNames;
static StringPool *GCNamePool;
-static ManagedStatic<sys::RWMutex> GCLock;
+static ManagedStatic<sys::SmartRWMutex<true> > GCLock;
bool Function::hasGC() const {
- if (llvm_is_multithreaded()) {
- sys::ScopedReader Reader(&*GCLock);
- return GCNames && GCNames->count(this);
- } else
- return GCNames && GCNames->count(this);
+ sys::SmartScopedReader<true> Reader(&*GCLock);
+ return GCNames && GCNames->count(this);
}
const char *Function::getGC() const {
assert(hasGC() && "Function has no collector");
- if (llvm_is_multithreaded()) {
- sys::ScopedReader Reader(&*GCLock);
- return *(*GCNames)[this];
- } else
- return *(*GCNames)[this];
+ sys::SmartScopedReader<true> Reader(&*GCLock);
+ return *(*GCNames)[this];
}
void Function::setGC(const char *Str) {
- if (llvm_is_multithreaded()) GCLock->writer_acquire();
+ sys::SmartScopedWriter<true> Writer(&*GCLock);
if (!GCNamePool)
GCNamePool = new StringPool();
if (!GCNames)
GCNames = new DenseMap<const Function*,PooledStringPtr>();
(*GCNames)[this] = GCNamePool->intern(Str);
- if (llvm_is_multithreaded()) GCLock->writer_release();
}
void Function::clearGC() {
- if (llvm_is_multithreaded()) GCLock->writer_acquire();
+ sys::SmartScopedWriter<true> Writer(&*GCLock);
if (GCNames) {
GCNames->erase(this);
if (GCNames->empty()) {
@@ -275,7 +268,6 @@ void Function::clearGC() {
}
}
}
- if (llvm_is_multithreaded()) GCLock->writer_release();
}
/// copyAttributesFrom - copy all additional attributes (those not needed to
OpenPOWER on IntegriCloud