ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
diagnostic.h
Go to the documentation of this file.
1 
2 #ifndef BDWY_DIAGNOSTIC_CHAIN_H
3 #define BDWY_DIAGNOSTIC_CHAIN_H
4 
5 #include "c_breeze.h"
6 #include "pointers.h"
7 #include "broadway.h"
8 
9 
14 class Diagnostic {
15 private:
16  typedef map<memoryDef*, memoryuse_set> def2uses;
17 
23  TREE map<Location*,def2uses> _def2uses;
24 
25 public:
27  Diagnostic(enumPropertyAnn *property) : _property(property) {}
28 
31  return v && _diagnostic_values.test(v->id());
32  }
33 
37  }
38 
40  inline bool contain_diagnostic_value(enumvalue_set values) const {
41  return (_diagnostic_values & values).any();
42  }
43 
45  inline void add_defuse(Location *loc, memoryDef *lhs, memoryUse *rhs) {
46  if(loc && lhs && rhs) _def2uses[loc][lhs].insert(rhs);
47  }
48 
50  inline void reset(Location *loc) { _def2uses.erase(loc); }
51  inline void reset() { _def2uses.clear(); }
52 
55  void trace(ostream & out, Location *loc, pointerValue &pv);
56 
57 private:
60  typedef pair<Location*,memoryDef*> Location_pair;
61 
66  class Segment; // holds an ordered list of Location
67 
69  typedef list<Segment*> Segments;
70 
73 
76 
78  map<Location_pair,Segment*> segment_path;
79 
81  Segment *trace(Location *from, memoryDef *def);
82 
84  Segment *trace(Location *from, Location *to);
85 
86  int detect_cycle(Segment *cur, Segments & visited, bool specific=false);
87 
88  void find_shortest(Segment *cur, Segments path, Segments &shortest);
89 };
90 
91 #endif