[llvm-branch-commits] [llvm-gcc-branch] r70442 - /llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-backend.cpp
Bill Wendling
isanbard at gmail.com
Wed Apr 29 16:32:36 PDT 2009
Author: void
Date: Wed Apr 29 18:32:35 2009
New Revision: 70442
URL: http://llvm.org/viewvc/llvm-project?rev=70442&view=rev
Log:
Use enums instead of raw opt level.
Modified:
llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-backend.cpp?rev=70442&r1=70441&r2=70442&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/llvm-backend.cpp Wed Apr 29 18:32:35 2009
@@ -587,11 +587,21 @@
FunctionPassManager *PM = PerFunctionPasses;
HasPerFunctionPasses = true;
+ CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+
+ switch (optimize) {
+ default: break;
+ case 1: OptLevel = CodeGenOpt::One; break;
+ case 2: OptLevel = CodeGenOpt::Two; break;
+ case 3: OptLevel = CodeGenOpt::Aggressive; break;
+ case 4: OptLevel = CodeGenOpt::LTO; break;
+ }
+
// Normal mode, emit a .s file by running the code generator.
// Note, this also adds codegenerator level optimization passes.
switch (TheTarget->addPassesToEmitFile(*PM, *AsmOutRawStream,
TargetMachine::AssemblyFile,
- optimize)) {
+ OptLevel)) {
default:
case FileModel::Error:
cerr << "Error interfacing to target machine!\n";
@@ -600,7 +610,7 @@
break;
}
- if (TheTarget->addPassesToEmitFileFinish(*PM, 0, optimize)) {
+ if (TheTarget->addPassesToEmitFileFinish(*PM, 0, OptLevel)) {
cerr << "Error interfacing to target machine!\n";
exit(1);
}
@@ -733,11 +743,21 @@
new FunctionPassManager(new ExistingModuleProvider(TheModule));
PM->add(new TargetData(*TheTarget->getTargetData()));
+ CodeGenOpt::Level OptLevel = CodeGenOpt::Default;
+
+ switch (optimize) {
+ default: break;
+ case 1: OptLevel = CodeGenOpt::One; break;
+ case 2: OptLevel = CodeGenOpt::Two; break;
+ case 3: OptLevel = CodeGenOpt::Aggressive; break;
+ case 4: OptLevel = CodeGenOpt::LTO; break;
+ }
+
// Normal mode, emit a .s file by running the code generator.
// Note, this also adds codegenerator level optimization passes.
switch (TheTarget->addPassesToEmitFile(*PM, *AsmOutRawStream,
TargetMachine::AssemblyFile,
- optimize)) {
+ OptLevel)) {
default:
case FileModel::Error:
cerr << "Error interfacing to target machine!\n";
@@ -746,7 +766,7 @@
break;
}
- if (TheTarget->addPassesToEmitFileFinish(*PM, 0, optimize)) {
+ if (TheTarget->addPassesToEmitFileFinish(*PM, 0, OptLevel)) {
cerr << "Error interfacing to target machine!\n";
exit(1);
}
More information about the llvm-branch-commits
mailing list