[llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp

Chris Lattner sabre at nondot.org
Fri Dec 1 14:21:28 PST 2006



Changes in directory llvm/lib/VMCore:

Pass.cpp updated: 1.72 -> 1.73
---
Log message:

move 'cfgonly' pass tracking into PassInfo, instead of handling it with
yet-another global data structure.


---
Diffs of the changes:  (+26 -37)

 Pass.cpp |   63 ++++++++++++++++++++++++++-------------------------------------
 1 files changed, 26 insertions(+), 37 deletions(-)


Index: llvm/lib/VMCore/Pass.cpp
diff -u llvm/lib/VMCore/Pass.cpp:1.72 llvm/lib/VMCore/Pass.cpp:1.73
--- llvm/lib/VMCore/Pass.cpp:1.72	Sun Sep  3 23:07:39 2006
+++ llvm/lib/VMCore/Pass.cpp	Fri Dec  1 16:21:11 2006
@@ -24,21 +24,6 @@
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
-//   AnalysisID Class Implementation
-//
-
-// getCFGOnlyAnalyses - A wrapper around the CFGOnlyAnalyses which make it
-// initializer order independent.
-static std::vector<const PassInfo*> &getCFGOnlyAnalyses() {
-  static std::vector<const PassInfo*> CFGOnlyAnalyses;
-  return CFGOnlyAnalyses;
-}
-
-void RegisterPassBase::setOnlyUsesCFG() {
-  getCFGOnlyAnalyses().push_back(&PIObj);
-}
-
-//===----------------------------------------------------------------------===//
 //   AnalysisResolver Class Implementation
 //
 
@@ -50,28 +35,6 @@
 }
 
 //===----------------------------------------------------------------------===//
-//   AnalysisUsage Class Implementation
-//
-
-// setPreservesCFG - This function should be called to by the pass, iff they do
-// not:
-//
-//  1. Add or remove basic blocks from the function
-//  2. Modify terminator instructions in any way.
-//
-// This function annotates the AnalysisUsage info object to say that analyses
-// that only depend on the CFG are preserved by this pass.
-//
-void AnalysisUsage::setPreservesCFG() {
-  // Since this transformation doesn't modify the CFG, it preserves all analyses
-  // that only depend on the CFG (like dominators, loop info, etc...)
-  //
-  Preserved.insert(Preserved.end(),
-                   getCFGOnlyAnalyses().begin(), getCFGOnlyAnalyses().end());
-}
-
-
-//===----------------------------------------------------------------------===//
 // PassManager implementation - The PassManager class is a simple Pimpl class
 // that wraps the PassManagerT template.
 //
@@ -500,3 +463,29 @@
       passEnumerate(I->second);
 }
 
+//===----------------------------------------------------------------------===//
+//   AnalysisUsage Class Implementation
+//
+
+// setPreservesCFG - This function should be called to by the pass, iff they do
+// not:
+//
+//  1. Add or remove basic blocks from the function
+//  2. Modify terminator instructions in any way.
+//
+// This function annotates the AnalysisUsage info object to say that analyses
+// that only depend on the CFG are preserved by this pass.
+//
+void AnalysisUsage::setPreservesCFG() {
+  // Since this transformation doesn't modify the CFG, it preserves all analyses
+  // that only depend on the CFG (like dominators, loop info, etc...)
+  //
+  if (PassInfoMap) {
+    for (std::map<TypeInfo, PassInfo*>::iterator I = PassInfoMap->begin(),
+             E = PassInfoMap->end(); I != E; ++I)
+      if (I->second->isCFGOnlyPass())
+        Preserved.push_back(I->second);
+  }
+}
+
+






More information about the llvm-commits mailing list