ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
placeUIDs.h
Go to the documentation of this file.
1 #ifndef PLACE_UIDS_H
2 #define PLACE_UIDS_H
3 
5 #include "VirtualCFGIterator.h"
6 #include "cfgUtils.h"
7 #include "CallGraphTraverse.h"
8 #include "analysisCommon.h"
9 #include "analysis.h"
10 #include "dataflow.h"
11 #include "latticeFull.h"
12 #include "printAnalysisStates.h"
13 
14 extern int sgnAnalysisDebugLevel;
15 
16 /* Assigns a unique numeric ID to each DataflowNode. IDs are unique only within each function and
17  may be repeated across functions. */
18 
19 class NodeID: public NodeFact
20 {
21  int id;
22  public:
23 
24  NodeID(int id): id(id) {}
25 
26  int getID();
27 
28  // The string that represents this object.
29  // Every line of this string must be prefixed by indent.
30  // The last character of the returned string must not be '\n', even if it is a multi-line string.
31  std::string str(std::string indent="");
32 
33  // returns a copy of this node fact
34  NodeFact* copy() const;
35 };
36 
38 {
39  int curID;
40  public:
42  {
43  curID = 0;
44  }
45 
46  void visit(const Function& func, const DataflowNode& n, NodeState& state);
47 };
48 
49 // Runs the placeUniqueIDs analysis to associate a unique ID with each DataflowNode within each function
50 void runPlaceUniqueIDs();
51 
52 // Returns the Unique ID recorded in the given NodeState
53 int getNodeID(const NodeState& state);
54 
55 #endif