summaryrefslogtreecommitdiffstats
path: root/llvm/tools/opt/Passes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/opt/Passes.cpp')
-rw-r--r--llvm/tools/opt/Passes.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/tools/opt/Passes.cpp b/llvm/tools/opt/Passes.cpp
index 29be9dee94e..e79ac422eb2 100644
--- a/llvm/tools/opt/Passes.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud