[cfe-commits] r70451 - /cfe/trunk/tools/clang-cc/Backend.cpp
Bill Wendling
isanbard at gmail.com
Wed Apr 29 16:53:29 PDT 2009
Author: void
Date: Wed Apr 29 18:53:23 2009
New Revision: 70451
URL: http://llvm.org/viewvc/llvm-project?rev=70451&view=rev
Log:
Use the new code gen optimization enum instead of passing in the optimization
level. This is more expressive.
Modified:
cfe/trunk/tools/clang-cc/Backend.cpp
Modified: cfe/trunk/tools/clang-cc/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/Backend.cpp?rev=70451&r1=70450&r2=70451&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/Backend.cpp (original)
+++ cfe/trunk/tools/clang-cc/Backend.cpp Wed Apr 29 18:53:23 2009
@@ -256,12 +256,20 @@
// FIXME: This is disabled right now until bugs can be worked out. Reenable
// this for fast -O0 compiles!
FunctionPassManager *PM = getCodeGenPasses();
-
+ CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+
+ switch (CompileOpts.OptimizationLevel) {
+ default: break;
+ case 0: OptLevel = CodeGenOpt::None; break;
+ case 1: OptLevel = CodeGenOpt::One; break;
+ case 2: OptLevel = CodeGenOpt::Two; break;
+ case 3: OptLevel = CodeGenOpt::Aggressive; break;
+ }
+
// Normal mode, emit a .s file by running the code generator.
// Note, this also adds codegenerator level optimization passes.
switch (TM->addPassesToEmitFile(*PM, *AsmOutStream,
- TargetMachine::AssemblyFile,
- CompileOpts.OptimizationLevel)) {
+ TargetMachine::AssemblyFile, OptLevel)) {
default:
case FileModel::Error:
Error = "Unable to interface with target machine!\n";
@@ -270,8 +278,7 @@
break;
}
- if (TM->addPassesToEmitFileFinish(*CodeGenPasses, 0,
- CompileOpts.OptimizationLevel)) {
+ if (TM->addPassesToEmitFileFinish(*CodeGenPasses, 0, OptLevel)) {
Error = "Unable to interface with target machine!\n";
return false;
}
More information about the cfe-commits
mailing list