+/** @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
#include "hashtable.h"
-#include "action.h"
#include <vector>
+#include <inttypes.h>
class CycleNode;
+class ModelAction;
/** @brief A graph of Model Actions for tracking cycles. */
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<class ModelAction *, class 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<class CycleNode *> * getEdges();
+ std::vector<CycleNode *> * getEdges();
+ bool setRMW(CycleNode *);
+ CycleNode* getRMW();
private:
- ModelAction *action;
- std::vector<class CycleNode *> edges;
+ const ModelAction *action;
+ std::vector<CycleNode *> edges;
+ CycleNode * hasRMW;
};
#endif