X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=funcinst.h;h=9aec00f6cc3ae74880c4fc3af6a47cec5df28dd3;hp=3f2307e17c9e01fd5c7aa4ba635e24234da7c850;hb=897371c3246cdfaa949c943b9b8a1d075360d6fc;hpb=252be3e5cabb3ea9372aa03dae8d5e79207ba1c4 diff --git a/funcinst.h b/funcinst.h index 3f2307e1..9aec00f6 100644 --- a/funcinst.h +++ b/funcinst.h @@ -1,3 +1,6 @@ +#ifndef __FUNCINST_H__ +#define __FUNCINST_H__ + #include "action.h" #include "hashtable.h" @@ -7,31 +10,60 @@ typedef ModelList func_inst_list_mt; class FuncInst { public: - FuncInst(ModelAction *act); + FuncInst(ModelAction *act, FuncNode *func_node); ~FuncInst(); - //ModelAction * get_action() const { return action; } const char * get_position() const { return position; } + void * get_location() const { return location; } + void set_location(void * loc) { location = loc; } + void reset_location() { location = NULL; } + action_type get_type() const { return type; } + memory_order get_mo() const { return order; } + FuncNode * get_func_node() const { return func_node; } bool add_pred(FuncInst * other); bool add_succ(FuncInst * other); - FuncInst * search_in_collision(ModelAction *act); + //FuncInst * search_in_collision(ModelAction *act); + //func_inst_list_mt * get_collisions() { return &collisions; } - func_inst_list_mt * get_collisions() { return &collisions; } func_inst_list_mt * get_preds() { return &predecessors; } func_inst_list_mt * get_succs() { return &successors; } + bool is_read() const; + bool is_write() const; + bool is_single_location() { return single_location; } + void not_single_location() { single_location = false; } + + void print(); + MEMALLOC private: - //ModelAction * const action; const char * position; - void *location; + + /* Atomic operations with the same source line number may act at different + * memory locations, such as the next field of the head pointer in ms-queue. + * location only stores the memory location when this FuncInst was constructed. + */ + void * location; action_type type; + memory_order order; + FuncNode * func_node; + + bool single_location; + + /* Currently not in use. May remove this field later + * + * collisions store a list of FuncInsts with the same position + * but different action types. For example, CAS is broken down + * as three different atomic operations in cmodelint.cc */ + // func_inst_list_mt collisions; - func_inst_list_mt collisions; func_inst_list_mt predecessors; func_inst_list_mt successors; }; + +#endif /* __FUNCINST_H__ */ +