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

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 12 19:43:01 PST 2003


Changes in directory llvm/include/llvm/Analysis:

DataStructure.h updated: 1.75 -> 1.76

---
Log message:

Add an initial version of the CompleteBUDataStructures pass


---
Diffs of the changes:  (+34 -0)

Index: llvm/include/llvm/Analysis/DataStructure.h
diff -u llvm/include/llvm/Analysis/DataStructure.h:1.75 llvm/include/llvm/Analysis/DataStructure.h:1.76
--- llvm/include/llvm/Analysis/DataStructure.h:1.75	Tue Nov 11 16:41:31 2003
+++ llvm/include/llvm/Analysis/DataStructure.h	Wed Nov 12 19:42:38 2003
@@ -82,6 +82,7 @@
 // only performs a "Bottom Up" propagation (hence the name).
 //
 class BUDataStructures : public Pass {
+protected:
   // DSInfo, one graph for each function
   hash_map<Function*, DSGraph*> DSInfo;
   DSGraph *GlobalsGraph;
@@ -185,6 +186,39 @@
                         std::vector<DSGraph*> &PostOrder,
                         const BUDataStructures::ActualCalleesTy &ActualCallees);
 };
+
+
+// CompleteBUDataStructures - This is the exact same as the bottom-up graphs,
+// but we use take a completed call graph and inline all indirect callees into
+// their callers graphs, making the result more useful for things like pool
+// allocation.
+//
+struct CompleteBUDataStructures : public BUDataStructures {
+  virtual bool run(Module &M);
+
+  bool hasGraph(const Function &F) const {
+    return DSInfo.find(const_cast<Function*>(&F)) != DSInfo.end();
+  }
+
+  // getDSGraph - Return the data structure graph for the specified function.
+  DSGraph &getDSGraph(const Function &F) const {
+    hash_map<Function*, DSGraph*>::const_iterator I =
+      DSInfo.find(const_cast<Function*>(&F));
+    assert(I != DSInfo.end() && "Function not in module!");
+    return *I->second;
+  }
+
+  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+    AU.setPreservesAll();
+    AU.addRequired<BUDataStructures>();
+
+    // FIXME: TEMPORARY (remove once finalization of indirect call sites in the
+    // globals graph has been implemented in the BU pass)
+    AU.addRequired<TDDataStructures>();
+  }
+};
+
+
 
 } // End llvm namespace
 





More information about the llvm-commits mailing list