[LLVMdev] MSIL backend

Jeff Cohen jeffc at jolt-lang.org
Thu Mar 22 15:48:28 PDT 2007


Chris Lattner wrote:
> On Thu, 22 Mar 2007, Jeff Cohen wrote:
>> I'm confused.  A MSIL front end I can understand, but a back end?  How
>> will it be used?  The GCC-based front ends that come with LLVM generate
>> bytecodes that have dependencies on the GCC runtime, which is not going
>> to be present in a .NET environment.
>
> Who said the input has to come through the GCC front-ends?  Perhaps 
> this is for Jolt -> .NET? :)
>
> -Chris

The problem is worse than I thought.

MSIL, and .NET in general, defines a specific object model.  This object 
model is explicitly part of MSIL semantics.  LLVM is at a lower level; 
it does not have an object model.  To do a virtual call, LLVM 
instructions must be generated to load a function pointer from a vtable 
and dereference it.  But MSIL is at a higher level, where one simply 
uses the callvirt instruction to do a virtual call and no vtable is 
supplied or even present.  There's no obvious way to reconstruct the 
higher level object semantics from LLVM IR, and sure enough the new MSIL 
back end never generates a callvirt instruction.  In other words, it is 
incapable of using the .NET framework library or anything else relying 
on virtual method calls.

What am I missing?




More information about the llvm-dev mailing list