llvm::AtomicOrdering

Atomic ordering for LLVM's memory model.

Synopsis

Declared in <llvm/Support/AtomicOrdering.h>

enum class AtomicOrdering : unsigned int;

Description

C++ defines ordering as a lattice. LLVM supplements this with NotAtomic and Unordered, which are both below the C++ orders.

not_atomic-->unordered-->relaxed-->release--------------->acq_rel-->seq_cst -->consume-->acquire--/

Members

NameDescription
NotAtomic Non-atomic access; the default for ordinary LLVM loads and stores.
Unordered Weakest atomicity: well-defined under races, but no synchronization.
Monotonic Atomic with a consistent per-address order; equivalent to C++ relaxed.
Acquire Synchronize with prior releases of the same atomic location (load/RMW).
Release Make prior stores visible to subsequent acquires of the same location.
AcquireRelease Read-modify-write operations that both acquire and release, combining the effects of Acquire and Release on the same atomic access.
SequentiallyConsistent Read-modify-write operations that both acquire and release, combining the effects of Acquire and Release on the same atomic access.
LAST Read-modify-write operations that both acquire and release, combining the effects of Acquire and Release on the same atomic access.

Non-Member Functions

NameDescription
getMergedAtomicOrderingReturn a single atomic ordering that is at least as strong as both the AO and Other orderings for an atomic operation.
isAcquireOrStrongerReturn true if AO is Acquire or stronger in the atomic ordering lattice.
isAtLeastOrStrongerThanReturn true if AO is at least as strong as Other in the atomic ordering lattice.
isReleaseOrStrongerReturn true if AO is Release or stronger in the atomic ordering lattice.
isStrongerThanReturns true if ao is stronger than other as defined by the AtomicOrdering lattice, which is based on C++'s definition.
isStrongerThanMonotonicReturn true if AO is strictly stronger than Monotonic.
isStrongerThanUnorderedReturn true if AO is strictly stronger than Unordered.
operator<Deleted; LLVM atomic orders form a lattice, not a total order.
operator<=Deleted; LLVM atomic orders form a lattice, not a total order.
operator>Deleted; LLVM atomic orders form a lattice, not a total order.
operator>=Deleted; LLVM atomic orders form a lattice, not a total order.
toCABIMap LLVM AO to the corresponding C11/C++11 ABI memory-order encoding.
toIRStringString used by LLVM IR to represent atomic ordering.