1 /* Copyright (c) 2015 Regents of the University of California
3 * Author: Brian Demsky <bdemsky@uci.edu>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
12 #include "classlist.h"
13 #include "stl-model.h"
16 TRUE, FALSE, IMPLIES, AND, OR, VAR, NOTVAR, BOGUS
19 typedef enum ConstraintType CType;
23 Constraint(CType t, Constraint *l, Constraint *r);
24 Constraint(CType t, Constraint *l);
25 Constraint(CType t, uint num, Constraint ** array);
26 Constraint(CType t, uint var);
30 void dumpConstraint(IncrementalSolver *solver);
31 uint getVar() {ASSERT(type==VAR); return numoperandsorvar;}
32 ModelVector<Constraint *> * simplify();
33 CType getType() {return type;}
34 bool isFalse() {return type==FALSE;}
35 bool isTrue() {return type==TRUE;}
39 void setNeg(Constraint *c) {neg=c;}
45 uint numoperandsorvar;
46 Constraint ** operands;
48 friend bool mergeandfree(ModelVector<Constraint *> * to, ModelVector<Constraint *> * from);
51 extern Constraint ctrue;
52 extern Constraint cfalse;
54 Constraint * generateConstraint(uint numvars, Constraint ** vars, uint value);
55 Constraint * generateLTConstraint(uint numvars, Constraint ** vars, uint value);
56 Constraint * generateEquivConstraint(uint numvars, Constraint **var1, Constraint **var2);
57 Constraint * generateEquivConstraint(Constraint *var1, Constraint *var2);