diff options
| author | Owen Anderson <resistor@mac.com> | 2009-06-18 20:56:48 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2009-06-18 20:56:48 +0000 |
| commit | 24164bc8f563a34eb00a7d4a5dd6acafadf0f3fc (patch) | |
| tree | 38ad4175ebce39ce5ad5f9ffe37c8de85aedacb3 /lib | |
| parent | a0ce1551db78754a44aa9c0872ed86736e831e24 (diff) | |
| download | external_llvm-24164bc8f563a34eb00a7d4a5dd6acafadf0f3fc.zip external_llvm-24164bc8f563a34eb00a7d4a5dd6acafadf0f3fc.tar.gz external_llvm-24164bc8f563a34eb00a7d4a5dd6acafadf0f3fc.tar.bz2 | |
Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73723 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/VMCore/Function.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index ace54d3..0450566 100644 --- a/lib/VMCore/Function.cpp +++ b/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 |
