Skip to content
Snippets Groups Projects
Commit f7d47c04 authored by Daniel Dunbar's avatar Daniel Dunbar
Browse files

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75821 91177308-0d34-0410-b5e6-96231b3b80d8
parent 0cdad6c5
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "llvm/Target/SubtargetFeature.h" #include "llvm/Target/SubtargetFeature.h"
#include "llvm/Target/TargetData.h" #include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetMachineRegistry.h" #include "llvm/Target/TargetRegistry.h"
using namespace clang; using namespace clang;
using namespace llvm; using namespace llvm;
...@@ -205,9 +205,9 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) { ...@@ -205,9 +205,9 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) {
bool Fast = CompileOpts.OptimizationLevel == 0; bool Fast = CompileOpts.OptimizationLevel == 0;
// Create the TargetMachine for generating code. // Create the TargetMachine for generating code.
const TargetMachineRegistry::entry *TME = const llvm::Target *TheTarget =
TargetMachineRegistry::getClosestStaticTargetForModule(*TheModule, Error); TargetRegistry::getClosestStaticTargetForModule(*TheModule, Error);
if (!TME) { if (!TheTarget) {
Error = std::string("Unable to get target machine: ") + Error; Error = std::string("Unable to get target machine: ") + Error;
return false; return false;
} }
...@@ -222,7 +222,7 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) { ...@@ -222,7 +222,7 @@ bool BackendConsumer::AddEmitPasses(std::string &Error) {
Features.AddFeature(*it); Features.AddFeature(*it);
FeaturesStr = Features.getString(); FeaturesStr = Features.getString();
} }
TargetMachine *TM = TME->CtorFn(*TheModule, FeaturesStr); TargetMachine *TM = TheTarget->createTargetMachine(*TheModule, FeaturesStr);
// Set register scheduler & allocation policy. // Set register scheduler & allocation policy.
RegisterScheduler::setDefault(createDefaultScheduler); RegisterScheduler::setDefault(createDefaultScheduler);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment