diff options
author | Chris Lattner <sabre@nondot.org> | 2005-12-22 19:26:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-12-22 19:26:06 +0000 |
commit | 171eee54717a22f439b06a4e07b361fcd983af1f (patch) | |
tree | 13eadeae5cab28704112353c920a338933632515 /tools | |
parent | 39706e68a5a645d85d0f24c2e43d67cb6024829d (diff) | |
download | external_llvm-171eee54717a22f439b06a4e07b361fcd983af1f.zip external_llvm-171eee54717a22f439b06a4e07b361fcd983af1f.tar.gz external_llvm-171eee54717a22f439b06a4e07b361fcd983af1f.tar.bz2 |
Fix test/Regression/Other/2002-01-31-CallGraph.ll after the recent callgraph
rework.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/analyze/AnalysisWrappers.cpp | 20 | ||||
-rw-r--r-- | tools/opt/AnalysisWrappers.cpp | 20 |
2 files changed, 34 insertions, 6 deletions
diff --git a/tools/analyze/AnalysisWrappers.cpp b/tools/analyze/AnalysisWrappers.cpp index dcbd349..8e5c333 100644 --- a/tools/analyze/AnalysisWrappers.cpp +++ b/tools/analyze/AnalysisWrappers.cpp @@ -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 @@ namespace { 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"); } diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp index dcbd349..8e5c333 100644 --- a/tools/opt/AnalysisWrappers.cpp +++ b/tools/opt/AnalysisWrappers.cpp @@ -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 @@ namespace { 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"); } |