Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for atomic_exchange_explicit in litmus code #740

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dartagnan/src/main/antlr4/C11Lexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ lexer grammar C11Lexer;

C11AtomicLoad : 'atomic_load_explicit';
C11AtomicStore : 'atomic_store_explicit';
C11AtomicXchg : 'atomic_exchange_explicit';
C11AtomicSCAS : 'atomic_compare_exchange_strong_explicit';
C11AtomicWCAS : 'atomic_compare_exchange_weak_explicit';
C11AtomicFence : 'atomic_thread_fence';
Expand Down
2 changes: 2 additions & 0 deletions dartagnan/src/main/antlr4/LitmusC.g4
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ re locals [IntBinaryOp op, String mo]
| XchgAcquire LPar address = re Comma value = re RPar {$mo = Linux.MO_ACQUIRE;}
| XchgRelease LPar address = re Comma value = re RPar {$mo = Linux.MO_RELEASE;}) # reXchg

| C11AtomicXchg LPar address = re Comma value = re Comma c11Mo RPar # reC11AtomicXchg

| ( AtomicCmpXchg LPar address = re Comma cmp = re Comma value = re RPar {$mo = Linux.MO_MB;}
| AtomicCmpXchgRelaxed LPar address = re Comma cmp = re Comma value = re RPar {$mo = Linux.MO_RELAXED;}
| AtomicCmpXchgAcquire LPar address = re Comma cmp = re Comma value = re RPar {$mo = Linux.MO_ACQUIRE;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ public Expression visitReAtomicAddUnless(LitmusCParser.ReAtomicAddUnlessContext
return register;
}

@Override
public Expression visitReC11AtomicXchg(LitmusCParser.ReC11AtomicXchgContext ctx) {
Register register = getReturnRegister(true);
Expression value = (Expression) ctx.value.accept(this);
Event event = EventFactory.Atomic.newExchange(register, getAddress(ctx.address), value, ctx.c11Mo().mo);
programBuilder.addChild(currentThread, event);
return register;
}

@Override
public Expression visitReXchg(LitmusCParser.ReXchgContext ctx){
Register register = getReturnRegister(true);
Expand Down
Loading