Add sleep score
[c11tester.git] / predicate.h
index 4c26a9ddb8bace0986dbb54abda505d8090b3969..413b2cd88ec90ff0ac2c9e64dc89c0ec8892aa72 100644 (file)
@@ -12,7 +12,7 @@ typedef HSIterator<struct pred_expr *, uintptr_t, 0, model_malloc, model_calloc,
 
 class Predicate {
 public:
-       Predicate(FuncInst * func_inst, bool is_entry = false);
+       Predicate(FuncInst * func_inst, bool is_entry = false, bool is_exit = false);
        ~Predicate();
 
        FuncInst * get_func_inst() { return func_inst; }
@@ -21,11 +21,13 @@ public:
        void add_predicate_expr(token_t token, FuncInst * func_inst, bool value);
        void add_child(Predicate * child);
        void set_parent(Predicate * parent_pred) { parent = parent_pred; }
+       void set_exit(Predicate * exit_pred) { exit = exit_pred; }
        void add_backedge(Predicate * back_pred) { backedges.add(back_pred); }
        void copy_predicate_expr(Predicate * other);
 
        ModelVector<Predicate *> * get_children() { return &children; }
        Predicate * get_parent() { return parent; }
+       Predicate * get_exit() { return exit; }
        PredSet * get_backedges() { return &backedges; }
 
        bool is_entry_predicate() { return entry_predicate; }
@@ -37,6 +39,14 @@ public:
 
        ConcretePredicate * evaluate(inst_act_map_t * inst_act_map, thread_id_t tid);
 
+       uint32_t get_expl_count() { return exploration_count; }
+       uint32_t get_fail_count() { return failure_count; }
+       uint32_t get_scleep_score() { return sleep_score; }
+       void incr_expl_count();
+       void incr_fail_count();
+       void incr_sleep_score(uint32_t amount);
+       void decr_sleep_score(uint32_t amount);
+
        void print_predicate();
        void print_pred_subtree();
 
@@ -44,14 +54,20 @@ public:
 private:
        FuncInst * func_inst;
        bool entry_predicate;
+       bool exit_predicate;
        bool does_write;
 
+       uint32_t exploration_count;
+       uint32_t failure_count;
+       uint32_t sleep_score;   /* 0 <= sleep_score <= 100 */
+
        /* May have multiple predicate expressions */
        PredExprSet pred_expressions;
        ModelVector<Predicate *> children;
 
        /* Only a single parent may exist */
        Predicate * parent;
+       Predicate * exit;
 
        /* May have multiple back edges, e.g. nested loops */
        PredSet backedges;