cyclegraph: map Promises to Promise nodes
[c11tester.git] / cyclegraph.h
index 5c49992ea26b7dc99bc88cea4040e98c88cc3361..4a3d083d13c19fb897a29ebe2917af04f0990423 100644 (file)
@@ -24,7 +24,10 @@ class CycleGraph {
  public:
        CycleGraph();
        ~CycleGraph();
-       void addEdge(const ModelAction *from, const ModelAction *to);
+
+       template <typename T, typename U>
+       void addEdge(const T from, const U to);
+
        bool checkForCycles() const;
        void addRMWEdge(const ModelAction *from, const ModelAction *rmw);
        bool checkPromise(const ModelAction *from, Promise *p) const;
@@ -42,10 +45,16 @@ class CycleGraph {
        void addNodeEdge(CycleNode *fromnode, CycleNode *tonode);
        void putNode(const ModelAction *act, CycleNode *node);
        CycleNode * getNode(const ModelAction *);
+       CycleNode * getNode(const Promise *promise);
+
        HashTable<const CycleNode *, const CycleNode *, uintptr_t, 4, model_malloc, model_calloc, model_free> *discovered;
 
        /** @brief A table for mapping ModelActions to CycleNodes */
        HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
+       /** @brief A table for mapping reader ModelActions to Promise
+        *  CycleNodes */
+       HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> readerToPromiseNode;
+
 #if SUPPORT_MOD_ORDER_DUMP
        std::vector<CycleNode *> nodeList;
 #endif