pub struct AtomicExpr {
pub op: AtomicOp,
pub class: AtomicClass,
pub value_ty: Ty,
pub ptr: Option<Expr>,
pub value: Option<Expr>,
pub expected: Option<Expr>,
pub success: MemOrder,
pub failure: MemOrder,
}Expand description
One of the __atomic_*, __sync_* or __c11_atomic_* builtins, resolved.
The pointer is the object the operation is performed on; sema has already
checked that what it points at is one of the types
AtomicClass covers, and has resolved the memory orders — which C
requires to be integer constant expressions here, exactly as <stdatomic.h>
writes them.
Fields§
§op: AtomicOpWhat to do.
class: AtomicClassWhat kind of atomic to do it through.
value_ty: TyThe C type of the object, with any _Atomic already taken off: the
type of the value the operation produces or stores.
ptr: Option<Expr>The object’s address, absent only for a fence.
value: Option<Expr>The value operand — what is stored, exchanged or added.
expected: Option<Expr>The expected value of a compare-and-exchange: a pointer to it for
AtomicOp::CompareExchange, which writes the observed value back
through it, and the value itself for AtomicOp::SyncCompareSwap.
success: MemOrderThe order of the operation, and of a successful compare-and-exchange.
failure: MemOrderThe order of a failed compare-and-exchange.