remove redundant domains
[satune.git] / src / ASTTransform / elementopt.cc
1 #include "elementopt.h"
2 #include "csolver.h"
3 #include "tunable.h"
4 #include "iterator.h"
5 #include "boolean.h"
6 #include "element.h"
7 #include "predicate.h"
8
9 ElementOpt::ElementOpt(CSolver *_solver)
10         : Transform(_solver)
11 {
12 }
13
14 ElementOpt::~ElementOpt() {
15 }
16
17 void ElementOpt::doTransform() {
18         if (solver->getTuner()->getTunable(ELEMENTOPT, &onoff) == 0)
19                 return;
20
21         BooleanIterator bit(solver);
22         while (bit.hasNext()) {
23                 Boolean *b = bit.next();
24                 if (b->type == PREDICATEOP)
25                         processPredicate((BooleanPredicate *)b);
26         }
27 }
28
29 void ElementOpt::processPredicate(BooleanPredicate * pred) {
30         uint numInputs = pred->inputs.getSize();
31         if (numInputs != 2)
32                 return;
33
34         Predicate * p = pred->getPredicate();
35         if (p->type == TABLEPRED)
36                         return;
37
38         PredicateOperator * pop = (PredicateOperator *) p;
39         CompOp op = pop->getOp();
40
41         Element * left = pred->inputs.get(0);
42         Element * right = pred->inputs.get(1);
43
44         if (left->type == ELEMCONST) {
45
46         } else if (right->type == ELEMCONST) {
47
48         } else {
49                 return;
50         }
51 }