Tuesday, September 21, 2010

Emscripten, Now With More Clang

Emscripten can now work with Clang. It turns out that the llvm bitcode that Clang generates is slightly different from that of llvm-gcc, which uncovered various minor bugs and missing elements in Emscripten (for example, the 'phi' command).

All the tests now pass both llvm-gcc and Clang, and with both optimization and relooping on (however, relooping has been weakened, due to some bugs that were discovered).

The benefits of allowing Clang to be used is that having two sources of LLVM bitcode is better than one - more chances to catch bugs (but even more important would be to add non-C/C++ sources of LLVM bitcode as well!). Another benefit is that Clang is simpler to build so it will allow more people to play with Emscripten.

The wiki has been updated with full instructions, so you can get Clang and try it out with Emscripten right now.


  1. Hey Kripken, most probably not the right place to ask, but what are the chances of Emscripten or the like doing the reverse, and compiling Javascript to LLVM bitcode, for interestingness' sake?

  2. @TheAncientGoat:

    That would be possible, it would just take the work to implement it. But not sure what the point would be aside from coolness ;)

  3. Weell, then you could do Emscripten like projects to translate LLVM bitcode to other languages, and thus take JS projects and make them native C++ projects XD

  4. Hmm, this seems relevant ;)


    - kripken