diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2014-01-12 12:15:39 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2014-01-12 12:15:39 +0000 |
commit | a59525786d39de4af8d7ee65531c220348ec48b6 (patch) | |
tree | c31cf0ba4e85bc2dd06c56b8687489dd24a17750 /tools/opt/Passes.cpp | |
parent | 895ada05e91c427afc8c19d1c4267434325948f6 (diff) | |
download | llvm-a59525786d39de4af8d7ee65531c220348ec48b6.tar.gz llvm-a59525786d39de4af8d7ee65531c220348ec48b6.tar.bz2 llvm-a59525786d39de4af8d7ee65531c220348ec48b6.tar.xz |
[PM] Add module and function printing passes for the new pass manager.
This implements the legacy passes in terms of the new ones. It adds
basic testing using explicit runs of the passes. Next up will be wiring
the basic output mechanism of opt up when the new pass manager is
engaged unless bitcode writing is requested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt/Passes.cpp')
-rw-r--r-- | tools/opt/Passes.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/opt/Passes.cpp b/tools/opt/Passes.cpp index 29be9dee94..e79ac422eb 100644 --- a/tools/opt/Passes.cpp +++ b/tools/opt/Passes.cpp @@ -15,7 +15,9 @@ //===----------------------------------------------------------------------===// #include "Passes.h" +#include "llvm/IR/IRPrintingPasses.h" #include "llvm/IR/PassManager.h" +#include "llvm/Support/Debug.h" using namespace llvm; @@ -39,12 +41,14 @@ struct NoOpFunctionPass { // under different macros. static bool isModulePassName(StringRef Name) { if (Name == "no-op-module") return true; + if (Name == "print") return true; return false; } static bool isFunctionPassName(StringRef Name) { if (Name == "no-op-function") return true; + if (Name == "print") return true; return false; } @@ -54,6 +58,10 @@ static bool parseModulePassName(ModulePassManager &MPM, StringRef Name) { MPM.addPass(NoOpModulePass()); return true; } + if (Name == "print") { + MPM.addPass(PrintModulePass(dbgs())); + return true; + } return false; } @@ -62,6 +70,10 @@ static bool parseFunctionPassName(FunctionPassManager &FPM, StringRef Name) { FPM.addPass(NoOpFunctionPass()); return true; } + if (Name == "print") { + FPM.addPass(PrintFunctionPass(dbgs())); + return true; + } return false; } |