[LLVMdev] Two languages in the same IR

Renato Golin rengolin at systemcall.org
Sat Mar 5 03:37:00 PST 2011


On 5 March 2011 11:00, Duncan Sands <baldrick at free.fr> wrote:
> it is perfectly possible to compile C++ and Ada (and other languages) to
> bitcode and link the modules together, resulting in a mixed language module.
> The only thing I know of that doesn't work well is if exception handling
> constructs from different languages get inlined into the same function.  But
> maybe this is not what you mean?

Hi Duncan,

Exception handling is another beast, not concern about it now... ;)


> In Ada you can import functions from other languages.  I regularly do this
> to use C, C++ and Fortran functions from Ada.  The frontend takes care of
> ensuring that the right calling conventions etc are used, so everything is
> sorted out before it gets to the LLVM IR generation stage.

So the Ada front-end "understands" C? And generate IR from both?

I was thinking more along the lines of linking IR generated by two (or
more) different front-ends.

One would need some kind of ABI (like JNI) to make sure types and PCS
were retained.

cheers,
--renato




More information about the llvm-dev mailing list