mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
IR: add a second ordering operand to cmpxhg for failure
The syntax for "cmpxchg" should now look something like: cmpxchg i32* %addr, i32 42, i32 3 acquire monotonic where the second ordering argument gives the required semantics in the case that no exchange takes place. It should be no stronger than the first ordering constraint and cannot be either "release" or "acq_rel" (since no store will have taken place). rdar://problem/15996804 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203559 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1829,10 +1829,23 @@ void Verifier::visitAllocaInst(AllocaInst &AI) {
|
||||
}
|
||||
|
||||
void Verifier::visitAtomicCmpXchgInst(AtomicCmpXchgInst &CXI) {
|
||||
Assert1(CXI.getOrdering() != NotAtomic,
|
||||
|
||||
// FIXME: more conditions???
|
||||
Assert1(CXI.getSuccessOrdering() != NotAtomic,
|
||||
"cmpxchg instructions must be atomic.", &CXI);
|
||||
Assert1(CXI.getOrdering() != Unordered,
|
||||
Assert1(CXI.getFailureOrdering() != NotAtomic,
|
||||
"cmpxchg instructions must be atomic.", &CXI);
|
||||
Assert1(CXI.getSuccessOrdering() != Unordered,
|
||||
"cmpxchg instructions cannot be unordered.", &CXI);
|
||||
Assert1(CXI.getFailureOrdering() != Unordered,
|
||||
"cmpxchg instructions cannot be unordered.", &CXI);
|
||||
Assert1(CXI.getSuccessOrdering() >= CXI.getFailureOrdering(),
|
||||
"cmpxchg instructions be at least as constrained on success as fail",
|
||||
&CXI);
|
||||
Assert1(CXI.getFailureOrdering() != Release &&
|
||||
CXI.getFailureOrdering() != AcquireRelease,
|
||||
"cmpxchg failure ordering cannot include release semantics", &CXI);
|
||||
|
||||
PointerType *PTy = dyn_cast<PointerType>(CXI.getOperand(0)->getType());
|
||||
Assert1(PTy, "First cmpxchg operand must be a pointer.", &CXI);
|
||||
Type *ElTy = PTy->getElementType();
|
||||
|
Reference in New Issue
Block a user