[llvm-commits] [llvm-gcc-4.2] r144790 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Evan Cheng
evan.cheng at apple.com
Wed Nov 16 00:39:32 PST 2011
Author: evancheng
Date: Wed Nov 16 02:39:32 2011
New Revision: 144790
URL: http://llvm.org/viewvc/llvm-project?rev=144790&view=rev
Log:
Match LLVM API change.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=144790&r1=144789&r2=144790&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Nov 16 02:39:32 2011
@@ -413,6 +413,14 @@
Reloc::Model RelocModel = Reloc::Default;
CodeModel::Model CMModel = CodeModel::Default;
+ CodeGenOpt::Level OptLevel = CodeGenOpt::Default; // -O2, -Os, and -Oz
+ if (optimize == 0)
+ OptLevel = CodeGenOpt::None;
+ else if (optimize == 1)
+ OptLevel = CodeGenOpt::Less;
+ else if (optimize == 3)
+ // -O3 and above.
+ OptLevel = CodeGenOpt::Aggressive;
// Initialize LLVM options.
std::vector<const char*> Args;
@@ -563,7 +571,7 @@
FeatureStr = Features.getString();
TheTarget = TME->createTargetMachine(TargetTriple, CPU, FeatureStr,
- RelocModel, CMModel);
+ RelocModel, CMModel, OptLevel);
TheTarget->setMCUseLoc(false);
TheTarget->setMCUseCFI(false);
assert(TheTarget->getTargetData()->isBigEndian() == BYTES_BIG_ENDIAN);
@@ -767,7 +775,7 @@
// Note, this also adds codegenerator level optimization passes.
if (TheTarget->addPassesToEmitFile(*PM, *AsmOutRawStream,
TargetMachine::CGFT_AssemblyFile,
- OptLevel, DisableVerify)) {
+ DisableVerify)) {
errs() << "Error interfacing to target machine!\n";
exit(1);
}
@@ -880,7 +888,7 @@
// Note, this also adds codegenerator level optimization passes.
if (TheTarget->addPassesToEmitFile(*PM, *AsmOutRawStream,
TargetMachine::CGFT_AssemblyFile,
- OptLevel, DisableVerify)) {
+ DisableVerify)) {
errs() << "Error interfacing to target machine!\n";
exit(1);
}
More information about the llvm-commits
mailing list