projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[X86][Haswell][SchedModel] Add architecture specific scheduling models.
[oota-llvm.git]
/
lib
/
ExecutionEngine
/
ExecutionEngine.cpp
diff --git
a/lib/ExecutionEngine/ExecutionEngine.cpp
b/lib/ExecutionEngine/ExecutionEngine.cpp
index 01b9bcc8905cf2cc934ed8206f43e6571a07f155..063f3fb05c2de903d85765d467b4285c19b3cb23 100644
(file)
--- a/
lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/
lib/ExecutionEngine/ExecutionEngine.cpp
@@
-48,6
+48,12
@@
void ObjectCache::anchor() {}
void ObjectBuffer::anchor() {}
void ObjectBufferStream::anchor() {}
void ObjectBuffer::anchor() {}
void ObjectBufferStream::anchor() {}
+ExecutionEngine *(*ExecutionEngine::JITCtor)(
+ Module *M,
+ std::string *ErrorStr,
+ JITMemoryManager *JMM,
+ bool GVsWithCode,
+ TargetMachine *TM) = nullptr;
ExecutionEngine *(*ExecutionEngine::MCJITCtor)(
Module *M,
std::string *ErrorStr,
ExecutionEngine *(*ExecutionEngine::MCJITCtor)(
Module *M,
std::string *ErrorStr,
@@
-411,8
+417,10
@@
void EngineBuilder::InitEngine() {
MCJMM = nullptr;
JMM = nullptr;
Options = TargetOptions();
MCJMM = nullptr;
JMM = nullptr;
Options = TargetOptions();
+ AllocateGVsWithCode = false;
RelocModel = Reloc::Default;
CMModel = CodeModel::JITDefault;
RelocModel = Reloc::Default;
CMModel = CodeModel::JITDefault;
+ UseMCJIT = false;
// IR module verification is enabled by default in debug builds, and disabled
// by default in release builds.
// IR module verification is enabled by default in debug builds, and disabled
// by default in release builds.
@@
-445,6
+453,14
@@
ExecutionEngine *EngineBuilder::create(TargetMachine *TM) {
return nullptr;
}
}
return nullptr;
}
}
+
+ if (MCJMM && ! UseMCJIT) {
+ if (ErrorStr)
+ *ErrorStr =
+ "Cannot create a legacy JIT with a runtime dyld memory "
+ "manager.";
+ return nullptr;
+ }
// Unless the interpreter was explicitly selected or the JIT is not linked,
// try making a JIT.
// Unless the interpreter was explicitly selected or the JIT is not linked,
// try making a JIT.
@@
-457,9
+473,12
@@
ExecutionEngine *EngineBuilder::create(TargetMachine *TM) {
}
ExecutionEngine *EE = nullptr;
}
ExecutionEngine *EE = nullptr;
- if (ExecutionEngine::MCJITCtor)
+ if (
UseMCJIT &&
ExecutionEngine::MCJITCtor)
EE = ExecutionEngine::MCJITCtor(M, ErrorStr, MCJMM ? MCJMM : JMM,
TheTM.release());
EE = ExecutionEngine::MCJITCtor(M, ErrorStr, MCJMM ? MCJMM : JMM,
TheTM.release());
+ else if (ExecutionEngine::JITCtor)
+ EE = ExecutionEngine::JITCtor(M, ErrorStr, JMM,
+ AllocateGVsWithCode, TheTM.release());
if (EE) {
EE->setVerifyModules(VerifyModules);
if (EE) {
EE->setVerifyModules(VerifyModules);
@@
-477,7
+496,8
@@
ExecutionEngine *EngineBuilder::create(TargetMachine *TM) {
return nullptr;
}
return nullptr;
}
- if ((WhichEngine & EngineKind::JIT) && !ExecutionEngine::MCJITCtor) {
+ if ((WhichEngine & EngineKind::JIT) && !ExecutionEngine::JITCtor &&
+ !ExecutionEngine::MCJITCtor) {
if (ErrorStr)
*ErrorStr = "JIT has not been linked in.";
}
if (ErrorStr)
*ErrorStr = "JIT has not been linked in.";
}
@@
-823,6
+843,9
@@
GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
Result = PTOGV(getPointerToFunctionOrStub(const_cast<Function*>(F)));
else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(C))
Result = PTOGV(getOrEmitGlobalVariable(const_cast<GlobalVariable*>(GV)));
Result = PTOGV(getPointerToFunctionOrStub(const_cast<Function*>(F)));
else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(C))
Result = PTOGV(getOrEmitGlobalVariable(const_cast<GlobalVariable*>(GV)));
+ else if (const BlockAddress *BA = dyn_cast<BlockAddress>(C))
+ Result = PTOGV(getPointerToBasicBlock(const_cast<BasicBlock*>(
+ BA->getBasicBlock())));
else
llvm_unreachable("Unknown constant pointer type!");
break;
else
llvm_unreachable("Unknown constant pointer type!");
break;