summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-10-18 01:31:43 +0000
committerChris Lattner <sabre@nondot.org>2001-10-18 01:31:43 +0000
commit5b6026a13acbca938fcc41bcf6fca6886ae6f312 (patch)
tree59bd3cc785c1a6a7197dd89cdfc85e78acfedf84 /llvm/tools
parent2fa0dabf9f8e744bff6849a4ac85a98cbf3e85d6 (diff)
downloadbcm5719-llvm-5b6026a13acbca938fcc41bcf6fca6886ae6f312.tar.gz
bcm5719-llvm-5b6026a13acbca938fcc41bcf6fca6886ae6f312.zip
* Passes return true if they change something, not if they fail
* Convert opt to use Pass's and convert optimizations to pass structure llvm-svn: 870
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/opt/opt.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index 973a78ff8d3..3d62ef8ebf5 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -39,17 +39,17 @@ enum Opts {
struct {
enum Opts OptID;
- bool (*OptPtr)(Module *C);
+ Pass *ThePass;
} OptTable[] = {
- { dce , DoDeadCodeElimination },
- { constprop, DoConstantPropogation },
- { inlining , DoMethodInlining },
- { strip , DoSymbolStripping },
- { mstrip , DoFullSymbolStripping },
- { indvars , DoInductionVariableCannonicalize },
- { sccp , DoSCCP },
- { adce , DoADCE },
- { raise , DoRaiseRepresentation },
+ { dce , new opt::DeadCodeElimination() },
+ { constprop, new opt::ConstantPropogation() },
+ { inlining , new opt::MethodInlining() },
+ { strip , new opt::SymbolStripping() },
+ { mstrip , new opt::FullSymbolStripping() },
+ { indvars , new opt::InductionVariableCannonicalize() },
+ { sccp , new opt::SCCPPass() },
+ { adce , new opt::AgressiveDCE() },
+ { raise , new opt::RaiseRepresentation() },
};
cl::String InputFilename ("", "Load <arg> file to optimize", cl::NoFlags, "-");
@@ -86,7 +86,7 @@ int main(int argc, char **argv) {
unsigned j;
for (j = 0; j < sizeof(OptTable)/sizeof(OptTable[0]); ++j) {
if (Opt == OptTable[j].OptID) {
- if (OptTable[j].OptPtr(C) && !Quiet)
+ if (OptTable[j].ThePass->run(C) && !Quiet)
cerr << OptimizationList.getArgName(Opt)
<< " pass made modifications!\n";
break;
OpenPOWER on IntegriCloud