ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
adaptor_statistics.h
Go to the documentation of this file.
1 #ifndef BDWY_ADAPTOR_STATISTICS_H
2 #define BDWY_ADAPTOR_STATISTICS_H
3 
4 #include "broadway.h"
5 
7 
8  typedef enum { Complicit = 0x1,
9  Control_flow = 0x2,
11  Weak_update = 0x8,
12  Additive = 0x10 } ReasonKind;
13 
14  typedef pair<procedureInfo*,memoryBlock*> CS_Block;
15  typedef map<procedureInfo*,ReasonKind> CS_Reasons;
16  typedef map<CS_Block,ReasonKind> CS_Block_Reasons;
17  typedef map<memoryBlock*,ReasonKind> FS_Reasons;
18 
19  typedef set<Location*> Locations;
20  typedef map<memoryBlock*,Locations> Destructions;
21 
22  typedef pair<Location*,memoryBlock*> Complicit_assign;
23  typedef set<Complicit_assign> Complicit_assigns;
24  typedef map<memoryBlock*,Complicit_assigns> Complicits;
25 
26  typedef map<procedureInfo*,memoryblock_set> CS_blocks;
27 
28  typedef map<memoryBlock*,basicblockNode*> CF_Sites;
29 
30  // FS
31  memoryblock_set fs_blocks;
35 
36  // CS
37  procedureinfo_set cs_procs;
43 
44  typedef pair<int,int> int_pair;
45  typedef set<unsigned long> enumvalue_sets;
46  typedef map<int_pair, enumvalue_sets> Arg_Property;
47  typedef map<stmtLocation*,Arg_Property> Site_Property;
48  typedef map<procedureInfo*,Site_Property> Proc_Site_Property;
49  typedef set<stmtLocation*> stmtLocations;
50  typedef pair<int_pair, enumvalue_sets> Arg_Property_Pair;
51  typedef map<Arg_Property_Pair,stmtLocations> Site_Partition;
52 
54 
55  // control-flow
56  memoryblock_set cf_blocks;
58 
59  //REF
61  Analyzer *_analyzer;
62 
63 public:
64  Adaptor_Statistics(Annotations *ann, Analyzer *analyzer)
65  : _ann(ann), _analyzer(analyzer) {}
66 
67  void make_CS(memoryBlock *block, procedureInfo *proc,
68  Location *site,
69  memoryBlock::DestructiveKind reason);
70 
71  void make_CS(memoryBlock *block, procedureInfo *proc,
72  Location *site,
73  memoryBlock *complicit);
74 
75  void print_statistics(ostream & out);
76 
77  // void reset();
78 
79 private:
80  void print_cs_statistics(ostream & out);
81  void print_fs_statistics(ostream & out);
82  void print_cf_statistics(ostream & out);
83  void print_unify_statistics(ostream & out);
84 
85  void print_block_chain(memoryBlock *block, Destructions & destructions,
86  Complicits & complicits,
87  memoryblock_set & printed,
88  string indent, string block_indent,
89  ostream & out);
90 
91  void print_call_args(stmtLocation *site, procedureInfo *caller,
92  procedureInfo *callee, int arg, declNode *formal,
93  ostream & out);
94  void print_call_arg(declNode *formal, int arg, operandNode *parameter,
95  int dereference, pointerValue & parameter_value,
96  stmtLocation *site, procedureInfo *caller,
97  procedureInfo *callee, const enum_property_map & props,
98  ostream & out);
99 
100  string reason_str(ReasonKind);
101 };
102 
103 #endif