[llvm-commits] [llvm] r89151 - in /llvm/trunk: include/llvm/ExecutionEngine/ExecutionEngine.h lib/ExecutionEngine/ExecutionEngine.cpp lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h
Eric Christopher
echristo at apple.com
Tue Nov 17 13:58:16 PST 2009
Author: echristo
Date: Tue Nov 17 15:58:16 2009
New Revision: 89151
URL: http://llvm.org/viewvc/llvm-project?rev=89151&view=rev
Log:
Add ability to set code model within the execution engine builders
and creation interfaces.
Modified:
llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
llvm/trunk/lib/ExecutionEngine/JIT/JIT.h
Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=89151&r1=89150&r2=89151&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Tue Nov 17 15:58:16 2009
@@ -113,7 +113,8 @@
std::string *ErrorStr,
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel,
- bool GVsWithCode);
+ bool GVsWithCode,
+ CodeModel::Model CMM);
static ExecutionEngine *(*InterpCtor)(ModuleProvider *MP,
std::string *ErrorStr);
@@ -173,7 +174,9 @@
JITMemoryManager *JMM = 0,
CodeGenOpt::Level OptLevel =
CodeGenOpt::Default,
- bool GVsWithCode = true);
+ bool GVsWithCode = true,
+ CodeModel::Model CMM =
+ CodeModel::Default);
/// addModuleProvider - Add a ModuleProvider to the list of modules that we
/// can JIT from. Note that this takes ownership of the ModuleProvider: when
@@ -425,6 +428,7 @@
CodeGenOpt::Level OptLevel;
JITMemoryManager *JMM;
bool AllocateGVsWithCode;
+ CodeModel::Model CMModel;
/// InitEngine - Does the common initialization of default options.
///
@@ -434,6 +438,7 @@
OptLevel = CodeGenOpt::Default;
JMM = NULL;
AllocateGVsWithCode = false;
+ CMModel = CodeModel::Default;
}
public:
@@ -478,6 +483,13 @@
return *this;
}
+ /// setCodeModel - Set the CodeModel that the ExecutionEngine target
+ /// data is using. Defaults to target specific default "CodeModel::Default".
+ EngineBuilder &setCodeModel(CodeModel::Model M) {
+ CMModel = M;
+ return *this;
+ }
+
/// setAllocateGVsWithCode - Sets whether global values should be allocated
/// into the same buffer as code. For most applications this should be set
/// to false. Allocating globals with code breaks freeMachineCodeForFunction
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=89151&r1=89150&r2=89151&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Tue Nov 17 15:58:16 2009
@@ -40,7 +40,8 @@
std::string *ErrorStr,
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel,
- bool GVsWithCode) = 0;
+ bool GVsWithCode,
+ CodeModel::Model CMM) = 0;
ExecutionEngine *(*ExecutionEngine::InterpCtor)(ModuleProvider *MP,
std::string *ErrorStr) = 0;
ExecutionEngine::EERegisterFn ExecutionEngine::ExceptionTableRegister = 0;
@@ -444,7 +445,7 @@
if (ExecutionEngine::JITCtor) {
ExecutionEngine *EE =
ExecutionEngine::JITCtor(MP, ErrorStr, JMM, OptLevel,
- AllocateGVsWithCode);
+ AllocateGVsWithCode, CMModel);
if (EE) return EE;
}
}
Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=89151&r1=89150&r2=89151&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Tue Nov 17 15:58:16 2009
@@ -198,15 +198,17 @@
std::string *ErrorStr,
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel,
- bool GVsWithCode) {
- return JIT::createJIT(MP, ErrorStr, JMM, OptLevel, GVsWithCode);
+ bool GVsWithCode,
+ CodeModel::Model CMM) {
+ return JIT::createJIT(MP, ErrorStr, JMM, OptLevel, GVsWithCode, CMM);
}
ExecutionEngine *JIT::createJIT(ModuleProvider *MP,
std::string *ErrorStr,
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel,
- bool GVsWithCode) {
+ bool GVsWithCode,
+ CodeModel::Model CMM) {
// Make sure we can resolve symbols in the program as well. The zero arg
// to the function tells DynamicLibrary to load the program, not a library.
if (sys::DynamicLibrary::LoadLibraryPermanently(0, ErrorStr))
@@ -215,6 +217,7 @@
// Pick a target either via -march or by guessing the native arch.
TargetMachine *TM = JIT::selectTarget(MP, ErrorStr);
if (!TM || (ErrorStr && ErrorStr->length() > 0)) return 0;
+ TM->setCodeModel(CMM);
// If the target supports JIT code generation, create a the JIT.
if (TargetJITInfo *TJ = TM->getJITInfo()) {
Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.h?rev=89151&r1=89150&r2=89151&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.h (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.h Tue Nov 17 15:58:16 2009
@@ -85,8 +85,10 @@
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel =
CodeGenOpt::Default,
- bool GVsWithCode = true) {
- return ExecutionEngine::createJIT(MP, Err, JMM, OptLevel, GVsWithCode);
+ bool GVsWithCode = true,
+ CodeModel::Model CMM = CodeModel::Default) {
+ return ExecutionEngine::createJIT(MP, Err, JMM, OptLevel, GVsWithCode,
+ CMM);
}
virtual void addModuleProvider(ModuleProvider *MP);
@@ -175,7 +177,8 @@
std::string *ErrorStr,
JITMemoryManager *JMM,
CodeGenOpt::Level OptLevel,
- bool GVsWithCode);
+ bool GVsWithCode,
+ CodeModel::Model CMM);
// Run the JIT on F and return information about the generated code
void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0);
More information about the llvm-commits
mailing list