diff options
author | Chris Lattner <sabre@nondot.org> | 2002-07-29 23:02:25 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-07-29 23:02:25 +0000 |
commit | 1ad4436cc249e7b426085a97fbc94dc23efb6600 (patch) | |
tree | b2d5defc218310c355b86f7467946f33e33a7b7b /tools | |
parent | 0b0554596ea445c93bcea02cb5533f43553424ee (diff) | |
download | external_llvm-1ad4436cc249e7b426085a97fbc94dc23efb6600.zip external_llvm-1ad4436cc249e7b426085a97fbc94dc23efb6600.tar.gz external_llvm-1ad4436cc249e7b426085a97fbc94dc23efb6600.tar.bz2 |
Use a module analysis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3133 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/analyze/analyze.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/analyze/analyze.cpp b/tools/analyze/analyze.cpp index cc3a478..79bcc4c 100644 --- a/tools/analyze/analyze.cpp +++ b/tools/analyze/analyze.cpp @@ -19,17 +19,22 @@ struct ModulePassPrinter : public Pass { - Pass *PassToPrint; - ModulePassPrinter(Pass *PI) : PassToPrint(PI) {} + const PassInfo *PassToPrint; + ModulePassPrinter(const PassInfo *PI) : PassToPrint(PI) {} virtual bool run(Module &M) { std::cout << "Printing Analysis info for Pass " << PassToPrint->getPassName() << ":\n"; - PassToPrint->print(std::cout, &M); + getAnalysis<Pass>(PassToPrint).print(std::cout, &M); // Get and print pass... return false; } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(PassToPrint); + AU.setPreservesAll(); + } }; struct FunctionPassPrinter : public FunctionPass { @@ -122,7 +127,7 @@ int main(int argc, char **argv) { else if (FunctionPass *FP = dynamic_cast<FunctionPass*>(P)) Passes.add(new FunctionPassPrinter(Analysis)); else - Passes.add(new ModulePassPrinter(P)); + Passes.add(new ModulePassPrinter(Analysis)); } else cerr << "Cannot create pass: " << Analysis->getPassName() << "\n"; |