[llvm-commits] CVS: llvm/include/llvm/Analysis/DSGraph.h DataStructure.h

Chris Lattner lattner at cs.uiuc.edu
Sat Nov 9 14:02:00 PST 2002


Changes in directory llvm/include/llvm/Analysis:

DSGraph.h updated: 1.32 -> 1.33
DataStructure.h updated: 1.53 -> 1.54

---
Log message:

Add initial support for a globals graph 



---
Diffs of the changes:

Index: llvm/include/llvm/Analysis/DSGraph.h
diff -u llvm/include/llvm/Analysis/DSGraph.h:1.32 llvm/include/llvm/Analysis/DSGraph.h:1.33
--- llvm/include/llvm/Analysis/DSGraph.h:1.32	Fri Nov  8 16:28:55 2002
+++ llvm/include/llvm/Analysis/DSGraph.h	Sat Nov  9 14:01:01 2002
@@ -13,18 +13,13 @@
 /// DSGraph - The graph that represents a function.
 ///
 class DSGraph {
-  Function *Func;
+  Function *Func;          // Func - The LLVM function this graph corresponds to
+  DSGraph *GlobalsGraph;   // Pointer to the common graph of global objects
+
+  DSNodeHandle RetNode;    // The node that gets returned...
   std::vector<DSNode*> Nodes;
-  DSNodeHandle RetNode;                          // Node that gets returned...
   std::map<Value*, DSNodeHandle> ScalarMap;
 
-#if 0
-  // GlobalsGraph -- Reference to the common graph of globally visible objects.
-  // This includes GlobalValues, New nodes, Cast nodes, and Calls.
-  // 
-  GlobalDSGraph* GlobalsGraph;
-#endif
-
   // FunctionCalls - This vector maintains a single entry for each call
   // instruction in the current graph.  The first entry in the vector is the
   // scalar that holds the return value for the call, the second is the function
@@ -41,18 +36,26 @@
 
   void operator=(const DSGraph &); // DO NOT IMPLEMENT
 public:
-  DSGraph() : Func(0) {}           // Create a new, empty, DSGraph.
-  DSGraph(Function &F);            // Compute the local DSGraph
+  DSGraph() : Func(0), GlobalsGraph(0) {}      // Create a new, empty, DSGraph.
+  DSGraph(Function &F, DSGraph *GlobalsGraph); // Compute the local DSGraph
 
   // Copy ctor - If you want to capture the node mapping between the source and
   // destination graph, you may optionally do this by specifying a map to record
   // this into.
+  //
+  // Note that a copied graph does not retain the GlobalsGraph pointer of the
+  // source.  You need to set a new GlobalsGraph with the setGlobalsGraph
+  // method.
+  //
   DSGraph(const DSGraph &DSG);
   DSGraph(const DSGraph &DSG, std::map<const DSNode*, DSNodeHandle> &NodeMap);
   ~DSGraph();
 
   bool hasFunction() const { return Func != 0; }
   Function &getFunction() const { return *Func; }
+
+  DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
+  void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }
 
   /// getNodes - Get a vector of all the nodes in the graph
   /// 


Index: llvm/include/llvm/Analysis/DataStructure.h
diff -u llvm/include/llvm/Analysis/DataStructure.h:1.53 llvm/include/llvm/Analysis/DataStructure.h:1.54
--- llvm/include/llvm/Analysis/DataStructure.h:1.53	Sat Nov  9 13:24:41 2002
+++ llvm/include/llvm/Analysis/DataStructure.h	Sat Nov  9 14:01:01 2002
@@ -33,6 +33,7 @@
 class LocalDataStructures : public Pass {
   // DSInfo, one graph for each function
   std::map<const Function*, DSGraph*> DSInfo;
+  DSGraph *GlobalsGraph;
 public:
   ~LocalDataStructures() { releaseMemory(); }
 





More information about the llvm-commits mailing list