+/** @file cyclegraph.h @brief Data structure to track ordering
+ * constraints on modification order. The idea is to see whether a
+ * total order exists that satisfies the ordering constriants.*/
+
#ifndef CYCLEGRAPH_H
#define CYCLEGRAPH_H
class CycleGraph {
public:
CycleGraph();
- void addEdge(ModelAction *from, ModelAction *to);
+ ~CycleGraph();
+ void addEdge(const ModelAction *from, const ModelAction *to);
bool checkForCycles();
+ void addRMWEdge(const ModelAction *from, const ModelAction *to);
private:
- CycleNode * getNode(ModelAction *);
- HashTable<ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
+ CycleNode * getNode(const ModelAction *);
+ HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
bool checkReachable(CycleNode *from, CycleNode *to);
bool hasCycles;
-
};
class CycleNode {
public:
- CycleNode(ModelAction *action);
+ CycleNode(const ModelAction *action);
void addEdge(CycleNode * node);
std::vector<CycleNode *> * getEdges();
+ bool setRMW(CycleNode *);
+ CycleNode* getRMW();
private:
- ModelAction *action;
+ const ModelAction *action;
std::vector<CycleNode *> edges;
+ CycleNode * hasRMW;
};
#endif