fairness changes...
[model-checker.git] / cyclegraph.cc
index c7bb69b990d801dc026765420e918e35a31f1b0d..2bfe76ac424c274bf8152638543ad7dd6bc1d31f 100644 (file)
@@ -41,6 +41,7 @@ CycleNode * CycleGraph::getNode(const ModelAction *action) {
 void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) {
        ASSERT(from);
        ASSERT(to);
+       ASSERT(from != to);
 
        CycleNode *fromnode=getNode(from);
        CycleNode *tonode=getNode(to);
@@ -82,6 +83,7 @@ void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) {
 void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw) {
        ASSERT(from);
        ASSERT(rmw);
+       ASSERT(from != rmw);
 
        CycleNode *fromnode=getNode(from);
        CycleNode *rmwnode=getNode(rmw);
@@ -130,6 +132,9 @@ void CycleGraph::dumpGraphToFile(const char *filename) {
                std::vector<CycleNode *> * edges=cn->getEdges();
                const ModelAction *action=cn->getAction();
                fprintf(file, "N%u [label=\"%u, T%u\"];\n",action->get_seq_number(),action->get_seq_number(), action->get_tid());
+               if (cn->getRMW()!=NULL) {
+                       fprintf(file, "N%u -> N%u[style=dotted];\n", action->get_seq_number(), cn->getRMW()->getAction()->get_seq_number());
+               }
                for(unsigned int j=0;j<edges->size();j++) {
                  CycleNode *dst=(*edges)[j];
                        const ModelAction *dstaction=dst->getAction();