4 FuncInst::FuncInst(ModelAction *act, FuncNode *func_node) :
6 execution_number(model->get_execution_number())
10 this->position = act->get_position();
11 this->location = act->get_location();
12 this->type = act->get_type();
13 this->order = act->get_mo();
14 this->func_node = func_node;
17 /* @param other Preceding FuncInst in the same execution trace
18 * Add other to predecessors if it has been added
20 * @return false: other is already in predecessors
21 * true : other is added to precedessors
23 bool FuncInst::add_pred(FuncInst * other)
25 mllnode<FuncInst*> * it;
26 for (it = predecessors.begin();it != NULL;it=it->getNext()) {
27 FuncInst * inst = it->getVal();
32 predecessors.push_back(other);
36 bool FuncInst::add_succ(FuncInst * other)
38 mllnode<FuncInst*>* it;
39 for (it = successors.begin();it != NULL;it=it->getNext()) {
40 FuncInst * inst = it->getVal();
45 successors.push_back(other);
50 FuncInst * FuncInst::search_in_collision(ModelAction *act)
52 action_type type = act->get_type();
54 mllnode<FuncInst*> * it;
55 for (it = collisions.begin(); it != NULL; it = it->getNext()) {
56 FuncInst * inst = it->getVal();
57 if (inst->get_type() == type)
64 /* Note: is_read() is equivalent to ModelAction::is_read() */
65 bool FuncInst::is_read() const
67 return type == ATOMIC_READ || type == ATOMIC_RMWR || type == ATOMIC_RMWRCAS || type == ATOMIC_RMW;
70 /* Note: because of action type conversion in ModelExecution
71 * is_write() <==> pure writes (excluding rmw) */
72 bool FuncInst::is_write() const
74 return type == ATOMIC_WRITE || type == ATOMIC_RMW || type == ATOMIC_INIT || type == ATOMIC_UNINIT || type == NONATOMIC_WRITE;
77 void FuncInst::print()
79 model_print("func inst - pos: %s, loc: %p, type: %d,\n", position, location, type);