4 FuncInst::FuncInst(ModelAction *act, FuncNode *func_node) :
7 action_marker(0) /* The marker for FuncNode starts from 1 */
11 this->position = act->get_position();
12 this->location = act->get_location();
13 this->type = act->get_type();
14 this->order = act->get_mo();
15 this->func_node = func_node;
18 /* @param other Preceding FuncInst in the same execution trace
19 * Add other to predecessors if it has been added
21 * @return false: other is already in predecessors
22 * true : other is added to precedessors
24 bool FuncInst::add_pred(FuncInst * other)
26 mllnode<FuncInst*> * it;
27 for (it = predecessors.begin();it != NULL;it=it->getNext()) {
28 FuncInst * inst = it->getVal();
33 predecessors.push_back(other);
37 bool FuncInst::add_succ(FuncInst * other)
39 mllnode<FuncInst*>* it;
40 for (it = successors.begin();it != NULL;it=it->getNext()) {
41 FuncInst * inst = it->getVal();
46 successors.push_back(other);
50 void FuncInst::set_associated_act(ModelAction * act, uint32_t marker)
53 action_marker = marker;
56 ModelAction * FuncInst::get_associated_act(uint32_t marker)
58 if (action_marker == marker)
59 return associated_act;
64 /* Search the FuncInst that has the same type as act in the collision list */
65 FuncInst * FuncInst::search_in_collision(ModelAction *act)
67 action_type type = act->get_type();
69 mllnode<FuncInst*> * it;
70 for (it = collisions.begin();it != NULL;it = it->getNext()) {
71 FuncInst * inst = it->getVal();
72 if (inst->get_type() == type)
78 void FuncInst::add_to_collision(FuncInst * inst)
80 collisions.push_back(inst);
83 /* Note: is_read() is equivalent to ModelAction::is_read() */
84 bool FuncInst::is_read() const
86 return type == ATOMIC_READ || type == ATOMIC_RMWR || type == ATOMIC_RMWRCAS || type == ATOMIC_RMW;
89 /* Note: because of action type conversion in ModelExecution
90 * is_write() <==> pure writes (excluding rmw) */
91 bool FuncInst::is_write() const
93 return type == ATOMIC_WRITE || type == ATOMIC_RMW || type == ATOMIC_INIT || type == ATOMIC_UNINIT || type == NONATOMIC_WRITE;
96 void FuncInst::print()
98 model_print("func inst - pos: %s, loc: %p, type: %d,\n", position, location, type);