change some data structures
[c11tester.git] / predicate.h
index e2412d186705e079e60dabe68762b085af1245b8..42511c609cb5a8907b7bda7d740047c4f3b0387d 100644 (file)
@@ -1,5 +1,12 @@
+#ifndef __PREDICTAE_H__
+#define __PREDICATE_H__
+
 #include "funcinst.h"
 
 #include "funcinst.h"
 
+unsigned int pred_expr_hash (struct pred_expr *);
+bool pred_expr_equal(struct pred_expr *, struct pred_expr *);
+typedef HashSet<struct pred_expr *, uintptr_t, 0, model_malloc, model_calloc, model_free, pred_expr_hash, pred_expr_equal> PredicateSet;
+
 typedef enum predicate_token {
        EQUALITY, NULLITY
 } token_t;
 typedef enum predicate_token {
        EQUALITY, NULLITY
 } token_t;
@@ -8,24 +15,28 @@ typedef enum predicate_token {
  * this load should read the same value as the last value 
  * read at memory location specified in predicate_expr.
  */
  * this load should read the same value as the last value 
  * read at memory location specified in predicate_expr.
  */
-struct predicate_expr {
+struct pred_expr {
        token_t token;
        void * location;
        bool value;
 };
 
        token_t token;
        void * location;
        bool value;
 };
 
+
 class Predicate {
 public:
 class Predicate {
 public:
-       Predicate();
+       Predicate(FuncInst * func_inst);
        ~Predicate();
 
        FuncInst * get_func_inst() { return func_inst; }
        ~Predicate();
 
        FuncInst * get_func_inst() { return func_inst; }
-       ModelList<predicate_expr> * get_predicates() { return &predicates; }
-       void add_predicate(predicate_expr predicate);
+       PredicateSet * get_predicates() { return &predicates; }
+       void add_predicate(token_t token, void * location, bool value);
 
        MEMALLOC
 private:
        FuncInst * func_inst;
        /* may have multiple precicates */
 
        MEMALLOC
 private:
        FuncInst * func_inst;
        /* may have multiple precicates */
-       ModelList<predicate_expr> predicates;
+       PredicateSet predicates;
+       ModelVector<Predicate *> children;
 };
 };
+
+#endif /* __PREDICATE_H__ */