Enabling x86-64 JIT under Visual Studio compiler

I built the LLVM 2.2 distribution under Visual Studio for x86-64 just fine, but then trying to run my first “hello world” application, found that the JIT compiler was not enabled.

I’m completely new to LLVM, so I didn’t know exactly where to look to see why the JIT for my platform wasn’t being built (is it in the configure steps, or in the C++ code itself?). My educated guess is currently that X86_64TargetMachine::getJITMatchQuality is the interesting point.

I have noticed that all the points in the codebase that try to detect x86-64 are currently using the gcc-style “x86_64” preprocessor symbol. The Visual Studio compiler, instead, defines _M_X64 (similar to the _M_IX86 define that matches x86).

Adding a defined(_M_X64) case to all the existing #ifdefs is no big deal, but I notice that two of them (one in X86JitInfo.cpp and one in X86Subtarget.cpp) are guarding inline assembly blocks written in the gcc-style inline assembly syntax.

Would adding cases for these assembly blocks that are in Visual Studio syntax be enough to enable a working x86-64 JIT target under Windows builds? I can’t pretend to understand this codebase, so if there are more roadblocks stopping 64-bit JIT on Windows targets I’d be interested to hear…

  • Tim Foley