From 712e80e188c306125e32e46e9ed5db9dfc2f7cc9 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Mon, 4 May 2009 23:05:19 +0000 Subject: [PATCH] Default llc / lli optimization to "Default", which corresponds to -O1 / -O2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70934 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llc/llc.cpp | 8 ++++---- tools/lli/lli.cpp | 28 +++++++++++++++++++++------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index e5560dad059..4808f0e529c 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -55,10 +55,11 @@ OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename")); static cl::opt Force("f", cl::desc("Overwrite output files")); -// Determine optimization level. Level -O0 is equivalent to "fast" code gen. +// Determine optimization level. static cl::opt OptLevel("O", - cl::desc("Optimization level. [-O0, -O1, -O2, or -O3]"), + cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] " + "(default = '-O2')"), cl::Prefix, cl::ZeroOrMore, cl::init(' ')); @@ -253,8 +254,7 @@ int main(int argc, char **argv) { raw_ostream *Out = GetOutputStream(argv[0]); if (Out == 0) return 1; - CodeGenOpt::Level OLvl = CodeGenOpt::Aggressive; - + CodeGenOpt::Level OLvl = CodeGenOpt::Default; switch (OptLevel) { default: std::cerr << argv[0] << ": invalid optimization level.\n"; diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 812e52c8a96..6d3cbbc1f5f 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -43,10 +43,14 @@ namespace { cl::desc("Force interpretation: disable JIT"), cl::init(false)); - cl::opt Fast("fast", - cl::desc("Generate code quickly, " - "potentially sacrificing code quality"), - cl::init(false)); + // Determine optimization level. + cl::opt + OptLevel("O", + cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] " + "(default = '-O2')"), + cl::Prefix, + cl::ZeroOrMore, + cl::init(' ')); cl::opt TargetTriple("mtriple", cl::desc("Override target triple for module")); @@ -122,9 +126,19 @@ int main(int argc, char **argv, char * const *envp) { if (!TargetTriple.empty()) Mod->setTargetTriple(TargetTriple); - EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg, - Fast ? - CodeGenOpt::None : CodeGenOpt::Aggressive); + CodeGenOpt::Level OLvl = CodeGenOpt::Default; + switch (OptLevel) { + default: + std::cerr << argv[0] << ": invalid optimization level.\n"; + return 1; + case ' ': break; + case '0': OLvl = CodeGenOpt::None; break; + case '1': + case '2': OLvl = CodeGenOpt::Default; break; + case '3': OLvl = CodeGenOpt::Aggressive; break; + } + + EE = ExecutionEngine::create(MP, ForceInterpreter, &ErrorMsg, OLvl); if (!EE && !ErrorMsg.empty()) { std::cerr << argv[0] << ":error creating EE: " << ErrorMsg << "\n"; exit(1); -- 2.11.0