diff options
| author | Dylan Noblesmith <nobled@dreamwidth.org> | 2011-12-12 04:20:36 +0000 |
|---|---|---|
| committer | Dylan Noblesmith <nobled@dreamwidth.org> | 2011-12-12 04:20:36 +0000 |
| commit | 7f26246a7101ccdb26679a55d8bd8c5331e35e0e (patch) | |
| tree | 2f00a34e0f2d9ed1cf58fbe6ea04ab2d6f0045bd /llvm/lib/ExecutionEngine/ExecutionEngine.cpp | |
| parent | 08608f6744b7bf179193f0891119d1f8ccc3568f (diff) | |
| download | bcm5719-llvm-7f26246a7101ccdb26679a55d8bd8c5331e35e0e.tar.gz bcm5719-llvm-7f26246a7101ccdb26679a55d8bd8c5331e35e0e.zip | |
ExecutionEngine: refactor interface
The OptLevel is now redundant with the TargetMachine*.
And selectTarget() isn't really JIT-specific and could probably
get refactored into one of the lower level libraries.
llvm-svn: 146355
Diffstat (limited to 'llvm/lib/ExecutionEngine/ExecutionEngine.cpp')
| -rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 26b05848402..7829a2986bb 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -28,6 +28,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Support/DynamicLibrary.h" #include "llvm/Support/Host.h" +#include "llvm/Support/TargetRegistry.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" #include <cmath> @@ -41,14 +42,12 @@ ExecutionEngine *(*ExecutionEngine::JITCtor)( Module *M, std::string *ErrorStr, JITMemoryManager *JMM, - CodeGenOpt::Level OptLevel, bool GVsWithCode, TargetMachine *TM) = 0; ExecutionEngine *(*ExecutionEngine::MCJITCtor)( Module *M, std::string *ErrorStr, JITMemoryManager *JMM, - CodeGenOpt::Level OptLevel, bool GVsWithCode, TargetMachine *TM) = 0; ExecutionEngine *(*ExecutionEngine::InterpCtor)(Module *M, @@ -436,13 +435,14 @@ ExecutionEngine *ExecutionEngine::createJIT(Module *M, StringRef MCPU = ""; SmallVector<std::string, 1> MAttrs; + Triple TT(M->getTargetTriple()); // TODO: permit custom TargetOptions here TargetMachine *TM = - EngineBuilder::selectTarget(M, MArch, MCPU, MAttrs, TargetOptions(), RM, + EngineBuilder::selectTarget(TT, MArch, MCPU, MAttrs, TargetOptions(), RM, CMM, OL, ErrorStr); if (!TM || (ErrorStr && ErrorStr->length() > 0)) return 0; - return ExecutionEngine::JITCtor(M, ErrorStr, JMM, OL, GVsWithCode, TM); + return ExecutionEngine::JITCtor(M, ErrorStr, JMM, GVsWithCode, TM); } ExecutionEngine *EngineBuilder::create() { @@ -467,18 +467,25 @@ ExecutionEngine *EngineBuilder::create() { // Unless the interpreter was explicitly selected or the JIT is not linked, // try making a JIT. if (WhichEngine & EngineKind::JIT) { - if (TargetMachine *TM = EngineBuilder::selectTarget(M, MArch, MCPU, MAttrs, + Triple TT(M->getTargetTriple()); + if (TargetMachine *TM = EngineBuilder::selectTarget(TT, MArch, MCPU, MAttrs, Options, RelocModel, CMModel, OptLevel, ErrorStr)) { + if (!TM->getTarget().hasJIT()) { + errs() << "WARNING: This target JIT is not designed for the host" + << " you are running. If bad things happen, please choose" + << " a different -march switch.\n"; + } + if (UseMCJIT && ExecutionEngine::MCJITCtor) { ExecutionEngine *EE = - ExecutionEngine::MCJITCtor(M, ErrorStr, JMM, OptLevel, + ExecutionEngine::MCJITCtor(M, ErrorStr, JMM, AllocateGVsWithCode, TM); if (EE) return EE; } else if (ExecutionEngine::JITCtor) { ExecutionEngine *EE = - ExecutionEngine::JITCtor(M, ErrorStr, JMM, OptLevel, + ExecutionEngine::JITCtor(M, ErrorStr, JMM, AllocateGVsWithCode, TM); if (EE) return EE; } |

