forked from hernanponcedeleon/Dat3M
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove term-based relation merging in CAT parser & fix duplicated fre…
…e relations (hernanponcedeleon#632) * - Removed merging of equivalent relations in cat parser * - Removed dead code * Added pass to distinguish different free relations. This fixes an issue where different free relations accidentally shared the same variables in the encoding.
- Loading branch information
1 parent
9f8b630
commit b9653ff
Showing
4 changed files
with
40 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
dartagnan/src/main/java/com/dat3m/dartagnan/wmm/processing/MarkFreeRelations.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.dat3m.dartagnan.wmm.processing; | ||
|
||
import com.dat3m.dartagnan.wmm.Relation; | ||
import com.dat3m.dartagnan.wmm.Wmm; | ||
import com.dat3m.dartagnan.wmm.definition.Free; | ||
|
||
/* | ||
This pass makes sure that differently freely defined relations have different names, in particular, | ||
unnamed relations will get a dummy name. | ||
This makes sure that we generate different encoding variables for different relations | ||
(there is no name collision). | ||
NOTE: We could generalize this pass to give distinguishing names to any pair of different relations | ||
if they are unnamed but have the same term. However, this is should only happen to free relations right now. | ||
*/ | ||
public class MarkFreeRelations implements WmmProcessor { | ||
|
||
private MarkFreeRelations() { | ||
} | ||
|
||
public static MarkFreeRelations newInstance() { | ||
return new MarkFreeRelations(); | ||
} | ||
|
||
@Override | ||
public void run(Wmm wmm) { | ||
int counter = 0; | ||
for (Relation rel : wmm.getRelations()) { | ||
if (rel.getDefinition() instanceof Free && !rel.hasName()) { | ||
wmm.addAlias("free#" + counter, rel); | ||
counter++; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters