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