From: bdemsky <bdemsky@uci.edu>
Date: Wed, 30 Aug 2017 23:36:27 +0000 (-0700)
Subject: Change dependences
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c5e632659f6f8ad931cf14104f72a5aa59acf911;p=satune.git

Change dependences
---

diff --git a/src/AST/asthash.h b/src/AST/asthash.h
index 1842152..bdb5ec6 100644
--- a/src/AST/asthash.h
+++ b/src/AST/asthash.h
@@ -1,6 +1,6 @@
 #ifndef ASTHASH_H
 #define ASTHASH_H
-#include "classlist.h"
+#include "classes.h"
 #include "hashtable.h"
 
 uint hashBoolean(Boolean * boolean);
diff --git a/src/AST/astnode.h b/src/AST/astnode.h
index 0fc94a0..e6760ea 100644
--- a/src/AST/astnode.h
+++ b/src/AST/astnode.h
@@ -8,7 +8,7 @@ class ASTNode {
 public:
 	ASTNode(ASTNodeType _type) : type(_type) {}
 	ASTNodeType type;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 #endif
diff --git a/src/AST/boolean.h b/src/AST/boolean.h
index f66cee4..7dd0bb3 100644
--- a/src/AST/boolean.h
+++ b/src/AST/boolean.h
@@ -18,7 +18,7 @@ public:
 	BooleanValue boolVal;
 	Vector<Boolean *> parents;
 
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class BooleanConst : public Boolean {
@@ -26,7 +26,7 @@ class BooleanConst : public Boolean {
 	BooleanConst(bool isTrue);
 	Boolean *clone(CSolver *solver, CloneMap *map);
 	bool isTrue;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class BooleanVar : public Boolean {
@@ -36,7 +36,7 @@ public:
 
 	VarType vtype;
 	Edge var;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class BooleanOrder : public Boolean {
@@ -47,7 +47,7 @@ public:
 	Order *order;
 	uint64_t first;
 	uint64_t second;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class BooleanPredicate : public Boolean {
@@ -60,7 +60,7 @@ public:
 	Array<Element *> inputs;
 	Boolean *undefStatus;
 	FunctionEncoding *getFunctionEncoding() {return &encoding;}
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class BooleanLogic : public Boolean {
@@ -70,6 +70,6 @@ public:
 
 	LogicOp op;
 	Array<Boolean *> inputs;
-	MEMALLOC;
+	CMEMALLOC;
 };
 #endif
diff --git a/src/AST/element.h b/src/AST/element.h
index 8277b42..2622437 100644
--- a/src/AST/element.h
+++ b/src/AST/element.h
@@ -16,7 +16,7 @@ public:
 	ElementEncoding encoding;
 	virtual Element *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;};
 	
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class ElementConst : public Element {
@@ -25,7 +25,7 @@ public:
 	Set *set;
 	uint64_t value;
 	Element *clone(CSolver *solver, CloneMap *map);
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class ElementSet : public Element {
@@ -33,7 +33,7 @@ public:
 	ElementSet(Set *s);
 	Set *set;
 	Element *clone(CSolver *solver, CloneMap *map);
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class ElementFunction : public Element {
@@ -44,7 +44,7 @@ public:
 	Boolean *overflowstatus;
 	FunctionEncoding functionencoding;
 	Element *clone(CSolver *solver, CloneMap *map);
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 Set *getElementSet(Element *This);
diff --git a/src/AST/function.h b/src/AST/function.h
index 6d0e1d0..fcb5068 100644
--- a/src/AST/function.h
+++ b/src/AST/function.h
@@ -12,7 +12,7 @@ public:
 	FunctionType type;
 	virtual ~Function() {}
 	virtual Function *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;}
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class FunctionOperator : public Function {
@@ -25,7 +25,7 @@ public:
 	uint64_t applyFunctionOperator(uint numVals, uint64_t *values);
 	bool isInRangeFunction(uint64_t val);
 	Function *clone(CSolver *solver, CloneMap *map);
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class FunctionTable : public Function {
@@ -34,7 +34,7 @@ public:
 	UndefinedBehavior undefBehavior;
 	FunctionTable (Table *table, UndefinedBehavior behavior);
 	Function *clone(CSolver *solver, CloneMap *map);
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 #endif
diff --git a/src/AST/mutableset.h b/src/AST/mutableset.h
index 080db14..568678f 100644
--- a/src/AST/mutableset.h
+++ b/src/AST/mutableset.h
@@ -7,6 +7,6 @@ public:
 	MutableSet(VarType t);
 	void addElementMSet(uint64_t element);
 	Set *clone(CSolver *solver, CloneMap *map);
-	MEMALLOC;
+	CMEMALLOC;
 };
 #endif
diff --git a/src/AST/order.h b/src/AST/order.h
index f9bd69b..ea2de5e 100644
--- a/src/AST/order.h
+++ b/src/AST/order.h
@@ -23,7 +23,7 @@ public:
 	void initializeOrderElementsHashTable();
 	void addOrderConstraint(BooleanOrder *constraint);
 	void setOrderEncodingType(OrderEncodingType type);
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 #endif
diff --git a/src/AST/predicate.h b/src/AST/predicate.h
index 8d37051..183a960 100644
--- a/src/AST/predicate.h
+++ b/src/AST/predicate.h
@@ -13,7 +13,7 @@ public:
 	virtual ~Predicate() {}
 	virtual Predicate *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;}
 	PredicateType type;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class PredicateOperator : public Predicate {
@@ -23,7 +23,7 @@ public:
 	Predicate *clone(CSolver *solver, CloneMap *map);
 	CompOp op;
 	Array<Set *> domains;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class PredicateTable : public Predicate {
@@ -32,6 +32,6 @@ public:
 	Predicate *clone(CSolver *solver, CloneMap *map);
 	Table *table;
 	UndefinedBehavior undefinedbehavior;
-	MEMALLOC;
+	CMEMALLOC;
 };
 #endif
diff --git a/src/AST/set.h b/src/AST/set.h
index eb406bb..056794e 100644
--- a/src/AST/set.h
+++ b/src/AST/set.h
@@ -25,7 +25,7 @@ public:
 	uint64_t getMemberAt(uint index);
 	uint64_t getElement(uint index);
 	virtual Set *clone(CSolver *solver, CloneMap *map);
-	MEMALLOC;
+	CMEMALLOC;
 protected:
 	VarType type;
 	bool isRange;
diff --git a/src/AST/table.h b/src/AST/table.h
index 346da47..51c1581 100644
--- a/src/AST/table.h
+++ b/src/AST/table.h
@@ -14,7 +14,7 @@ public:
 	Array<Set *> domains;
 	Set *range;
 	HashSetTableEntry *entries;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 #endif
diff --git a/src/ASTAnalyses/orderedge.h b/src/ASTAnalyses/orderedge.h
index 9b1af29..b10b781 100644
--- a/src/ASTAnalyses/orderedge.h
+++ b/src/ASTAnalyses/orderedge.h
@@ -21,7 +21,7 @@ public:
 	unsigned int mustPos : 1;
 	unsigned int mustNeg : 1;
 	unsigned int pseudoPos : 1;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 #endif/* ORDEREDGE_H */
diff --git a/src/ASTAnalyses/ordergraph.h b/src/ASTAnalyses/ordergraph.h
index eb756a8..f80ec98 100644
--- a/src/ASTAnalyses/ordergraph.h
+++ b/src/ASTAnalyses/ordergraph.h
@@ -28,7 +28,7 @@ public:
 	HSIteratorOrderNode *getNodes() {return nodes->iterator();}
 	HSIteratorOrderEdge *getEdges() {return edges->iterator();}
 
-	MEMALLOC;
+	CMEMALLOC;
 private:
 	HashSetOrderNode *nodes;
 	HashSetOrderEdge *edges;
diff --git a/src/ASTAnalyses/ordernode.h b/src/ASTAnalyses/ordernode.h
index 550bf1e..3ffecb8 100644
--- a/src/ASTAnalyses/ordernode.h
+++ b/src/ASTAnalyses/ordernode.h
@@ -28,7 +28,7 @@ public:
 	uint sccNum;
 	HashSetOrderEdge inEdges;
 	HashSetOrderEdge outEdges;
-	MEMALLOC;
+	CMEMALLOC;
 };
 #endif/* ORDERNODE_H */
 
diff --git a/src/ASTTransform/integerencodingrecord.h b/src/ASTTransform/integerencodingrecord.h
index 3069da5..da53918 100644
--- a/src/ASTTransform/integerencodingrecord.h
+++ b/src/ASTTransform/integerencodingrecord.h
@@ -17,7 +17,7 @@ public:
 	IntegerEncodingRecord(Set* set);
 	~IntegerEncodingRecord();
 	Element* getOrderIntegerElement(CSolver *This, uint64_t item);
-	MEMALLOC;
+	CMEMALLOC;
 	
 private:
 	HashSetOrderElement *elementTable;
diff --git a/src/ASTTransform/pass.h b/src/ASTTransform/pass.h
index c9ee69e..211bd4e 100644
--- a/src/ASTTransform/pass.h
+++ b/src/ASTTransform/pass.h
@@ -20,7 +20,7 @@ public:
 	virtual inline bool canExecutePass(CSolver* This, uint type, Tunables tunable, TunableDesc* desc){
 		return GETVARTUNABLE(This->getTuner(), type, tunable, desc);
 	}
-	MEMALLOC;
+	CMEMALLOC;
 
 };
 
diff --git a/src/Backend/orderelement.h b/src/Backend/orderelement.h
index a5f08a3..ab2ef79 100644
--- a/src/Backend/orderelement.h
+++ b/src/Backend/orderelement.h
@@ -17,7 +17,7 @@ public:
 	OrderElement(uint64_t item, Element *elem);
 	uint64_t item;
 	Element *elem;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 
diff --git a/src/Backend/orderpair.h b/src/Backend/orderpair.h
index 6fc5df1..aad68ff 100644
--- a/src/Backend/orderpair.h
+++ b/src/Backend/orderpair.h
@@ -19,7 +19,7 @@ public:
 	uint64_t first;
 	uint64_t second;
 	Edge constraint;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 #endif/* ORDERPAIR_H */
diff --git a/src/Backend/satencoder.h b/src/Backend/satencoder.h
index 4cfe4c2..25a46d0 100644
--- a/src/Backend/satencoder.h
+++ b/src/Backend/satencoder.h
@@ -19,7 +19,7 @@ class SATEncoder {
 	long long getSolveTime() { return cnf->solveTime; }
 	long long getEncodeTime() { return cnf->encodeTime; }
 	
-	MEMALLOC;
+	CMEMALLOC;
  private:
 	Edge getNewVarSATEncoder();
 	void getArrayNewVarsSATEncoder(uint num, Edge *carray);
diff --git a/src/Collections/corestructs.h b/src/Collections/corestructs.h
new file mode 100644
index 0000000..867feb7
--- /dev/null
+++ b/src/Collections/corestructs.h
@@ -0,0 +1,10 @@
+#ifndef CORESTRUCTS_H
+#define CORESTRUCTS_H
+
+#include "cppvector.h"
+#include "hashset.h"
+
+typedef HashSet<Boolean *, uintptr_t, 4> HashSetBoolean;
+typedef HSIterator<Boolean *, uintptr_t, 4> HSIteratorBoolean;
+
+#endif
diff --git a/src/Collections/structs.h b/src/Collections/structs.h
index 266fc17..30fc93b 100644
--- a/src/Collections/structs.h
+++ b/src/Collections/structs.h
@@ -5,6 +5,7 @@
 #include "hashset.h"
 #include "classlist.h"
 #include "array.h"
+#include "corestructs.h"
 
 unsigned int table_entry_hash_function(TableEntry *This);
 bool table_entry_equals(TableEntry *key1, TableEntry *key2);
@@ -18,7 +19,7 @@ unsigned int order_pair_hash_function(OrderPair *This);
 bool order_pair_equals(OrderPair *key1, OrderPair *key2);
 
 
-typedef HashSet<Boolean *, uintptr_t, 4> HashSetBoolean;
+
 typedef HashSet<TableEntry *, uintptr_t, 4, table_entry_hash_function, table_entry_equals> HashSetTableEntry;
 typedef HashSet<OrderNode *, uintptr_t, 4, order_node_hash_function, order_node_equals> HashSetOrderNode;
 typedef HashSet<OrderEdge *, uintptr_t, 4, order_edge_hash_function, order_edge_equals> HashSetOrderEdge;
@@ -29,7 +30,6 @@ typedef HashTable<void *, void *, uintptr_t, 4> CloneMap;
 typedef HashTable<Order* , IntegerEncodingRecord*, uintptr_t, 4> HashTableOrderIntegerEncoding; 
 
 typedef HSIterator<TableEntry *, uintptr_t, 4, table_entry_hash_function, table_entry_equals> HSIteratorTableEntry;
-typedef HSIterator<Boolean *, uintptr_t, 4> HSIteratorBoolean;
 typedef HSIterator<OrderEdge *, uintptr_t, 4, order_edge_hash_function, order_edge_equals> HSIteratorOrderEdge;
 typedef HSIterator<OrderNode *, uintptr_t, 4, order_node_hash_function, order_node_equals> HSIteratorOrderNode;
 
diff --git a/src/Encoders/elementencoding.h b/src/Encoders/elementencoding.h
index 1d41940..d7585f4 100644
--- a/src/Encoders/elementencoding.h
+++ b/src/Encoders/elementencoding.h
@@ -55,7 +55,7 @@ public:
 		};
 	};
 	uint numVars;	/* Number of variables */
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 
diff --git a/src/Encoders/functionencoding.h b/src/Encoders/functionencoding.h
index e4bd5aa..a7b6364 100644
--- a/src/Encoders/functionencoding.h
+++ b/src/Encoders/functionencoding.h
@@ -24,7 +24,7 @@ public:
 	FunctionEncoding(Boolean *predicate);
 	void setFunctionEncodingType(FunctionEncodingType type);
 	FunctionEncodingType getFunctionEncodingType() {return type;}
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 
diff --git a/src/Encoders/orderencoding.h b/src/Encoders/orderencoding.h
index 57409e7..4d71805 100644
--- a/src/Encoders/orderencoding.h
+++ b/src/Encoders/orderencoding.h
@@ -14,7 +14,7 @@ public:
 
 	OrderEncodingType type;
 	Order *order;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 #endif
diff --git a/src/Tuner/autotuner.h b/src/Tuner/autotuner.h
index 2490d56..9e36732 100644
--- a/src/Tuner/autotuner.h
+++ b/src/Tuner/autotuner.h
@@ -8,7 +8,7 @@ class AutoTuner {
 	AutoTuner(uint budget);
 	void addProblem(CSolver *solver);
 	void tune();
-	MEMALLOC;
+	CMEMALLOC;
  private:
 	long long evaluate(CSolver *problem, SearchTuner *tuner);
 	double evaluateAll(SearchTuner *tuner);
diff --git a/src/Tuner/searchtuner.h b/src/Tuner/searchtuner.h
index b41a3e0..3470aa8 100644
--- a/src/Tuner/searchtuner.h
+++ b/src/Tuner/searchtuner.h
@@ -11,7 +11,7 @@ class TunableSetting {
 	TunableSetting(TunableSetting * ts);
 	void setDecision(int _low, int _high, int _default, int _selection);
 	void print();
-	MEMALLOC;
+	CMEMALLOC;
  private:
 	bool hasVar;
 	VarType type;
@@ -43,7 +43,7 @@ class SearchTuner : public Tuner {
 	void print();
 	void printUsed();
 
-	MEMALLOC;
+	CMEMALLOC;
  private:
 	/** Used Settings keeps track of settings that were actually used by
 		 the example. Mutating settings may cause the Constraint Compiler
diff --git a/src/Tuner/tunable.h b/src/Tuner/tunable.h
index a1e165a..4800345 100644
--- a/src/Tuner/tunable.h
+++ b/src/Tuner/tunable.h
@@ -8,7 +8,7 @@ public:
 	virtual int getTunable(TunableParam param, TunableDesc *descriptor) {ASSERT(0); return 0;}
 	virtual int getVarTunable(VarType vartype, TunableParam param, TunableDesc *descriptor) {ASSERT(0); return 0;}
 	virtual ~Tuner() {}
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 class DefaultTuner : public Tuner {
@@ -16,7 +16,7 @@ public:
 	DefaultTuner();
 	int getTunable(TunableParam param, TunableDesc *descriptor);
 	int getVarTunable(VarType vartype, TunableParam param, TunableDesc *descriptor);
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 
@@ -27,7 +27,7 @@ public:
 	int lowValue;
 	int highValue;
 	int defaultValue;
-	MEMALLOC;
+	CMEMALLOC;
 };
 
 
diff --git a/src/classes.h b/src/classes.h
new file mode 100755
index 0000000..fd370a7
--- /dev/null
+++ b/src/classes.h
@@ -0,0 +1,30 @@
+/*      Copyright (c) 2015 Regents of the University of California
+ *
+ *      Author: Brian Demsky <bdemsky@uci.edu>
+ *
+ *      This program is free software; you can redistribute it and/or
+ *      modify it under the terms of the GNU General Public License
+ *      version 2 as published by the Free Software Foundation.
+ */
+
+#ifndef CLASSES_H
+#define CLASSES_H
+
+#include "mymemory.h"
+#include <inttypes.h>
+
+class SATEncoder;
+class CSolver;
+class Boolean;
+class Element;
+class Predicate;
+class Table;
+class Order;
+class MutableSet;
+class Function;
+class Tuner;
+class Set;
+class BooleanLogic;
+typedef uint64_t VarType;
+
+#endif
diff --git a/src/classlist.h b/src/classlist.h
index 7b842ff..1145d67 100644
--- a/src/classlist.h
+++ b/src/classlist.h
@@ -12,32 +12,30 @@
 
 #include "mymemory.h"
 #include <inttypes.h>
+#include "classes.h"
+
 
-class CSolver;
-class SATEncoder;
-class Boolean;
 class BooleanOrder;
 class BooleanVar;
-class BooleanLogic;
+
 class BooleanPredicate;
 class ASTNode;
-class Set;
-class MutableSet;
+
+
 
 class ElementFunction;
 class ElementSet;
 class ElementConst;
-class Element;
 
 class FunctionOperator;
 class FunctionTable;
-class Function;
 
-class Predicate;
+
+
 class PredicateTable;
 class PredicateOperator;
-class Table;
-class Order;
+
+
 class OrderPair;
 
 class OrderElement;
@@ -57,18 +55,16 @@ class AutoTuner;
 class SearchTuner;
 class TunableSetting;
 
+class TunableDesc;
+
 struct IncrementalSolver;
 typedef struct IncrementalSolver IncrementalSolver;
 
 struct TableEntry;
 typedef struct TableEntry TableEntry;
 
-class Tuner;
-class TunableDesc;
-
 typedef int TunableParam;
-
 typedef unsigned int uint;
 typedef long int int64;
-typedef uint64_t VarType;
+
 #endif
diff --git a/src/csolver.cc b/src/csolver.cc
index 9092af9..bcde64e 100644
--- a/src/csolver.cc
+++ b/src/csolver.cc
@@ -14,6 +14,7 @@
 #include "analyzer.h"
 #include "autotuner.h"
 #include "astops.h"
+#include "structs.h"
 
 CSolver::CSolver() :
 	boolTrue(new BooleanConst(true)),
diff --git a/src/csolver.h b/src/csolver.h
index 52f1c98..0f49dcd 100644
--- a/src/csolver.h
+++ b/src/csolver.h
@@ -1,8 +1,8 @@
 #ifndef CSOLVER_H
 #define CSOLVER_H
-#include "classlist.h"
+#include "classes.h"
 #include "ops.h"
-#include "structs.h"
+#include "corestructs.h"
 #include "asthash.h"
 
 class CSolver {
@@ -129,7 +129,7 @@ public:
 	long long getEncodeTime();
 	long long getSolveTime();
 	
-	MEMALLOC;
+	CMEMALLOC;
 
 private:
 	void handleXORFalse(BooleanLogic *bexpr, Boolean *child);
diff --git a/src/mymemory.h b/src/mymemory.h
index 294985d..1c7f3b3 100644
--- a/src/mymemory.h
+++ b/src/mymemory.h
@@ -11,8 +11,8 @@
  *  @brief Memory allocation functions.
  */
 
-#ifndef _MY_MEMORY_H
-#define _MY_MEMORY_H
+#ifndef CSAT_MY_MEMORY_H
+#define CSAT_MY_MEMORY_H
 #include <limits.h>
 #include <stddef.h>
 #include <stdlib.h>
@@ -31,7 +31,7 @@ static inline void ourfree(void *ptr) { free(ptr); }
 static inline void *ourcalloc(size_t count, size_t size) { return calloc(count, size); }
 static inline void *ourrealloc(void *ptr, size_t size) { return realloc(ptr, size); }
 
-#define MEMALLOC                           \
+#define CMEMALLOC                           \
 	void *operator new(size_t size) {       \
 		return ourmalloc(size);                \
 	}                                                  \