5 #include "graphstructs.h"
9 NodeValuePair(EncodingNode *n, uint64_t val) : node(n), value(val) {}
17 typedef Hashset<EncodingValue *, uintptr_t, PTRSHIFT> HashsetEncodingValue;
18 typedef SetIterator<EncodingValue *, uintptr_t, PTRSHIFT> SetIteratorEncodingValue;
22 EncodingValue(uint64_t _val) : value(_val), encoding(0), inComparison(false), assigned(false) {}
23 void merge(EncodingValue *value);
28 HashsetEncodingNode nodes;
29 HashsetEncodingValue larger;
30 HashsetEncodingValue notequals;
34 uint hashNodeValuePair(NodeValuePair *nvp);
35 bool equalsNodeValuePair(NodeValuePair *nvp1, NodeValuePair *nvp2);
37 typedef Hashtable<NodeValuePair *, EncodingValue *, uintptr_t, 0, hashNodeValuePair, equalsNodeValuePair> NVPMap;
39 class EncodingSubGraph {
43 void addNode(EncodingNode *n);
44 SetIteratorEncodingNode *nodeIterator();
46 uint getEncoding(EncodingNode *n, uint64_t val);
47 uint getEncodingMaxVal(EncodingNode *n) { return maxEncodingVal;}
48 double measureSimilarity(EncodingNode *n);
49 double measureSimilarity(EncodingSubGraph *sg);
52 uint estimateNewSize(EncodingNode *n);
53 uint estimateNewSize(EncodingSubGraph *sg);
54 void traverseValue(EncodingNode *node, uint64_t value);
55 void computeEncodingValue();
56 void computeComparisons();
57 void computeEqualities();
58 void solveComparisons();
60 void generateComparison(EncodingNode *left, EncodingNode *right);
61 void generateEquals(EncodingNode *left, EncodingNode *right);
62 void orderEV(EncodingValue *smaller, EncodingValue *larger);
64 HashsetEncodingValue values;
65 HashsetEncodingNode nodes;
71 friend class EncodingGraph;