summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/LLVMTargetMachine.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-03-31 04:18:03 +0000
committerChris Lattner <sabre@nondot.org>2007-03-31 04:18:03 +0000
commitc8d288f8fa9e46199a29e1954550c980f184bd1c (patch)
tree6020f49d3ce66f6ec843510c2122553d7ceae8a7 /lib/CodeGen/LLVMTargetMachine.cpp
parentdbe0deca339585dfbaed5951ef0ca2c6a0df173c (diff)
downloadexternal_llvm-c8d288f8fa9e46199a29e1954550c980f184bd1c.zip
external_llvm-c8d288f8fa9e46199a29e1954550c980f184bd1c.tar.gz
external_llvm-c8d288f8fa9e46199a29e1954550c980f184bd1c.tar.bz2
move a bunch of code out of the sdisel pass into its own opt pass "codegenprepare".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r--lib/CodeGen/LLVMTargetMachine.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp
index 641c046..34c45f3 100644
--- a/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/lib/CodeGen/LLVMTargetMachine.cpp
@@ -23,7 +23,7 @@
using namespace llvm;
static cl::opt<bool> PrintLSR("print-lsr-output");
-
+static cl::opt<bool> PrintISelInput("print-isel-input");
FileModel::Model
LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
std::ostream &Out,
@@ -48,6 +48,13 @@ LLVMTargetMachine::addPassesToEmitFile(FunctionPassManager &PM,
// Make sure that no unreachable blocks are instruction selected.
PM.add(createUnreachableBlockEliminationPass());
+ if (!Fast)
+ PM.add(createCodeGenPreparePass(getTargetLowering()));
+
+ if (PrintISelInput)
+ PM.add(new PrintFunctionPass("\n\n*** Final LLVM Code input to ISel *** \n",
+ &cerr));
+
// Ask the target for an isel.
if (addInstSelector(PM, Fast))
return FileModel::Error;
@@ -126,7 +133,11 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(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());
@@ -137,6 +148,13 @@ bool LLVMTargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM,
// Make sure that no unreachable blocks are instruction selected.
PM.add(createUnreachableBlockEliminationPass());
+ if (!Fast)
+ PM.add(createCodeGenPreparePass(getTargetLowering()));
+
+ if (PrintISelInput)
+ PM.add(new PrintFunctionPass("\n\n*** Final LLVM Code input to ISel *** \n",
+ &cerr));
+
// Ask the target for an isel.
if (addInstSelector(PM, Fast))
return true;