X-Git-Url: http://plrg.eecs.uci.edu/git/?p=satune.git;a=blobdiff_plain;f=src%2FASTAnalyses%2FEncoding%2Fencodinggraph.cc;h=08db96d7b55cc47e02c7be0e394ae1135270ce5a;hp=e0cc869bd19cc5ffc781b88698c063f9c2d1c5c2;hb=0c1d68d80bf0f95947d82e20120f68ddf54f4e89;hpb=5f41b2b031712790013f031bedcf815c668b5768 diff --git a/src/ASTAnalyses/Encoding/encodinggraph.cc b/src/ASTAnalyses/Encoding/encodinggraph.cc index e0cc869..08db96d 100644 --- a/src/ASTAnalyses/Encoding/encodinggraph.cc +++ b/src/ASTAnalyses/Encoding/encodinggraph.cc @@ -8,6 +8,7 @@ #include "tunable.h" #include "qsort.h" #include "subgraph.h" +#include "elementencoding.h" EncodingGraph::EncodingGraph(CSolver * _solver) : solver(_solver) { @@ -45,11 +46,39 @@ void EncodingGraph::buildGraph() { decideEdges(); } +void EncodingGraph::encode() { + SetIteratorEncodingSubGraph * itesg=subgraphs.iterator(); + while(itesg->hasNext()) { + EncodingSubGraph *sg=itesg->next(); + sg->encode(); + } + delete itesg; + + ElementIterator it(solver); + while(it.hasNext()) { + Element * e = it.next(); + switch(e->type) { + case ELEMSET: + case ELEMFUNCRETURN: { + ElementEncoding *encoding=getElementEncoding(e); + if (encoding->getElementEncodingType() == ELEM_UNASSIGNED) { + //Do assignment... + } + break; + } + default: + break; + } + } + +} + void EncodingGraph::mergeNodes(EncodingNode *first, EncodingNode *second) { EncodingSubGraph *graph1=graphMap.get(first); EncodingSubGraph *graph2=graphMap.get(second); if (graph1 == NULL && graph2 == NULL) { graph1 = new EncodingSubGraph(); + subgraphs.add(graph1); graphMap.put(first, graph1); graph1->addNode(first); } @@ -67,6 +96,7 @@ void EncodingGraph::mergeNodes(EncodingNode *first, EncodingNode *second) { graph1->addNode(node); graphMap.put(node, graph1); } + subgraphs.remove(graph2); delete nodeit; delete graph2; } else {