I’m writing an application that generates LLVM byte code and executes it at runtime. The options I’m looking at are to use the LLVM ExecutionEngine for JIT execution, or to write an assembly file, link it as a DLL using gcc/mingw, and load the DLL. It has to work on Linux and Windows.
I’ve been testing it on Windows, and found that the JIT execution, and executing functions from a DLL are equally fast. Can anyone explain why? When I test JIT, I don’t have MinGW’s GCC in the path, so I wouldn’t expect it to be compiling to native code.
Regards,
Michael Smith
I’m writing an application that generates LLVM byte code and executes it at
runtime. The options I’m looking at are to use the LLVM ExecutionEngine for
JIT execution, or to write an assembly file, link it as a DLL using
gcc/mingw, and load the DLL. It has to work on Linux and Windows.
I’ve been testing it on Windows, and found that the JIT execution, and
executing functions from a DLL are equally fast. Can anyone explain why?
When I test JIT, I don’t have MinGW’s GCC in the path, so I wouldn’t expect
it to be compiling to native code.
Why?
LLVM does not require an external application to compile to native code.
The JIT is in fact compiling to native code.
My understanding was that compiling directly to native code wasn't supported on Windows yet. At least Clang seems to require having GCC in the path on Windows.
Hello Michael,
That's for the final linkage. Since the JIT does linking at the bitcode level, it doesn't need to access an external linker AFAIK.
--Sam
From: Michael Smith <Michael.Smith@synopsys.com>
To: Daniel Berlin <dberlin@dberlin.org>
Cc: "llvmdev@cs.uiuc.edu" <llvmdev@cs.uiuc.edu>
Sent: Tue, May 11, 2010 6:49:52 PM
Subject: Re: [LLVMdev] Machine Code, JIT, and Windows
My understanding was that compiling directly to native code wasn't supported on
Windows yet. At least Clang seems to require having GCC in the path on
Windows.
ymailto="mailto:dberlin@dberlin.org"
href="mailto:dberlin@dberlin.org">dberlin@dberlin.org]
Sent: Tuesday,
May 11, 2010 4:14 PM
Cc:
ymailto="mailto:llvmdev@cs.uiuc.edu"
href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu
[LLVMdev] Machine Code, JIT, and Windows
I'm writing an application that generates LLVM byte code and
executes it at
runtime. The options I'm looking at are to use the LLVM
ExecutionEngine for
JIT execution, or to write an assembly file, link it
as a DLL using
gcc/mingw, and load the DLL. It has to work on Linux and
Windows.
I've been testing it on Windows, and
found that the JIT execution, and
executing functions from a DLL are
equally fast. Can anyone explain why?
When I test JIT, I don't have
MinGW's GCC in the path, so I wouldn't expect
it to be compiling to
native code.
Why?
LLVM does not require an external application to
compile to native code.
The JIT is in fact compiling to native
Before MC, which changes this, LLVM didn't have the ability to
assemble its own output into an object file. There is a special code
path for the JIT, though, which allows the JIT to encode instructions
in memory. It's the difference between being able to make "native
code" and being able to make an object file or executable.
The plan for the future (maybe this summer?) is to switch the JIT over
to the new MC-based instruction encoders.
Reid
Reid Kleckner <rnk@mit.edu> writes:
[snip]
The plan for the future (maybe this summer?) is to switch the JIT over
to the new MC-based instruction encoders.
Would this change something on the performance of the JIT? (the time it
requires for creating the native code)