Reapply r75764: [llvm up] Switch to using the new TargetRegistry

llvm-svn: 75821
This commit is contained in:
Daniel Dunbar 2009-07-15 20:25:38 +00:00
parent e833810a5e
commit ee71c25eee
1 changed files with 5 additions and 5 deletions

View File

@ -33,7 +33,7 @@
#include "llvm/Target/SubtargetFeature.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetMachineRegistry.h"
#include "llvm/Target/TargetRegistry.h"
using namespace clang;
using namespace llvm;
@ -205,9 +205,9 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) {
bool Fast = CompileOpts.OptimizationLevel == 0;
// Create the TargetMachine for generating code.
const TargetMachineRegistry::entry *TME =
TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, Error);
if (!TME) {
const llvm::Target *TheTarget =
TargetRegistry::getClosestStaticTargetForModule(*TheModule, Error);
if (!TheTarget) {
Error = std::string("Unable to get target machine: ") + Error;
return false;
}
@ -222,7 +222,7 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) {
Features.AddFeature(*it);
FeaturesStr = Features.getString();
}
TargetMachine *TM = TME->CtorFn(*TheModule, FeaturesStr);
TargetMachine *TM = TheTarget->createTargetMachine(*TheModule, FeaturesStr);
// Set register scheduler & allocation policy.
RegisterScheduler::setDefault(createDefaultScheduler);