case ELEMFUNCRETURN: {
ElementEncoding *encoding=getElementEncoding(e);
if (encoding->getElementEncodingType() == ELEM_UNASSIGNED) {
- //Do assignment...
+ EncodingNode *n = getNode(e);
+ ASSERT(n != NULL);
+ ElementEncodingType encodetype=n->getEncoding();
+ encoding->setElementEncodingType(encodetype);
+ if (encodetype == UNARY || encodetype == ONEHOT) {
+ encoding->encodingArrayInitialization();
+ } else if (encodetype == BINARYINDEX) {
+ EncodingSubGraph * subgraph = graphMap.get(n);
+ uint encodingSize = subgraph->getEncodingSize(n);
+ uint paddedSize = encoding->getSizeEncodingArray(encodingSize);
+ encoding->allocInUseArrayElement(paddedSize);
+ encoding->allocEncodingArrayElement(paddedSize);
+ Set * s=e->getRange();
+ for(uint i=0;i<s->getSize();i++) {
+ uint64_t value=s->getElement(i);
+ uint encodingIndex=subgraph->getEncoding(n, value);
+ encoding->setInUseElement(encodingIndex);
+ encoding->encodingArray[encodingIndex] = value;
+ }
+ }
}
break;
}
return n;
}
+EncodingNode * EncodingGraph::getNode(Element *e) {
+ if (e->type == ELEMCONST)
+ return NULL;
+ Set *s = e->getRange();
+ EncodingNode *n = encodingMap.get(s);
+ return n;
+}
+
void EncodingNode::addElement(Element *e) {
elements.add(e);
}
void processFunction(ElementFunction *f);
void processPredicate(BooleanPredicate *b);
EncodingNode * createNode(Element *e);
+ EncodingNode * getNode(Element *e);
EncodingEdge * getEdge(EncodingNode *left, EncodingNode *right, EncodingNode *dst);
};
uint getSize() const;
VarType getType() const;
void setEncoding(ElementEncodingType e) {encoding=e;}
-
+ ElementEncodingType getEncoding() {return encoding;}
CMEMALLOC;
private:
Set *s;
return 1;
}
+uint EncodingSubGraph::getEncoding(EncodingNode *n, uint64_t val) {
+ NodeValuePair nvp(n, val);
+ EncodingValue *ev = map.get(&nvp);
+ return ev->encoding;
+}
+
void EncodingSubGraph::solveEquals() {
Vector<EncodingValue *> toEncode;
Vector<bool> encodingArray;
void addNode(EncodingNode *n);
SetIteratorEncodingNode * nodeIterator();
void encode();
+ uint getEncoding(EncodingNode *n, uint64_t val);
+ uint getEncodingSize(EncodingNode *n) { return maxEncodingVal;}
CMEMALLOC;
private: