[llvm-commits] CVS: llvm/tools/analyze/AnalysisWrappers.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Dec 22 11:26:18 PST 2005



Changes in directory llvm/tools/analyze:

AnalysisWrappers.cpp updated: 1.16 -> 1.17
---
Log message:

Fix test/Regression/Other/2002-01-31-CallGraph.ll after the recent callgraph
rework.


---
Diffs of the changes:  (+17 -3)

 AnalysisWrappers.cpp |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)


Index: llvm/tools/analyze/AnalysisWrappers.cpp
diff -u llvm/tools/analyze/AnalysisWrappers.cpp:1.16 llvm/tools/analyze/AnalysisWrappers.cpp:1.17
--- llvm/tools/analyze/AnalysisWrappers.cpp:1.16	Thu Apr 21 18:59:21 2005
+++ llvm/tools/analyze/AnalysisWrappers.cpp	Thu Dec 22 13:26:06 2005
@@ -20,6 +20,7 @@
 #include "llvm/Module.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CallSite.h"
+#include "llvm/Analysis/CallGraph.h"
 #include <iostream>
 using namespace llvm;
 
@@ -55,13 +56,26 @@
       return false;
     }
 
-    void print(std::ostream &OS) const {}
-
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
     }
   };
 
   RegisterAnalysis<ExternalFunctionsPassedConstants>
-  P2("externalfnconstants", "Print external fn callsites passed constants");
+  P1("externalfnconstants", "Print external fn callsites passed constants");
+  
+  struct CallGraphPrinter : public ModulePass {
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.setPreservesAll();
+      AU.addRequired<CallGraph>();
+    }
+    virtual bool runOnModule(Module &M) { return false; }
+
+    void print(std::ostream &OS, Module *M) const {
+      getAnalysis<CallGraph>().print(OS, M);
+    }
+  };
+  
+  RegisterAnalysis<CallGraphPrinter>
+    P2("callgraph", "Print a call graph");
 }






More information about the llvm-commits mailing list