aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lli
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-05-04 23:05:19 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-05-04 23:05:19 +0000
commitb244f3f01882914b6dc75ef0704719e5ee71574f (patch)
tree019bd7b1cde78e95910b61c87ae3e6eb69cf9d0d /tools/lli
parent099109d30e69192a4f1adabdc049891bbb26fd3a (diff)
downloadexternal_llvm-b244f3f01882914b6dc75ef0704719e5ee71574f.zip
external_llvm-b244f3f01882914b6dc75ef0704719e5ee71574f.tar.gz
external_llvm-b244f3f01882914b6dc75ef0704719e5ee71574f.tar.bz2
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
Diffstat (limited to 'tools/lli')
-rw-r--r--tools/lli/lli.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index 812e52c..6d3cbbc 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<bool> Fast("fast",
- cl::desc("Generate code quickly, "
- "potentially sacrificing code quality"),
- cl::init(false));
+ // Determine optimization level.
+ cl::opt<char>
+ OptLevel("O",
+ cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
+ "(default = '-O2')"),
+ cl::Prefix,
+ cl::ZeroOrMore,
+ cl::init(' '));
cl::opt<std::string>
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);