X-Git-Url: http://plrg.eecs.uci.edu/git/?p=satune.git;a=blobdiff_plain;f=src%2FASTAnalyses%2FEncoding%2Fsubgraph.h;h=88a129129a8c3de1e8b005469727ba1656218e61;hp=5520709be9360f6cfa61685d09ff89a117d00d0b;hb=457ee300c637089a095444672c9d4628faf901e7;hpb=effcb0cac2350f338c4cd42c04194c0a0f0a8e90 diff --git a/src/ASTAnalyses/Encoding/subgraph.h b/src/ASTAnalyses/Encoding/subgraph.h index 5520709..88a1291 100644 --- a/src/ASTAnalyses/Encoding/subgraph.h +++ b/src/ASTAnalyses/Encoding/subgraph.h @@ -5,42 +5,65 @@ #include "graphstructs.h" class NodeValuePair { - public: - NodeValuePair(EncodingNode *n, uint64_t val) : node(n), value(val) {} +public: + NodeValuePair(EncodingNode *n, uint64_t val) : node(n), value(val) {} EncodingNode *node; uint64_t value; }; +class EncodingValue; + +typedef Hashset HashsetEncodingValue; +typedef SetIterator SetIteratorEncodingValue; + class EncodingValue { - public: +public: + EncodingValue(uint64_t _val) : value(_val), encoding(0), inComparison(false), assigned(false) {} void merge(EncodingValue *value); uint64_t value; + uint encoding; + bool inComparison; + bool assigned; HashsetEncodingNode nodes; + HashsetEncodingValue larger; + HashsetEncodingValue notequals; }; uint hashNodeValuePair(NodeValuePair *nvp); bool equalsNodeValuePair(NodeValuePair *nvp1, NodeValuePair *nvp2); -typedef Hashtable NVPMap; +typedef Hashtable NVPMap; class EncodingSubGraph { - public: +public: EncodingSubGraph(); + ~EncodingSubGraph(); void addNode(EncodingNode *n); - SetIteratorEncodingNode * nodeIterator(); + SetIteratorEncodingNode *nodeIterator(); void encode(); - + uint getEncoding(EncodingNode *n, uint64_t val); + uint getEncodingMaxVal(EncodingNode *n) { return maxEncodingVal;} + CMEMALLOC; - private: +private: uint estimateNewSize(EncodingNode *n); uint estimateNewSize(EncodingSubGraph *sg); void traverseValue(EncodingNode *node, uint64_t value); + void computeEncodingValue(); + void computeComparisons(); + void computeEqualities(); + void solveComparisons(); + void solveEquals(); + void generateComparison(EncodingNode *left, EncodingNode *right); + void generateEquals(EncodingNode *left, EncodingNode *right); + void orderEV(EncodingValue *smaller, EncodingValue *larger); - + HashsetEncodingValue values; HashsetEncodingNode nodes; NVPMap map; uint encodingSize; uint numElements; + uint maxEncodingVal; friend class EncodingGraph; };