mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-10-25 03:03:31 +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:
1 parent
fb411c8b8c
commit
ca396e391e
60 files changed
+489
-288
No files matched your search
@@ -2882,7 +2882,8 @@ error_code BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
break;
|
||||
}
|
||||
case bitc::FUNC_CODE_INST_CMPXCHG: {
|
||||
// CMPXCHG:[ptrty, ptr, cmp, new, vol, ordering, synchscope]
|
||||
// CMPXCHG:[ptrty, ptr, cmp, new, vol, successordering, synchscope,
|
||||
// failureordering]
|
||||
unsigned OpNum = 0;
|
||||
Value *Ptr, *Cmp, *New;
|
||||
if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
|
||||
@@ -2890,13 +2891,22 @@ error_code BitcodeReader::ParseFunctionBody(Function *F) {
|
||||
cast<PointerType>(Ptr->getType())->getElementType(), Cmp) ||
|
||||
popValue(Record, OpNum, NextValueNo,
|
||||
cast<PointerType>(Ptr->getType())->getElementType(), New) ||
|
||||
OpNum+3 != Record.size())
|
||||
(OpNum + 3 != Record.size() && OpNum + 4 != Record.size()))
|
||||
return Error(InvalidRecord);
|
||||
AtomicOrdering Ordering = GetDecodedOrdering(Record[OpNum+1]);
|
||||
if (Ordering == NotAtomic || Ordering == Unordered)
|
||||
AtomicOrdering SuccessOrdering = GetDecodedOrdering(Record[OpNum+1]);
|
||||
if (SuccessOrdering == NotAtomic || SuccessOrdering == Unordered)
|
||||
return Error(InvalidRecord);
|
||||
SynchronizationScope SynchScope = GetDecodedSynchScope(Record[OpNum+2]);
|
||||
I = new AtomicCmpXchgInst(Ptr, Cmp, New, Ordering, SynchScope);
|
||||
|
||||
AtomicOrdering FailureOrdering;
|
||||
if (Record.size() < 7)
|
||||
FailureOrdering =
|
||||
AtomicCmpXchgInst::getStrongestFailureOrdering(SuccessOrdering);
|
||||
else
|
||||
FailureOrdering = GetDecodedOrdering(Record[OpNum+3]);
|
||||
|
||||
I = new AtomicCmpXchgInst(Ptr, Cmp, New, SuccessOrdering, FailureOrdering,
|
||||
SynchScope);
|
||||
cast<AtomicCmpXchgInst>(I)->setVolatile(Record[OpNum]);
|
||||
InstructionList.push_back(I);
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user