Lookup targets by Triple instead of Module.

llvm-svn: 77108
This commit is contained in:
Daniel Dunbar 2009-07-26 01:27:26 +00:00
parent 397792d981
commit 6a82e424d0
1 changed files with 2 additions and 1 deletions

View File

@ -205,8 +205,9 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) {
bool Fast = CompileOpts.OptimizationLevel == 0;
// Create the TargetMachine for generating code.
std::string Triple = TheModule->getTargetTriple();
const llvm::Target *TheTarget =
TargetRegistry::getClosestStaticTargetForModule(*TheModule, Error);
TargetRegistry::getClosestStaticTargetForTriple(Triple, Error);
if (!TheTarget) {
Error = std::string("Unable to get target machine: ") + Error;
return false;