createTargetMachine now takes a CPU string.

llvm-svn: 134128
This commit is contained in:
Evan Cheng 2011-06-30 02:06:32 +00:00
parent fe6e405e8c
commit adc7959851
2 changed files with 5 additions and 4 deletions

View File

@ -258,16 +258,16 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
const_cast<char **>(&BackendArgs[0])); const_cast<char **>(&BackendArgs[0]));
std::string FeaturesStr; std::string FeaturesStr;
if (TargetOpts.CPU.size() || TargetOpts.Features.size()) { if (TargetOpts.Features.size()) {
SubtargetFeatures Features; SubtargetFeatures Features;
Features.setCPU(TargetOpts.CPU);
for (std::vector<std::string>::const_iterator for (std::vector<std::string>::const_iterator
it = TargetOpts.Features.begin(), it = TargetOpts.Features.begin(),
ie = TargetOpts.Features.end(); it != ie; ++it) ie = TargetOpts.Features.end(); it != ie; ++it)
Features.AddFeature(*it); Features.AddFeature(*it);
FeaturesStr = Features.getString(); FeaturesStr = Features.getString();
} }
TargetMachine *TM = TheTarget->createTargetMachine(Triple, FeaturesStr); TargetMachine *TM = TheTarget->createTargetMachine(Triple, TargetOpts.CPU,
FeaturesStr);
if (CodeGenOpts.RelaxAll) if (CodeGenOpts.RelaxAll)
TM->setMCRelaxAll(true); TM->setMCRelaxAll(true);

View File

@ -261,7 +261,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, Diagnostic &Diags) {
return false; return false;
// FIXME: We shouldn't need to do this (and link in codegen). // FIXME: We shouldn't need to do this (and link in codegen).
OwningPtr<TargetMachine> TM(TheTarget->createTargetMachine(Opts.Triple, "")); OwningPtr<TargetMachine> TM(TheTarget->createTargetMachine(Opts.Triple,
"", ""));
if (!TM) { if (!TM) {
Diags.Report(diag::err_target_unknown_triple) << Opts.Triple; Diags.Report(diag::err_target_unknown_triple) << Opts.Triple;
return false; return false;