[LLVMdev] LLVM IR execution in JavaScript

Alon Zakai azakai at mozilla.com
Wed Jan 2 11:37:27 PST 2013



----- Original Message -----
> From: "Sebastian Redl" <sebastian.redl at getdesigned.at>
> To: "Eli Bendersky" <eliben at google.com>
> Cc: "Alon Zakai" <azakai at mozilla.com>, "llvmdev" <llvmdev at cs.uiuc.edu>
> Sent: Wednesday, January 2, 2013 11:24:33 AM
> Subject: Re: [LLVMdev] LLVM IR execution in JavaScript
> 
> 
> On 02.01.2013, at 19:51, Eli Bendersky wrote:
> 
> >> I compiled parts of LLVM to JavaScript using emscripten and made a
> >> demo of parsing and executing LLVM assembly,
> >> 
> >> http://kripken.github.com/llvm.js/demo.html
> >> 
> >> Basically you enter some LLVM IR, press a button and see the
> >> output of compiling and running it, directly in the browser.
> >> 
> >> This was done mainly as a fun hacking project over the holidays,
> >> but I'm posting it here in case anyone thinks it might be useful
> >> for something - maybe to teach people LLVM IR in a simple way (no
> >> need to install anything, just visit a website). If it is
> >> potentially useful it can be optimized and polished etc.
> >> 
> > 
> > Cool project. This is a nice complement to http://llvm.org/demo/
> 
> It would be awesome to combine the llvm.org demo with the in-browser
> emscripten (or possibly a server-side emscripten) so that the user
> can execute his snippets in the browser.
> 
> This would be especially awesome for a C++ tutorial page. Instead of
> having to start with the arduous process of setting up a compiler
> environment, the user could jump straight into the fun by typing his
> programs in the web page and executing them there.
> 

It would definitely be nice to allow compiling C++ to LLVM IR to JS all in the browser, yeah! That means compiling clang to JS though, which would require a fairly large download I think. If there is a way to compile clang with just the parts we need though (just compile a single C/C++ file to only LLVM IR, nothing else) then this would be much simpler.

- azakai



More information about the llvm-dev mailing list