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"
16 TRUE, FALSE, IMPLIES, AND, OR, VAR, NOTVAR, BOGUS
19 typedef enum ConstraintType CType;
23 uint numoperandsorvar;
24 Constraint ** operands;
28 Constraint * allocConstraint(CType t, Constraint *l, Constraint *r);
29 Constraint * allocUnaryConstraint(CType t, Constraint *l);
30 Constraint * allocArrayConstraint(CType t, uint num, Constraint ** array);
31 Constraint * allocVarConstraint(CType t, uint var);
33 void deleteConstraint(Constraint *);
34 void printConstraint(Constraint * c);
35 void dumpConstraint(Constraint * c, IncrementalSolver *solver);
36 static inline uint getVarConstraint(Constraint * c) {ASSERT(c->type==VAR); return c->numoperandsorvar;}
37 VectorConstraint * simplifyConstraint(Constraint * This);
38 static inline CType getType(Constraint * c) {return c->type;}
39 static inline bool isFalse(Constraint * c) {return c->type==FALSE;}
40 static inline bool isTrue(Constraint * c) {return c->type==TRUE;}
41 void internalfreeConstraint(Constraint * c);
42 void freerecConstraint(Constraint * c);
43 Constraint * cloneConstraint(Constraint * c);
44 static inline void setNegConstraint(Constraint * This, Constraint *c) {This->neg=c;}
45 Constraint *negateConstraint(Constraint * c);
48 extern Constraint ctrue;
49 extern Constraint cfalse;
51 Constraint * generateBinaryConstraint(uint numvars, Constraint ** vars, uint value);
52 Constraint * generateLTConstraint(uint numvars, Constraint ** vars, uint value);
53 Constraint * generateEquivNVConstraint(uint numvars, Constraint **var1, Constraint **var2);
54 Constraint * generateEquivConstraint(Constraint *var1, Constraint *var2);