[LLVMdev] Make PPC JIT support inline assembly?

Duncan Sands baldrick at free.fr
Thu Mar 24 02:14:57 PDT 2011


Hi chenwj,

>> it is not in llvm-2.8, it will not even be in llvm-2.9.  This is why you
>> couldn't find it :)  Some patches went into the subversion repository
>> lately if you are interested.
>
>    You mentioned "the plan was to solve this with the new MC-JIT". You
> mean that MC-JIT can handle inline assembly as an input, and generate
> target binary code?

MC allows you to turn LLVM IR into object code or assembler.  It also enables
you to turn assembler into object code.  Consider now how a JIT works.  When a
function is to be run, the LLVM IR for it needs to be turned into object code
in memory; the object code will then be executed by the processor.  I hope it
is clear that MC could be used to generate the object code in memory, rather
than the hand-crafted assembly snippets currently used.  Now consider what is
required to have the JIT execute inline assembler.  Essentially an inline asm
is a string containing assembly code.  In order for the JIT to execute it it
needs to convert that assembly code into object code in memory.  Thus the JIT
needs to have a built in assembler.  Currently the JIT does not have a built
in assembler (though in the X86 case it does have an assembler that can only
handle a few special cases).  Since MC can also act as an assembler, it could
be used to turn inline asm into object code.

Ciao, Duncan.



More information about the llvm-dev mailing list