diff options
| author | Dylan Noblesmith <nobled@dreamwidth.org> | 2011-05-06 22:06:22 +0000 |
|---|---|---|
| committer | Dylan Noblesmith <nobled@dreamwidth.org> | 2011-05-06 22:06:22 +0000 |
| commit | ab6bd20da9cc02661dde52675d0f0b25ae70236a (patch) | |
| tree | 3c1d8a5a0a08c964e24e998bdf6aa651acfc631f /llvm/lib/ExecutionEngine/ExecutionEngine.cpp | |
| parent | fed7f0b3a0bda0f649be3c8ce16565f3ca063274 (diff) | |
| download | llvm-ab6bd20da9cc02661dde52675d0f0b25ae70236a.zip llvm-ab6bd20da9cc02661dde52675d0f0b25ae70236a.tar.gz llvm-ab6bd20da9cc02661dde52675d0f0b25ae70236a.tar.bz2 | |
ExecutionEngine: push TargetMachine creation into clients
In particular, into EngineBuilder. This should only impact
the private API between the EE and EB classes, not external
clients, since JITCtor and MCJITCtor are both protected members.
llvm-svn: 131026
Diffstat (limited to 'llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
| -rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 2b1e878..824b090 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -29,6 +29,7 @@ #include "llvm/Support/DynamicLibrary.h" #include "llvm/Support/Host.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetMachine.h" #include <cmath> #include <cstring> using namespace llvm; @@ -42,20 +43,14 @@ ExecutionEngine *(*ExecutionEngine::JITCtor)( JITMemoryManager *JMM, CodeGenOpt::Level OptLevel, bool GVsWithCode, - CodeModel::Model CMM, - StringRef MArch, - StringRef MCPU, - const SmallVectorImpl<std::string>& MAttrs) = 0; + TargetMachine *TM) = 0; ExecutionEngine *(*ExecutionEngine::MCJITCtor)( Module *M, std::string *ErrorStr, JITMemoryManager *JMM, CodeGenOpt::Level OptLevel, bool GVsWithCode, - CodeModel::Model CMM, - StringRef MArch, - StringRef MCPU, - const SmallVectorImpl<std::string>& MAttrs) = 0; + TargetMachine *TM) = 0; ExecutionEngine *(*ExecutionEngine::InterpCtor)(Module *M, std::string *ErrorStr) = 0; @@ -441,17 +436,20 @@ ExecutionEngine *EngineBuilder::create() { // Unless the interpreter was explicitly selected or the JIT is not linked, // try making a JIT. if (WhichEngine & EngineKind::JIT) { + TargetMachine *TM = + ExecutionEngine::selectTarget(M, MArch, MCPU, MAttrs, ErrorStr); + if (!TM || (ErrorStr && ErrorStr->length() > 0)) return 0; + TM->setCodeModel(CMModel); + if (UseMCJIT && ExecutionEngine::MCJITCtor) { ExecutionEngine *EE = ExecutionEngine::MCJITCtor(M, ErrorStr, JMM, OptLevel, - AllocateGVsWithCode, CMModel, - MArch, MCPU, MAttrs); + AllocateGVsWithCode, TM); if (EE) return EE; } else if (ExecutionEngine::JITCtor) { ExecutionEngine *EE = ExecutionEngine::JITCtor(M, ErrorStr, JMM, OptLevel, - AllocateGVsWithCode, CMModel, - MArch, MCPU, MAttrs); + AllocateGVsWithCode, TM); if (EE) return EE; } } |
