+void FuncNode::init_predicate_tree(func_inst_list_t * inst_list)
+{
+ if (inst_list == NULL || inst_list->size() == 0)
+ return;
+
+ if (predicate_tree_initialized)
+ return;
+
+ predicate_tree_initialized = true;
+
+ // maybe restrict the size of hashtable to save calloc time
+ HashTable<void *, FuncInst *, uintptr_t, 4> loc_inst_map;
+
+ sllnode<FuncInst *> *it = inst_list->begin();
+ sllnode<FuncInst *> *prev;
+
+ FuncInst * entry_inst = it->getVal();
+
+ /* entry instruction has no predicate expression */
+ Predicate * pred_entry = new Predicate(entry_inst);
+ loc_inst_map.put(entry_inst->get_location(), entry_inst);
+
+ it = it->getNext();
+ while (it != NULL) {
+ prev = it->getPrev();
+
+ FuncInst * curr_inst = it->getVal();
+ FuncInst * prev_inst = prev->getVal();
+
+ if ( loc_inst_map.contains(curr_inst->get_location()) ) {
+ Predicate * pred1 = new Predicate(curr_inst);
+ pred1->add_predicate(EQUALITY, curr_inst->get_location(), 0);
+
+ Predicate * pred2 = new Predicate(curr_inst);
+ pred2->add_predicate(EQUALITY, curr_inst->get_location(), 1);
+ }
+
+ loc_inst_map.put(curr_inst->get_location(), curr_inst);
+
+ it = it->getNext();
+ }
+}
+
+