13#ifndef LLVM_SUPPORT_RWMUTEX_H
14#define LLVM_SUPPORT_RWMUTEX_H
16#include "llvm/Config/llvm-config.h"
20#include <shared_mutex>
23#define LLVM_USE_RW_MUTEX_IMPL
29#if defined(LLVM_USE_RW_MUTEX_IMPL)
37 explicit RWMutexImpl();
42 RWMutexImpl(
const RWMutexImpl &original) =
delete;
43 RWMutexImpl &operator=(
const RWMutexImpl &) =
delete;
68 bool try_lock_shared();
90#if defined(LLVM_ENABLE_THREADS) && LLVM_ENABLE_THREADS != 0
91 void *data_ =
nullptr;
100#if !defined(LLVM_USE_RW_MUTEX_IMPL)
101 std::shared_mutex impl;
105 unsigned readers = 0;
106 unsigned writers = 0;
123 impl.unlock_shared();
129 assert(readers > 0 &&
"Reader lock not acquired before release!");
144 assert(writers == 0 &&
"Writer lock already acquired!");
157 assert(writers == 1 &&
"Writer lock not acquired before release!");
168#if !defined(LLVM_USE_RW_MUTEX_IMPL)
169template <
bool mt_only>
185#if !defined(LLVM_USE_RW_MUTEX_IMPL)
186template <
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.