mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-13 08:25:27 +00:00
ExecutionEngine: push TargetMachine creation into clients (v2)
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@131317 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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,18 +436,21 @@ ExecutionEngine *EngineBuilder::create() {
|
||||
// Unless the interpreter was explicitly selected or the JIT is not linked,
|
||||
// try making a JIT.
|
||||
if (WhichEngine & EngineKind::JIT) {
|
||||
if (UseMCJIT && ExecutionEngine::MCJITCtor) {
|
||||
ExecutionEngine *EE =
|
||||
ExecutionEngine::MCJITCtor(M, ErrorStr, JMM, OptLevel,
|
||||
AllocateGVsWithCode, CMModel,
|
||||
MArch, MCPU, MAttrs);
|
||||
if (EE) return EE;
|
||||
} else if (ExecutionEngine::JITCtor) {
|
||||
ExecutionEngine *EE =
|
||||
ExecutionEngine::JITCtor(M, ErrorStr, JMM, OptLevel,
|
||||
AllocateGVsWithCode, CMModel,
|
||||
MArch, MCPU, MAttrs);
|
||||
if (EE) return EE;
|
||||
if (TargetMachine *TM =
|
||||
EngineBuilder::selectTarget(M, MArch, MCPU, MAttrs, ErrorStr)) {
|
||||
TM->setCodeModel(CMModel);
|
||||
|
||||
if (UseMCJIT && ExecutionEngine::MCJITCtor) {
|
||||
ExecutionEngine *EE =
|
||||
ExecutionEngine::MCJITCtor(M, ErrorStr, JMM, OptLevel,
|
||||
AllocateGVsWithCode, TM);
|
||||
if (EE) return EE;
|
||||
} else if (ExecutionEngine::JITCtor) {
|
||||
ExecutionEngine *EE =
|
||||
ExecutionEngine::JITCtor(M, ErrorStr, JMM, OptLevel,
|
||||
AllocateGVsWithCode, TM);
|
||||
if (EE) return EE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user