Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/constraint_compiler
authorbdemsky <bdemsky@uci.edu>
Wed, 20 Sep 2017 00:16:04 +0000 (17:16 -0700)
committerbdemsky <bdemsky@uci.edu>
Wed, 20 Sep 2017 00:16:04 +0000 (17:16 -0700)
1  2 
src/ASTAnalyses/Encoding/encodinggraph.cc

@@@ -60,28 -61,9 +61,28 @@@ void EncodingGraph::encode() 
                switch(e->type) {
                case ELEMSET:
                case ELEMFUNCRETURN: {
-                       ElementEncoding *encoding=getElementEncoding(e);
+                       ElementEncoding *encoding=e->getElementEncoding();
                        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;
                }