3 FuncInst::FuncInst(ModelAction *act, FuncNode *func_node) :
8 this->position = act->get_position();
9 this->location = act->get_location();
10 this->type = act->get_type();
11 this->order = act->get_mo();
12 this->func_node = func_node;
15 /* @param other Preceding FuncInst in the same execution trace
16 * Add other to predecessors if it has been added
18 * @return false: other is already in predecessors
19 * true : other is added to precedessors
21 bool FuncInst::add_pred(FuncInst * other)
23 mllnode<FuncInst*> * it;
24 for (it = predecessors.begin();it != NULL;it=it->getNext()) {
25 FuncInst * inst = it->getVal();
30 predecessors.push_back(other);
34 bool FuncInst::add_succ(FuncInst * other)
36 mllnode<FuncInst*>* it;
37 for (it = successors.begin();it != NULL;it=it->getNext()) {
38 FuncInst * inst = it->getVal();
43 successors.push_back(other);
48 FuncInst * FuncInst::search_in_collision(ModelAction *act)
50 action_type type = act->get_type();
52 mllnode<FuncInst*> * it;
53 for (it = collisions.begin(); it != NULL; it = it->getNext()) {
54 FuncInst * inst = it->getVal();
55 if (inst->get_type() == type)
62 bool FuncInst::is_read() const
64 return type == ATOMIC_READ || type == ATOMIC_RMWR || type == ATOMIC_RMWRCAS || type == ATOMIC_RMW;
67 bool FuncInst::is_write() const
69 return type == ATOMIC_WRITE || type == ATOMIC_RMW || type == ATOMIC_INIT || type == ATOMIC_UNINIT || type == NONATOMIC_WRITE;
72 void FuncInst::print()
74 model_print("func inst - pos: %s, loc: %p, type: %d,\n", position, location, type);