On 10/13/14 11:44 AM, Eli Bendersky wrote:> On Mon, Oct 13, 2014 at 10:35 AM, Dave Pitsbawn <dpitsbawn at gmail.com> wrote: > >> Is it possible to write LLVM IR but not using C++? >> >> I'm exceedingly terrible at C++. >> >> I was thinking, isn't it possible to write the IR using Java? >> > > > You can use llvmpy (Python bindings to LLVM) to create LLVM IR modules, if > you'd like. [http://www.llvmpy.org/]LLVM also has C bindings. I'm not aware of a tutorial specifically for these bindings, but a great reference for things along the line of "how do use LLVM as my language's backend" is the Kaleidoscope tutorial: http://llvm.org/docs/tutorial/ (which has guides for both OCaml and C++). Cheers, Jon> > > >> I effectively have emit some sort of binary op codes to be passed into >> llvm right? >> >> > Not sure what you're asking here, can you clarify? > > Eli >-- Jon Roelofs jonathan at codesourcery.com CodeSourcery / Mentor Embedded
Ah ok. I should check that out. My first time implementing something like this, so apologies if this is an obvious question -- but why is that JIT and GC go hand-in-hand? I'm trying to think what is the relationship between converting source code to LLVM IR, that if I want it be like Java or even more dynamic typing sorts -- what is the rationale that a GC is required. And that somehow JIT and GC are related in this. Would love to know if I could pick up these concepts somewhere. On Mon, Oct 13, 2014 at 11:03 AM, Jonathan Roelofs < jonathan at codesourcery.com> wrote:> > > On 10/13/14 11:44 AM, Eli Bendersky wrote: > > On Mon, Oct 13, 2014 at 10:35 AM, Dave Pitsbawn <dpitsbawn at gmail.com> > wrote: > > > >> Is it possible to write LLVM IR but not using C++? > >> > >> I'm exceedingly terrible at C++. > >> > >> I was thinking, isn't it possible to write the IR using Java? > >> > > > > > > You can use llvmpy (Python bindings to LLVM) to create LLVM IR modules, > if > > you'd like. [http://www.llvmpy.org/] > LLVM also has C bindings. I'm not aware of a tutorial specifically for > these > bindings, but a great reference for things along the line of "how do use > LLVM as > my language's backend" is the Kaleidoscope tutorial: > http://llvm.org/docs/tutorial/ (which has guides for both OCaml and C++). > > > Cheers, > > Jon > > > > > > > >> I effectively have emit some sort of binary op codes to be passed into > >> llvm right? > >> > >> > > Not sure what you're asking here, can you clarify? > > > > Eli > > > > -- > Jon Roelofs > jonathan at codesourcery.com > CodeSourcery / Mentor Embedded >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20141013/fd144a4f/attachment.html>
On 10/13/14 12:27 PM, Dave Pitsbawn wrote:> Ah ok. I should check that out. > > My first time implementing something like this, so apologies if this is an > obvious question -- but why is that JIT and GC go hand-in-hand? I'm trying > to think what is the relationship between converting source code to LLVM > IR, that if I want it be like Java or even more dynamic typing sorts -- > what is the rationale that a GC is required. And that somehow JIT and GC > are related in this.It depends on the features of the language you're trying to implement. GC is needed when the language has automatic memory management (i.e. you don't see delete/free in java/python/lisp, but you do see them in C++/C), whereas JIT is desired in places where the compiler can do a better job if you give it more information at runtime (things that are not available statically at compile time).... You'll often see JIT and GC together because languages happen to have features that make having both desirable, but that does not imply that one /necessitates/ the other.> > Would love to know if I could pick up these concepts somewhere.Hmm. Can't think of one single reference off the top of my head. Cheers, Jon -- Jon Roelofs jonathan at codesourcery.com CodeSourcery / Mentor Embedded