mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131026 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -214,8 +214,12 @@ ExecutionEngine *ExecutionEngine::createJIT(Module *M,
|
||||
StringRef MArch = "";
|
||||
StringRef MCPU = "";
|
||||
SmallVector<std::string, 1> MAttrs;
|
||||
return JIT::createJIT(M, ErrorStr, JMM, OptLevel, GVsWithCode, CMM,
|
||||
MArch, MCPU, MAttrs);
|
||||
TargetMachine *TM =
|
||||
ExecutionEngine::selectTarget(M, MArch, MCPU, MAttrs, ErrorStr);
|
||||
if (!TM || (ErrorStr && ErrorStr->length() > 0)) return 0;
|
||||
TM->setCodeModel(CMM);
|
||||
|
||||
return JIT::createJIT(M, ErrorStr, JMM, OptLevel, GVsWithCode, TM);
|
||||
}
|
||||
|
||||
ExecutionEngine *JIT::createJIT(Module *M,
|
||||
@@ -223,25 +227,12 @@ ExecutionEngine *JIT::createJIT(Module *M,
|
||||
JITMemoryManager *JMM,
|
||||
CodeGenOpt::Level OptLevel,
|
||||
bool GVsWithCode,
|
||||
CodeModel::Model CMM,
|
||||
StringRef MArch,
|
||||
StringRef MCPU,
|
||||
const SmallVectorImpl<std::string>& MAttrs) {
|
||||
TargetMachine *TM) {
|
||||
// Try to register the program as a source of symbols to resolve against.
|
||||
//
|
||||
// FIXME: Don't do this here.
|
||||
sys::DynamicLibrary::LoadLibraryPermanently(0, NULL);
|
||||
|
||||
// Pick a target either via -march or by guessing the native arch.
|
||||
//
|
||||
// FIXME: This should be lifted out of here, it isn't something which should
|
||||
// be part of the JIT policy, rather the burden for this selection should be
|
||||
// pushed to clients.
|
||||
TargetMachine *TM =
|
||||
ExecutionEngine::selectTarget(M, MArch, MCPU, MAttrs, ErrorStr);
|
||||
if (!TM || (ErrorStr && ErrorStr->length() > 0)) return 0;
|
||||
TM->setCodeModel(CMM);
|
||||
|
||||
// If the target supports JIT code generation, create the JIT.
|
||||
if (TargetJITInfo *TJ = TM->getJITInfo()) {
|
||||
return new JIT(M, *TM, *TJ, JMM, OptLevel, GVsWithCode);
|
||||
|
Reference in New Issue
Block a user