[llvm-commits] [llvm] r119508 - in /llvm/trunk: include/llvm/ExecutionEngine/ExecutionEngine.h lib/ExecutionEngine/ExecutionEngine.cpp tools/lli/lli.cpp
Daniel Dunbar
daniel at zuster.org
Wed Nov 17 08:06:37 PST 2010
Author: ddunbar
Date: Wed Nov 17 10:06:37 2010
New Revision: 119508
URL: http://llvm.org/viewvc/llvm-project?rev=119508&view=rev
Log:
lli: Add stub -use-mcjit option, which doesn't currently do anything.
Modified:
llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/trunk/tools/lli/lli.cpp
Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=119508&r1=119507&r2=119508&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Wed Nov 17 10:06:37 2010
@@ -126,8 +126,8 @@
virtual char *getMemoryForGV(const GlobalVariable *GV);
// To avoid having libexecutionengine depend on the JIT and interpreter
- // libraries, the JIT and Interpreter set these functions to ctor pointers at
- // startup time if they are linked in.
+ // libraries, the execution engine implementations set these functions to ctor
+ // pointers at startup time if they are linked in.
static ExecutionEngine *(*JITCtor)(
Module *M,
std::string *ErrorStr,
@@ -138,6 +138,16 @@
StringRef MArch,
StringRef MCPU,
const SmallVectorImpl<std::string>& MAttrs);
+ static 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);
static ExecutionEngine *(*InterpCtor)(Module *M,
std::string *ErrorStr);
@@ -447,6 +457,7 @@
std::string MArch;
std::string MCPU;
SmallVector<std::string, 4> MAttrs;
+ bool UseMCJIT;
/// InitEngine - Does the common initialization of default options.
void InitEngine() {
@@ -456,6 +467,7 @@
JMM = NULL;
AllocateGVsWithCode = false;
CMModel = CodeModel::Default;
+ UseMCJIT = false;
}
public:
@@ -526,6 +538,12 @@
return *this;
}
+ /// setUseMCJIT - Set whether the MC-JIT implementation should be used
+ /// (experimental).
+ void setUseMCJIT(bool Value) {
+ UseMCJIT = Value;
+ }
+
/// setMAttrs - Set cpu-specific attributes.
template<typename StringSequence>
EngineBuilder &setMAttrs(const StringSequence &mattrs) {
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=119508&r1=119507&r2=119508&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Wed Nov 17 10:06:37 2010
@@ -46,6 +46,16 @@
StringRef MArch,
StringRef MCPU,
const SmallVectorImpl<std::string>& MAttrs) = 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;
ExecutionEngine *(*ExecutionEngine::InterpCtor)(Module *M,
std::string *ErrorStr) = 0;
@@ -430,7 +440,13 @@
// Unless the interpreter was explicitly selected or the JIT is not linked,
// try making a JIT.
if (WhichEngine & EngineKind::JIT) {
- if (ExecutionEngine::JITCtor) {
+ 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,
Modified: llvm/trunk/tools/lli/lli.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/lli.cpp?rev=119508&r1=119507&r2=119508&view=diff
==============================================================================
--- llvm/trunk/tools/lli/lli.cpp (original)
+++ llvm/trunk/tools/lli/lli.cpp Wed Nov 17 10:06:37 2010
@@ -55,6 +55,10 @@
cl::desc("Force interpretation: disable JIT"),
cl::init(false));
+ cl::opt<bool> UseMCJIT(
+ "use-mcjit", cl::desc("Enable use of the MC-based JIT (if available)"),
+ cl::init(false));
+
// Determine optimization level.
cl::opt<char>
OptLevel("O",
@@ -167,6 +171,10 @@
if (!TargetTriple.empty())
Mod->setTargetTriple(Triple::normalize(TargetTriple));
+ // Enable MCJIT, if desired.
+ if (UseMCJIT)
+ builder.setUseMCJIT(true);
+
CodeGenOpt::Level OLvl = CodeGenOpt::Default;
switch (OptLevel) {
default:
More information about the llvm-commits
mailing list