Emit IR to implement the given cmpxchg operation on values in registers, returning the new value.
Declared in <llvm/Transforms/Utils/LowerAtomic.h>
std::pair<Value*, Value*>
buildCmpXchgValue(
IRBuilderBase& Builder,
Value* Ptr,
Value* Cmp,
Value* Val,
Align Alignment);
A pair of the original loaded value and whether it equaled Cmp.
| Name | Description |
|---|---|
| Builder | IR builder used to emit the non-atomic cmpxchg sequence. |
| Ptr | Pointer to the memory location being compared and exchanged. |
| Cmp | Expected value compared against the loaded contents of Ptr. |
| Val | New value stored to Ptr when the comparison succeeds. |
| Alignment | Alignment of the load and store to Ptr. |