add entry atomic instructions to FuncNode
[c11tester.git] / funcnode.h
1 #include "action.h"
2 #include "funcinst.h"
3 #include "hashtable.h"
4
5 class ModelAction;
6
7 typedef ModelList<FuncInst *> func_inst_list_mt;
8
9 class FuncNode {
10 public:
11         FuncNode();
12         ~FuncNode();
13
14         uint32_t get_func_id() { return func_id; }
15         const char * get_func_name() { return func_name; }
16         void set_func_id(uint32_t id) { func_id = id; }
17         void set_func_name(const char * name) { func_name = name; }
18
19         FuncInst * get_or_add_action(ModelAction *act);
20
21         HashTable<const char *, FuncInst *, uintptr_t, 4, model_malloc, model_calloc, model_free> * getFuncInsts() { return &func_insts; }
22         func_inst_list_mt * get_inst_list() { return &inst_list; }
23         func_inst_list_mt * get_entry_insts() { return &entry_insts; }
24         void add_entry_inst(FuncInst * inst);
25
26         MEMALLOC
27 private:
28         uint32_t func_id;
29         const char * func_name;
30
31         /* Use source line number as the key of hashtable, to check if 
32          * atomic operation with this line number has been added or not
33          *
34          * To do: cds_atomic_compare_exchange contains three atomic operations
35          * that are feeded with the same source line number by llvm pass
36          */
37         HashTable<const char *, FuncInst *, uintptr_t, 4, model_malloc, model_calloc, model_free> func_insts;
38
39         /* list of all atomic instructions in this function */
40         func_inst_list_mt inst_list;
41
42         /* possible entry atomic instructions in this function */
43         func_inst_list_mt entry_insts;
44 };