JIT support for new architectures

What would be needed in order to make MCJIT work on a new architecture?
I am thinking BG/Q and Xeon Phi (native).

Let's assume the components required for JIT (core, mcjit, native, etc.) can be
cross-compiled and linked with an Intel or IBM compiler for such an architecture,
and somehow one manages to execute the application. (I didn't try all that yet.)
Also, let's assume there is some codegen support for these architectures (which
I understand there is). It might not be complete, but it might also be enough
for my application (only floating-point and integer arithmetic, loads/stores).
What JIT-related features are definitely not there (yet) and would be needed
to make MCJIT actually work such these architectures?

Frank

Hi Frank,

In general, for platforms that use ELF object format the only thing needed for MCJIT to support the architecture (assuming code generation is available) is to handle any architecture-specific relocations in RuntimeDyldELF. In fact, you don't even need to implement all the possible relocation types, just the ones that get generated for the code model and relocation model you're interested in. Our approach to this point has been to just implement relocation types as we encounter them.

I don't know the state of support for the IBM architecture you mentioned, but I can tell you that general PowerPC support is in place for MCJIT, so there probably wouldn't be much extra work needed, if any.

I'm also not sure about the state of LLVM support for the Intel(R) Xeon Phi(TM) processor code named Knights Corner, though the basic functionality you describe is probably available. It is my understanding that the processor code named Knights Landing is well supported in LLVM. I wouldn't expect anything extra to be required to use MCJIT with either one.

-Andy

From: "Frank Winter" <fwinter@jlab.org>
To: llvmdev@cs.uiuc.edu
Sent: Friday, November 22, 2013 12:55:52 PM
Subject: [LLVMdev] JIT support for new architectures

What would be needed in order to make MCJIT work on a new
architecture?
I am thinking BG/Q and Xeon Phi (native).

Let's assume the components required for JIT (core, mcjit, native,
etc.)
can be
cross-compiled and linked with an Intel or IBM compiler for such an
architecture,
and somehow one manages to execute the application. (I didn't try all
that yet.)
Also, let's assume there is some codegen support for these
architectures
(which
I understand there is). It might not be complete, but it might also
be
enough
for my application (only floating-point and integer arithmetic,
loads/stores).
What JIT-related features are definitely not there (yet) and would be
needed
to make MCJIT actually work such these architectures?

Full CodeGen support for the BG/Q is available (not all of the QPX support is available upstream yet; but is available here: https://trac.alcf.anl.gov/projects/llvm-bgq). MCJIT on PPC64/Linux works, and so it *should* work on the BG/Q. I've never tried it. Please contact me off-list and I'll be happy to work with you on getting it setup.

-Hal