aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-12-14 16:50:35 +0000
committerChris Lattner <sabre@nondot.org>2001-12-14 16:50:35 +0000
commit528e8b58a52c6f5b6a2a694059679c04a49111c9 (patch)
tree8046c3178bbeb74bd051d8664cb3e968e785fda3 /tools
parentf23eb85de8c19eeb0b1b274c19b2b1f7dc5c80ff (diff)
downloadexternal_llvm-528e8b58a52c6f5b6a2a694059679c04a49111c9.zip
external_llvm-528e8b58a52c6f5b6a2a694059679c04a49111c9.tar.gz
external_llvm-528e8b58a52c6f5b6a2a694059679c04a49111c9.tar.bz2
Add instruction combining pass
Rename -mergecons to -constmerge git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1478 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/opt/opt.cpp65
1 files changed, 34 insertions, 31 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index c183dec..9dfb51a 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -18,19 +18,20 @@
#include "llvm/Transforms/SwapStructContents.h"
#include "llvm/Transforms/IPO/GlobalDCE.h"
#include "llvm/Transforms/Scalar/IndVarSimplify.h"
+#include "llvm/Transforms/Scalar/InstructionCombining.h"
#include "Support/CommandLine.h"
#include <fstream>
#include <memory>
enum Opts {
// Basic optimizations
- dce, constprop, inlining, mergecons, strip, mstrip,
+ dce, constprop, inlining, constmerge, strip, mstrip,
// Miscellaneous Transformations
trace, tracem, print, cleangcc,
// More powerful optimizations
- indvars, sccp, adce, raise,
+ indvars, instcombine, sccp, adce, raise,
// Interprocedural optimizations...
globaldce, swapstructs,
@@ -41,20 +42,21 @@ struct {
Pass *ThePass;
} OptTable[] = {
{ swapstructs, 0 },
- { dce , new opt::DeadCodeElimination() },
- { constprop, new opt::ConstantPropogation() },
- { inlining , new opt::MethodInlining() },
- { mergecons, new ConstantMerge() },
- { strip , new opt::SymbolStripping() },
- { mstrip , new opt::FullSymbolStripping() },
- { indvars , new InductionVariableSimplify() },
- { sccp , new opt::SCCPPass() },
- { adce , new opt::AgressiveDCE() },
- { raise , new RaisePointerReferences() },
- { trace , new InsertTraceCode(true, true) },
- { tracem , new InsertTraceCode(false, true) },
- { print , new PrintModulePass("Current Method: \n",&cerr) },
- { cleangcc , new CleanupGCCOutput() },
+ { dce , new opt::DeadCodeElimination() },
+ { constprop , new opt::ConstantPropogation() },
+ { inlining , new opt::MethodInlining() },
+ { constmerge , new ConstantMerge() },
+ { strip , new opt::SymbolStripping() },
+ { mstrip , new opt::FullSymbolStripping() },
+ { indvars , new InductionVariableSimplify() },
+ { instcombine, new InstructionCombining() },
+ { sccp , new opt::SCCPPass() },
+ { adce , new opt::AgressiveDCE() },
+ { raise , new RaisePointerReferences() },
+ { trace , new InsertTraceCode(true, true) },
+ { tracem , new InsertTraceCode(false, true) },
+ { print , new PrintModulePass("Current Method: \n",&cerr) },
+ { cleangcc , new CleanupGCCOutput() },
};
cl::String InputFilename ("", "Load <arg> file to optimize", cl::NoFlags, "-");
@@ -63,24 +65,25 @@ cl::Flag Force ("f", "Overwrite output files", cl::NoFlags, false);
cl::Flag Quiet ("q", "Don't print modifying pass names", 0, false);
cl::Alias QuietA ("quiet", "Alias for -q", cl::NoFlags, Quiet);
cl::EnumList<enum Opts> OptimizationList(cl::NoFlags,
- clEnumVal(dce , "Dead Code Elimination"),
- clEnumVal(constprop, "Simple Constant Propogation"),
- clEnumValN(inlining , "inline", "Method Integration"),
- clEnumVal(mergecons, "Merge identical global constants"),
- clEnumVal(strip , "Strip Symbols"),
- clEnumVal(mstrip , "Strip Module Symbols"),
- clEnumVal(indvars , "Simplify Induction Variables"),
- clEnumVal(sccp , "Sparse Conditional Constant Propogation"),
- clEnumVal(adce , "Agressive DCE"),
+ clEnumVal(dce , "Dead Code Elimination"),
+ clEnumVal(constprop , "Simple Constant Propogation"),
+ clEnumValN(inlining , "inline", "Method Integration"),
+ clEnumVal(constmerge , "Merge identical global constants"),
+ clEnumVal(strip , "Strip Symbols"),
+ clEnumVal(mstrip , "Strip Module Symbols"),
+ clEnumVal(indvars , "Simplify Induction Variables"),
+ clEnumVal(instcombine, "Simplify Induction Variables"),
+ clEnumVal(sccp , "Sparse Conditional Constant Propogation"),
+ clEnumVal(adce , "Agressive DCE"),
- clEnumVal(globaldce, "Remove unreachable globals"),
+ clEnumVal(globaldce , "Remove unreachable globals"),
clEnumVal(swapstructs, "Swap structure types around"),
- clEnumVal(cleangcc , "Cleanup GCC Output"),
- clEnumVal(raise , "Raise to Higher Level"),
- clEnumVal(trace , "Insert BB & Method trace code"),
- clEnumVal(tracem , "Insert Method trace code only"),
- clEnumVal(print , "Print working method to stderr"),
+ clEnumVal(cleangcc , "Cleanup GCC Output"),
+ clEnumVal(raise , "Raise to Higher Level"),
+ clEnumVal(trace , "Insert BB & Method trace code"),
+ clEnumVal(tracem , "Insert Method trace code only"),
+ clEnumVal(print , "Print working method to stderr"),
0);
static void RunOptimization(Module *M, enum Opts Opt) {