summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2015-03-25 12:11:48 +0000
committerLang Hames <lhames@gmail.com>2015-03-25 12:11:48 +0000
commit50a0296f7af422224d05019ce21d40e7c00ca70a (patch)
treeacb805362704a086f57c4a95a7398460b425a0f7
parent81eeec0f8ab3bfde0d154bd7e173bcf2f9e3d377 (diff)
[Orc][lli] Add a very simple Orc-based lazy JIT to lli.
This ensures that we're building and testing the CompileOnDemand layer, at least in a basic way. Currently x86-64 only, and with limited to no library calls enabled (depending on host platform). Patches welcome. ;) To enable access to the lazy JIT, this patch replaces the '-use-orcmcjit' lli option with a new option: '-jit-kind={ mcjit | orc-mcjit | orc-lazy }'. All regression tests are updated to use the new option, and one trivial test of the new lazy JIT is added.
-rw-r--r--llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h4
-rw-r--r--llvm/test/ExecutionEngine/OrcJIT/multi-module-a.ll9
-rw-r--r--llvm/test/ExecutionEngine/OrcJIT/multi-module-sm-pic-a.ll10
-rw-r--r--llvm/test/ExecutionEngine/OrcJIT/remote/cross-module-a.ll12
-rw-r--r--llvm/test/ExecutionEngine/OrcJIT/remote/cross-module-sm-pic-a.ll14
-rw-r--r--llvm/test/ExecutionEngine/OrcJIT/remote/multi-module-a.ll9
-rw-r--r--llvm/test/ExecutionEngine/OrcJIT/remote/multi-module-sm-pic-a.ll10
-rw-r--r--llvm/test/ExecutionEngine/OrcJIT/simplesttest.ll6
-rw-r--r--llvm/test/ExecutionEngine/OrcLazy/lit.local.cfg2
-rw-r--r--llvm/test/ExecutionEngine/OrcLazy/trivial_retval_1.ll25
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2002-12-16-ArgTest.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2002-12-16-ArgTest.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-01-04-ArgumentBug.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-01-04-ArgumentBug.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-01-04-LoopTest.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-01-04-LoopTest.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-01-04-PhiTest.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-01-04-PhiTest.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-01-09-SARTest.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-01-09-SARTest.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-01-10-FUCOM.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-01-10-FUCOM.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-01-15-AlignmentTest.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-01-15-AlignmentTest.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-05-06-LivenessClobber.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-05-06-LivenessClobber.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-05-07-ArgumentTest.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-05-07-ArgumentTest.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-05-11-PHIRegAllocBug.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-05-11-PHIRegAllocBug.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-06-04-bzip2-bug.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-06-04-bzip2-bug.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-06-05-PHIBug.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-06-05-PHIBug.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-08-15-AllocaAssertion.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-08-15-AllocaAssertion.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-08-21-EnvironmentTest.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-08-21-EnvironmentTest.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-08-23-RegisterAllocatePhysReg.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-08-23-RegisterAllocatePhysReg.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2005-12-02-TailCallBug.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2005-12-02-TailCallBug.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2007-12-10-APIntLoadStore.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2007-12-10-APIntLoadStore.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2008-06-05-APInt-OverAShr.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2008-06-05-APInt-OverAShr.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/2013-04-04-RelocAddend.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/2013-04-04-RelocAddend.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/Inputs/cross-module-b.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/Inputs/cross-module-b.ll)0
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/Inputs/multi-module-b.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/Inputs/multi-module-b.ll)0
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/Inputs/multi-module-c.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/Inputs/multi-module-c.ll)0
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/Inputs/multi-module-eh-b.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/Inputs/multi-module-eh-b.ll)0
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/cross-module-a.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/cross-module-a.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/cross-module-sm-pic-a.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/cross-module-sm-pic-a.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/eh-lg-pic.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/eh-sm-pic.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/eh-sm-pic.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/eh.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/eh.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/fpbitcast.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/fpbitcast.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/hello-sm-pic.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/hello-sm-pic.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/hello.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/hello.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/hello2.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/hello2.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/lit.local.cfg (renamed from llvm/test/ExecutionEngine/OrcJIT/lit.local.cfg)0
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/load-object-a.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/load-object-a.ll)6
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/multi-module-a.ll9
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/multi-module-eh-a.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/multi-module-sm-pic-a.ll10
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/non-extern-addend.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/non-extern-addend.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/pr13727.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/pr13727.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/Inputs/cross-module-b.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/Inputs/cross-module-b.ll)0
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/Inputs/multi-module-b.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-b.ll)0
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/Inputs/multi-module-c.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-c.ll)0
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/cross-module-a.ll12
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/cross-module-sm-pic-a.ll14
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/lit.local.cfg (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/lit.local.cfg)0
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/multi-module-a.ll9
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/multi-module-sm-pic-a.ll10
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/simpletest-remote.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/simpletest-remote.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/stubs-remote.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/stubs-remote.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/stubs-sm-pic.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/stubs-sm-pic.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/test-common-symbols-remote.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/test-common-symbols-remote.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/test-data-align-remote.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/test-data-align-remote.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/test-fp-no-external-funcs-remote.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/test-fp-no-external-funcs-remote.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/test-global-init-nonzero-remote.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-remote.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/test-global-init-nonzero-sm-pic.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-sm-pic.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/test-ptr-reloc-remote.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-remote.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/remote/test-ptr-reloc-sm-pic.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-sm-pic.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/simplesttest.ll6
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/simpletest.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/simpletest.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/stubs-sm-pic.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/stubs-sm-pic.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/stubs.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/stubs.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-arith.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-arith.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-branch.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-branch.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-call-no-external-funcs.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-call-no-external-funcs.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-call.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-call.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-cast.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-cast.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-common-symbols-alignment.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-common-symbols-alignment.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-common-symbols.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-common-symbols.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-constantexpr.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-constantexpr.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-data-align.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-data-align.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-fp-no-external-funcs.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-fp-no-external-funcs.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-fp.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-fp.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-global-ctors.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-global-ctors.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-global-init-nonzero-sm-pic.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-global-init-nonzero-sm-pic.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-global-init-nonzero.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-global-init-nonzero.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-global.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-global.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-loadstore.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-loadstore.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-local.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-local.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-logical.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-logical.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-loop.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-loop.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-phi.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-phi.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-ptr-reloc-sm-pic.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-ptr-reloc-sm-pic.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-ptr-reloc.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-ptr-reloc.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-ret.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-ret.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-return.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-return.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-setcond-fp.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-setcond-fp.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-setcond-int.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-setcond-int.ll)2
-rw-r--r--llvm/test/ExecutionEngine/OrcMCJIT/test-shift.ll (renamed from llvm/test/ExecutionEngine/OrcJIT/test-shift.ll)2
-rw-r--r--llvm/tools/lli/CMakeLists.txt1
-rw-r--r--llvm/tools/lli/OrcLazyJIT.cpp53
-rw-r--r--llvm/tools/lli/OrcLazyJIT.h97
-rw-r--r--llvm/tools/lli/lli.cpp28
103 files changed, 346 insertions, 154 deletions
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
index 3dd1a37e1ed..77b0c48d0a7 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
@@ -193,8 +193,8 @@ public:
/// below this one.
JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name,
bool ExportedSymbolsOnly) {
- BaseLayerModuleSetHandleListT &BaseLayerHandles = H->second;
- for (auto &BH : BaseLayerHandles) {
+
+ for (auto &BH : H->BaseLayerModuleSetHandles) {
if (auto Symbol = BaseLayer.findSymbolIn(BH, Name, ExportedSymbolsOnly))
return Symbol;
}
diff --git a/llvm/test/ExecutionEngine/OrcJIT/multi-module-a.ll b/llvm/test/ExecutionEngine/OrcJIT/multi-module-a.ll
deleted file mode 100644
index 587a1e893ed..00000000000
--- a/llvm/test/ExecutionEngine/OrcJIT/multi-module-a.ll
+++ /dev/null
@@ -1,9 +0,0 @@
-; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll %s > /dev/null
-
-declare i32 @FB()
-
-define i32 @main() {
- %r = call i32 @FB( ) ; <i32> [#uses=1]
- ret i32 %r
-}
-
diff --git a/llvm/test/ExecutionEngine/OrcJIT/multi-module-sm-pic-a.ll b/llvm/test/ExecutionEngine/OrcJIT/multi-module-sm-pic-a.ll
deleted file mode 100644
index b5ee3d13b96..00000000000
--- a/llvm/test/ExecutionEngine/OrcJIT/multi-module-sm-pic-a.ll
+++ /dev/null
@@ -1,10 +0,0 @@
-; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -relocation-model=pic -code-model=small %s > /dev/null
-; XFAIL: mips, i686, i386
-
-declare i32 @FB()
-
-define i32 @main() {
- %r = call i32 @FB( ) ; <i32> [#uses=1]
- ret i32 %r
-}
-
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/cross-module-a.ll b/llvm/test/ExecutionEngine/OrcJIT/remote/cross-module-a.ll
deleted file mode 100644
index cc48fd4426c..00000000000
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/cross-module-a.ll
+++ /dev/null
@@ -1,12 +0,0 @@
-; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
-
-declare i32 @FB()
-
-define i32 @FA() nounwind {
- ret i32 0
-}
-
-define i32 @main() nounwind {
- %r = call i32 @FB( ) ; <i32> [#uses=1]
- ret i32 %r
-}
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/cross-module-sm-pic-a.ll b/llvm/test/ExecutionEngine/OrcJIT/remote/cross-module-sm-pic-a.ll
deleted file mode 100644
index d6209d7523a..00000000000
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/cross-module-sm-pic-a.ll
+++ /dev/null
@@ -1,14 +0,0 @@
-; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext -relocation-model=pic -code-model=small %s > /dev/null
-; XFAIL: mips, i686, i386, arm
-
-declare i32 @FB()
-
-define i32 @FA() {
- ret i32 0
-}
-
-define i32 @main() {
- %r = call i32 @FB( ) ; <i32> [#uses=1]
- ret i32 %r
-}
-
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/multi-module-a.ll b/llvm/test/ExecutionEngine/OrcJIT/remote/multi-module-a.ll
deleted file mode 100644
index 9ae0e060dd0..00000000000
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/multi-module-a.ll
+++ /dev/null
@@ -1,9 +0,0 @@
-; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
-
-declare i32 @FB()
-
-define i32 @main() nounwind {
- %r = call i32 @FB( ) ; <i32> [#uses=1]
- ret i32 %r
-}
-
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/multi-module-sm-pic-a.ll b/llvm/test/ExecutionEngine/OrcJIT/remote/multi-module-sm-pic-a.ll
deleted file mode 100644
index a1d4b81eb1a..00000000000
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/multi-module-sm-pic-a.ll
+++ /dev/null
@@ -1,10 +0,0 @@
-; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext -relocation-model=pic -code-model=small %s > /dev/null
-; XFAIL: mips, i686, i386, arm
-
-declare i32 @FB()
-
-define i32 @main() {
- %r = call i32 @FB( ) ; <i32> [#uses=1]
- ret i32 %r
-}
-
diff --git a/llvm/test/ExecutionEngine/OrcJIT/simplesttest.ll b/llvm/test/ExecutionEngine/OrcJIT/simplesttest.ll
deleted file mode 100644
index c2f24f6450a..00000000000
--- a/llvm/test/ExecutionEngine/OrcJIT/simplesttest.ll
+++ /dev/null
@@ -1,6 +0,0 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
-
-define i32 @main() {
- ret i32 0
-}
-
diff --git a/llvm/test/ExecutionEngine/OrcLazy/lit.local.cfg b/llvm/test/ExecutionEngine/OrcLazy/lit.local.cfg
new file mode 100644
index 00000000000..bf63c4f73ed
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcLazy/lit.local.cfg
@@ -0,0 +1,2 @@
+if config.root.host_arch not in ['x86_64']:
+ config.unsupported = True
diff --git a/llvm/test/ExecutionEngine/OrcLazy/trivial_retval_1.ll b/llvm/test/ExecutionEngine/OrcLazy/trivial_retval_1.ll
new file mode 100644
index 00000000000..b1234f9a44d
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcLazy/trivial_retval_1.ll
@@ -0,0 +1,25 @@
+; RUN: lli -jit-kind=orc-lazy %s; [ $? -eq 30 ]
+define i32 @baz() {
+entry:
+ ret i32 2
+}
+
+define i32 @bar() {
+entry:
+ %call = call i32 @baz()
+ %mul = mul nsw i32 3, %call
+ ret i32 %mul
+}
+
+define i32 @foo() {
+entry:
+ %call = call i32 @bar()
+ %mul = mul nsw i32 5, %call
+ ret i32 %mul
+}
+
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ %call = call i32 @foo()
+ ret i32 %call
+}
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2002-12-16-ArgTest.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2002-12-16-ArgTest.ll
index 027085519b4..e8eb6939850 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2002-12-16-ArgTest.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2002-12-16-ArgTest.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
@.LC0 = internal global [10 x i8] c"argc: %d\0A\00" ; <[10 x i8]*> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-01-04-ArgumentBug.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-04-ArgumentBug.ll
index 67425a9a3a3..2061329f252 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-01-04-ArgumentBug.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-04-ArgumentBug.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @foo(i32 %X, i32 %Y, double %A) {
%cond212 = fcmp une double %A, 1.000000e+00 ; <i1> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-01-04-LoopTest.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-04-LoopTest.ll
index cf805ea4162..a298172e678 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-01-04-LoopTest.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-04-LoopTest.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
call i32 @mylog( i32 4 ) ; <i32>:1 [#uses=0]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-01-04-PhiTest.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-04-PhiTest.ll
index b8b851966c0..a24e188438f 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-01-04-PhiTest.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-04-PhiTest.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
; <label>:0
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-01-09-SARTest.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-09-SARTest.ll
index 85b0031e61e..8f79ff2a683 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-01-09-SARTest.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-09-SARTest.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; We were accidentally inverting the signedness of right shifts. Whoops.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-01-10-FUCOM.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-10-FUCOM.ll
index 66b21c9953c..7e2ce669a7e 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-01-10-FUCOM.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-10-FUCOM.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
%X = fadd double 0.000000e+00, 1.000000e+00 ; <double> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-01-15-AlignmentTest.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-15-AlignmentTest.ll
index 1f27c1f78d5..38d5f83af03 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-01-15-AlignmentTest.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-01-15-AlignmentTest.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @bar(i8* %X) {
; pointer should be 4 byte aligned!
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-05-06-LivenessClobber.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-05-06-LivenessClobber.ll
index dbb62e0bd26..82bf97d2a92 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-05-06-LivenessClobber.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-05-06-LivenessClobber.ll
@@ -1,6 +1,6 @@
; This testcase should return with an exit code of 1.
;
-; RUN: not %lli -use-orcmcjit %s
+; RUN: not %lli -jit-kind=orc-mcjit %s
@test = global i64 0 ; <i64*> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-05-07-ArgumentTest.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-05-07-ArgumentTest.ll
index 44ead0cb4d1..43e9ec956b2 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-05-07-ArgumentTest.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-05-07-ArgumentTest.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s test
+; RUN: %lli -jit-kind=orc-mcjit %s test
declare i32 @puts(i8*)
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-05-11-PHIRegAllocBug.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-05-11-PHIRegAllocBug.ll
index 68402d9889c..47988b9c0f0 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-05-11-PHIRegAllocBug.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-05-11-PHIRegAllocBug.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
entry:
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-06-04-bzip2-bug.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-06-04-bzip2-bug.ll
index 0907993f91f..942b8362c70 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-06-04-bzip2-bug.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-06-04-bzip2-bug.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; Testcase distilled from 256.bzip2.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-06-05-PHIBug.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-06-05-PHIBug.ll
index 2eb497bed48..07bcbbde12d 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-06-05-PHIBug.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-06-05-PHIBug.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; Testcase distilled from 256.bzip2.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-08-15-AllocaAssertion.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-08-15-AllocaAssertion.ll
index 290d5a20ba5..43c26b7e1a0 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-08-15-AllocaAssertion.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-08-15-AllocaAssertion.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; This testcase failed to work because two variable sized allocas confused the
; local register allocator.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-08-21-EnvironmentTest.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-08-21-EnvironmentTest.ll
index ea4b145e469..88dd46e2d63 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-08-21-EnvironmentTest.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-08-21-EnvironmentTest.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
;
; Regression Test: EnvironmentTest.ll
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-08-23-RegisterAllocatePhysReg.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-08-23-RegisterAllocatePhysReg.ll
index bd26c38f877..fc3734f151d 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-08-23-RegisterAllocatePhysReg.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-08-23-RegisterAllocatePhysReg.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; This testcase exposes a bug in the local register allocator where it runs out
; of registers (due to too many overlapping live ranges), but then attempts to
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll
index c59ad32ee10..4e38184afe4 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
@A = global i32 0 ; <i32*> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2005-12-02-TailCallBug.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2005-12-02-TailCallBug.ll
index 7f1d3b0b6dd..aff7fce9b06 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2005-12-02-TailCallBug.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2005-12-02-TailCallBug.ll
@@ -1,5 +1,5 @@
; PR672
-; RUN: %lli -use-orcmcjit %s
+; RUN: %lli -jit-kind=orc-mcjit %s
; XFAIL: mcjit-ia32
define i32 @main() {
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2007-12-10-APIntLoadStore.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2007-12-10-APIntLoadStore.ll
index 454ae70dd23..5bad45a587b 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2007-12-10-APIntLoadStore.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2007-12-10-APIntLoadStore.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -force-interpreter %s
+; RUN: %lli -jit-kind=orc-mcjit -force-interpreter %s
; PR1836
define i32 @main() {
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2008-06-05-APInt-OverAShr.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2008-06-05-APInt-OverAShr.ll
index e29843aece4..9dc3e5bffeb 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2008-06-05-APInt-OverAShr.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2008-06-05-APInt-OverAShr.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -force-interpreter=true %s | FileCheck %s
+; RUN: %lli -jit-kind=orc-mcjit -force-interpreter=true %s | FileCheck %s
; CHECK: 1
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
diff --git a/llvm/test/ExecutionEngine/OrcJIT/2013-04-04-RelocAddend.ll b/llvm/test/ExecutionEngine/OrcMCJIT/2013-04-04-RelocAddend.ll
index 140fbed4c20..94ccf957c82 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/2013-04-04-RelocAddend.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/2013-04-04-RelocAddend.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s
+; RUN: %lli -jit-kind=orc-mcjit %s
;
; Verify relocations to global symbols with addend work correctly.
;
diff --git a/llvm/test/ExecutionEngine/OrcJIT/Inputs/cross-module-b.ll b/llvm/test/ExecutionEngine/OrcMCJIT/Inputs/cross-module-b.ll
index 68701174110..68701174110 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/Inputs/cross-module-b.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/Inputs/cross-module-b.ll
diff --git a/llvm/test/ExecutionEngine/OrcJIT/Inputs/multi-module-b.ll b/llvm/test/ExecutionEngine/OrcMCJIT/Inputs/multi-module-b.ll
index 103b601e7f0..103b601e7f0 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/Inputs/multi-module-b.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/Inputs/multi-module-b.ll
diff --git a/llvm/test/ExecutionEngine/OrcJIT/Inputs/multi-module-c.ll b/llvm/test/ExecutionEngine/OrcMCJIT/Inputs/multi-module-c.ll
index b39306be9e3..b39306be9e3 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/Inputs/multi-module-c.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/Inputs/multi-module-c.ll
diff --git a/llvm/test/ExecutionEngine/OrcJIT/Inputs/multi-module-eh-b.ll b/llvm/test/ExecutionEngine/OrcMCJIT/Inputs/multi-module-eh-b.ll
index d7dbb032b5d..d7dbb032b5d 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/Inputs/multi-module-eh-b.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/Inputs/multi-module-eh-b.ll
diff --git a/llvm/test/ExecutionEngine/OrcJIT/cross-module-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/cross-module-a.ll
index 14a73f5548c..451b2662ddf 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/cross-module-a.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/cross-module-a.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/cross-module-b.ll %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/cross-module-b.ll %s > /dev/null
declare i32 @FB()
diff --git a/llvm/test/ExecutionEngine/OrcJIT/cross-module-sm-pic-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/cross-module-sm-pic-a.ll
index 50ad1c0180f..4f5afd0ed47 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/cross-module-sm-pic-a.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/cross-module-sm-pic-a.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/cross-module-b.ll -relocation-model=pic -code-model=small %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/cross-module-b.ll -relocation-model=pic -code-model=small %s > /dev/null
; XFAIL: mips, i686, i386
declare i32 @FB()
diff --git a/llvm/test/ExecutionEngine/OrcJIT/eh-lg-pic.ll b/llvm/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll
index e5fa22c04ef..32b53c4847b 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/eh-lg-pic.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/eh-lg-pic.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -relocation-model=pic -code-model=large %s
+; RUN: %lli -jit-kind=orc-mcjit -relocation-model=pic -code-model=large %s
; XFAIL: cygwin, win32, mingw, mips, i686, i386, aarch64, arm, asan, msan
declare i8* @__cxa_allocate_exception(i64)
declare void @__cxa_throw(i8*, i8*, i8*)
diff --git a/llvm/test/ExecutionEngine/OrcJIT/eh-sm-pic.ll b/llvm/test/ExecutionEngine/OrcMCJIT/eh-sm-pic.ll
index f22cea90f15..a54795ead56 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/eh-sm-pic.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/eh-sm-pic.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -relocation-model=pic -code-model=small %s
+; RUN: %lli -jit-kind=orc-mcjit -relocation-model=pic -code-model=small %s
; XFAIL: cygwin, win32, mingw, mips, i686, i386, darwin, aarch64, arm, asan, msan
declare i8* @__cxa_allocate_exception(i64)
declare void @__cxa_throw(i8*, i8*, i8*)
diff --git a/llvm/test/ExecutionEngine/OrcJIT/eh.ll b/llvm/test/ExecutionEngine/OrcMCJIT/eh.ll
index 130146ba766..2de6a517b2b 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/eh.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/eh.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s
+; RUN: %lli -jit-kind=orc-mcjit %s
; XFAIL: arm, cygwin, win32, mingw, asan, msan
declare i8* @__cxa_allocate_exception(i64)
declare void @__cxa_throw(i8*, i8*, i8*)
diff --git a/llvm/test/ExecutionEngine/OrcJIT/fpbitcast.ll b/llvm/test/ExecutionEngine/OrcMCJIT/fpbitcast.ll
index 3f074f80883..767b58016c6 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/fpbitcast.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/fpbitcast.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -force-interpreter=true %s | FileCheck %s
+; RUN: %lli -jit-kind=orc-mcjit -force-interpreter=true %s | FileCheck %s
; CHECK: 40091eb8
define i32 @test(double %x) {
diff --git a/llvm/test/ExecutionEngine/OrcJIT/hello-sm-pic.ll b/llvm/test/ExecutionEngine/OrcMCJIT/hello-sm-pic.ll
index 52c91d5dcc4..59b47afadb1 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/hello-sm-pic.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/hello-sm-pic.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -relocation-model=pic -code-model=small %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit -relocation-model=pic -code-model=small %s > /dev/null
; XFAIL: mips, i686, i386, darwin, aarch64, arm
@.LC0 = internal global [12 x i8] c"Hello World\00" ; <[12 x i8]*> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/hello.ll b/llvm/test/ExecutionEngine/OrcMCJIT/hello.ll
index c315a157a0c..08413c2b582 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/hello.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/hello.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
@.LC0 = internal global [12 x i8] c"Hello World\00" ; <[12 x i8]*> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/hello2.ll b/llvm/test/ExecutionEngine/OrcMCJIT/hello2.ll
index 9e7cf5b9af8..8f071cd34a4 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/hello2.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/hello2.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
@X = global i32 7 ; <i32*> [#uses=0]
@msg = internal global [13 x i8] c"Hello World\0A\00" ; <[13 x i8]*> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/lit.local.cfg b/llvm/test/ExecutionEngine/OrcMCJIT/lit.local.cfg
index f9814035773..f9814035773 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/lit.local.cfg
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/lit.local.cfg
diff --git a/llvm/test/ExecutionEngine/OrcJIT/load-object-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/load-object-a.ll
index 0b9509c3c88..abd470df547 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/load-object-a.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/load-object-a.ll
@@ -1,20 +1,20 @@
; This first line will generate the .o files for the next run line
; RUN: rm -rf %t.cachedir %t.cachedir2 %t.cachedir3
; RUN: mkdir -p %t.cachedir %t.cachedir2 %t.cachedir3
-; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -enable-cache-manager -object-cache-dir=%t.cachedir %s
+; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -enable-cache-manager -object-cache-dir=%t.cachedir %s
; Collect generated objects.
; RUN: find %t.cachedir -type f -name 'multi-module-?.o' -exec mv -v '{}' %t.cachedir2 ';'
; This line tests MCJIT object loading
-; RUN: %lli -use-orcmcjit -extra-object=%t.cachedir2/multi-module-b.o -extra-object=%t.cachedir2/multi-module-c.o %s
+; RUN: %lli -jit-kind=orc-mcjit -extra-object=%t.cachedir2/multi-module-b.o -extra-object=%t.cachedir2/multi-module-c.o %s
; These lines put the object files into an archive
; RUN: llvm-ar r %t.cachedir3/load-object.a %t.cachedir2/multi-module-b.o
; RUN: llvm-ar r %t.cachedir3/load-object.a %t.cachedir2/multi-module-c.o
; This line test MCJIT archive loading
-; RUN: %lli -use-orcmcjit -extra-archive=%t.cachedir3/load-object.a %s
+; RUN: %lli -jit-kind=orc-mcjit -extra-archive=%t.cachedir3/load-object.a %s
declare i32 @FB()
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-a.ll
new file mode 100644
index 00000000000..d622efca03e
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-a.ll
@@ -0,0 +1,9 @@
+; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll %s > /dev/null
+
+declare i32 @FB()
+
+define i32 @main() {
+ %r = call i32 @FB( ) ; <i32> [#uses=1]
+ ret i32 %r
+}
+
diff --git a/llvm/test/ExecutionEngine/OrcJIT/multi-module-eh-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll
index 6117e4c9646..f77cb44a878 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/multi-module-eh-a.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-eh-a.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -extra-module=%p/Inputs/multi-module-eh-b.ll %s
+; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/multi-module-eh-b.ll %s
; XFAIL: arm, cygwin, win32, mingw, asan, msan
declare i8* @__cxa_allocate_exception(i64)
declare void @__cxa_throw(i8*, i8*, i8*)
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-sm-pic-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-sm-pic-a.ll
new file mode 100644
index 00000000000..80b8e163d5d
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/multi-module-sm-pic-a.ll
@@ -0,0 +1,10 @@
+; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -relocation-model=pic -code-model=small %s > /dev/null
+; XFAIL: mips, i686, i386
+
+declare i32 @FB()
+
+define i32 @main() {
+ %r = call i32 @FB( ) ; <i32> [#uses=1]
+ ret i32 %r
+}
+
diff --git a/llvm/test/ExecutionEngine/OrcJIT/non-extern-addend.ll b/llvm/test/ExecutionEngine/OrcMCJIT/non-extern-addend.ll
index d768e2b7fab..bb2f7e4d325 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/non-extern-addend.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/non-extern-addend.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @foo(i32 %x, i32 %y, double %d) {
entry:
diff --git a/llvm/test/ExecutionEngine/OrcJIT/pr13727.ll b/llvm/test/ExecutionEngine/OrcMCJIT/pr13727.ll
index 163fa798ae3..a48c573ba28 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/pr13727.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/pr13727.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -O0 -disable-lazy-compilation=false %s
+; RUN: %lli -jit-kind=orc-mcjit -O0 -disable-lazy-compilation=false %s
; The intention of this test is to verify that symbols mapped to COMMON in ELF
; work as expected.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/Inputs/cross-module-b.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/Inputs/cross-module-b.ll
index bc13b1de8ef..bc13b1de8ef 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/Inputs/cross-module-b.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/Inputs/cross-module-b.ll
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-b.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/Inputs/multi-module-b.ll
index 0b8d5eb37ad..0b8d5eb37ad 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-b.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/Inputs/multi-module-b.ll
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-c.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/Inputs/multi-module-c.ll
index 98350a8c106..98350a8c106 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/Inputs/multi-module-c.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/Inputs/multi-module-c.ll
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/remote/cross-module-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/cross-module-a.ll
new file mode 100644
index 00000000000..16553ebd2ad
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/cross-module-a.ll
@@ -0,0 +1,12 @@
+; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
+
+declare i32 @FB()
+
+define i32 @FA() nounwind {
+ ret i32 0
+}
+
+define i32 @main() nounwind {
+ %r = call i32 @FB( ) ; <i32> [#uses=1]
+ ret i32 %r
+}
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/remote/cross-module-sm-pic-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/cross-module-sm-pic-a.ll
new file mode 100644
index 00000000000..c8979043857
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/cross-module-sm-pic-a.ll
@@ -0,0 +1,14 @@
+; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/cross-module-b.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext -relocation-model=pic -code-model=small %s > /dev/null
+; XFAIL: mips, i686, i386, arm
+
+declare i32 @FB()
+
+define i32 @FA() {
+ ret i32 0
+}
+
+define i32 @main() {
+ %r = call i32 @FB( ) ; <i32> [#uses=1]
+ ret i32 %r
+}
+
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/lit.local.cfg b/llvm/test/ExecutionEngine/OrcMCJIT/remote/lit.local.cfg
index 625d82dc618..625d82dc618 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/lit.local.cfg
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/lit.local.cfg
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/remote/multi-module-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/multi-module-a.ll
new file mode 100644
index 00000000000..aa343486230
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/multi-module-a.ll
@@ -0,0 +1,9 @@
+; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
+
+declare i32 @FB()
+
+define i32 @main() nounwind {
+ %r = call i32 @FB( ) ; <i32> [#uses=1]
+ ret i32 %r
+}
+
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/remote/multi-module-sm-pic-a.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/multi-module-sm-pic-a.ll
new file mode 100644
index 00000000000..41812d25169
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/multi-module-sm-pic-a.ll
@@ -0,0 +1,10 @@
+; RUN: %lli -jit-kind=orc-mcjit -extra-module=%p/Inputs/multi-module-b.ll -extra-module=%p/Inputs/multi-module-c.ll -disable-lazy-compilation=true -remote-mcjit -mcjit-remote-process=lli-child-target%exeext -relocation-model=pic -code-model=small %s > /dev/null
+; XFAIL: mips, i686, i386, arm
+
+declare i32 @FB()
+
+define i32 @main() {
+ %r = call i32 @FB( ) ; <i32> [#uses=1]
+ ret i32 %r
+}
+
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/simpletest-remote.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/simpletest-remote.ll
index 3ef929bc9e9..45e11fce5a6 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/simpletest-remote.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/simpletest-remote.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
define i32 @bar() nounwind {
ret i32 0
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/stubs-remote.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/stubs-remote.ll
index 895e0d9de2f..aeff011d5ed 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/stubs-remote.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/stubs-remote.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -remote-mcjit -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target%exeext %s
+; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target%exeext %s
; XFAIL: *
; This test should fail until remote symbol resolution is supported.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/stubs-sm-pic.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/stubs-sm-pic.ll
index ef1e5ef003f..a67edba1d23 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/stubs-sm-pic.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/stubs-sm-pic.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -remote-mcjit -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s
+; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s
; XFAIL: *
; This function should fail until remote symbol resolution is supported.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/test-common-symbols-remote.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-common-symbols-remote.ll
index 444339550ae..7e4dc056027 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/test-common-symbols-remote.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-common-symbols-remote.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -remote-mcjit -O0 -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target%exeext %s
+; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -O0 -disable-lazy-compilation=false -mcjit-remote-process=lli-child-target%exeext %s
; The intention of this test is to verify that symbols mapped to COMMON in ELF
; work as expected.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/test-data-align-remote.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-data-align-remote.ll
index 768729b0999..95c9b825a8d 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/test-data-align-remote.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-data-align-remote.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target%exeext %s
+; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target%exeext %s
; Check that a variable is always aligned as specified.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/test-fp-no-external-funcs-remote.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-fp-no-external-funcs-remote.ll
index 5c1be7669c6..28671033884 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/test-fp-no-external-funcs-remote.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-fp-no-external-funcs-remote.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
define double @test(double* %DP, double %Arg) nounwind {
%D = load double, double* %DP ; <double> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-remote.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-global-init-nonzero-remote.ll
index 683263dee3b..5dabb8f44d6 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-remote.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-global-init-nonzero-remote.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s > /dev/null
@count = global i32 1, align 4
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-sm-pic.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-global-init-nonzero-sm-pic.ll
index 251cef40c52..ec9e1ae1a03 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/test-global-init-nonzero-sm-pic.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-global-init-nonzero-sm-pic.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -remote-mcjit -relocation-model=pic -code-model=small %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -relocation-model=pic -code-model=small %s > /dev/null
; XFAIL: mips, aarch64, arm, i686, i386
@count = global i32 1, align 4
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-remote.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-ptr-reloc-remote.ll
index d9fb5de225c..aa07db9f512 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-remote.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-ptr-reloc-remote.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target%exeext %s
+; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -O0 -mcjit-remote-process=lli-child-target%exeext %s
@.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1
@ptr = global i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), align 4
diff --git a/llvm/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-sm-pic.ll b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-ptr-reloc-sm-pic.ll
index 34cd3d5ebdd..61321ac1b94 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/remote/test-ptr-reloc-sm-pic.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/remote/test-ptr-reloc-sm-pic.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -remote-mcjit -O0 -relocation-model=pic -code-model=small %s
+; RUN: %lli -jit-kind=orc-mcjit -remote-mcjit -O0 -relocation-model=pic -code-model=small %s
; XFAIL: mips, aarch64, arm, i686, i386
@.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1
diff --git a/llvm/test/ExecutionEngine/OrcMCJIT/simplesttest.ll b/llvm/test/ExecutionEngine/OrcMCJIT/simplesttest.ll
new file mode 100644
index 00000000000..4a47131ada2
--- /dev/null
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/simplesttest.ll
@@ -0,0 +1,6 @@
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
+
+define i32 @main() {
+ ret i32 0
+}
+
diff --git a/llvm/test/ExecutionEngine/OrcJIT/simpletest.ll b/llvm/test/ExecutionEngine/OrcMCJIT/simpletest.ll
index e99f615658e..be1148be8a5 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/simpletest.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/simpletest.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @bar() {
ret i32 0
diff --git a/llvm/test/ExecutionEngine/OrcJIT/stubs-sm-pic.ll b/llvm/test/ExecutionEngine/OrcMCJIT/stubs-sm-pic.ll
index 73c265f35de..f354a0de093 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/stubs-sm-pic.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/stubs-sm-pic.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s
+; RUN: %lli -jit-kind=orc-mcjit -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s
; XFAIL: mips, i686, i386, aarch64, arm
define i32 @main() nounwind {
diff --git a/llvm/test/ExecutionEngine/OrcJIT/stubs.ll b/llvm/test/ExecutionEngine/OrcMCJIT/stubs.ll
index 66d0762b8fd..c096f5fd7e7 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/stubs.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/stubs.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -disable-lazy-compilation=false %s
+; RUN: %lli -jit-kind=orc-mcjit -disable-lazy-compilation=false %s
define i32 @main() nounwind {
entry:
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-arith.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-arith.ll
index b66256742d6..c4331bf7327 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-arith.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-arith.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
%A = add i8 0, 12 ; <i8> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-branch.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-branch.ll
index b66cfafeb5d..b3ef86a193e 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-branch.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-branch.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; test unconditional branch
define i32 @main() {
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-call-no-external-funcs.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-call-no-external-funcs.ll
index c536efec5c4..78c6a1bb2f9 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-call-no-external-funcs.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-call-no-external-funcs.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @_Z14func_exit_codev() nounwind uwtable {
entry:
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-call.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-call.ll
index 8f50bdc9742..5345856f565 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-call.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-call.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
declare void @exit(i32)
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-cast.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-cast.ll
index 4efd76057fc..f1a521f3b62 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-cast.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-cast.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @foo() {
ret i32 0
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-common-symbols-alignment.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-common-symbols-alignment.ll
index d48e05764c3..cfbd2761a37 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-common-symbols-alignment.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-common-symbols-alignment.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -O0 %s
+; RUN: %lli -jit-kind=orc-mcjit -O0 %s
; This test checks that common symbols have been allocated addresses honouring
; the alignment requirement.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-common-symbols.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-common-symbols.ll
index 5ebdd8d4fbc..db3c0471a8e 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-common-symbols.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-common-symbols.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -O0 -disable-lazy-compilation=false %s
+; RUN: %lli -jit-kind=orc-mcjit -O0 -disable-lazy-compilation=false %s
; The intention of this test is to verify that symbols mapped to COMMON in ELF
; work as expected.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-constantexpr.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-constantexpr.ll
index 380848c936f..9a147c2fc1a 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-constantexpr.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-constantexpr.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; This tests to make sure that we can evaluate weird constant expressions
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-data-align.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-data-align.ll
index f76dda9fbeb..f0deb56d52d 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-data-align.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-data-align.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -O0 %s
+; RUN: %lli -jit-kind=orc-mcjit -O0 %s
; Check that a variable is always aligned as specified.
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-fp-no-external-funcs.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-fp-no-external-funcs.ll
index 3a88a7da8c0..2baadcde4b1 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-fp-no-external-funcs.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-fp-no-external-funcs.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define double @test(double* %DP, double %Arg) {
%D = load double, double* %DP ; <double> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-fp.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-fp.ll
index 6129f7ee798..6d56e69a997 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-fp.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-fp.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define double @test(double* %DP, double %Arg) {
%D = load double, double* %DP ; <double> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-global-ctors.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-global-ctors.ll
index da911d9f4bf..d66efc27fb4 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-global-ctors.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-global-ctors.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; XFAIL: darwin
@var = global i32 1, align 4
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @ctor_func }]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-global-init-nonzero-sm-pic.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-global-init-nonzero-sm-pic.ll
index 158d64f51e0..7f66aec7707 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-global-init-nonzero-sm-pic.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-global-init-nonzero-sm-pic.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -relocation-model=pic -code-model=small %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit -relocation-model=pic -code-model=small %s > /dev/null
; XFAIL: mips, aarch64, arm, i686, i386
@count = global i32 1, align 4
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-global-init-nonzero.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-global-init-nonzero.ll
index 0fcf8f9ff21..f8d43bffb8b 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-global-init-nonzero.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-global-init-nonzero.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
@count = global i32 1, align 4
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-global.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-global.ll
index 96036e02783..3e42caee12c 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-global.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-global.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
@count = global i32 0, align 4
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-loadstore.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-loadstore.ll
index 9c298f45b4c..d95d61a067f 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-loadstore.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-loadstore.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define void @test(i8* %P, i16* %P.upgrd.1, i32* %P.upgrd.2, i64* %P.upgrd.3) {
%V = load i8, i8* %P ; <i8> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-local.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-local.ll
index 5a08e47598b..1e63d9f231f 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-local.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-local.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() nounwind uwtable {
entry:
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-logical.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-logical.ll
index aa8e5def010..9d53ac96e2f 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-logical.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-logical.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
%A = and i8 4, 8 ; <i8> [#uses=2]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-loop.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-loop.ll
index 5cb93530bb1..dfb62d355e0 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-loop.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-loop.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
; <label>:0
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-phi.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-phi.ll
index 880a9169c62..70bf8c82d44 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-phi.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-phi.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; test phi node
@Y = global i32 6 ; <i32*> [#uses=1]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-ptr-reloc-sm-pic.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-ptr-reloc-sm-pic.ll
index 057fc0d620b..6e0a425623b 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-ptr-reloc-sm-pic.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-ptr-reloc-sm-pic.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -O0 -relocation-model=pic -code-model=small %s
+; RUN: %lli -jit-kind=orc-mcjit -O0 -relocation-model=pic -code-model=small %s
; XFAIL: mips, aarch64, arm, i686, i386
@.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-ptr-reloc.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-ptr-reloc.ll
index 014fa9dcafb..a3846aa26e4 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-ptr-reloc.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-ptr-reloc.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit -O0 %s
+; RUN: %lli -jit-kind=orc-mcjit -O0 %s
@.str = private unnamed_addr constant [6 x i8] c"data1\00", align 1
@ptr = global i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), align 4
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-ret.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-ret.ll
index 71ff45246d1..000bea02e97 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-ret.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-ret.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; test return instructions
define void @test1() {
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-return.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-return.ll
index 07e74b060b8..f7a1cdda070 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-return.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-return.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() nounwind uwtable {
entry:
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-setcond-fp.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-setcond-fp.ll
index d708b90cef0..8514c8df820 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-setcond-fp.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-setcond-fp.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-setcond-int.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-setcond-int.ll
index b801d97e822..2f63d0bbef3 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-setcond-int.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-setcond-int.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
%int1 = add i32 0, 0 ; <i32> [#uses=6]
diff --git a/llvm/test/ExecutionEngine/OrcJIT/test-shift.ll b/llvm/test/ExecutionEngine/OrcMCJIT/test-shift.ll
index 500987c8b65..2d064211cf5 100644
--- a/llvm/test/ExecutionEngine/OrcJIT/test-shift.ll
+++ b/llvm/test/ExecutionEngine/OrcMCJIT/test-shift.ll
@@ -1,4 +1,4 @@
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
%shamt = add i8 0, 1 ; <i8> [#uses=8]
diff --git a/llvm/tools/lli/CMakeLists.txt b/llvm/tools/lli/CMakeLists.txt
index 60c731b6b0c..f98275b5fe6 100644
--- a/llvm/tools/lli/CMakeLists.txt
+++ b/llvm/tools/lli/CMakeLists.txt
@@ -35,6 +35,7 @@ endif( LLVM_USE_INTEL_JITEVENTS )
add_llvm_tool(lli
lli.cpp
+ OrcLazyJIT.cpp
RemoteMemoryManager.cpp
RemoteTarget.cpp
RemoteTargetExternal.cpp
diff --git a/llvm/tools/lli/OrcLazyJIT.cpp b/llvm/tools/lli/OrcLazyJIT.cpp
new file mode 100644
index 00000000000..4a8d3b9e3ed
--- /dev/null
+++ b/llvm/tools/lli/OrcLazyJIT.cpp
@@ -0,0 +1,53 @@
+//===------ OrcLazyJIT.cpp - Basic Orc-based JIT for lazy execution -------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "OrcLazyJIT.h"
+#include "llvm/ExecutionEngine/Orc/OrcTargetSupport.h"
+
+using namespace llvm;
+
+std::unique_ptr<OrcLazyJIT::CompileCallbackMgr>
+OrcLazyJIT::createCallbackMgr(Triple T, LLVMContext &Context) {
+ switch (T.getArch()) {
+ default:
+ // Flag error.
+ Error = true;
+ return nullptr;
+
+ case Triple::x86_64: {
+ typedef orc::JITCompileCallbackManager<CompileLayerT,
+ orc::OrcX86_64> CCMgrT;
+ return make_unique<CCMgrT>(CompileLayer, Context, 0, 64);
+ }
+ }
+}
+
+int llvm::runOrcLazyJIT(std::unique_ptr<Module> M, int ArgC, char* ArgV[]) {
+ OrcLazyJIT J(std::unique_ptr<TargetMachine>(EngineBuilder().selectTarget()),
+ getGlobalContext());
+
+ if (!J.Ok()) {
+ errs() << "Could not construct JIT.\n";
+ return 1;
+ }
+
+ auto MainHandle = J.addModule(std::move(M));
+ auto MainSym = J.findSymbolIn(MainHandle, "main");
+
+ if (!MainSym) {
+ errs() << "Could not find main function.\n";
+ return 1;
+ }
+
+ typedef int (*MainFnPtr)(int, char*[]);
+ auto Main = reinterpret_cast<MainFnPtr>(
+ static_cast<uintptr_t>(MainSym.getAddress()));
+
+ return Main(ArgC, ArgV);
+}
diff --git a/llvm/tools/lli/OrcLazyJIT.h b/llvm/tools/lli/OrcLazyJIT.h
new file mode 100644
index 00000000000..577c171697b
--- /dev/null
+++ b/llvm/tools/lli/OrcLazyJIT.h
@@ -0,0 +1,97 @@
+//===--- OrcLazyJIT.h - Basic Orc-based JIT for lazy execution --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Simple Orc-based JIT. Uses the compile-on-demand layer to break up and
+// lazily compile modules.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLI_ORCLAZYJIT_H
+#define LLVM_TOOLS_LLI_ORCLAZYJIT_H
+
+#include "llvm/ADT/Triple.h"
+#include "llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h"
+#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
+#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
+#include "llvm/ExecutionEngine/Orc/LazyEmittingLayer.h"
+#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
+#include "llvm/IR/LLVMContext.h"
+
+namespace llvm {
+
+class OrcLazyJIT {
+public:
+
+ typedef orc::JITCompileCallbackManagerBase CompileCallbackMgr;
+ typedef orc::ObjectLinkingLayer<> ObjLayerT;
+ typedef orc::IRCompileLayer<ObjLayerT> CompileLayerT;
+ typedef orc::LazyEmittingLayer<CompileLayerT> LazyEmitLayerT;
+ typedef orc::CompileOnDemandLayer<LazyEmitLayerT,
+ CompileCallbackMgr> CODLayerT;
+ typedef typename CODLayerT::ModuleSetHandleT ModuleHandleT;
+
+ OrcLazyJIT(std::unique_ptr<TargetMachine> TM, LLVMContext &Context)
+ : Error(false), TM(std::move(TM)),
+ Mang(this->TM->getDataLayout()),
+ ObjectLayer([](){ return llvm::make_unique<SectionMemoryManager>(); }),
+ CompileLayer(ObjectLayer, orc::SimpleCompiler(*this->TM)),
+ LazyEmitLayer(CompileLayer),
+ CCMgr(createCallbackMgr(Triple(this->TM->getTargetTriple()), Context)),
+ CODLayer(LazyEmitLayer, *CCMgr) { }
+
+ bool Ok() const { return !Error; }
+
+ ModuleHandleT addModule(std::unique_ptr<Module> M) {
+ // Attach a data-layout if one isn't already present.
+ if (M->getDataLayout().isDefault())
+ M->setDataLayout(*TM->getDataLayout());
+
+ std::vector<std::unique_ptr<Module>> S;
+ S.push_back(std::move(M));
+ return CODLayer.addModuleSet(std::move(S));
+ }
+
+ orc::JITSymbol findSymbol(const std::string &Name) {
+ return CODLayer.findSymbol(mangle(Name), true);
+ }
+
+ orc::JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name) {
+ return CODLayer.findSymbolIn(H, mangle(Name), true);
+ }
+
+private:
+
+ std::unique_ptr<CompileCallbackMgr>
+ createCallbackMgr(Triple T, LLVMContext &Context);
+
+ std::string mangle(const std::string &Name) {
+ std::string MangledName;
+ {
+ raw_string_ostream MangledNameStream(MangledName);
+ Mang.getNameWithPrefix(MangledNameStream, Name);
+ }
+ return MangledName;
+ }
+
+ bool Error;
+ std::unique_ptr<TargetMachine> TM;
+ Mangler Mang;
+
+ ObjLayerT ObjectLayer;
+ CompileLayerT CompileLayer;
+ LazyEmitLayerT LazyEmitLayer;
+ std::unique_ptr<CompileCallbackMgr> CCMgr;
+ CODLayerT CODLayer;
+};
+
+int runOrcLazyJIT(std::unique_ptr<Module> M, int ArgC, char* ArgV[]);
+
+} // end namespace llvm
+
+#endif
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index cc8117d6e7a..47ce2c0ac34 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -14,6 +14,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/IR/LLVMContext.h"
+#include "OrcLazyJIT.h"
#include "RemoteMemoryManager.h"
#include "RemoteTarget.h"
#include "RemoteTargetExternal.h"
@@ -66,6 +67,9 @@ using namespace llvm;
#define DEBUG_TYPE "lli"
namespace {
+
+ enum class JITKind { MCJIT, OrcMCJITReplacement, OrcLazy };
+
cl::opt<std::string>
InputFile(cl::desc("<input bitcode>"), cl::Positional, cl::init("-"));
@@ -76,12 +80,19 @@ namespace {
cl::desc("Force interpretation: disable JIT"),
cl::init(false));
- cl::opt<bool> UseOrcMCJITReplacement("use-orcmcjit",
- cl::desc("Use the experimental "
- "OrcMCJITReplacement as a "
- "drop-in replacement for "
- "MCJIT."),
- cl::init(false));
+ cl::opt<JITKind> UseJITKind("jit-kind",
+ cl::desc("Choose underlying JIT kind."),
+ cl::init(JITKind::MCJIT),
+ cl::values(
+ clEnumValN(JITKind::MCJIT, "mcjit",
+ "MCJIT"),
+ clEnumValN(JITKind::OrcMCJITReplacement,
+ "orc-mcjit",
+ "Orc-based MCJIT replacement"),
+ clEnumValN(JITKind::OrcLazy,
+ "orc-lazy",
+ "Orc-based lazy JIT."),
+ clEnumValEnd));
// The MCJIT supports building for a target address space separate from
// the JIT compilation process. Use a forked process and a copying
@@ -404,6 +415,9 @@ int main(int argc, char **argv, char * const *envp) {
return 1;
}
+ if (UseJITKind == JITKind::OrcLazy)
+ return runOrcLazyJIT(std::move(Owner), argc, argv);
+
if (EnableCacheManager) {
std::string CacheName("file:");
CacheName.append(InputFile);
@@ -430,7 +444,7 @@ int main(int argc, char **argv, char * const *envp) {
builder.setEngineKind(ForceInterpreter
? EngineKind::Interpreter
: EngineKind::JIT);
- builder.setUseOrcMCJITReplacement(UseOrcMCJITReplacement);
+ builder.setUseOrcMCJITReplacement(UseJITKind == JITKind::OrcMCJITReplacement);
// If we are supposed to override the target triple, do so now.
if (!TargetTriple.empty())