13#ifndef LLVM_SUPPORT_RWMUTEX_H
14#define LLVM_SUPPORT_RWMUTEX_H
16#include "llvm/Config/llvm-config.h"
20#include <shared_mutex>
23#if defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
24#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
25#define LLVM_USE_RW_MUTEX_IMPL
32#if defined(LLVM_USE_RW_MUTEX_IMPL)
40 explicit RWMutexImpl();
45 RWMutexImpl(
const RWMutexImpl &original) =
delete;
46 RWMutexImpl &operator=(
const RWMutexImpl &) =
delete;
85#if defined(LLVM_ENABLE_THREADS) && LLVM_ENABLE_THREADS != 0
86 void *data_ =
nullptr;
95#if !defined(LLVM_USE_RW_MUTEX_IMPL)
96 std::shared_mutex impl;
100 unsigned readers = 0;
101 unsigned writers = 0;
118 impl.unlock_shared();
124 assert(readers > 0 &&
"Reader lock not acquired before release!");
137 assert(writers == 0 &&
"Writer lock already acquired!");
150 assert(writers == 1 &&
"Writer lock not acquired before release!");
159#if !defined(LLVM_USE_RW_MUTEX_IMPL)
160template <
bool mt_only>
176#if !defined(LLVM_USE_RW_MUTEX_IMPL)
177template <
bool mt_only>
place backedge safepoints impl
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
SmartMutex - An R/W mutex with a compile time constant parameter that indicates whether this mutex sh...
SmartScopedReader< false > ScopedReader
SmartScopedWriter< false > ScopedWriter
const std::shared_lock< SmartRWMutex< mt_only > > SmartScopedReader
ScopedReader - RAII acquisition of a reader lock.
std::lock_guard< SmartRWMutex< mt_only > > SmartScopedWriter
ScopedWriter - RAII acquisition of a writer lock.
SmartRWMutex< false > RWMutex
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool llvm_is_multithreaded()
Returns true if LLVM is compiled with support for multi-threading, and false otherwise.