name variables
[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> * getFuncInstMap() { return &func_inst_map; }
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         void group_reads_by_loc(FuncInst * inst);
27
28         MEMALLOC
29 private:
30         uint32_t func_id;
31         const char * func_name;
32
33         /* Use source line number as the key of hashtable, to check if 
34          * atomic operation with this line number has been added or not
35          *
36          * To do: cds_atomic_compare_exchange contains three atomic operations
37          * that are feeded with the same source line number by llvm pass
38          */
39         HashTable<const char *, FuncInst *, uintptr_t, 4, model_malloc, model_calloc, model_free> func_inst_map;
40
41         /* list of all atomic actions in this function */
42         func_inst_list_mt inst_list;
43
44         /* possible entry atomic actions in this function */
45         func_inst_list_mt entry_insts;
46
47         /* group atomic read actions by memory location */
48         HashTable<void *, func_inst_list_mt *, uintptr_t, 4, model_malloc, model_calloc, model_free> reads_by_loc;
49 };