eb7bc7946cb7b6191d6dc2bbd660049332272be6
[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         FuncInst * get_or_add_action(ModelAction *act);
15
16         HashTable<const char *, FuncInst *, uintptr_t, 4, model_malloc, model_calloc, model_free> * getFuncInsts() { return &func_insts; }
17         func_inst_list_mt * get_inst_list() { return &inst_list; }
18
19         uint32_t get_func_id() { return func_id; }
20         const char * get_func_name() { return func_name; }
21         void set_func_id(uint32_t id) { func_id = id; }
22         void set_func_name(const char * name) { func_name = name; }
23
24         MEMALLOC
25 private:
26         uint32_t func_id;
27         const char * func_name;
28
29         /* Use source line number as the key of hashtable, to check if 
30          * atomic operation with this line number has been added or not
31          *
32          * To do: cds_atomic_compare_exchange contains three atomic operations
33          * that are feeded with the same source line number by llvm pass
34          */
35         HashTable<const char *, FuncInst *, uintptr_t, 4, model_malloc, model_calloc, model_free> func_insts;
36
37         /* list of all atomic instructions in this function */
38         func_inst_list_mt inst_list;
39
40         /* possible entry (atomic) instructions in this function */
41         func_inst_list_mt entry_insts;
42 };