X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cyclegraph.cc;h=62cef7c56079e2d2a46587a181340320a9fe0405;hb=c1372661a92b8d2ba3bc977ebbabf52127354bea;hp=66f9f69548608d02baa36dbd09bbd9b8ac2feac7;hpb=3b3533a76db06884f44b3e70ccdbad647275fcc4;p=model-checker.git diff --git a/cyclegraph.cc b/cyclegraph.cc index 66f9f69..62cef7c 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -62,6 +62,16 @@ void CycleGraph::addEdge(const ModelAction *from, const ModelAction *to) CycleNode *fromnode = getNode(from); CycleNode *tonode = getNode(to); + addEdge(fromnode, tonode); +} + +/** + * Adds an edge between two CycleNodes. + * @param fromnode The edge comes from this CycleNode + * @param tonode The edge points to this CycleNode + */ +void CycleGraph::addEdge(CycleNode *fromnode, CycleNode *tonode) +{ if (!hasCycles) hasCycles = checkReachable(tonode, fromnode); @@ -117,11 +127,7 @@ void CycleGraph::addRMWEdge(const ModelAction *from, const ModelAction *rmw) } } - if (!hasCycles) - hasCycles = checkReachable(rmwnode, fromnode); - - if (fromnode->addEdge(rmwnode)) - rollbackvector.push_back(fromnode); + addEdge(fromnode, rmwnode); } #if SUPPORT_MOD_ORDER_DUMP