/// 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;
}
+++ /dev/null
-; 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
-}
-
+++ /dev/null
-; 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
-}
-
+++ /dev/null
-; 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
-}
+++ /dev/null
-; 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
-}
-
+++ /dev/null
-; 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
-}
-
+++ /dev/null
-; 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
-}
-
+++ /dev/null
-; RUN: %lli -use-orcmcjit %s > /dev/null
-
-define i32 @main() {
- ret i32 0
-}
-
--- /dev/null
+if config.root.host_arch not in ['x86_64']:
+ config.unsupported = True
--- /dev/null
+; 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
+}
-; 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]
-; 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]
-; 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]
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
; <label>:0
-; 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.
-; 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]
-; 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!
; 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]
-; RUN: %lli -use-orcmcjit %s test
+; RUN: %lli -jit-kind=orc-mcjit %s test
declare i32 @puts(i8*)
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
entry:
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; Testcase distilled from 256.bzip2.
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; Testcase distilled from 256.bzip2.
-; 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.
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
;
; Regression Test: EnvironmentTest.ll
-; 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
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
@A = global i32 0 ; <i32*> [#uses=1]
; PR672
-; RUN: %lli -use-orcmcjit %s
+; RUN: %lli -jit-kind=orc-mcjit %s
; XFAIL: mcjit-ia32
define i32 @main() {
-; RUN: %lli -use-orcmcjit -force-interpreter %s
+; RUN: %lli -jit-kind=orc-mcjit -force-interpreter %s
; PR1836
define i32 @main() {
-; 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"
-; RUN: %lli -use-orcmcjit %s
+; RUN: %lli -jit-kind=orc-mcjit %s
;
; Verify relocations to global symbols with addend work correctly.
;
-; 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()
-; 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()
-; 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*)
-; 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*)
-; 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*)
-; 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) {
-; 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]
-; 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]
-; 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]
; 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()
--- /dev/null
+; 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
+}
+
-; 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*)
--- /dev/null
+; 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
+}
+
-; 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:
-; 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.
--- /dev/null
+; 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
+}
--- /dev/null
+; 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
+}
+
--- /dev/null
+; 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
+}
+
--- /dev/null
+; 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
+}
+
-; 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
-; 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.
-; 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.
-; 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.
-; 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.
-; 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]
-; 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
-; 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
-; 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
-; 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
--- /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
+
+define i32 @main() {
+ ret i32 0
+}
+
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @bar() {
ret i32 0
-; 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 {
-; 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:
-; 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]
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; test unconditional branch
define i32 @main() {
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @_Z14func_exit_codev() nounwind uwtable {
entry:
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
declare void @exit(i32)
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @foo() {
ret i32 0
-; 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.
-; 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.
-; 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
-; RUN: %lli -use-orcmcjit -O0 %s
+; RUN: %lli -jit-kind=orc-mcjit -O0 %s
; Check that a variable is always aligned as specified.
-; 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]
-; 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]
-; 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 }]
-; 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
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
@count = global i32 1, align 4
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
@count = global i32 0, align 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]
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() nounwind uwtable {
entry:
-; 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]
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
; <label>:0
-; 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]
-; 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
-; 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
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
; test return instructions
define void @test1() {
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() nounwind uwtable {
entry:
-; RUN: %lli -use-orcmcjit %s > /dev/null
+; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
define i32 @main() {
-; 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]
-; 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]
add_llvm_tool(lli
lli.cpp
+ OrcLazyJIT.cpp
RemoteMemoryManager.cpp
RemoteTarget.cpp
RemoteTargetExternal.cpp
--- /dev/null
+//===------ 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);
+}
--- /dev/null
+//===--- 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
//===----------------------------------------------------------------------===//
#include "llvm/IR/LLVMContext.h"
+#include "OrcLazyJIT.h"
#include "RemoteMemoryManager.h"
#include "RemoteTarget.h"
#include "RemoteTargetExternal.h"
#define DEBUG_TYPE "lli"
namespace {
+
+ enum class JITKind { MCJIT, OrcMCJITReplacement, OrcLazy };
+
cl::opt<std::string>
InputFile(cl::desc("<input bitcode>"), cl::Positional, cl::init("-"));
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
return 1;
}
+ if (UseJITKind == JITKind::OrcLazy)
+ return runOrcLazyJIT(std::move(Owner), argc, argv);
+
if (EnableCacheManager) {
std::string CacheName("file:");
CacheName.append(InputFile);
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())