Make it possible to set the cpu used for codegen.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110759 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2010-08-11 00:15:13 +00:00
parent 4ee87398e8
commit 2d643ef328
5 changed files with 29 additions and 1 deletions

View File

@@ -119,6 +119,11 @@ bool LTOCodeGenerator::setCodePICModel(lto_codegen_model model,
return true;
}
void LTOCodeGenerator::setCpu(const char* mCpu)
{
_mCpu = mCpu;
}
void LTOCodeGenerator::setAssemblerPath(const char* path)
{
if ( _assemblerPath )
@@ -314,7 +319,7 @@ bool LTOCodeGenerator::determineTarget(std::string& errMsg)
// construct LTModule, hand over ownership of module and target
SubtargetFeatures Features;
Features.getDefaultSubtargetFeatures("" /* cpu */, llvm::Triple(Triple));
Features.getDefaultSubtargetFeatures(_mCpu, llvm::Triple(Triple));
std::string FeatureStr = Features.getString();
_target = march->createTargetMachine(Triple, FeatureStr);
}