projects
/
satune.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
271ecfa
)
Use union in Boolean to save space
author
bdemsky
<bdemsky@uci.edu>
Sat, 17 Jun 2017 05:54:03 +0000
(22:54 -0700)
committer
bdemsky
<bdemsky@uci.edu>
Sat, 17 Jun 2017 05:54:03 +0000
(22:54 -0700)
src/AST/boolean.c
patch
|
blob
|
history
src/AST/boolean.h
patch
|
blob
|
history
src/AST/ops.h
patch
|
blob
|
history
src/Encoders/elementencoding.c
patch
|
blob
|
history
src/Encoders/elementencoding.h
patch
|
blob
|
history
src/classlist.h
patch
|
blob
|
history
diff --git
a/src/AST/boolean.c
b/src/AST/boolean.c
index a7ffd259841caa1fb3fc1b68e36e5df1e1bc3761..aaebba7312315e02f07b4068852de98499058459 100644
(file)
--- a/
src/AST/boolean.c
+++ b/
src/AST/boolean.c
@@
-2,17
+2,17
@@
Boolean* allocBoolean(VarType t) {
Boolean* tmp=(Boolean*) ourmalloc(sizeof (Boolean));
Boolean* allocBoolean(VarType t) {
Boolean* tmp=(Boolean*) ourmalloc(sizeof (Boolean));
- tmp->
vtype=t
;
- tmp->
btype=_BOOLEAN
;
+ tmp->
btype=BOOLEANVAR
;
+ tmp->
var.vtype=t
;
return tmp;
}
return tmp;
}
-Boolean* allocBooleanOrder(Order* order,uint64_t first, uint64_t second) {
+Boolean* allocBooleanOrder(Order* order,
uint64_t first, uint64_t second) {
Boolean* tmp=(Boolean*) ourmalloc(sizeof (Boolean));
Boolean* tmp=(Boolean*) ourmalloc(sizeof (Boolean));
- tmp->btype=
_ORDER
;
- tmp->order=order;
- tmp->first=first;
- tmp->second=second;
+ tmp->btype=
ORDERCONST
;
+ tmp->order
.order
=order;
+ tmp->
order.
first=first;
+ tmp->
order.
second=second;
return tmp;
}
return tmp;
}
diff --git
a/src/AST/boolean.h
b/src/AST/boolean.h
index 030e1d9dd72205a993f5c5a9d54218435014ac4b..87d7a49da28aec59607f52f9d2332d344811bf01 100644
(file)
--- a/
src/AST/boolean.h
+++ b/
src/AST/boolean.h
@@
-3,16
+3,41
@@
#include "classlist.h"
#include "mymemory.h"
#include "ops.h"
#include "classlist.h"
#include "mymemory.h"
#include "ops.h"
-struct Boolean {
- VarType vtype;
- enum BooleanType btype;
+
+struct BooleanOrder {
Order* order;
uint64_t first;
uint64_t second;
};
Order* order;
uint64_t first;
uint64_t second;
};
-Boolean* allocBoolean(VarType t);
-Boolean* allocBooleanOrder(Order* order,uint64_t first, uint64_t second);
+struct BooleanVar {
+ VarType vtype;
+};
+
+struct BooleanLogic {
+ LogicOp op;
+ Boolean * left;
+ Boolean * right;
+};
+
+struct BooleanComp {
+ CompOp op;
+ Boolean * left;
+ Boolean * right;
+};
+
+struct Boolean {
+ BooleanType btype;
+ union {
+ BooleanOrder order;
+ BooleanVar var;
+ BooleanLogic logic;
+ BooleanComp comp;
+ };
+};
+
+Boolean * allocBoolean(VarType t);
+Boolean * allocBooleanOrder(Order * order, uint64_t first, uint64_t second);
void deleteBoolean(Boolean * this);
#endif
void deleteBoolean(Boolean * this);
#endif
diff --git
a/src/AST/ops.h
b/src/AST/ops.h
index 40febd4d06ccb042be3e68bf02edd687b0e832b8..7fdf2f300b41a0e42c7780aaf34f05a438b475ab 100644
(file)
--- a/
src/AST/ops.h
+++ b/
src/AST/ops.h
@@
-15,6
+15,6
@@
enum OrderType {PARTIAL, TOTAL};
*/
enum OverFlowBehavior {IGNORE, WRAPAROUND, FLAGFORCESOVERFLOW, OVERFLOWSETSFLAG, FLAGIFFOVERFLOW, NOOVERFLOW};
*/
enum OverFlowBehavior {IGNORE, WRAPAROUND, FLAGFORCESOVERFLOW, OVERFLOWSETSFLAG, FLAGIFFOVERFLOW, NOOVERFLOW};
-enum BooleanType {
_ORDER, _BOOLEAN
};
+enum BooleanType {
ORDERCONST, BOOLEANVAR, LOGICOP, COMPARE
};
#endif
#endif
diff --git
a/src/Encoders/elementencoding.c
b/src/Encoders/elementencoding.c
index b97fee0cb53d49d6cf61b1ff0a9f23a39810d731..095f99ded848dc8dc3d4316b951a0eef971de42e 100644
(file)
--- a/
src/Encoders/elementencoding.c
+++ b/
src/Encoders/elementencoding.c
@@
-4,9
+4,16
@@
ElementEncoding * allocElementEncoding(ElementEncodingType type, Element *elemen
ElementEncoding * this=(ElementEncoding *)ourmalloc(sizeof(ElementEncoding));
this->element=element;
this->type=type;
ElementEncoding * this=(ElementEncoding *)ourmalloc(sizeof(ElementEncoding));
this->element=element;
this->type=type;
+ this->variables=NULL;
+ this->encodingArray=NULL;
+ this->numVars=0;
return this;
}
void deleteElementEncoding(ElementEncoding *this) {
return this;
}
void deleteElementEncoding(ElementEncoding *this) {
+ if (this->variables!=NULL)
+ ourfree(this->variables);
+ if (this->encodingArray!=NULL)
+ ourfree(this->encodingArray);
ourfree(this);
}
ourfree(this);
}
diff --git
a/src/Encoders/elementencoding.h
b/src/Encoders/elementencoding.h
index b94632cc2803fa045a5625807f5b71b740091b70..eb20f2b865853a948626f3033e861a092b667df0 100644
(file)
--- a/
src/Encoders/elementencoding.h
+++ b/
src/Encoders/elementencoding.h
@@
-11,6
+11,9
@@
typedef enum ElementEncodingType ElementEncodingType;
struct ElementEncoding {
ElementEncodingType type;
Element * element;
struct ElementEncoding {
ElementEncodingType type;
Element * element;
+ Boolean ** variables; /* List Variables Use To Encode Element */
+ uint64_t * encodingArray; /* List the Variables in the appropriate order */
+ uint numVars; /* Number of variables */
};
ElementEncoding * allocElementEncoding(ElementEncodingType type, Element *element);
};
ElementEncoding * allocElementEncoding(ElementEncodingType type, Element *element);
diff --git
a/src/classlist.h
b/src/classlist.h
index f38b44bc5cbe3422c1951ffeecc8d44ff0ef9555..f722a6e2331218e81535f978bd61a5eacdbddac9 100644
(file)
--- a/
src/classlist.h
+++ b/
src/classlist.h
@@
-22,6
+22,11
@@
typedef struct CSolver CSolver;
struct Constraint;
typedef struct Constraint Constraint;
struct Constraint;
typedef struct Constraint Constraint;
+typedef struct BooleanOrder BooleanOrder;
+typedef struct BooleanVar BooleanVar;
+typedef struct BooleanLogic BooleanLogic;
+typedef struct BooleanComp BooleanComp;
+
struct Boolean;
typedef struct Boolean Boolean;
struct Boolean;
typedef struct Boolean Boolean;
@@
-62,6
+67,7
@@
typedef enum ArithOp ArithOp;
typedef enum LogicOp LogicOp;
typedef enum CompOp CompOp;
typedef enum OrderType OrderType;
typedef enum LogicOp LogicOp;
typedef enum CompOp CompOp;
typedef enum OrderType OrderType;
+typedef enum BooleanType BooleanType;
typedef enum OverFlowBehavior OverFlowBehavior;
typedef unsigned int uint;
typedef enum OverFlowBehavior OverFlowBehavior;
typedef unsigned int uint;