aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/LLVMTargetMachine.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-03-31 00:24:43 +0000
committerChris Lattner <sabre@nondot.org>2007-03-31 00:24:43 +0000
commit31442f9dc5512b6a29cdb332b12ae09a1c9e8176 (patch)
tree125e759a00324e24e2fac968235a9a2d816c8055 /lib/CodeGen/LLVMTargetMachine.cpp
parentc9addb74883fef318140272768422656a694341f (diff)
Add a -print-lsr-output option to LLC, to print the output of the LSR pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35522 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r--lib/CodeGen/LLVMTargetMachine.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp
index d7b27bd84d..641c04653a 100644
--- a/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/lib/CodeGen/LLVMTargetMachine.cpp
@@ -14,12 +14,16 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/PassManager.h"
#include "llvm/Pass.h"
+#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Transforms/Scalar.h"
+#include "llvm/Support/CommandLine.h"
using namespace llvm;
+static cl::opt<bool> PrintLSR("print-lsr-output");
+
FileModel::Model
LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
std::ostream &Out,
@@ -28,7 +32,11 @@ LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
// Standard LLVM-Level Passes.
// Run loop strength reduction before anything else.
- if (!Fast) PM.add(createLoopStrengthReducePass(getTargetLowering()));
+ if (!Fast) {
+ PM.add(createLoopStrengthReducePass(getTargetLowering()));
+ if (PrintLSR)
+ PM.add(new PrintFunctionPass("\n\n*** Code after LSR *** \n", &cerr));
+ }
// FIXME: Implement efficient support for garbage collection intrinsics.
PM.add(createLowerGCPass());