3 Predicate::Predicate(FuncInst * func_inst) :
9 unsigned int pred_expr_hash(struct pred_expr * expr)
11 return (unsigned int)((uintptr_t)expr);
14 bool pred_expr_equal(struct pred_expr * p1, struct pred_expr * p2)
16 if (p1->token != p2->token)
18 if (p1->token == EQUALITY && p1->location != p2->location)
20 if (p1->value != p2->value)
25 void Predicate::add_predicate(token_t token, void * location, bool value)
27 struct pred_expr *ptr = new pred_expr(token, location, value);
31 void Predicate::add_child(Predicate * child)
33 /* check duplication? */
34 children.push_back(child);
37 void Predicate::print_predicate()
39 model_print("\"%p\" [shape=box, label=\"%p\n", this, this);
41 PredSetIter * it = predicates.iterator();
43 if (predicates.getSize() == 0)
44 model_print("no predicate\n");
46 while (it->hasNext()) {
47 struct pred_expr * expr = it->next();
48 model_print("predicate: token: %d, location: %p, value: %d\n", expr->token, expr->location, expr->value);
50 model_print("\"];\n");
53 void Predicate::print_pred_subtree()
56 for (uint i = 0; i < children.size(); i++) {
57 Predicate * child = children[i];
58 child->print_pred_subtree();
59 model_print("\"%p\" -> \"%p\"\n", this, child);