fix bug
[c11tester.git] / funcinst.h
1 #include "action.h"
2 #include "hashtable.h"
3
4 class ModelAction;
5
6 typedef ModelList<FuncInst *> func_inst_list_mt;
7
8 class FuncInst {
9 public:
10         FuncInst(ModelAction *act, FuncNode *func_node);
11         ~FuncInst();
12
13         //ModelAction * get_action() const { return action; }
14         const char * get_position() const { return position; }
15         void * get_location() const { return location; }
16         action_type get_type() const { return type; }
17         FuncNode * get_func_node() const { return func_node; }
18
19         bool add_pred(FuncInst * other);
20         bool add_succ(FuncInst * other);
21
22         FuncInst * search_in_collision(ModelAction *act);
23
24         func_inst_list_mt * get_collisions() { return &collisions; }
25         func_inst_list_mt * get_preds() { return &predecessors; }
26         func_inst_list_mt * get_succs() { return &successors; }
27
28         bool is_read() const;
29
30         MEMALLOC
31 private:
32         //ModelAction * const action;
33         const char * position;
34         void * location;
35         action_type type;
36         FuncNode * func_node;
37
38         /* collisions store a list of FuncInsts with the same position
39          * but different action types. For example, CAS is broken down
40          * as three different atomic operations in cmodelint.cc */
41         func_inst_list_mt collisions;
42
43         func_inst_list_mt predecessors;
44         func_inst_list_mt successors;
45 };