Search in sources :

Example 1 with RecursiveRelation

use of com.dat3m.dartagnan.wmm.relation.RecursiveRelation in project Dat3M by hernanponcedeleon.

the class VisitorBase method visitLetRecAndDefinition.

@Override
public Object visitLetRecAndDefinition(CatParser.LetRecAndDefinitionContext ctx) {
    RecursiveRelation rRecursive = (RecursiveRelation) relationRepository.getRelation(RecursiveRelation.class, ctx.n.getText());
    Relation rConcrete = ctx.e.accept(relationVisitor);
    if (rRecursive == null || rConcrete == null) {
        throw new ParsingException(ctx.getText());
    }
    rRecursive.setConcreteRelation(rConcrete);
    recursiveGroup.add(rRecursive);
    return null;
}
Also used : RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) Relation(com.dat3m.dartagnan.wmm.relation.Relation) RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) ParsingException(com.dat3m.dartagnan.exception.ParsingException)

Example 2 with RecursiveRelation

use of com.dat3m.dartagnan.wmm.relation.RecursiveRelation in project Dat3M by hernanponcedeleon.

the class VisitorBase method visitLetRecDefinition.

@Override
public Object visitLetRecDefinition(CatParser.LetRecDefinitionContext ctx) {
    recursiveGroup = new HashSet<>();
    recursiveDef = true;
    RecursiveRelation rRecursive = (RecursiveRelation) relationRepository.getRelation(RecursiveRelation.class, ctx.n.getText());
    Relation rConcrete = ctx.e.accept(relationVisitor);
    if (rRecursive == null || rConcrete == null) {
        throw new ParsingException(ctx.getText());
    }
    rRecursive.setConcreteRelation(rConcrete);
    recursiveGroup.add(rRecursive);
    for (CatParser.LetRecAndDefinitionContext c : ctx.letRecAndDefinition()) {
        c.accept(this);
    }
    wmm.addRecursiveGroup(recursiveGroup);
    recursiveDef = false;
    return null;
}
Also used : RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) Relation(com.dat3m.dartagnan.wmm.relation.Relation) RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) ParsingException(com.dat3m.dartagnan.exception.ParsingException) CatParser(com.dat3m.dartagnan.parsers.CatParser)

Example 3 with RecursiveRelation

use of com.dat3m.dartagnan.wmm.relation.RecursiveRelation in project Dat3M by hernanponcedeleon.

the class RecursiveGroup method initMinTupleSets.

public void initMinTupleSets() {
    boolean changed = true;
    while (changed) {
        changed = false;
        for (RecursiveRelation relation : relations) {
            relation.setDoRecurse();
            int oldSize = relation.getMinTupleSet().size();
            if (oldSize != relation.getMinTupleSetRecursive().size()) {
                changed = true;
            }
        }
    }
}
Also used : RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation)

Example 4 with RecursiveRelation

use of com.dat3m.dartagnan.wmm.relation.RecursiveRelation in project Dat3M by hernanponcedeleon.

the class RecursiveGroup method updateEncodeTupleSets.

public void updateEncodeTupleSets() {
    Map<Relation, Integer> encodeSetSizes = new HashMap<>();
    for (Relation relation : relations) {
        encodeSetSizes.put(relation, 0);
    }
    boolean changed = true;
    while (changed) {
        changed = false;
        for (RecursiveRelation relation : relations) {
            relation.setDoRecurse();
            relation.addEncodeTupleSet(relation.getEncodeTupleSet());
            int newSize = relation.getEncodeTupleSet().size();
            if (newSize != encodeSetSizes.get(relation)) {
                encodeSetSizes.put(relation, newSize);
                changed = true;
            }
        }
    }
}
Also used : RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation) Relation(com.dat3m.dartagnan.wmm.relation.Relation) RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation)

Example 5 with RecursiveRelation

use of com.dat3m.dartagnan.wmm.relation.RecursiveRelation in project Dat3M by hernanponcedeleon.

the class RecursiveGroup method initMaxTupleSets.

public void initMaxTupleSets() {
    boolean changed = true;
    while (changed) {
        changed = false;
        for (RecursiveRelation relation : relations) {
            relation.setDoRecurse();
            int oldSize = relation.getMaxTupleSet().size();
            if (oldSize != relation.getMaxTupleSetRecursive().size()) {
                changed = true;
            }
        }
    }
}
Also used : RecursiveRelation(com.dat3m.dartagnan.wmm.relation.RecursiveRelation)

Aggregations

RecursiveRelation (com.dat3m.dartagnan.wmm.relation.RecursiveRelation)5 Relation (com.dat3m.dartagnan.wmm.relation.Relation)3 ParsingException (com.dat3m.dartagnan.exception.ParsingException)2 CatParser (com.dat3m.dartagnan.parsers.CatParser)1