diff options
| author | Eric Christopher <echristo@gmail.com> | 2014-08-07 22:02:54 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@gmail.com> | 2014-08-07 22:02:54 +0000 |
| commit | b9fd9ed37ebf24d0935fe597cc8ea13f77288636 (patch) | |
| tree | 6d3bd604747981f5dcc37bcb3509f1c793287e59 /llvm/tools/lli/lli.cpp | |
| parent | b5220dc77963e8172cfe0ea7aeeacc76b3da8413 (diff) | |
| download | bcm5719-llvm-b9fd9ed37ebf24d0935fe597cc8ea13f77288636.tar.gz bcm5719-llvm-b9fd9ed37ebf24d0935fe597cc8ea13f77288636.zip | |
Temporarily Revert "Nuke the old JIT." as it's not quite ready to
be deleted. This will be reapplied as soon as possible and before
the 3.6 branch date at any rate.
Approved by Jim Grosbach, Lang Hames, Rafael Espindola.
This reverts commits r215111, 215115, 215116, 215117, 215136.
llvm-svn: 215154
Diffstat (limited to 'llvm/tools/lli/lli.cpp')
| -rw-r--r-- | llvm/tools/lli/lli.cpp | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index 13472214dfb..fda55e4b575 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -22,6 +22,7 @@ #include "llvm/CodeGen/LinkAllCodegenComponents.h" #include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/ExecutionEngine/Interpreter.h" +#include "llvm/ExecutionEngine/JIT.h" #include "llvm/ExecutionEngine/JITEventListener.h" #include "llvm/ExecutionEngine/JITMemoryManager.h" #include "llvm/ExecutionEngine/MCJIT.h" @@ -75,6 +76,10 @@ namespace { 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)); + cl::opt<bool> DebugIR( "debug-ir", cl::desc("Generate debug information to allow debugging IR."), cl::init(false)); @@ -400,9 +405,12 @@ int main(int argc, char **argv, char * const *envp) { } if (EnableCacheManager) { - std::string CacheName("file:"); - CacheName.append(InputFile); - Mod->setModuleIdentifier(CacheName); + if (UseMCJIT) { + std::string CacheName("file:"); + CacheName.append(InputFile); + Mod->setModuleIdentifier(CacheName); + } else + errs() << "warning: -enable-cache-manager can only be used with MCJIT."; } // If not jitting lazily, load the whole bitcode file eagerly too. @@ -415,6 +423,12 @@ int main(int argc, char **argv, char * const *envp) { } if (DebugIR) { + if (!UseMCJIT) { + errs() << "warning: -debug-ir used without -use-mcjit. Only partial debug" + << " information will be emitted by the non-MC JIT engine. To see full" + << " source debug information, enable the flag '-use-mcjit'.\n"; + + } ModulePass *DebugIRPass = createDebugIRPass(); DebugIRPass->runOnModule(*Mod); } @@ -437,7 +451,8 @@ int main(int argc, char **argv, char * const *envp) { // Enable MCJIT if desired. RTDyldMemoryManager *RTDyldMM = nullptr; - if (!ForceInterpreter) { + if (UseMCJIT && !ForceInterpreter) { + builder.setUseMCJIT(true); if (RemoteMCJIT) RTDyldMM = new RemoteMemoryManager(); else @@ -502,9 +517,12 @@ int main(int argc, char **argv, char * const *envp) { return 1; } if (EnableCacheManager) { - std::string CacheName("file:"); - CacheName.append(ExtraModules[i]); - XMod->setModuleIdentifier(CacheName); + if (UseMCJIT) { + std::string CacheName("file:"); + CacheName.append(ExtraModules[i]); + XMod->setModuleIdentifier(CacheName); + } + // else, we already printed a warning above. } EE->addModule(XMod); } @@ -593,12 +611,20 @@ int main(int argc, char **argv, char * const *envp) { NULL); // Run static constructors. - if (!ForceInterpreter) { + if (UseMCJIT && !ForceInterpreter) { // Give MCJIT a chance to apply relocations and set page permissions. EE->finalizeObject(); } EE->runStaticConstructorsDestructors(false); + if (!UseMCJIT && NoLazyCompilation) { + for (Module::iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) { + Function *Fn = &*I; + if (Fn != EntryFn && !Fn->isDeclaration()) + EE->getPointerToFunction(Fn); + } + } + // Trigger compilation separately so code regions that need to be // invalidated will be known. (void)EE->getPointerToFunction(EntryFn); |

