augment hashtable with keyset
[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         MEMALLOC
29 private:
30         //ModelAction * const action;
31         const char * position;
32         void * location;
33         action_type type;
34         FuncNode * func_node;
35
36         /* collisions store a list of FuncInsts with the same position
37          * but different action types. For example, CAS is broken down
38          * as three different atomic operations in cmodelint.cc */
39         func_inst_list_mt collisions;
40
41         func_inst_list_mt predecessors;
42         func_inst_list_mt successors;
43 };