ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
defsAndUsesTraversal.h
Go to the documentation of this file.
1 #pragma once
2 #include "rose.h"
4 
5 namespace ssa_private
6 {
7 
9  class ChildUses
10  {
11  private:
14 
16  std::vector<SgNode*> uses;
17 
18  public:
19 
22  {
23  }
24 
25  ChildUses(SgNode* useNode, SgVarRefExp* var)
26  {
27  uses.push_back(useNode);
28  currentVar = var;
29  }
30 
35  ChildUses(const std::vector<SgNode*>& useTree, SgVarRefExp* var = NULL)
36  {
37  if (useTree.size() > 0)
38  uses.assign(useTree.begin(), useTree.end());
39  currentVar = var;
40  }
41 
46  std::vector<SgNode*>& getUses()
47  {
48  return uses;
49  }
50 
55  void setUses(const std::vector<SgNode*>& newUses)
56  {
57  uses.assign(newUses.begin(), newUses.end());
58  }
59 
61  {
62  return currentVar;
63  }
64  };
65 
69  class DefsAndUsesTraversal : public AstBottomUpProcessing<ChildUses>
70  {
72 
76 
77  public:
78 
83  {
84  }
85 
95 
96  private:
97 
99  void addUsesToNode(SgNode* node, std::vector<SgNode*> uses);
100 
102  void addDefForVarAtNode(SgVarRefExp* currentVar, SgNode* defNode);
103  };
104 
105 } //namespace ssa_private
106