From: bdemsky Date: Fri, 16 Jun 2017 18:15:45 +0000 (-0700) Subject: Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/constraint_compiler X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fdf0e45c309033c29b504a69dfe1e9ab0e2e2ff7;p=satune.git Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/constraint_compiler --- fdf0e45c309033c29b504a69dfe1e9ab0e2e2ff7 diff --cc src/AST/boolean.c index 13070fa,0000000..ce6fad9 mode 100644,000000..100644 --- a/src/AST/boolean.c +++ b/src/AST/boolean.c @@@ -1,1 -1,0 +1,16 @@@ +#include "boolean.h" ++ ++Boolean* allocBoolean(VarType t){ ++ Boolean* tmp = (Boolean*) ourmalloc(sizeof (Boolean)); ++ tmp->vtype=t; ++ tmp->btype=_BOOLEAN; ++ return tmp; ++} ++ ++Boolean* allocBooleanOrder(Order* order,uint64_t first, uint64_t second){ ++ Boolean* tmp = (Boolean*) ourmalloc(sizeof (Boolean)); ++ tmp ->btype= _ORDER; ++ tmp->order = order; ++ tmp->first=first; ++ tmp->second=second; ++} diff --cc src/AST/boolean.h index 5e8c5a5,0000000..fcd4751 mode 100644,000000..100644 --- a/src/AST/boolean.h +++ b/src/AST/boolean.h @@@ -1,8 -1,0 +1,16 @@@ +#ifndef BOOLEAN_H +#define BOOLEAN_H +#include "classlist.h" +#include "mymemory.h" - ++#include "ops.h" +struct Boolean { ++ VarType vtype; ++ enum BooleanType btype; ++ Order* order; ++ uint64_t first; ++ uint64_t second; +}; ++ ++Boolean* allocBoolean(VarType t); ++Boolean* allocBooleanOrder(Order* order,uint64_t first, uint64_t second); +#endif diff --cc src/AST/function.h index da5087b,0000000..f023f4a mode 100644,000000..100644 --- a/src/AST/function.h +++ b/src/AST/function.h @@@ -1,8 -1,0 +1,10 @@@ +#ifndef FUNCTION_H +#define FUNCTION_H +#include "classlist.h" +#include "mymemory.h" + +struct Function { ++ ++ Table* table; +}; +#endif diff --cc src/AST/ops.h index 40e6f99,0000000..3990aec mode 100644,000000..100644 --- a/src/AST/ops.h +++ b/src/AST/ops.h @@@ -1,17 -1,0 +1,19 @@@ +#ifndef OPS_H +#define OPS_H +enum LogicOp {AND, OR, NOT, XOR, IMPLIES}; +enum ArithOp {ADD, SUB}; +enum CompOp {EQUALS}; +enum OrderType {PARTIAL, TOTAL}; + +/** + * FLAGFORCESOVERFLOW forces the operation to overflow if the boolean flag is true + * OVERFLOWSETSFLAG -- sets the flag if the operation overflows + * FLAGIFFOVERFLOW -- flag is set iff the operation overflows + * IGNORE -- doesn't constrain output if the result cannot be represented + * WRAPAROUND -- wraps around like stand integer arithmetic + */ +enum OverFlowBehavior {IGNORE, WRAPAROUND, FLAGFORCESOVERFLOW, OVERFLOWSETSFLAG, FLAGIFFOVERFLOW}; + ++enum BooleanType {_ORDER, _BOOLEAN}; ++ +#endif diff --cc src/AST/order.c index 727b2dd,0000000..2f8381e mode 100644,000000..100644 --- a/src/AST/order.c +++ b/src/AST/order.c @@@ -1,1 -1,0 +1,29 @@@ +#include "order.h" ++#include "structs.h" ++#include "set.h" ++ ++ ++Order* allocOrder(enum OrderType type, Set * set){ ++ Order* order = (Order*)ourmalloc(sizeof(Order)); ++ order->set=set; ++ order->constraints = allocDefVectorBoolean(); ++ order->type=type; ++ return order; ++} ++ ++Boolean* getOrderConstraint(Order* order, uint64_t first, uint64_t second){ ++ uint size = getSizeVectorInt(order->set->members); ++ //First we need to make sure that first and second are part of the list! ++ bool exist1=false, exist2=false; ++ for(int i=0; iset->members, i)==first){ ++ exist1=true; ++ }else if(getVectorInt(order->set->members, i) == second){ ++ exist2=true; ++ }else if(exist1 && exist2){ ++ break; ++ } ++ } ++ ASSERT(exist1 && exist2); ++ ++} diff --cc src/AST/order.h index b164a11,0000000..08bc2a7 mode 100644,000000..100644 --- a/src/AST/order.h +++ b/src/AST/order.h @@@ -1,8 -1,0 +1,15 @@@ +#ifndef ORDER_H +#define ORDER_H +#include "classlist.h" +#include "mymemory.h" - ++#include "structs.h" ++#include "ops.h" +struct Order { ++ enum OrderType type; ++ Set * set; ++ VectorBoolean* constraints; +}; ++ ++Order* allocOrder(enum OrderType type, Set * set); ++Boolean* getOrderConstraint(Order* order,uint64_t first, uint64_t second); +#endif diff --cc src/AST/predicate.c index dcec97a,0000000..2beef61 mode 100644,000000..100644 --- a/src/AST/predicate.c +++ b/src/AST/predicate.c @@@ -1,1 -1,0 +1,12 @@@ +#include "predicate.h" ++#include "structs.h" ++ ++ ++Predicate* allocPredicate(enum CompOp op, Set ** domain, uint numDomain){ ++ Predicate* predicate = (Predicate*) ourmalloc(sizeof(Predicate)); ++ predicate->domains = allocDefVectorSet(); ++ for(uint i=0; idomains,domain[i]); ++ predicate->op=op; ++ return predicate; ++} diff --cc src/AST/predicate.h index 9a17669,0000000..06c54bb mode 100644,000000..100644 --- a/src/AST/predicate.h +++ b/src/AST/predicate.h @@@ -1,9 -1,0 +1,15 @@@ +#ifndef PREDICATE_H +#define PREDICATE_H +#include "classlist.h" +#include "mymemory.h" ++#include "ops.h" ++#include "structs.h" + +struct Predicate { - ++ enum CompOp op; ++ VectorSet* domains; +}; ++ ++ ++Predicate* allocPredicate(enum CompOp op, Set ** domain, uint numDomain); +#endif