X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=predicate.h;h=33b2203f50767fcf1e6c3f89e86f1e51fde33ff8;hp=e2412d186705e079e60dabe68762b085af1245b8;hb=332eb3dfeb0f0272f4dbe3a3b10a8ff4bf3bb188;hpb=a177614511b9244854659a8d5f304d3e912c1658 diff --git a/predicate.h b/predicate.h index e2412d18..33b2203f 100644 --- a/predicate.h +++ b/predicate.h @@ -1,31 +1,61 @@ +#ifndef __PREDICTAE_H__ +#define __PREDICATE_H__ + #include "funcinst.h" +#include "hashset.h" + +unsigned int pred_expr_hash (struct pred_expr *); +bool pred_expr_equal(struct pred_expr *, struct pred_expr *); +typedef HashSet PredExprSet; +typedef HSIterator PredExprSetIter; typedef enum predicate_token { EQUALITY, NULLITY } token_t; /* If token is EQUALITY, then the predicate asserts whether - * this load should read the same value as the last value + * 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 { + pred_expr(token_t token, void * location, bool value) : + token(token), + location(location), + value(value) + {} + token_t token; void * location; bool value; + + MEMALLOC }; + class Predicate { public: - Predicate(); + Predicate(FuncInst * func_inst); ~Predicate(); FuncInst * get_func_inst() { return func_inst; } - ModelList * get_predicates() { return &predicates; } - void add_predicate(predicate_expr predicate); + PredExprSet * get_pred_expressions() { return &pred_expressions; } + void add_predicate(token_t token, void * location, bool value); + void add_child(Predicate * child); + ModelVector * get_children() { return &children; } + + bool is_entry_predicate() { return entry_predicate; } + void set_entry_predicate() { entry_predicate = true; } + + void print_predicate(); + void print_pred_subtree(); MEMALLOC private: FuncInst * func_inst; - /* may have multiple precicates */ - ModelList predicates; + bool entry_predicate; + /* may have multiple predicates */ + PredExprSet pred_expressions; + ModelVector children; }; + +#endif /* __PREDICATE_H__ */