[LLVMdev] Instantiating a JIT on win64
Charles Davis
cdavis at mymail.mines.edu
Tue Jun 21 14:28:10 PDT 2011
On 6/21/11 3:13 PM, Nicholas Lester wrote:
> hi all,
>
> I'm trying to write an LLVM-based interpreter for a small DSL that we
> have. The language is very simple (essentially a calculator), but I'd
> like it to execute efficiently. I've been following the tutorial, and
> have the following code for instantiating an ExecutionEngine:
>
> #include <LLVM\ExecutionEngine\JIT.h>
> #include <LLVM\ExecutionEngine\Interpreter.h>
>
> // ...
>
> std::string builderErr;
> llvm::EngineBuilder engineBuilder(&m_state.GetModule());
> engineBuilder.setErrorStr(&builderErr);
> m_engine = engineBuilder.create();
>
> Unfortunately, i can't seem to instantiate a JIT. I can get into the
> JIT::createJIT function, but i then fail to find an appropriate JIT for
> my architecture (which is actually X86_64-win64, via visual c++
> compilation. I also had to fiddle around to get LLVM 2.9 to compile
> under the custom build system I'm working with). The JIT::selectTarget
> call infers a triple of "x86_64-pc-win32", which then fails to find a
> target machine. Interestingly, the TargetRegistry appears to be empty,
> which doesn't seem right (maybe i haven't linked in a library that
> populates this?). I also tried specifying MCPU as "X86_64"/"X86" and
> MArch as "win64"/"w64"/"win32" using EngineBuilder functions, which
> didn't help.
Did you link to the libraries that live in lib\Target\X86? Specifically,
you need LLVMX86Info, which populates the TargetRegistry with the x86
and x86_64 targets. You should also link to LLVMX86AsmPrinter,
LLVMX86CodeGen and LLVMX86Utils.
>
> Can anyone tell me what the correct MArch/MCPU strings are for my
> machine, and why the current code is not able to infer it?
x86_64 should be the right mcpu.
Chip
More information about the llvm-dev
mailing list