aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/TargetMachine.cpp
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-09-20 00:52:43 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-09-20 00:52:43 +0000
commite5b2565a02efc2f44d1b5e07438e46974d4b24c1 (patch)
treeb7c7c11f1cd742368c40d26809ad24129404dd68 /lib/Target/TargetMachine.cpp
parentd55697cf136150b697b9bbddce9088e87a1be963 (diff)
Add peephole optimization pass at the end of code generation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3846 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetMachine.cpp')
-rw-r--r--lib/Target/TargetMachine.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp
index 84149f8934..8d9a832d28 100644
--- a/lib/Target/TargetMachine.cpp
+++ b/lib/Target/TargetMachine.cpp
@@ -12,6 +12,7 @@
#include "llvm/CodeGen/InstrSelection.h"
#include "llvm/CodeGen/InstrScheduling.h"
#include "llvm/CodeGen/RegisterAllocation.h"
+#include "llvm/CodeGen/PeepholeOpts.h"
#include "llvm/CodeGen/MachineCodeForMethod.h"
#include "llvm/CodeGen/MachineCodeForInstruction.h"
#include "llvm/Reoptimizer/Mapping/MappingInfo.h"
@@ -32,6 +33,9 @@ static cl::opt<bool> DisablePreSelect("nopreselect",
static cl::opt<bool> DisableSched("nosched",
cl::desc("Disable local scheduling pass"));
+static cl::opt<bool> DisablePeephole("nopeephole",
+ cl::desc("Disable peephole optimization pass"));
+
//---------------------------------------------------------------------------
// class TargetMachine
//
@@ -132,13 +136,11 @@ TargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)
PM.add(getRegisterAllocator(*this));
- //PM.add(new OptimizeLeafProcedures());
- //PM.add(new DeleteFallThroughBranches());
- //PM.add(new RemoveChainedBranches()); // should be folded with previous
- //PM.add(new RemoveRedundantOps()); // operations with %g0, NOP, etc.
-
PM.add(getPrologEpilogInsertionPass());
+ if (!DisablePeephole)
+ PM.add(createPeepholeOptsPass(*this));
+
PM.add(MappingInfoForFunction(Out));
// Output assembly language to the .s file. Assembly emission is split into